Skip to content

Commit

Permalink
Add source offsets for fields, properties and bare ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Mar 16, 2018
1 parent 46030d8 commit 0882873
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,12 @@ private void declareProperty(VariableDeclarationContext ctx, ModifierManager mod
configureAST(fieldNode, variableExpression, initialValue);
configureAST(propertyNode, variableExpression, initialValue);
}
// GRECLIPSE add
fieldNode.setNameStart(variableExpression.getStart());
fieldNode.setNameEnd(variableExpression.getEnd() - 1);
propertyNode.setNameStart(variableExpression.getStart());
propertyNode.setNameEnd(variableExpression.getEnd() - 1);
// GRECLIPSE end
}

private void declareField(VariableDeclarationContext ctx, ModifierManager modifierManager, ClassNode variableType, ClassNode classNode, int i, VariableExpression variableExpression, String fieldName, int modifiers, Expression initialValue) {
Expand Down Expand Up @@ -2184,6 +2190,10 @@ private void declareField(VariableDeclarationContext ctx, ModifierManager modifi
} else {
configureAST(fieldNode, variableExpression, initialValue);
}
// GRECLIPSE add
fieldNode.setNameStart(variableExpression.getStart());
fieldNode.setNameEnd(variableExpression.getEnd() - 1);
// GRECLIPSE end
}

private boolean isFieldDeclaration(ModifierManager modifierManager, ClassNode classNode) {
Expand Down Expand Up @@ -4608,7 +4618,11 @@ private Parameter processFormalParameter(GroovyParserRuleContext ctx,
if (asBoolean(ellipsis)) {
// GRECLIPSE edit
//classNode = configureAST(classNode.makeArray(), classNode);
classNode = configureAST(classNode.makeArray(), typeContext);
if (asBoolean(typeContext)) {
classNode = configureAST(classNode.makeArray(), typeContext);
} else {
classNode = configureAST(classNode.makeArray(), ellipsis);
}
// GRECLIPSE end
}

Expand Down

0 comments on commit 0882873

Please sign in to comment.