More built-in constants; Get/set parsing fixes; I64.toF64 fixes

This commit is contained in:
dcodeIO
2018-01-02 21:41:25 +01:00
parent 2b182b505e
commit 1221ff129d
14 changed files with 448 additions and 47 deletions

View File

@ -730,13 +730,13 @@ export class Tokenizer extends DiagnosticEmitter {
}
}
peek(checkOnNewLine: bool = false): Token {
peek(checkOnNewLine: bool = false, preferIdentifier: bool = false, maxCompoundLength: i32 = i32.MAX_VALUE): Token {
var text = this.source.text;
if (this.nextToken < 0) {
var posBefore = this.pos;
var tokenBefore = this.token;
var tokenPosBefore = this.tokenPos;
this.nextToken = this.unsafeNext();
this.nextToken = this.unsafeNext(preferIdentifier, maxCompoundLength);
if (checkOnNewLine) {
this.nextTokenOnNewLine = false;
while (--this.tokenPos > posBefore) {
@ -1096,7 +1096,7 @@ export class Tokenizer extends DiagnosticEmitter {
if (this.pos < this.end) {
var c = text.charCodeAt(this.pos);
if (c == CharCode.E || c == CharCode.e) {
if (++this.pos < this.end && text.charCodeAt(this.pos) == CharCode.MINUS)
if (++this.pos < this.end && (text.charCodeAt(this.pos) == CharCode.MINUS || text.charCodeAt(this.pos) == CharCode.PLUS) && isDecimalDigit(text.charCodeAt(this.pos + 1)))
++this.pos;
while (this.pos < this.end && isDecimalDigit(text.charCodeAt(this.pos)))
++this.pos;