Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-15400

invalid template argument extraction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 3.6.0
    • None
    • Debugger
    • None
    • 4099cef35db9c26add8ce8e6d5c4a95aaaa552ca

    Description

      in the following code:

      main() {
      
      struct LARGE {
      in a;
      int b;
      int c
      };
      
      QList<LARGE> test
      }
      
      

      the extraction of the template argument using the API

      def extractTemplateArgument(self, typename, position): (dymper.py)

      will fail. This is because the data type is: QList<main(int, char**)::LARGE>

      A possible correction,is that when () are used it is for function name only and everythong before the closing ')' can be discarded. The real name look-up will be done in the context of the current function (only possible case), and this name is not needed.

      correction could be:

      
          def extractTemplateArgument(self, typename, position):
      
              level = 0
              skipSpace = False
              inner = ''
              semi = -1
              for c in typename[typename.find('<') + 1 : -1]:
                  if c == '<':
                      inner += c
                      level += 1
                  elif c == '>':
                      level -= 1
                      inner += c
                  elif c == ')':
                      semi = 0
                  elif c == ':' and semi!=-1:
                      semi += 1
                      if semi==2:
                          inner = ''
                  elif c == ',':
                      if level == 0:
                          if position == 0:
                              return inner.strip()
                          position -= 1
                          inner = ''
                      else:
                          inner += c
                          skipSpace = True
                  else:
                      if skipSpace and c == ' ':
                          pass
                      else:
                          inner += c
                          skipSpace = False
              return inner.strip()
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hjk hjk
            toolinfo stephane petithomme
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes