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
                  }
      

        Attachments

          Issue Links

            Activity

              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: