groovy

line/column information patch for several nodes

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major 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
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    2

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.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: