Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse non-octals with leading zeros in non strict mode correctly (#9114)
* Parse non-octals with leading zeros in non strict mode correctly * Better error message
- Loading branch information
Showing
16 changed files
with
104 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
09.5 |
4 changes: 4 additions & 0 deletions
4
packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:0)" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/core/regression/non-octal-float/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
09.5 |
70 changes: 70 additions & 0 deletions
70
packages/babel-parser/test/fixtures/core/regression/non-octal-float/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"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", | ||
"interpreter": null, | ||
"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": 9.5, | ||
"raw": "09.5" | ||
}, | ||
"value": 9.5 | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
07.5 |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/core/regression/octal-float-fail/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"throws": "Unexpected token, expected \";\" (1:2)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/core/uncategorised/500/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:33)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:33)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/core/uncategorised/502/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:36)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:36)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/core/uncategorised/522/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:65)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:65)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/core/uncategorised/550/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (2:10)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (2:10)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/core/uncategorised/552/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (2:10)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (2:10)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:21)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:21)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:21)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:21)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:33)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:33)" | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"throws": "Invalid number (1:36)" | ||
"throws": "Legacy octal literals are not allowed in strict mode (1:36)" | ||
} |