Fix some diagnostic issues when skipping invalid statements, see #80; Make game-of-life example somewhat interactive; Update dist files

This commit is contained in:
dcodeIO
2018-04-22 23:13:02 +02:00
parent fac0fc59b5
commit 2ff1bb745a
17 changed files with 771 additions and 1770 deletions

View File

@ -3,7 +3,7 @@
* @module builtins
*//***/
import {
import {
Compiler,
ConversionKind,

View File

@ -176,6 +176,12 @@ export class Parser extends DiagnosticEmitter {
var exportStart: i32 = 0;
var exportEnd: i32 = 0;
if (tn.skip(Token.EXPORT)) {
if (tn.skip(Token.DEFAULT)) {
this.error(
DiagnosticCode.Operation_not_supported,
tn.range()
);
}
if (startPos < 0) startPos = tn.tokenPos;
flags |= CommonFlags.EXPORT;
exportStart = tn.tokenPos;
@ -3181,11 +3187,8 @@ export class Parser extends DiagnosticEmitter {
let nextToken = tn.peek(true);
if (
nextToken == Token.ENDOFFILE || // next step should handle this
nextToken == Token.CLOSEBRACE // current step should handle this
nextToken == Token.SEMICOLON // end of the statement for sure
) {
break;
}
if (nextToken == Token.SEMICOLON) { // end of the statement for sure
tn.next();
break;
}

View File

@ -905,7 +905,6 @@ export class Tokenizer extends DiagnosticEmitter {
this.token = state.token;
this.tokenPos = state.tokenPos;
this.nextToken = -1;
reusableState = state;
}
range(start: i32 = -1, end: i32 = -1): Range {