Merge pull request #993 from ericvergnaud/minor-javacript-bug-fixes

was failing when ran in NodeJS
This commit is contained in:
Terence Parr 2015-09-18 12:22:39 -07:00
commit 7b602e6054
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@
// when you construct the object.
//
var InputStream = require('./InputStream').InputStream;
var isNodeJs = typeof window === 'undefined' && importScripts === 'undefined';
var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
var fs = isNodeJs ? require("fs") : null;
function FileStream(fileName) {

View File

@ -214,7 +214,7 @@ ParserRuleContext.prototype.getSourceInterval = function() {
if( this.start === null || this.stop === null) {
return INVALID_INTERVAL;
} else {
return Interval(this.start.tokenIndex, this.stop.tokenIndex);
return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
}
};