fix: push new token context when braceHashL is seen (#11941)
* fix: push new token context when braceHashL is seen * Update packages/babel-parser/src/tokenizer/context.js
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<Card card={{|title: "foo"|}}></Card>
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["jsx", "flow", ["recordAndTuple", { "syntaxType": "bar" }]]
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}},
|
||||
"name": "Card"
|
||||
},
|
||||
"attributes": [
|
||||
{
|
||||
"type": "JSXAttribute",
|
||||
"start":6,"end":29,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":29}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}},
|
||||
"name": "card"
|
||||
},
|
||||
"value": {
|
||||
"type": "JSXExpressionContainer",
|
||||
"start":11,"end":29,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":29}},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"title"},
|
||||
"name": "title"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "StringLiteral",
|
||||
"start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}},
|
||||
"extra": {
|
||||
"rawValue": "foo",
|
||||
"raw": "\"foo\""
|
||||
},
|
||||
"value": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"selfClosing": false
|
||||
},
|
||||
"closingElement": {
|
||||
"type": "JSXClosingElement",
|
||||
"start":30,"end":37,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":37}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":32,"end":36,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":36}},
|
||||
"name": "Card"
|
||||
}
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<Card card={#{title: "foo"}}></Card>
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["jsx", "flow", ["recordAndTuple", { "syntaxType": "hash" }]]
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":1,"end":5,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":5}},
|
||||
"name": "Card"
|
||||
},
|
||||
"attributes": [
|
||||
{
|
||||
"type": "JSXAttribute",
|
||||
"start":6,"end":28,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":28}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":6,"end":10,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":10}},
|
||||
"name": "card"
|
||||
},
|
||||
"value": {
|
||||
"type": "JSXExpressionContainer",
|
||||
"start":11,"end":28,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":28}},
|
||||
"expression": {
|
||||
"type": "RecordExpression",
|
||||
"start":12,"end":27,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":27}},
|
||||
"properties": [
|
||||
{
|
||||
"type": "ObjectProperty",
|
||||
"start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}},
|
||||
"method": false,
|
||||
"key": {
|
||||
"type": "Identifier",
|
||||
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"title"},
|
||||
"name": "title"
|
||||
},
|
||||
"computed": false,
|
||||
"shorthand": false,
|
||||
"value": {
|
||||
"type": "StringLiteral",
|
||||
"start":21,"end":26,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":26}},
|
||||
"extra": {
|
||||
"rawValue": "foo",
|
||||
"raw": "\"foo\""
|
||||
},
|
||||
"value": "foo"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"selfClosing": false
|
||||
},
|
||||
"closingElement": {
|
||||
"type": "JSXClosingElement",
|
||||
"start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start":31,"end":35,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":35}},
|
||||
"name": "Card"
|
||||
}
|
||||
},
|
||||
"children": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
(#{})/foo
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["jsx", "flow", ["recordAndTuple", { "syntaxType": "hash" }]]
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"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": "RecordExpression",
|
||||
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||
"properties": [],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 0
|
||||
}
|
||||
},
|
||||
"operator": "/",
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user