Collect bailouts in BuildHIR::lowerJsxElementName

This commit is contained in:
Lauren Tan committed 2023-01-20 11:47:10 -05:00
1 parent 9697e15bd5
commit 4b3b498e37
3 files changed
+80 -50

No files matched your search

+21 -2
View File
@@ -1500,8 +1500,27 @@ function lowerJsxElementName(
t.JSXIdentifier | t.JSXMemberExpression | t.JSXNamespacedName
>
): Place {
todoInvariant(exprPath.isJSXIdentifier(), "handle non-identifier tags");
const exprLoc = exprPath.node.loc ?? GeneratedSource;
const exprNode = exprPath.node;
const exprLoc = exprNode.loc ?? GeneratedSource;
if (!exprPath.isJSXIdentifier()) {
builder.pushError({
reason: "Handle non-identifier tags",
severity: ErrorSeverity.Todo,
nodePath: exprPath,
});
const place: Place = buildTemporaryPlace(builder, exprLoc);
builder.push({
id: makeInstructionId(0),
value: {
kind: "UnsupportedNode",
node: exprNode,
loc: exprLoc,
},
loc: exprLoc,
lvalue: { place: { ...place }, kind: InstructionKind.Const },
});
return { ...place };
}
const tag: string = exprPath.node.name;
if (tag.match(/^[A-Z]/)) {
const identifier = builder.resolveIdentifier(exprPath);
@@ -25,6 +25,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
<Button {...args}></Button>;
<Button xlink:href="localhost:3000"></Button>;
<Button haha={1}></Button>;
<DesignSystem.Button />;
const j = function bar([quz, qux], ...args) {};
@@ -148,7 +149,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
| ^^^^^^^^^
22 | <Button xlink:href="localhost:3000"></Button>;
23 | <Button haha={1}></Button>;
24 |
24 | <DesignSystem.Button />;
[ReactForget] TodoError: Handle non-identifier jsx attribute names
20 |
@@ -156,77 +157,86 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
> 22 | <Button xlink:href="localhost:3000"></Button>;
| ^^^^^^^^^^
23 | <Button haha={1}></Button>;
24 |
25 | const j = function bar([quz, qux], ...args) {};
24 | <DesignSystem.Button />;
25 |
[ReactForget] TodoError: Handle non-identifier tags
22 | <Button xlink:href="localhost:3000"></Button>;
23 | <Button haha={1}></Button>;
> 24 | <DesignSystem.Button />;
| ^^^^^^^^^^^^^^^^^^^
25 |
26 | const j = function bar([quz, qux], ...args) {};
27 |
[ReactForget] TodoError: Handle non identifier params
23 | <Button haha={1}></Button>;
24 |
> 25 | const j = function bar([quz, qux], ...args) {};
24 | <DesignSystem.Button />;
25 |
> 26 | const j = function bar([quz, qux], ...args) {};
| ^^^^^^^^^^
26 |
27 | for (; i < 3; i += 1) {
28 | x.push(i);
27 |
28 | for (; i < 3; i += 1) {
29 | x.push(i);
[ReactForget] TodoError: Handle non identifier params
23 | <Button haha={1}></Button>;
24 |
> 25 | const j = function bar([quz, qux], ...args) {};
24 | <DesignSystem.Button />;
25 |
> 26 | const j = function bar([quz, qux], ...args) {};
| ^^^^^^^
26 |
27 | for (; i < 3; i += 1) {
28 | x.push(i);
27 |
28 | for (; i < 3; i += 1) {
29 | x.push(i);
[ReactForget] TodoError: Support non-variable initialization in for
25 | const j = function bar([quz, qux], ...args) {};
26 |
> 27 | for (; i < 3; i += 1) {
26 | const j = function bar([quz, qux], ...args) {};
27 |
> 28 | for (; i < 3; i += 1) {
| ^
28 | x.push(i);
29 | }
30 | for (; i < 3; ) {}
29 | x.push(i);
30 | }
31 | for (; i < 3; ) {}
[ReactForget] TodoError: Support non-variable initialization in for
28 | x.push(i);
29 | }
> 30 | for (; i < 3; ) {}
29 | x.push(i);
30 | }
> 31 | for (; i < 3; ) {}
| ^^^^^^^^^^^^^^^^^^
31 | for (;;) {}
32 | }
33 |
32 | for (;;) {}
33 | }
34 |
[ReactForget] TodoError: Handle empty for updater
28 | x.push(i);
29 | }
> 30 | for (; i < 3; ) {}
29 | x.push(i);
30 | }
> 31 | for (; i < 3; ) {}
| ^^^^^^^^^^^^^^^^^^
31 | for (;;) {}
32 | }
33 |
32 | for (;;) {}
33 | }
34 |
[ReactForget] TodoError: Support non-variable initialization in for
29 | }
30 | for (; i < 3; ) {}
> 31 | for (;;) {}
30 | }
31 | for (; i < 3; ) {}
> 32 | for (;;) {}
| ^^^^^^^^^^^
32 | }
33 |
33 | }
34 |
[ReactForget] TodoError: Handle empty for updater
29 | }
30 | for (; i < 3; ) {}
> 31 | for (;;) {}
30 | }
31 | for (; i < 3; ) {}
> 32 | for (;;) {}
| ^^^^^^^^^^^
32 | }
33 |
33 | }
34 |
[ReactForget] TodoError: ForStatement without test
29 | }
30 | for (; i < 3; ) {}
> 31 | for (;;) {}
30 | }
31 | for (; i < 3; ) {}
> 32 | for (;;) {}
| ^^^^^^^^^^^
32 | }
33 |
33 | }
34 |
```
@@ -21,6 +21,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
<Button {...args}></Button>;
<Button xlink:href="localhost:3000"></Button>;
<Button haha={1}></Button>;
<DesignSystem.Button />;
const j = function bar([quz, qux], ...args) {};