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

Line-/Column Information of PropertyExpression and FieldExpression

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-1
    • Fix Version/s: 1.5.7, 1.6-beta-2
    • Component/s: ast builder
    • Labels:
      None
    • Environment:
      WinXP

      Description

      The FieldExpression as well as the PropertyExpression had no source position information. Also the ConstantExpression that represents the method name in a MethodPointerExpression had no source position information.

      The following fixes are made:

      • in rule pathElement of the grammar: use the create() method of the GroovyRecognizer to create the root node for each operator (SPREAD_DOT, OPTIONAL_DOT, MEMBER_POINTER and DOT) and use the prefix to set the start position of the operator node. The end position is set by using the start position of the next token to parse (LT(1)). Doing that leads to correct source position information for the operator node. This node is later used to set the source position of the PropertyExpression and FieldExpression.
      • in the StaticImportVisitor: set the source position from the PropertyExpression before the transformation, to the newly created.
      • in the AntlrParserPlugin: call configureAST() to set the source position of the ConstantExpression which represents the method name in a MethodPointerExpression

      Tests that verify these changes are also included.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: