Francisco Ryan Tolmasky I 966387d263
Always expose expressionValue in DirectiveLiteral nodes (#13960)
* fix(babel-parser): Move storage of expressionValue in DirectiveLiteral to main parser so it is accessible to others.

Closes #13953.

Reviewed by @tolmasky.

* Add results from running `OVERWRITE=true yarn jest babel-parser`.

Reviewed by @tolmasky.
2021-11-13 20:46:16 -05:00

77 lines
2.8 KiB
JSON

{
"type": "File",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}},
"errors": [
"SyntaxError: In strict mode code, functions can only be declared at top level or inside a block. (1:35)"
],
"program": {
"type": "Program",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":53}},
"id": {
"type": "Identifier",
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"},
"name": "foo"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":15,"end":53,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":53}},
"body": [
{
"type": "LabeledStatement",
"start":30,"end":52,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":52}},
"body": {
"type": "FunctionDeclaration",
"start":35,"end":52,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":52}},
"id": {
"type": "Identifier",
"start":44,"end":47,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":47},"identifierName":"baz"},
"name": "baz"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":50,"end":52,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":52}},
"body": [],
"directives": []
}
},
"label": {
"type": "Identifier",
"start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33},"identifierName":"bar"},
"name": "bar"
}
}
],
"directives": [
{
"type": "Directive",
"start":16,"end":29,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":29}},
"value": {
"type": "DirectiveLiteral",
"start":16,"end":28,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":28}},
"extra": {
"rawValue": "use strict",
"raw": "\"use strict\"",
"expressionValue": "use strict"
},
"value": "use strict"
}
}
]
}
}
],
"directives": []
}
}