Skip to content

Commit

Permalink
Fix source offsets for argument list expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Apr 17, 2018
1 parent ab9e189 commit 7ec7cd8
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2633,7 +2633,9 @@ public Expression visitPathElement(PathElementContext ctx) {

if (asBoolean(ctx.arguments())) {
Expression argumentsExpr = this.visitArguments(ctx.arguments());
configureAST(argumentsExpr, ctx);
// GRECLIPSE edit
//configureAST(argumentsExpr, ctx);
// GRECLIPSE end

if (isInsideParentheses(baseExpr)) { // e.g. (obj.x)(), (obj.@x)()
return configureAST(createCallMethodCallExpression(baseExpr, argumentsExpr), ctx);
Expand Down Expand Up @@ -2878,10 +2880,27 @@ public Expression visitArguments(ArgumentsContext ctx) {
}

if (!asBoolean(ctx) || !asBoolean(ctx.enhancedArgumentList())) {
return new ArgumentListExpression();
// GRECLIPSE edit -- exclude parentheses from source range
//return new ArgumentListExpression();
ArgumentListExpression ale = new ArgumentListExpression();
if (ctx != null) {
ale.setStart(locationSupport.findOffset(ctx.getStart().getLine(), ctx.getStart().getCharPositionInLine() + 2));
ale.setEnd(locationSupport.findOffset(ctx.getStop().getLine(), ctx.getStop().getCharPositionInLine() + 1));
int[] row_col = locationSupport.getRowCol(ale.getStart());
ale.setLineNumber(row_col[0]);
ale.setColumnNumber(row_col[1]);
row_col = locationSupport.getRowCol(ale.getEnd());
ale.setLastLineNumber(row_col[0]);
ale.setLastColumnNumber(row_col[1]);
}
return ale;
// GRECLIPSE end
}

return configureAST(this.visitEnhancedArgumentList(ctx.enhancedArgumentList()), ctx);
// GRECLIPSE edit
//return configureAST(this.visitEnhancedArgumentList(ctx.enhancedArgumentList()), ctx);
return visitEnhancedArgumentList(ctx.enhancedArgumentList());
// GRECLIPSE end
}

@Override
Expand Down

0 comments on commit 7ec7cd8

Please sign in to comment.