fix circular dependency

This commit is contained in:
Eric Vergnaud 2020-10-03 17:18:25 +08:00
parent 0bd0a05f24
commit eafb3d8ea6
1 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,6 @@
const {RuleNode} = require('./tree/Tree');
const {INVALID_INTERVAL} = require('./tree/Tree');
const INVALID_ALT_NUMBER = require('./atn/ATN').INVALID_ALT_NUMBER || 0; // TODO: solve cyclic dependency to avoid || 0
const Trees = require('./tree/Trees');
class RuleContext extends RuleNode {
@ -98,7 +97,10 @@ class RuleContext extends RuleNode {
* option contextSuperClass.
* to set it.
*/
getAltNumber() { return INVALID_ALT_NUMBER; }
getAltNumber() {
// use constant value of ATN.INVALID_ALT_NUMBER to avoid circular dependency
return 0;
}
/**
* Set the outer alternative number for this context node. Default