mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 15:32:16 +00:00
Fix infinite loop when skipping statements, see #167
This commit is contained in:
parent
cc72d02542
commit
585d246165
@ -21,6 +21,10 @@ const colorsUtil = require("./util/colors");
|
|||||||
const optionsUtil = require("./util/options");
|
const optionsUtil = require("./util/options");
|
||||||
const EOL = process.platform === "win32" ? "\r\n" : "\n";
|
const EOL = process.platform === "win32" ? "\r\n" : "\n";
|
||||||
|
|
||||||
|
// Emscripten adds an `uncaughtException` listener to Binaryen that results in an additional
|
||||||
|
// useless code fragment on top of an actual error. suppress this:
|
||||||
|
if (process.removeAllListeners) process.removeAllListeners("uncaughtException");
|
||||||
|
|
||||||
// Use distribution files if present, otherwise run the sources directly
|
// Use distribution files if present, otherwise run the sources directly
|
||||||
var assemblyscript, isDev = false;
|
var assemblyscript, isDev = false;
|
||||||
(() => {
|
(() => {
|
||||||
@ -38,9 +42,6 @@ var assemblyscript, isDev = false;
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// combine both errors that lead us here
|
// combine both errors that lead us here
|
||||||
e.stack = e_ts.stack + "\n---\n" + e.stack;
|
e.stack = e_ts.stack + "\n---\n" + e.stack;
|
||||||
// Emscripten adds an `uncaughtException` listener to Binaryen that results in an additional
|
|
||||||
// useless code fragment on top of the actual error. suppress this:
|
|
||||||
if (process.removeAllListeners) process.removeAllListeners("uncaughtException");
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
dist/asc.js
vendored
2
dist/asc.js
vendored
File diff suppressed because one or more lines are too long
2
dist/asc.js.map
vendored
2
dist/asc.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js
vendored
2
dist/assemblyscript.js
vendored
File diff suppressed because one or more lines are too long
2
dist/assemblyscript.js.map
vendored
2
dist/assemblyscript.js.map
vendored
File diff suppressed because one or more lines are too long
@ -546,13 +546,11 @@ export class Tokenizer extends DiagnosticEmitter {
|
|||||||
let c = text.charCodeAt(this.pos);
|
let c = text.charCodeAt(this.pos);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case CharCode.CARRIAGERETURN: {
|
case CharCode.CARRIAGERETURN: {
|
||||||
if (
|
if (!(
|
||||||
++this.pos < this.end &&
|
++this.pos < this.end &&
|
||||||
text.charCodeAt(this.pos) == CharCode.LINEFEED
|
text.charCodeAt(this.pos) == CharCode.LINEFEED
|
||||||
) {
|
)) break;
|
||||||
++this.pos;
|
// otherwise fall-through
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case CharCode.LINEFEED:
|
case CharCode.LINEFEED:
|
||||||
case CharCode.TAB:
|
case CharCode.TAB:
|
||||||
@ -960,8 +958,8 @@ export class Tokenizer extends DiagnosticEmitter {
|
|||||||
this.nextTokenPos = this.tokenPos;
|
this.nextTokenPos = this.tokenPos;
|
||||||
if (checkOnNewLine) {
|
if (checkOnNewLine) {
|
||||||
this.nextTokenOnNewLine = false;
|
this.nextTokenOnNewLine = false;
|
||||||
while (--this.tokenPos > posBefore) {
|
for (let pos = posBefore, end = this.nextTokenPos; pos < end; ++pos) {
|
||||||
if (isLineBreak(text.charCodeAt(this.tokenPos))) {
|
if (isLineBreak(text.charCodeAt(pos))) {
|
||||||
this.nextTokenOnNewLine = true;
|
this.nextTokenOnNewLine = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/(abc)\//;
|
/(abc)\//;
|
||||||
var re = /(abc)\//ig;
|
var re = /(abc)\//ig;
|
||||||
var noRe = !/(abc)\//i;
|
var noRe = !/(abc)\//i;
|
||||||
|
b / ig;
|
||||||
/(abc)\//iig;
|
/(abc)\//iig;
|
||||||
/(abc)\//iX;
|
/(abc)\//iX;
|
||||||
false && /abc/gX.test(someString) || true;
|
false && /abc/gX.test(someString) || true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user