* 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
193 lines
4.7 KiB
JSON
193 lines
4.7 KiB
JSON
{
|
|
"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": []
|
|
}
|
|
} |