You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/02/07 18:14:00 UTC
[jira] [Assigned] (GROOVY-5726) Source locations of command chain expressions
[ https://issues.apache.org/jira/browse/GROOVY-5726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-5726:
-----------------------------------
Assignee: Eric Milles
> 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
>
> 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)