Skip to content

Commit c26e26d

Browse files
Stephen Robertscopybara-github
authored andcommitted
Simplify expression numbering logic in CelExprFactory
PiperOrigin-RevId: 844507936
1 parent b3612d4 commit c26e26d

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

common/src/main/java/dev/cel/common/ast/CelExprFactory.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,5 @@ protected long nextExprId() {
264264
return ++exprId;
265265
}
266266

267-
/** Attempts to decrement the next expr ID if possible. */
268-
protected void maybeDeleteId(long id) {
269-
if (id == exprId - 1) {
270-
exprId--;
271-
}
272-
}
273-
274267
protected CelExprFactory() {}
275268
}

parser/src/main/java/dev/cel/parser/Parser.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ private Optional<CelExpr> visitMacro(
686686
CelExpr.newBuilder().setCall(callExpr.build()).build());
687687
}
688688

689-
exprFactory.maybeDeleteId(expr.id());
689+
sourceInfo.removePositions(expr.id());
690690
return expandedMacro;
691691
}
692692

@@ -1165,12 +1165,6 @@ private long nextExprId(int position) {
11651165
return exprId;
11661166
}
11671167

1168-
@Override
1169-
protected void maybeDeleteId(long id) {
1170-
sourceInfo.removePositions(id);
1171-
super.maybeDeleteId(id);
1172-
}
1173-
11741168
@Override
11751169
public long copyExprId(long id) {
11761170
return nextExprId(getPosition(id));

0 commit comments

Comments
 (0)