Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2748

line/column information patch for several nodes

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-1
    • Fix Version/s: 1.5.6, 1.6-beta-1
    • Component/s: parser
    • Labels:
      None
    • Environment:
      WinXP
    • Flags:
      Patch

      Description

      This patch corrects the source position information in the following situations:

      • MethodCallExpression
        • includes the callee and an appendedBlock (if there is one) to the method call
        • solved in grammar
      • StaticMethodCallExpression
        • set the source position for StaticMethodCallExprssion when it is created
        • Solved in StaticImportVisitor
      • indexPropertyArgs
        • set the source postion in terms like obj['prop'] correct
        • include the indexee if there is one
        • solved in grammar
      • ConstructorCallExpression
        • ConstructorCallExpression includes now whole expression with the type, not only the 'new' operator
        • solved in grammar
      • declaratorBrackets
        • DeclarationExpression like int[][][] array did only include the variable
        • now the whole expression
        • solved in grammar
      • transfomed DeclarationExpression
        • a declaration that contains a class like def i = Integer.parseInt("42") had -1 as source position information
        • solved in ResolveVisitor: Set the source position of the unresolved expression to the resolved DeclarationExpression
      • new create method for node creation
        • new create method of signature: public AST create(int type, String txt, AST first, Token last)
        • parameter 'first' is of type AST therefore a node can be used to set the start position
        • used in the patches above: MethodCallExpression, indexPropertyArgs

      The test patch contains tests for the test environment described in GROOVY-259.
      Due to the ConstructorCallExpression change, one test of GROOVY-2615 needed to be adapted. This is also patched with the test patch.

        Attachments

        1. SourcePositionsTest.patch
          4 kB
          Martin Kempf
        2. SourcePositions.patch
          7 kB
          Martin Kempf

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              mkempf Martin Kempf
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: