workaround current cyclic dependency on nodejs

This commit is contained in:
Camilo Roca 2020-02-23 14:12:08 +01:00
parent c8ae1a89a2
commit d95b3270c4
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@
var RuleNode = require('./tree/Tree').RuleNode;
var INVALID_INTERVAL = require('./tree/Tree').INVALID_INTERVAL;
var INVALID_ALT_NUMBER = require('./atn/ATN').INVALID_ALT_NUMBER;
var INVALID_ALT_NUMBER = require('./atn/ATN').INVALID_ALT_NUMBER || 0; // TODO: solve cyclic dependency to avoid || 0
function RuleContext(parent, invokingState) {
// What context invoked this rule?

View File

@ -51,7 +51,7 @@ const Trees = {
if(ruleNames!==null) {
if (t instanceof RuleContext) {
const altNumber = t.getAltNumber();
if ( altNumber != ATN.INVALID_ALT_NUMBER ) {
if ( altNumber != (ATN.INVALID_ALT_NUMBER || 0) ) { // TODO: solve cyclic dependency to avoid || 0
return ruleNames[t.ruleIndex]+":"+altNumber;
}
return ruleNames[t.ruleIndex];