[ https://issues.apache.org/jira/browse/GROOVY-5726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-5726. --------------------------------- Fix Version/s: 5.0.0-alpha-1 Resolution: Fixed https://github.com/apache/groovy/commit/72ecf0a2eb4d055fc7d406fe2f239d06eaeb8df7 > Source locations of command chain expressions > --------------------------------------------- > > Key: GROOVY-5726 > URL: https://issues.apache.org/jira/browse/GROOVY-5726 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 2.0.4 > Reporter: Andrew Eisenberg > Assignee: Eric Milles > Priority: Major > Fix For: 5.0.0-alpha-1 > > > Source locations of command chain expressions are incorrect. Consider the > following snippet (no whitespace before or after expression): > {code}foo bar baz{code} > Type that into the groovyConsole and inspect the AST. Expand a few sections > and see that the {{this.foo(bar)}} method call has a {{columnNumber}} of 5, > whic is incorrect. Expand one more level and see that the {{foo}} constant > expression has a {{columnNumber}} of 1, which is correct. > In Groovy-Eclipse, we have put a bit of a kludgy patch in to make it work. > At the end of the {{methodCallExpression(AST)}} method, immediately before > the return statement, we added this text: > {code} > // in the case of Groovy 1.8 command expressions, the slocs are > incorrect for the start of the method > if (!implicitThis && methodCallNode.getText().equals("<command>")) { > ret.setStart(objectExpression.getStart()); > ret.setLineNumber(objectExpression.getLineNumber()); > ret.setColumnNumber(objectExpression.getColumnNumber()); > ret.setEnd(arguments.getEnd()); > ret.setLastLineNumber(arguments.getLastLineNumber()); > ret.setLastColumnNumber(arguments.getLastColumnNumber()); > } > {code} > I'm not particularly happy with this solution, but it works for us. Perhaps > you can come up with something better. -- This message was sent by Atlassian Jira (v8.20.1#820001)