From 2e25837deb6bbfc02277257e191c6887e14ab6f7 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Thu, 12 May 2016 10:32:06 -0700 Subject: [PATCH] Made line number available in painless nodes for debugging. --- .../elasticsearch/painless/antlr/Walker.java | 86 ++++++++++--------- .../painless/node/AExpression.java | 16 ++-- .../elasticsearch/painless/node/ALink.java | 4 +- .../elasticsearch/painless/node/ANode.java | 8 +- .../painless/node/AStatement.java | 4 +- .../elasticsearch/painless/node/EBinary.java | 4 +- .../elasticsearch/painless/node/EBool.java | 4 +- .../elasticsearch/painless/node/EBoolean.java | 4 +- .../elasticsearch/painless/node/ECast.java | 4 +- .../elasticsearch/painless/node/EChain.java | 20 ++--- .../elasticsearch/painless/node/EComp.java | 4 +- .../painless/node/EConditional.java | 5 +- .../painless/node/EConstant.java | 4 +- .../elasticsearch/painless/node/EDecimal.java | 4 +- .../painless/node/EExplicit.java | 4 +- .../elasticsearch/painless/node/ENull.java | 4 +- .../elasticsearch/painless/node/ENumeric.java | 4 +- .../elasticsearch/painless/node/EUnary.java | 4 +- .../painless/node/LArrayLength.java | 4 +- .../elasticsearch/painless/node/LBrace.java | 10 +-- .../elasticsearch/painless/node/LCall.java | 6 +- .../elasticsearch/painless/node/LCast.java | 4 +- .../painless/node/LDefArray.java | 4 +- .../elasticsearch/painless/node/LDefCall.java | 4 +- .../painless/node/LDefField.java | 4 +- .../elasticsearch/painless/node/LField.java | 16 ++-- .../painless/node/LListShortcut.java | 4 +- .../painless/node/LMapShortcut.java | 4 +- .../painless/node/LNewArray.java | 4 +- .../elasticsearch/painless/node/LNewObj.java | 4 +- .../painless/node/LShortcut.java | 4 +- .../elasticsearch/painless/node/LString.java | 4 +- .../painless/node/LVariable.java | 4 +- .../elasticsearch/painless/node/SBlock.java | 4 +- .../elasticsearch/painless/node/SBreak.java | 4 +- .../painless/node/SContinue.java | 4 +- .../painless/node/SDeclBlock.java | 4 +- .../painless/node/SDeclaration.java | 4 +- .../org/elasticsearch/painless/node/SDo.java | 4 +- .../painless/node/SExpression.java | 4 +- .../org/elasticsearch/painless/node/SFor.java | 4 +- .../elasticsearch/painless/node/SIfElse.java | 5 +- .../elasticsearch/painless/node/SReturn.java | 4 +- .../elasticsearch/painless/node/SSource.java | 4 +- .../elasticsearch/painless/node/SThrow.java | 4 +- .../elasticsearch/painless/node/STrap.java | 4 +- .../org/elasticsearch/painless/node/STry.java | 4 +- .../elasticsearch/painless/node/SWhile.java | 4 +- 48 files changed, 170 insertions(+), 158 deletions(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/Walker.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/Walker.java index 71ada2fdf9b..4f6e2f5e87c 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/Walker.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/Walker.java @@ -146,6 +146,10 @@ public final class Walker extends PainlessParserBaseVisitor { return parser.source(); } + private int line(final ParserRuleContext ctx) { + return ctx.getStart().getLine(); + } + private String location(final ParserRuleContext ctx) { return "[ " + ctx.getStart().getLine() + " : " + ctx.getStart().getCharPositionInLine() + " ]"; } @@ -158,7 +162,7 @@ public final class Walker extends PainlessParserBaseVisitor { statements.add((AStatement)visit(statement)); } - return new SSource(location(ctx), statements); + return new SSource(line(ctx), location(ctx), statements); } @Override @@ -167,7 +171,7 @@ public final class Walker extends PainlessParserBaseVisitor { final AStatement ifblock = (AStatement)visit(ctx.block(0)); final AStatement elseblock = ctx.block(1) == null ? null : (AStatement)visit(ctx.block(1)); - return new SIfElse(location(ctx), condition, ifblock, elseblock); + return new SIfElse(line(ctx), location(ctx), condition, ifblock, elseblock); } @Override @@ -177,7 +181,7 @@ public final class Walker extends PainlessParserBaseVisitor { reserved.usesLoop(); - return new SWhile(location(ctx), condition, block); + return new SWhile(line(ctx), location(ctx), condition, block); } @Override @@ -187,7 +191,7 @@ public final class Walker extends PainlessParserBaseVisitor { reserved.usesLoop(); - return new SDo(location(ctx), block, condition); + return new SDo(line(ctx), location(ctx), block, condition); } @Override @@ -199,7 +203,7 @@ public final class Walker extends PainlessParserBaseVisitor { reserved.usesLoop(); - return new SFor(location(ctx), intializer, condition, afterthought, block); + return new SFor(line(ctx), location(ctx), intializer, condition, afterthought, block); } @Override @@ -209,19 +213,19 @@ public final class Walker extends PainlessParserBaseVisitor { @Override public ANode visitContinue(final ContinueContext ctx) { - return new SContinue(location(ctx)); + return new SContinue(line(ctx), location(ctx)); } @Override public ANode visitBreak(final BreakContext ctx) { - return new SBreak(location(ctx)); + return new SBreak(line(ctx), location(ctx)); } @Override public ANode visitReturn(final ReturnContext ctx) { final AExpression expression = (AExpression)visit(ctx.expression()); - return new SReturn(location(ctx), expression); + return new SReturn(line(ctx), location(ctx), expression); } @Override @@ -233,21 +237,21 @@ public final class Walker extends PainlessParserBaseVisitor { traps.add((STrap)visit(trap)); } - return new STry(location(ctx), block, traps); + return new STry(line(ctx), location(ctx), block, traps); } @Override public ANode visitThrow(final ThrowContext ctx) { final AExpression expression = (AExpression)visit(ctx.expression()); - return new SThrow(location(ctx), expression); + return new SThrow(line(ctx), location(ctx), expression); } @Override public ANode visitExpr(final ExprContext ctx) { final AExpression expression = (AExpression)visit(ctx.expression()); - return new SExpression(location(ctx), expression); + return new SExpression(line(ctx), location(ctx), expression); } @Override @@ -258,7 +262,7 @@ public final class Walker extends PainlessParserBaseVisitor { statements.add((AStatement)visit(statement)); } - return new SBlock(location(ctx), statements); + return new SBlock(line(ctx), location(ctx), statements); } @Override @@ -266,7 +270,7 @@ public final class Walker extends PainlessParserBaseVisitor { final List statements = new ArrayList<>(); statements.add((AStatement)visit(ctx.statement())); - return new SBlock(location(ctx), statements); + return new SBlock(line(ctx), location(ctx), statements); } @Override @@ -303,10 +307,10 @@ public final class Walker extends PainlessParserBaseVisitor { for (final DeclvarContext declvar : ctx.declvar()) { final String name = declvar.identifier().getText(); final AExpression expression = declvar.expression() == null ? null : (AExpression)visit(declvar.expression()); - declarations.add(new SDeclaration(location(ctx), type, name, expression)); + declarations.add(new SDeclaration(line(ctx), location(ctx), type, name, expression)); } - return new SDeclBlock(location(ctx), declarations); + return new SDeclBlock(line(ctx), location(ctx), declarations); } @Override @@ -325,7 +329,7 @@ public final class Walker extends PainlessParserBaseVisitor { final String name = ctx.identifier(1).getText(); final AStatement block = ctx.block() == null ? null : (AStatement)visit(ctx.block()); - return new STrap(location(ctx), type, name, block); + return new STrap(line(ctx), location(ctx), type, name, block); } @Override @@ -348,13 +352,13 @@ public final class Walker extends PainlessParserBaseVisitor { final boolean negate = ctx.parent instanceof UnaryContext && ((UnaryContext)ctx.parent).SUB() != null; if (ctx.DECIMAL() != null) { - return new EDecimal(location(ctx), (negate ? "-" : "") + ctx.DECIMAL().getText()); + return new EDecimal(line(ctx), location(ctx), (negate ? "-" : "") + ctx.DECIMAL().getText()); } else if (ctx.HEX() != null) { - return new ENumeric(location(ctx), (negate ? "-" : "") + ctx.HEX().getText().substring(2), 16); + return new ENumeric(line(ctx), location(ctx), (negate ? "-" : "") + ctx.HEX().getText().substring(2), 16); } else if (ctx.INTEGER() != null) { - return new ENumeric(location(ctx), (negate ? "-" : "") + ctx.INTEGER().getText(), 10); + return new ENumeric(line(ctx), location(ctx), (negate ? "-" : "") + ctx.INTEGER().getText(), 10); } else if (ctx.OCTAL() != null) { - return new ENumeric(location(ctx), (negate ? "-" : "") + ctx.OCTAL().getText().substring(1), 8); + return new ENumeric(line(ctx), location(ctx), (negate ? "-" : "") + ctx.OCTAL().getText().substring(1), 8); } else { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } @@ -362,17 +366,17 @@ public final class Walker extends PainlessParserBaseVisitor { @Override public ANode visitTrue(final TrueContext ctx) { - return new EBoolean(location(ctx), true); + return new EBoolean(line(ctx), location(ctx), true); } @Override public ANode visitFalse(FalseContext ctx) { - return new EBoolean(location(ctx), false); + return new EBoolean(line(ctx), location(ctx), false); } @Override public ANode visitNull(final NullContext ctx) { - return new ENull(location(ctx)); + return new ENull(line(ctx), location(ctx)); } @Override @@ -390,7 +394,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EChain(location(ctx), links, false, true, operation, null); + return new EChain(line(ctx), location(ctx), links, false, true, operation, null); } @Override @@ -408,7 +412,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EChain(location(ctx), links, true, false, operation, null); + return new EChain(line(ctx), location(ctx), links, true, false, operation, null); } @Override @@ -417,7 +421,7 @@ public final class Walker extends PainlessParserBaseVisitor { visitChain(ctx.chain(), links); - return new EChain(location(ctx), links, false, false, null, null); + return new EChain(line(ctx), location(ctx), links, false, false, null, null); } @Override @@ -439,13 +443,13 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EUnary(location(ctx), operation, (AExpression)visit(ctx.expression())); + return new EUnary(line(ctx), location(ctx), operation, (AExpression)visit(ctx.expression())); } } @Override public ANode visitCast(final CastContext ctx) { - return new EExplicit(location(ctx), ctx.decltype().getText(), (AExpression)visit(ctx.expression())); + return new EExplicit(line(ctx), location(ctx), ctx.decltype().getText(), (AExpression)visit(ctx.expression())); } @Override @@ -480,7 +484,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EBinary(location(ctx), operation, left, right); + return new EBinary(line(ctx), location(ctx), operation, left, right); } @Override @@ -509,7 +513,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EComp(location(ctx), operation, left, right); + return new EComp(line(ctx), location(ctx), operation, left, right); } @Override @@ -526,7 +530,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - return new EBool(location(ctx), operation, left, right); + return new EBool(line(ctx), location(ctx), operation, left, right); } @@ -536,7 +540,7 @@ public final class Walker extends PainlessParserBaseVisitor { final AExpression left = (AExpression)visit(ctx.expression(1)); final AExpression right = (AExpression)visit(ctx.expression(2)); - return new EConditional(location(ctx), condition, left, right); + return new EConditional(line(ctx), location(ctx), condition, left, right); } @Override @@ -572,7 +576,7 @@ public final class Walker extends PainlessParserBaseVisitor { operation = null; } - return new EChain(location(ctx), links, false, false, operation, (AExpression)visit(ctx.expression())); + return new EChain(line(ctx), location(ctx), links, false, false, operation, (AExpression)visit(ctx.expression())); } private void visitChain(final ChainContext ctx, final List links) { @@ -638,7 +642,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - links.add(new LCast(location(ctx), ctx.decltype().getText())); + links.add(new LCast(line(ctx), location(ctx), ctx.decltype().getText())); } @Override @@ -647,7 +651,7 @@ public final class Walker extends PainlessParserBaseVisitor { } private void visitLinkbrace(final LinkbraceContext ctx, final List links) { - links.add(new LBrace(location(ctx), (AExpression)visit(ctx.expression()))); + links.add(new LBrace(line(ctx), location(ctx), (AExpression)visit(ctx.expression()))); if (ctx.linkbrace() != null) { visitLinkbrace(ctx.linkbrace(), links); @@ -681,7 +685,7 @@ public final class Walker extends PainlessParserBaseVisitor { arguments.add((AExpression)visit(expression)); } - links.add(new LCall(location(ctx), ctx.EXTID().getText(), arguments)); + links.add(new LCall(line(ctx), location(ctx), ctx.EXTID().getText(), arguments)); if (ctx.linkbrace() != null) { visitLinkbrace(ctx.linkbrace(), links); @@ -700,7 +704,7 @@ public final class Walker extends PainlessParserBaseVisitor { reserved.markReserved(name); - links.add(new LVariable(location(ctx), name)); + links.add(new LVariable(line(ctx), location(ctx), name)); if (ctx.linkbrace() != null) { visitLinkbrace(ctx.linkbrace(), links); @@ -725,7 +729,7 @@ public final class Walker extends PainlessParserBaseVisitor { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } - links.add(new LField(location(ctx), value)); + links.add(new LField(line(ctx), location(ctx), value)); if (ctx.linkbrace() != null) { visitLinkbrace(ctx.linkbrace(), links); @@ -747,13 +751,13 @@ public final class Walker extends PainlessParserBaseVisitor { arguments.add((AExpression)visit(expression)); } - links.add(new LNewObj(location(ctx), ctx.identifier().getText(), arguments)); + links.add(new LNewObj(line(ctx), location(ctx), ctx.identifier().getText(), arguments)); } else if (ctx.expression().size() > 0) { for (final ExpressionContext expression : ctx.expression()) { arguments.add((AExpression)visit(expression)); } - links.add(new LNewArray(location(ctx), ctx.identifier().getText(), arguments)); + links.add(new LNewArray(line(ctx), location(ctx), ctx.identifier().getText(), arguments)); } else { throw new IllegalStateException("Error " + location(ctx) + ": Unexpected state."); } @@ -769,7 +773,7 @@ public final class Walker extends PainlessParserBaseVisitor { } private void visitLinkstring(final LinkstringContext ctx, final List links) { - links.add(new LString(location(ctx), ctx.STRING().getText().substring(1, ctx.STRING().getText().length() - 1))); + links.add(new LString(line(ctx), location(ctx), ctx.STRING().getText().substring(1, ctx.STRING().getText().length() - 1))); if (ctx.linkbrace() != null) { visitLinkbrace(ctx.linkbrace(), links); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AExpression.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AExpression.java index 185968c0a09..6f2b861b70c 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AExpression.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AExpression.java @@ -94,8 +94,8 @@ public abstract class AExpression extends ANode { */ protected Label fals = null; - public AExpression(final String location) { - super(location); + public AExpression(final int line, final String location) { + super(line, location); } /** @@ -120,7 +120,7 @@ public abstract class AExpression extends ANode { if (constant == null || this instanceof EConstant) { return this; } else { - final EConstant econstant = new EConstant(location, constant); + final EConstant econstant = new EConstant(line, location, constant); econstant.analyze(settings, definition, variables); if (!expected.equals(econstant.actual)) { @@ -131,7 +131,7 @@ public abstract class AExpression extends ANode { } } else { if (constant == null) { - final ECast ecast = new ECast(location, this, cast); + final ECast ecast = new ECast(line, location, this, cast); ecast.statement = statement; ecast.actual = expected; ecast.isNull = isNull; @@ -141,7 +141,7 @@ public abstract class AExpression extends ANode { if (expected.sort.constant) { constant = AnalyzerCaster.constCast(location, constant, cast); - final EConstant econstant = new EConstant(location, constant); + final EConstant econstant = new EConstant(line, location, constant); econstant.analyze(settings, definition, variables); if (!expected.equals(econstant.actual)) { @@ -150,19 +150,19 @@ public abstract class AExpression extends ANode { return econstant; } else if (this instanceof EConstant) { - final ECast ecast = new ECast(location, this, cast); + final ECast ecast = new ECast(line, location, this, cast); ecast.actual = expected; return ecast; } else { - final EConstant econstant = new EConstant(location, constant); + final EConstant econstant = new EConstant(line, location, constant); econstant.analyze(settings, definition, variables); if (!actual.equals(econstant.actual)) { throw new IllegalStateException(error("Illegal tree structure.")); } - final ECast ecast = new ECast(location, econstant, cast); + final ECast ecast = new ECast(line, location, econstant, cast); ecast.actual = expected; return ecast; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ALink.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ALink.java index f5cccfedc7d..79cbdf4a194 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ALink.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ALink.java @@ -75,8 +75,8 @@ public abstract class ALink extends ANode { */ String string = null; - ALink(final String location, final int size) { - super(location); + ALink(final int line, final String location, final int size) { + super(line, location); this.size = size; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ANode.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ANode.java index 8faaaff51b3..b4c4fdd677d 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ANode.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ANode.java @@ -24,12 +24,18 @@ package org.elasticsearch.painless.node; */ public abstract class ANode { + /** + * The line number in the original source used for debug messages. + */ + final int line; + /** * The location in the original source to be printed in error messages. */ final String location; - ANode(final String location) { + ANode(final int line, final String location) { + this.line = line; this.location = location; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AStatement.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AStatement.java index d6830adc9bd..c4366e1af36 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AStatement.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AStatement.java @@ -109,8 +109,8 @@ public abstract class AStatement extends ANode { */ Label brake = null; - AStatement(final String location) { - super(location); + AStatement(final int line, final String location) { + super(line, location); } /** diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBinary.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBinary.java index a3dd45e75c4..0df1f0f29de 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBinary.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBinary.java @@ -40,8 +40,8 @@ public final class EBinary extends AExpression { boolean cat = false; - public EBinary(final String location, final Operation operation, final AExpression left, final AExpression right) { - super(location); + public EBinary(final int line, final String location, final Operation operation, final AExpression left, final AExpression right) { + super(line, location); this.operation = operation; this.left = left; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBool.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBool.java index 650c4cfc97e..7f120894603 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBool.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBool.java @@ -35,8 +35,8 @@ public final class EBool extends AExpression { AExpression left; AExpression right; - public EBool(final String location, final Operation operation, final AExpression left, final AExpression right) { - super(location); + public EBool(final int line, final String location, final Operation operation, final AExpression left, final AExpression right) { + super(line, location); this.operation = operation; this.left = left; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBoolean.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBoolean.java index 84bf38ea459..a5fb9c7f9e2 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBoolean.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBoolean.java @@ -29,8 +29,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ public final class EBoolean extends AExpression { - public EBoolean(final String location, final boolean constant) { - super(location); + public EBoolean(final int line, final String location, final boolean constant) { + super(line, location); this.constant = constant; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECast.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECast.java index 77d39b92081..10622e758fc 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECast.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECast.java @@ -37,8 +37,8 @@ final class ECast extends AExpression { Cast cast = null; - ECast(final String location, final AExpression child, final Cast cast) { - super(location); + ECast(final int line, final String location, final AExpression child, final Cast cast) { + super(line, location); this.type = null; this.child = child; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java index af3ba4fc422..bc3c326f651 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EChain.java @@ -49,9 +49,9 @@ public final class EChain extends AExpression { Cast there = null; Cast back = null; - public EChain(final String location, final List links, + public EChain(final int line, final String location, final List links, final boolean pre, final boolean post, final Operation operation, final AExpression expression) { - super(location); + super(line, location); this.links = links; this.pre = pre; @@ -127,25 +127,25 @@ public final class EChain extends AExpression { if (operation == Operation.INCR) { if (sort == Sort.DOUBLE) { - expression = new EConstant(location, 1D); + expression = new EConstant(line, location, 1D); } else if (sort == Sort.FLOAT) { - expression = new EConstant(location, 1F); + expression = new EConstant(line, location, 1F); } else if (sort == Sort.LONG) { - expression = new EConstant(location, 1L); + expression = new EConstant(line, location, 1L); } else { - expression = new EConstant(location, 1); + expression = new EConstant(line, location, 1); } operation = Operation.ADD; } else if (operation == Operation.DECR) { if (sort == Sort.DOUBLE) { - expression = new EConstant(location, 1D); + expression = new EConstant(line, location, 1D); } else if (sort == Sort.FLOAT) { - expression = new EConstant(location, 1F); + expression = new EConstant(line, location, 1F); } else if (sort == Sort.LONG) { - expression = new EConstant(location, 1L); + expression = new EConstant(line, location, 1L); } else { - expression = new EConstant(location, 1); + expression = new EConstant(line, location, 1); } operation = Operation.SUB; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EComp.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EComp.java index 0fd14237ef5..c7f85eb57c7 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EComp.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EComp.java @@ -45,8 +45,8 @@ public final class EComp extends AExpression { AExpression left; AExpression right; - public EComp(final String location, final Operation operation, final AExpression left, final AExpression right) { - super(location); + public EComp(final int line, final String location, final Operation operation, final AExpression left, final AExpression right) { + super(line, location); this.operation = operation; this.left = left; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConditional.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConditional.java index 0006e5f8b97..1f751f9f7a3 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConditional.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConditional.java @@ -36,8 +36,9 @@ public final class EConditional extends AExpression { AExpression left; AExpression right; - public EConditional(final String location, final AExpression condition, final AExpression left, final AExpression right) { - super(location); + public EConditional(final int line, final String location, + final AExpression condition, final AExpression left, final AExpression right) { + super(line, location); this.condition = condition; this.left = left; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConstant.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConstant.java index 5b1e17142d9..41d5add5a31 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConstant.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EConstant.java @@ -32,8 +32,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ final class EConstant extends AExpression { - EConstant(final String location, final Object constant) { - super(location); + EConstant(final int line, final String location, final Object constant) { + super(line, location); this.constant = constant; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EDecimal.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EDecimal.java index c2fc010aa51..629c3cc0aa6 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EDecimal.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EDecimal.java @@ -31,8 +31,8 @@ public final class EDecimal extends AExpression { final String value; - public EDecimal(final String location, final String value) { - super(location); + public EDecimal(final int line, final String location, final String value) { + super(line, location); this.value = value; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EExplicit.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EExplicit.java index 0a3a39df7af..6dc3640a6d5 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EExplicit.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EExplicit.java @@ -35,8 +35,8 @@ public final class EExplicit extends AExpression { Cast cast = null; - public EExplicit(final String location, final String type, final AExpression child) { - super(location); + public EExplicit(final int line, final String location, final String type, final AExpression child) { + super(line, location); this.type = type; this.child = child; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENull.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENull.java index 189b12d9f97..6e953b50c2e 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENull.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENull.java @@ -30,8 +30,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ public final class ENull extends AExpression { - public ENull(final String location) { - super(location); + public ENull(final int line, final String location) { + super(line, location); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENumeric.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENumeric.java index 32260483b64..36ddf7f7242 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENumeric.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENumeric.java @@ -33,8 +33,8 @@ public final class ENumeric extends AExpression { final String value; int radix; - public ENumeric(final String location, final String value, final int radix) { - super(location); + public ENumeric(final int line, final String location, final String value, final int radix) { + super(line, location); this.value = value; this.radix = radix; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java index 7f6b52be89c..bc0929abdc2 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java @@ -43,8 +43,8 @@ public final class EUnary extends AExpression { Operation operation; AExpression child; - public EUnary(final String location, final Operation operation, final AExpression child) { - super(location); + public EUnary(final int line, final String location, final Operation operation, final AExpression child) { + super(line, location); this.operation = operation; this.child = child; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LArrayLength.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LArrayLength.java index b9cd0437992..34ad36480de 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LArrayLength.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LArrayLength.java @@ -31,8 +31,8 @@ public final class LArrayLength extends ALink { final String value; - LArrayLength(final String location, final String value) { - super(location, -1); + LArrayLength(final int line, final String location, final String value) { + super(line, location, -1); this.value = value; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LBrace.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LBrace.java index ff7c7fabc16..5cfaeb7466a 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LBrace.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LBrace.java @@ -35,8 +35,8 @@ public final class LBrace extends ALink { AExpression index; - public LBrace(final String location, final AExpression index) { - super(location, 2); + public LBrace(final int line, final String location, final AExpression index) { + super(line, location, 2); this.index = index; } @@ -58,12 +58,12 @@ public final class LBrace extends ALink { return this; } else if (sort == Sort.DEF) { - return new LDefArray(location, index).copy(this).analyze(settings, definition, variables); + return new LDefArray(line, location, index).copy(this).analyze(settings, definition, variables); } else { try { before.clazz.asSubclass(Map.class); - return new LMapShortcut(location, index).copy(this).analyze(settings, definition, variables); + return new LMapShortcut(line, location, index).copy(this).analyze(settings, definition, variables); } catch (final ClassCastException exception) { // Do nothing. } @@ -71,7 +71,7 @@ public final class LBrace extends ALink { try { before.clazz.asSubclass(List.class); - return new LListShortcut(location, index).copy(this).analyze(settings, definition, variables); + return new LListShortcut(line, location, index).copy(this).analyze(settings, definition, variables); } catch (final ClassCastException exception) { // Do nothing. } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java index 0d957a8b551..acb6646614a 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java @@ -38,8 +38,8 @@ public final class LCall extends ALink { Method method = null; - public LCall(final String location, final String name, final List arguments) { - super(location, -1); + public LCall(final int line, final String location, final String name, final List arguments) { + super(line, location, -1); this.name = name; this.arguments = arguments; @@ -80,7 +80,7 @@ public final class LCall extends ALink { return this; } else if (before.sort == Definition.Sort.DEF) { - final ALink link = new LDefCall(location, name, arguments); + final ALink link = new LDefCall(line, location, name, arguments); link.copy(this); return link.analyze(settings, definition, variables); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCast.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCast.java index 52c23be993e..64b64fb9c13 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCast.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCast.java @@ -36,8 +36,8 @@ public final class LCast extends ALink { Cast cast = null; - public LCast(final String location, final String type) { - super(location, -1); + public LCast(final int line, final String location, final String type) { + super(line, location, -1); this.type = type; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java index 6e0b60a9227..0fa2207bc9d 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java @@ -36,8 +36,8 @@ final class LDefArray extends ALink { AExpression index; - LDefArray(final String location, final AExpression index) { - super(location, 0); + LDefArray(final int line, final String location, final AExpression index) { + super(line, location, 0); this.index = index; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java index cda802e0138..dc3e3abdcc8 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java @@ -37,8 +37,8 @@ final class LDefCall extends ALink { final String name; final List arguments; - LDefCall(final String location, final String name, final List arguments) { - super(location, -1); + LDefCall(final int line, final String location, final String name, final List arguments) { + super(line, location, -1); this.name = name; this.arguments = arguments; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java index f198e2999bd..851c1e3f631 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java @@ -36,8 +36,8 @@ final class LDefField extends ALink { final String value; - LDefField(final String location, final String value) { - super(location, 1); + LDefField(final int line, final String location, final String value) { + super(line, location, 1); this.value = value; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java index 577b4123152..6e3aafc0516 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java @@ -39,8 +39,8 @@ public final class LField extends ALink { Field field; - public LField(final String location, final String value) { - super(location, 1); + public LField(final int line, final String location, final String value) { + super(line, location, 1); this.value = value; } @@ -54,9 +54,9 @@ public final class LField extends ALink { final Sort sort = before.sort; if (sort == Sort.ARRAY) { - return new LArrayLength(location, value).copy(this).analyze(settings, definition, variables); + return new LArrayLength(line, location, value).copy(this).analyze(settings, definition, variables); } else if (sort == Sort.DEF) { - return new LDefField(location, value).copy(this).analyze(settings, definition, variables); + return new LDefField(line, location, value).copy(this).analyze(settings, definition, variables); } final Struct struct = before.struct; @@ -77,15 +77,15 @@ public final class LField extends ALink { struct.methods.containsKey("set" + Character.toUpperCase(value.charAt(0)) + value.substring(1)); if (shortcut) { - return new LShortcut(location, value).copy(this).analyze(settings, definition, variables); + return new LShortcut(line, location, value).copy(this).analyze(settings, definition, variables); } else { - final EConstant index = new EConstant(location, value); + final EConstant index = new EConstant(line, location, value); index.analyze(settings, definition, variables); try { before.clazz.asSubclass(Map.class); - return new LMapShortcut(location, index).copy(this).analyze(settings, definition, variables); + return new LMapShortcut(line, location, index).copy(this).analyze(settings, definition, variables); } catch (final ClassCastException exception) { // Do nothing. } @@ -93,7 +93,7 @@ public final class LField extends ALink { try { before.clazz.asSubclass(List.class); - return new LListShortcut(location, index).copy(this).analyze(settings, definition, variables); + return new LListShortcut(line, location, index).copy(this).analyze(settings, definition, variables); } catch (final ClassCastException exception) { // Do nothing. } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LListShortcut.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LListShortcut.java index 05231f81b89..cf256a947f6 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LListShortcut.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LListShortcut.java @@ -36,8 +36,8 @@ final class LListShortcut extends ALink { Method getter; Method setter; - LListShortcut(final String location, final AExpression index) { - super(location, 2); + LListShortcut(final int line, final String location, final AExpression index) { + super(line, location, 2); this.index = index; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LMapShortcut.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LMapShortcut.java index 871950ef592..34c581f382b 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LMapShortcut.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LMapShortcut.java @@ -36,8 +36,8 @@ final class LMapShortcut extends ALink { Method getter; Method setter; - LMapShortcut(final String location, final AExpression index) { - super(location, 2); + LMapShortcut(final int line, final String location, final AExpression index) { + super(line, location, 2); this.index = index; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewArray.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewArray.java index beca6057022..db0a09185d9 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewArray.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewArray.java @@ -35,8 +35,8 @@ public final class LNewArray extends ALink { final String type; final List arguments; - public LNewArray(final String location, final String type, final List arguments) { - super(location, -1); + public LNewArray(final int line, final String location, final String type, final List arguments) { + super(line, location, -1); this.type = type; this.arguments = arguments; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewObj.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewObj.java index c460571f208..e5251e4130a 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewObj.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LNewObj.java @@ -39,8 +39,8 @@ public final class LNewObj extends ALink { Constructor constructor; - public LNewObj(final String location, final String type, final List arguments) { - super(location, -1); + public LNewObj(final int line, final String location, final String type, final List arguments) { + super(line, location, -1); this.type = type; this.arguments = arguments; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LShortcut.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LShortcut.java index df190896940..95e3bbe3a44 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LShortcut.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LShortcut.java @@ -38,8 +38,8 @@ final class LShortcut extends ALink { Method getter = null; Method setter = null; - LShortcut(final String location, final String value) { - super(location, 1); + LShortcut(final int line, final String location, final String value) { + super(line, location, 1); this.value = value; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LString.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LString.java index 70c554b327a..7291b4cf8df 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LString.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LString.java @@ -29,8 +29,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ public final class LString extends ALink { - public LString(final String location, final String string) { - super(location, -1); + public LString(final int line, final String location, final String string) { + super(line, location, -1); this.string = string; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LVariable.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LVariable.java index 73ead63b961..989fa9f9ef7 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LVariable.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LVariable.java @@ -36,8 +36,8 @@ public final class LVariable extends ALink { int slot; - public LVariable(final String location, final String name) { - super(location, 0); + public LVariable(final int line, final String location, final String name) { + super(line, location, 0); this.name = name; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBlock.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBlock.java index f24a603ad61..abaa332c7d3 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBlock.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBlock.java @@ -34,8 +34,8 @@ public final class SBlock extends AStatement { final List statements; - public SBlock(final String location, final List statements) { - super(location); + public SBlock(final int line, final String location, final List statements) { + super(line, location); this.statements = Collections.unmodifiableList(statements); } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBreak.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBreak.java index 23fd8d0603c..7b589ec740e 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBreak.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SBreak.java @@ -29,8 +29,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ public final class SBreak extends AStatement { - public SBreak(final String location) { - super(location); + public SBreak(final int line, final String location) { + super(line, location); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SContinue.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SContinue.java index 3ed7fa8905a..3da0c653129 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SContinue.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SContinue.java @@ -29,8 +29,8 @@ import org.objectweb.asm.commons.GeneratorAdapter; */ public final class SContinue extends AStatement { - public SContinue(final String location) { - super(location); + public SContinue(final int line, final String location) { + super(line, location); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclBlock.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclBlock.java index 875d4857c45..8511f087ef1 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclBlock.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclBlock.java @@ -34,8 +34,8 @@ public final class SDeclBlock extends AStatement { final List declarations; - public SDeclBlock(final String location, final List declarations) { - super(location); + public SDeclBlock(final int line, final String location, final List declarations) { + super(line, location); this.declarations = Collections.unmodifiableList(declarations); } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclaration.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclaration.java index cdcdce7acc8..14e240601ce 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclaration.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDeclaration.java @@ -38,8 +38,8 @@ public final class SDeclaration extends AStatement { Variable variable; - public SDeclaration(final String location, final String type, final String name, final AExpression expression) { - super(location); + public SDeclaration(final int line, final String location, final String type, final String name, final AExpression expression) { + super(line, location); this.type = type; this.name = name; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDo.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDo.java index 41b2acd5fcb..329d9133d40 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDo.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SDo.java @@ -34,8 +34,8 @@ public final class SDo extends AStatement { final AStatement block; AExpression condition; - public SDo(final String location, final AStatement block, final AExpression condition) { - super(location); + public SDo(final int line, final String location, final AStatement block, final AExpression condition) { + super(line, location); this.condition = condition; this.block = block; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SExpression.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SExpression.java index b9fd106e590..17460d09870 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SExpression.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SExpression.java @@ -33,8 +33,8 @@ public final class SExpression extends AStatement { AExpression expression; - public SExpression(final String location, final AExpression expression) { - super(location); + public SExpression(final int line, final String location, final AExpression expression) { + super(line, location); this.expression = expression; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SFor.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SFor.java index 0c26db7c63b..64d171ca611 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SFor.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SFor.java @@ -36,9 +36,9 @@ public final class SFor extends AStatement { AExpression afterthought; final AStatement block; - public SFor(final String location, + public SFor(final int line, final String location, final ANode initializer, final AExpression condition, final AExpression afterthought, final AStatement block) { - super(location); + super(line, location); this.initializer = initializer; this.condition = condition; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SIfElse.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SIfElse.java index 747730b1c53..3914b39ba7f 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SIfElse.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SIfElse.java @@ -34,8 +34,9 @@ public final class SIfElse extends AStatement { final AStatement ifblock; final AStatement elseblock; - public SIfElse(final String location, final AExpression condition, final AStatement ifblock, final AStatement elseblock) { - super(location); + public SIfElse(final int line, final String location, + final AExpression condition, final AStatement ifblock, final AStatement elseblock) { + super(line, location); this.condition = condition; this.ifblock = ifblock; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SReturn.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SReturn.java index c59156b1c4a..a89abe4c5bc 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SReturn.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SReturn.java @@ -31,8 +31,8 @@ public final class SReturn extends AStatement { AExpression expression; - public SReturn(final String location, final AExpression expression) { - super(location); + public SReturn(final int line, final String location, final AExpression expression) { + super(line, location); this.expression = expression; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SSource.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SSource.java index c00fc0c7fc4..b6e731854d0 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SSource.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SSource.java @@ -35,8 +35,8 @@ public final class SSource extends AStatement { final List statements; - public SSource(final String location, final List statements) { - super(location); + public SSource(final int line, final String location, final List statements) { + super(line, location); this.statements = Collections.unmodifiableList(statements); } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SThrow.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SThrow.java index 613b75e6332..b54caf1bce4 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SThrow.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SThrow.java @@ -31,8 +31,8 @@ public final class SThrow extends AStatement { AExpression expression; - public SThrow(final String location, final AExpression expression) { - super(location); + public SThrow(final int line, final String location, final AExpression expression) { + super(line, location); this.expression = expression; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STrap.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STrap.java index 8608344ecd1..77f3c9de9d6 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STrap.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STrap.java @@ -42,8 +42,8 @@ public final class STrap extends AStatement { Label end; Label exception; - public STrap(final String location, final String type, final String name, final AStatement block) { - super(location); + public STrap(final int line, final String location, final String type, final String name, final AStatement block) { + super(line, location); this.type = type; this.name = name; diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STry.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STry.java index 39aa68a0686..f9be4d75ad1 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STry.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/STry.java @@ -36,8 +36,8 @@ public final class STry extends AStatement { final AStatement block; final List traps; - public STry(final String location, final AStatement block, final List traps) { - super(location); + public STry(final int line, final String location, final AStatement block, final List traps) { + super(line, location); this.block = block; this.traps = Collections.unmodifiableList(traps); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SWhile.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SWhile.java index 493ddfe0e13..29028bfe3b4 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SWhile.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/SWhile.java @@ -34,8 +34,8 @@ public final class SWhile extends AStatement { AExpression condition; final AStatement block; - public SWhile(final String location, final AExpression condition, final AStatement block) { - super(location); + public SWhile(final int line, final String location, final AExpression condition, final AStatement block) { + super(line, location); this.condition = condition; this.block = block;