commit
9a1ef48ae3
@ -451,7 +451,7 @@ pp.flowParseObjectType = function (allowStatic, allowExact, allowSpread) {
|
||||
if (!allowSpread) {
|
||||
this.unexpected(
|
||||
null,
|
||||
"Spread operator cannnot appear in class or interface definitions"
|
||||
"Spread operator cannot appear in class or interface definitions"
|
||||
);
|
||||
}
|
||||
if (variance) {
|
||||
|
||||
@ -564,23 +564,27 @@ export default class Tokenizer {
|
||||
|
||||
readNumber(startsWithDot) {
|
||||
const start = this.state.pos;
|
||||
const octal = this.input.charCodeAt(this.state.pos) === 48;
|
||||
let octal = this.input.charCodeAt(start) === 48; // '0'
|
||||
let isFloat = false;
|
||||
|
||||
if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
|
||||
if (octal && this.state.pos == start + 1) octal = false; // number === 0
|
||||
|
||||
let next = this.input.charCodeAt(this.state.pos);
|
||||
if (next === 46) { // '.'
|
||||
if (next === 46 && !octal) { // '.'
|
||||
++this.state.pos;
|
||||
this.readInt(10);
|
||||
isFloat = true;
|
||||
next = this.input.charCodeAt(this.state.pos);
|
||||
}
|
||||
if (next === 69 || next === 101) { // 'eE'
|
||||
|
||||
if ((next === 69 || next === 101) && !octal) { // 'eE'
|
||||
next = this.input.charCodeAt(++this.state.pos);
|
||||
if (next === 43 || next === 45) ++this.state.pos; // '+-'
|
||||
if (this.readInt(10) === null) this.raise(start, "Invalid number");
|
||||
isFloat = true;
|
||||
}
|
||||
|
||||
if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
|
||||
|
||||
const str = this.input.slice(start, this.state.pos);
|
||||
@ -589,8 +593,10 @@ export default class Tokenizer {
|
||||
val = parseFloat(str);
|
||||
} else if (!octal || str.length === 1) {
|
||||
val = parseInt(str, 10);
|
||||
} else if (/[89]/.test(str) || this.state.strict) {
|
||||
} else if (this.state.strict) {
|
||||
this.raise(start, "Invalid number");
|
||||
} else if (/[89]/.test(str)) {
|
||||
val = parseInt(str, 10);
|
||||
} else {
|
||||
val = parseInt(str, 8);
|
||||
}
|
||||
|
||||
69
test/fixtures/core/uncategorised/355/expected.json
vendored
Normal file
69
test/fixtures/core/uncategorised/355/expected.json
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 2,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 2,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 2,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 0,
|
||||
"end": 2,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 9,
|
||||
"raw": "09"
|
||||
},
|
||||
"value": 9
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Invalid number (1:0)"
|
||||
}
|
||||
69
test/fixtures/core/uncategorised/356/expected.json
vendored
Normal file
69
test/fixtures/core/uncategorised/356/expected.json
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 18,
|
||||
"raw": "018"
|
||||
},
|
||||
"value": 18
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"throws": "Invalid number (1:0)"
|
||||
}
|
||||
2
test/fixtures/core/uncategorised/550/actual.js
vendored
Normal file
2
test/fixtures/core/uncategorised/550/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
const a = 07;
|
||||
3
test/fixtures/core/uncategorised/550/options.json
vendored
Normal file
3
test/fixtures/core/uncategorised/550/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid number (2:10)"
|
||||
}
|
||||
1
test/fixtures/core/uncategorised/551/actual.js
vendored
Normal file
1
test/fixtures/core/uncategorised/551/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
0111
|
||||
69
test/fixtures/core/uncategorised/551/expected.json
vendored
Normal file
69
test/fixtures/core/uncategorised/551/expected.json
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 73,
|
||||
"raw": "0111"
|
||||
},
|
||||
"value": 73
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
2
test/fixtures/core/uncategorised/552/actual.js
vendored
Normal file
2
test/fixtures/core/uncategorised/552/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
const a = 08;
|
||||
3
test/fixtures/core/uncategorised/552/options.json
vendored
Normal file
3
test/fixtures/core/uncategorised/552/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid number (2:10)"
|
||||
}
|
||||
1
test/fixtures/core/uncategorised/553/actual.js
vendored
Normal file
1
test/fixtures/core/uncategorised/553/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
0274134317073
|
||||
69
test/fixtures/core/uncategorised/553/expected.json
vendored
Normal file
69
test/fixtures/core/uncategorised/553/expected.json
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 25257156155,
|
||||
"raw": "0274134317073"
|
||||
},
|
||||
"value": 25257156155
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/core/uncategorised/554/actual.js
vendored
Normal file
1
test/fixtures/core/uncategorised/554/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var a = 0123.;
|
||||
3
test/fixtures/core/uncategorised/554/options.json
vendored
Normal file
3
test/fixtures/core/uncategorised/554/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token (1:13)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Spread operator cannnot appear in class or interface definitions (2:1)"
|
||||
"throws": "Spread operator cannot appear in class or interface definitions (2:1)"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user