You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/05/19 18:52:04 UTC

[jira] [Commented] (GROOVY-8193) TraitReceiverTransformer does not set source position on property expressions

    [ https://issues.apache.org/jira/browse/GROOVY-8193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16017834#comment-16017834 ] 

ASF GitHub Bot commented on GROOVY-8193:
----------------------------------------

GitHub user ArsenBabakhanyan opened a pull request:

    https://github.com/apache/groovy/pull/542

    GROOVY-8193: setting sourcePosition on Property Expression

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ArsenBabakhanyan/groovy GROOVY-8193

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/542.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #542
    
----
commit cc750bf27917f04ae5f3de872fa0d42c8050d10e
Author: Arsen Babakhanyan <ar...@gmail.com>
Date:   2017-05-19T18:46:39Z

    GROOVY-8193: setting sourcePosition on Property Expression

----


> TraitReceiverTransformer does not set source position on property expressions
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-8193
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8193
>             Project: Groovy
>          Issue Type: Bug
>          Components: xforms
>            Reporter: Eric Milles
>            Priority: Minor
>
> Two paths in TraitReceiverTransformer.transform create PropertyExpression nodes to stand in for unresolved variable references.  Neither case sets the exp source position onto the new node.  Other paths through this method transfer position info.
> The fix is simple: {code}
>             } else if (accessedVariable instanceof PropertyNode) {
>                 String propName = accessedVariable.getName();
>                 if (knownFields.contains(propName)) {
>                     return createFieldHelperCall(exp, weavedType, propName);
>                 } else {
>                     // GRECLIPSE edit
>                     PropertyExpression pe =
>                     /*return*/ new PropertyExpression(
>                             new VariableExpression(weaved),
>                             accessedVariable.getName()
>                     );
>                     pe.getProperty().setSourcePosition(exp);
>                     return pe;
>                     // GRECLIPSE end
>                 }
>             } else if (accessedVariable instanceof DynamicVariable) {
>                 // GRECLIPSE edit
>                 PropertyExpression pe =
>                 /*return*/ new PropertyExpression(
>                         new VariableExpression(weaved),
>                         accessedVariable.getName()
>                 );
>                 pe.getProperty().setSourcePosition(exp);
>                 return pe;
>                 // GRECLIPSE end
>             }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)