Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse let declarations whose id starts with \ #13325

Merged
merged 1 commit into from May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/babel-parser/src/parser/statement.js
Expand Up @@ -188,7 +188,13 @@ export default class StatementParser extends ExpressionParser {
// Statement) is allowed here. If context is not empty then only a Statement
// is allowed. However, `let [` is an explicit negative lookahead for
// ExpressionStatement, so special-case it first.
if (nextCh === charCodes.leftSquareBracket) return true;
// Also, `let \` is never valid as an expression so this must be a keyword.
if (
nextCh === charCodes.backslash ||
nextCh === charCodes.leftSquareBracket
) {
return true;
}
if (context) return false;

if (nextCh === charCodes.leftCurlyBrace) return true;
Expand Down
@@ -0,0 +1 @@
let \u0275ResourceLoaderImpl_BaseFactory
@@ -0,0 +1,30 @@
{
"type": "File",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
"program": {
"type": "Program",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}},
"declarations": [
{
"type": "VariableDeclarator",
"start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40}},
"id": {
"type": "Identifier",
"start":4,"end":40,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":40},"identifierName":"ɵResourceLoaderImpl_BaseFactory"},
"name": "ɵResourceLoaderImpl_BaseFactory"
},
"init": null
}
],
"kind": "let"
}
],
"directives": []
}
}
@@ -0,0 +1,2 @@
1 + let
\u0275ResourceLoaderImpl_BaseFactory
@@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}},
"program": {
"type": "Program",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":36}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}},
"left": {
"type": "NumericLiteral",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
},
"operator": "+",
"right": {
"type": "Identifier",
"start":4,"end":7,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":7},"identifierName":"let"},
"name": "let"
}
}
},
{
"type": "ExpressionStatement",
"start":8,"end":44,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":36}},
"expression": {
"type": "Identifier",
"start":8,"end":44,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":36},"identifierName":"ɵResourceLoaderImpl_BaseFactory"},
"name": "ɵResourceLoaderImpl_BaseFactory"
}
}
],
"directives": []
}
}