-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert in ParserRuleContext.java makes copyFrom unusable #57
Comments
Can you provide an example showing how this code path is hit?
ANTLR made some breaking API changes during earlier releases, which are not allowed in this repository. It's possible this assertion was incorrectly translated during a merge, but I'm surprised I haven't heard about it sooner since this code is more than 2 years old. |
Before, I used the old 4.5.3 version (without assertion) which occurred to have some performance problems in some cases, which ones are solved in the latest one. You don't need to have any concrete examples here, just try to copy any context and experience assertion error here because if context2 has children you call |
The context passed to |
with 4.5.3 I could have like ctx1.copyFrom(ctx2);
for (child: ctx2.childrens)
ctx1.addChild(child) (I know parents are not reassigned here, but it's ok for me.) public void copyFrom(ParserRuleContext ctx) {
this.parent = ctx.parent;
this.invokingState = ctx.invokingState;
this.start = ctx.start;
this.stop = ctx.stop;
} and |
@fedorusov Is it OK if I leave this one open? I can't promise it will change but I'd like to think about ways to improve the validation condition. |
Sure |
antlr4/runtime/Java/src/org/antlr/v4/runtime/ParserRuleContext.java
Line 143 in 269c382
If you call
you necessarily call
addAnyChild
which have this assert, so it fails.Vanilla antlr doesn't have this, why do you?
The text was updated successfully, but these errors were encountered: