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

TraitReceiverTransformer does not set source position on property expressions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.12
    • Component/s: xforms
    • Labels:
      None

      Description

      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:

                  } 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
                  }
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          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 <arsen.ba@gmail.com>
          Date: 2017-05-19T18:46:39Z

          GROOVY-8193: setting sourcePosition on Property Expression


          Show
          githubbot ASF GitHub Bot added a comment - 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 <arsen.ba@gmail.com> Date: 2017-05-19T18:46:39Z GROOVY-8193 : setting sourcePosition on Property Expression
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/542
          Hide
          jwagenleitner John Wagenleitner added a comment -

          PR from Arsen Babakhanyan merged, thanks for reporting the issue.

          Show
          jwagenleitner John Wagenleitner added a comment - PR from Arsen Babakhanyan merged, thanks for reporting the issue.
          Hide
          arsen.babakhanyan Arsen Babakhanyan added a comment -

          thanks John Wagenleitner for help

          Show
          arsen.babakhanyan Arsen Babakhanyan added a comment - thanks John Wagenleitner for help

            People

            • Assignee:
              jwagenleitner John Wagenleitner
              Reporter:
              emilles Eric Milles
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development