Skip to content

Commit

Permalink
tweak: do NOT clean up the error recovery info until the parse is done:
Browse files Browse the repository at this point in the history
- DO NOT cleanup the old one before we start the new error info track: the old one will *linger* on the error stack and stay alive until we  invoke the parser's cleanup API!
- `recoveringErrorInfo` is also part of the `__error_recovery_infos` array, hence has been destroyed already: no need to do that *twice*.
  • Loading branch information
GerHobbelt committed Oct 30, 2017
1 parent ef1732a commit 99ae63f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/jison-parser-kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,9 @@ function parse(input, parseParams) {
}
this.__error_recovery_infos.length = 0;

if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') {
recoveringErrorInfo.destroy();
// `recoveringErrorInfo` is also part of the `__error_recovery_infos` array,
// hence has been destroyed already: no need to do that *twice*.
if (recoveringErrorInfo) {
recoveringErrorInfo = undefined;
}

Expand Down Expand Up @@ -856,10 +857,9 @@ function parse(input, parseParams) {

p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0));

// cleanup the old one before we start the new error info track:
if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') {
recoveringErrorInfo.destroy();
}
// DO NOT cleanup the old one before we start the new error info track:
// the old one will *linger* on the error stack and stay alive until we
// invoke the parser's cleanup API!
recoveringErrorInfo = this.shallowCopyErrorInfo(p);

r = this.parseError(p.errStr, p, this.JisonParserError);
Expand Down

0 comments on commit 99ae63f

Please sign in to comment.