diff --git a/common/src/main/java/dev/cel/common/ast/CelExprFactory.java b/common/src/main/java/dev/cel/common/ast/CelExprFactory.java index 9ad23952e..b69dab05c 100644 --- a/common/src/main/java/dev/cel/common/ast/CelExprFactory.java +++ b/common/src/main/java/dev/cel/common/ast/CelExprFactory.java @@ -264,12 +264,5 @@ protected long nextExprId() { return ++exprId; } - /** Attempts to decrement the next expr ID if possible. */ - protected void maybeDeleteId(long id) { - if (id == exprId - 1) { - exprId--; - } - } - protected CelExprFactory() {} } diff --git a/parser/src/main/java/dev/cel/parser/Parser.java b/parser/src/main/java/dev/cel/parser/Parser.java index a0bef54bf..af860e936 100644 --- a/parser/src/main/java/dev/cel/parser/Parser.java +++ b/parser/src/main/java/dev/cel/parser/Parser.java @@ -686,7 +686,7 @@ private Optional visitMacro( CelExpr.newBuilder().setCall(callExpr.build()).build()); } - exprFactory.maybeDeleteId(expr.id()); + sourceInfo.removePositions(expr.id()); return expandedMacro; } @@ -1165,12 +1165,6 @@ private long nextExprId(int position) { return exprId; } - @Override - protected void maybeDeleteId(long id) { - sourceInfo.removePositions(id); - super.maybeDeleteId(id); - } - @Override public long copyExprId(long id) { return nextExprId(getPosition(id));