mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Collect bailouts in BuildHIR::lowerJsxElement
This commit is contained in:
@@ -1351,7 +1351,7 @@ function lowerExpression(
|
||||
for (const p of expr.get("params")) {
|
||||
if (!p.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Handle non identifier params",
|
||||
reason: `Support non identifier params: ${p.type}`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: p,
|
||||
});
|
||||
@@ -1563,7 +1563,25 @@ function lowerJsxElement(
|
||||
return lowerExpressionToPlace(builder, exprPath);
|
||||
} else if (exprPath.isJSXExpressionContainer()) {
|
||||
const expression = exprPath.get("expression");
|
||||
todoInvariant(expression.isExpression(), "handle empty expressions");
|
||||
if (!expression.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Handle empty expressions",
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: expression,
|
||||
});
|
||||
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 };
|
||||
}
|
||||
return lowerExpressionToPlace(builder, expression);
|
||||
} else if (exprPath.isJSXText()) {
|
||||
const place: Place = buildTemporaryPlace(builder, exprLoc);
|
||||
@@ -1579,10 +1597,13 @@ function lowerJsxElement(
|
||||
});
|
||||
return place;
|
||||
} else {
|
||||
invariant(
|
||||
t.isJSXFragment(exprNode) || t.isJSXSpreadChild(exprNode),
|
||||
"Expected refinement to work"
|
||||
);
|
||||
if (!(t.isJSXFragment(exprNode) || t.isJSXSpreadChild(exprNode))) {
|
||||
builder.pushError({
|
||||
reason: "Expected refinement to work",
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
}
|
||||
const place: Place = buildTemporaryPlace(builder, exprLoc);
|
||||
builder.push({
|
||||
id: makeInstructionId(0),
|
||||
|
||||
@@ -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>;
|
||||
<Button>{/** empty */}</Button>;
|
||||
<DesignSystem.Button />;
|
||||
|
||||
const j = function bar([quz, qux], ...args) {};
|
||||
@@ -149,7 +150,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 | <DesignSystem.Button />;
|
||||
24 | <Button>{/** empty */}</Button>;
|
||||
|
||||
[ReactForget] TodoError: Handle non-identifier jsx attribute names
|
||||
20 |
|
||||
@@ -157,86 +158,95 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
> 22 | <Button xlink:href="localhost:3000"></Button>;
|
||||
| ^^^^^^^^^^
|
||||
23 | <Button haha={1}></Button>;
|
||||
24 | <DesignSystem.Button />;
|
||||
25 |
|
||||
24 | <Button>{/** empty */}</Button>;
|
||||
25 | <DesignSystem.Button />;
|
||||
|
||||
[ReactForget] TodoError: Handle non-identifier tags
|
||||
[ReactForget] TodoError: Handle empty expressions
|
||||
22 | <Button xlink:href="localhost:3000"></Button>;
|
||||
23 | <Button haha={1}></Button>;
|
||||
> 24 | <DesignSystem.Button />;
|
||||
> 24 | <Button>{/** empty */}</Button>;
|
||||
| ^^^^^^^^^^^^
|
||||
25 | <DesignSystem.Button />;
|
||||
26 |
|
||||
27 | const j = function bar([quz, qux], ...args) {};
|
||||
|
||||
[ReactForget] TodoError: Handle non-identifier tags
|
||||
23 | <Button haha={1}></Button>;
|
||||
24 | <Button>{/** empty */}</Button>;
|
||||
> 25 | <DesignSystem.Button />;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
25 |
|
||||
26 | const j = function bar([quz, qux], ...args) {};
|
||||
27 |
|
||||
26 |
|
||||
27 | const j = function bar([quz, qux], ...args) {};
|
||||
28 |
|
||||
|
||||
[ReactForget] TodoError: Handle non identifier params
|
||||
24 | <DesignSystem.Button />;
|
||||
25 |
|
||||
> 26 | const j = function bar([quz, qux], ...args) {};
|
||||
[ReactForget] TodoError: Support non-identifier params: ArrayPattern
|
||||
25 | <DesignSystem.Button />;
|
||||
26 |
|
||||
> 27 | const j = function bar([quz, qux], ...args) {};
|
||||
| ^^^^^^^^^^
|
||||
27 |
|
||||
28 | for (; i < 3; i += 1) {
|
||||
29 | x.push(i);
|
||||
28 |
|
||||
29 | for (; i < 3; i += 1) {
|
||||
30 | x.push(i);
|
||||
|
||||
[ReactForget] TodoError: Handle non identifier params
|
||||
24 | <DesignSystem.Button />;
|
||||
25 |
|
||||
> 26 | const j = function bar([quz, qux], ...args) {};
|
||||
[ReactForget] TodoError: Support non-identifier params: RestElement
|
||||
25 | <DesignSystem.Button />;
|
||||
26 |
|
||||
> 27 | const j = function bar([quz, qux], ...args) {};
|
||||
| ^^^^^^^
|
||||
27 |
|
||||
28 | for (; i < 3; i += 1) {
|
||||
29 | x.push(i);
|
||||
28 |
|
||||
29 | for (; i < 3; i += 1) {
|
||||
30 | x.push(i);
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
26 | const j = function bar([quz, qux], ...args) {};
|
||||
27 |
|
||||
> 28 | for (; i < 3; i += 1) {
|
||||
27 | const j = function bar([quz, qux], ...args) {};
|
||||
28 |
|
||||
> 29 | for (; i < 3; i += 1) {
|
||||
| ^
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
30 | x.push(i);
|
||||
31 | }
|
||||
32 | for (; i < 3; ) {}
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
30 | x.push(i);
|
||||
31 | }
|
||||
> 32 | for (; i < 3; ) {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
32 | for (;;) {}
|
||||
33 | }
|
||||
34 |
|
||||
33 | for (;;) {}
|
||||
34 | }
|
||||
35 |
|
||||
|
||||
[ReactForget] TodoError: Handle empty for updater
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
30 | x.push(i);
|
||||
31 | }
|
||||
> 32 | for (; i < 3; ) {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
32 | for (;;) {}
|
||||
33 | }
|
||||
34 |
|
||||
33 | for (;;) {}
|
||||
34 | }
|
||||
35 |
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
31 | }
|
||||
32 | for (; i < 3; ) {}
|
||||
> 33 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 | }
|
||||
34 |
|
||||
34 | }
|
||||
35 |
|
||||
|
||||
[ReactForget] TodoError: Handle empty for updater
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
31 | }
|
||||
32 | for (; i < 3; ) {}
|
||||
> 33 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 | }
|
||||
34 |
|
||||
34 | }
|
||||
35 |
|
||||
|
||||
[ReactForget] TodoError: ForStatement without test
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
31 | }
|
||||
32 | for (; i < 3; ) {}
|
||||
> 33 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 | }
|
||||
34 |
|
||||
34 | }
|
||||
35 |
|
||||
```
|
||||
|
||||
|
||||
@@ -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>;
|
||||
<Button>{/** empty */}</Button>;
|
||||
<DesignSystem.Button />;
|
||||
|
||||
const j = function bar([quz, qux], ...args) {};
|
||||
|
||||
Reference in New Issue
Block a user