V8intrinsic syntax plugin (#10148)
* feat: v8intrinsic syntax plugin Implement V8 Intrinsic Syntax Extension. Here we check the execution branch inside the parseSubscript to make sure the V8IntrinsicIdentifier is immediately followed by a call expression. * feat: disable combining placeholders and v8intrisic per https://github.com/babel/babel/issues/10104#issuecomment-506950969 * test: add more error cases * refactor: parse v8 intrinsic in parseExprAtom This approach is identical to V8’s implementation. Move the test cases as the behaviour changes. * fix: plugin-name typo * test: add yield-expression test case * feat: require startsExpr on modulo for v8intrinsic * perf: skip eof and braceR check as they must return false * Print V8IntrinsicIdentifier * feat: add v8intrinsic to parser typings * Add generated type helpers * fix: incorrect type definition * fix: allow V8IntrinsicIdentifier to be callee
This commit is contained in:
committed by
Nicolò Ribaudo
parent
b02e35c19a
commit
da0af5fd99
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
::%DebugPrint(null)
|
||||
6
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json
vendored
Normal file
6
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
"v8intrinsic"
|
||||
],
|
||||
"throws": "Unexpected token (1:0)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
a.%DebugPrint();
|
||||
6
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json
vendored
Normal file
6
packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
"v8intrinsic"
|
||||
],
|
||||
"throws": "Unexpected token (1:2)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%DebugPrint(foo)
|
||||
4
packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json
vendored
Normal file
4
packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [],
|
||||
"throws": "Unexpected token (1:0)"
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
const i = %DebugPrint;
|
||||
i(foo);
|
||||
4
packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json
vendored
Normal file
4
packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["v8intrinsic"],
|
||||
"throws": "Unexpected token (1:10)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%DebugPrint?.(null)
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"optionalChaining",
|
||||
"v8intrinsic"
|
||||
],
|
||||
"throws": "Unexpected token (1:0)"
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
async () => { await %StringParseInt("42", 10) }
|
||||
191
packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json
vendored
Normal file
191
packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 0,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": true,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 12,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 47
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 14,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 45
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "AwaitExpression",
|
||||
"start": 14,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 45
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "CallExpression",
|
||||
"start": 20,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 45
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "V8IntrinsicIdentifier",
|
||||
"start": 20,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 35
|
||||
},
|
||||
"identifierName": "StringParseInt"
|
||||
},
|
||||
"name": "StringParseInt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 36,
|
||||
"end": 40,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 40
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "42",
|
||||
"raw": "\"42\""
|
||||
},
|
||||
"value": "42"
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 42,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 42
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 44
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%DebugPrint(foo)
|
||||
101
packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json
vendored
Normal file
101
packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "V8IntrinsicIdentifier",
|
||||
"start": 0,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"identifierName": "DebugPrint"
|
||||
},
|
||||
"name": "DebugPrint"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
new %DebugPrint(null);
|
||||
99
packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json
vendored
Normal file
99
packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "NewExpression",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "V8IntrinsicIdentifier",
|
||||
"start": 4,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "DebugPrint"
|
||||
},
|
||||
"name": "DebugPrint"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "NullLiteral",
|
||||
"start": 16,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%StringParseInt("42", 10);
|
||||
124
packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json
vendored
Normal file
124
packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 0,
|
||||
"end": 25,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 25
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "V8IntrinsicIdentifier",
|
||||
"start": 0,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "StringParseInt"
|
||||
},
|
||||
"name": "StringParseInt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 16,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "42",
|
||||
"raw": "\"42\""
|
||||
},
|
||||
"value": "42"
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 22,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function *foo() {
|
||||
yield %StringParseInt("42", 10)
|
||||
}
|
||||
193
packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json
vendored
Normal file
193
packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start": 0,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": true,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 16,
|
||||
"end": 53,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 20,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 33
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "YieldExpression",
|
||||
"start": 20,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 33
|
||||
}
|
||||
},
|
||||
"delegate": false,
|
||||
"argument": {
|
||||
"type": "CallExpression",
|
||||
"start": 26,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 33
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "V8IntrinsicIdentifier",
|
||||
"start": 26,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 23
|
||||
},
|
||||
"identifierName": "StringParseInt"
|
||||
},
|
||||
"name": "StringParseInt"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 42,
|
||||
"end": 46,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "42",
|
||||
"raw": "\"42\""
|
||||
},
|
||||
"value": "42"
|
||||
},
|
||||
{
|
||||
"type": "NumericLiteral",
|
||||
"start": 48,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 30
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 10,
|
||||
"raw": "10"
|
||||
},
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo%bar()
|
||||
116
packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json
vendored
Normal file
116
packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"operator": "%",
|
||||
"right": {
|
||||
"type": "CallExpression",
|
||||
"start": 4,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"identifierName": "bar"
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/v8intrinsic/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/v8intrinsic/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["v8intrinsic"]
|
||||
}
|
||||
Reference in New Issue
Block a user