mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Bailout TaggedTemplateExpressions instead of invariant
This commit is contained in:
@@ -1391,7 +1391,8 @@ function lowerExpression(
|
||||
const expr = exprPath as NodePath<t.TaggedTemplateExpression>;
|
||||
if (expr.get("quasi").get("expressions").length !== 0) {
|
||||
builder.errors.push({
|
||||
reason: "Unhandled tagged template with interpolations",
|
||||
reason:
|
||||
"(BuildHIR::lowerAssignment) Handle tagged template with interpolations",
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
@@ -1401,12 +1402,11 @@ function lowerExpression(
|
||||
expr.get("quasi").get("quasis").length == 1,
|
||||
"there should be only one quasi as we don't support interpolations yet"
|
||||
);
|
||||
|
||||
const value = expr.get("quasi").get("quasis").at(0)!.node.value;
|
||||
if (value.raw !== value.cooked) {
|
||||
builder.errors.push({
|
||||
reason:
|
||||
"Unhandled tagged template where cooked value is different from raw value",
|
||||
"(BuildHIR::lowerAssignment) Handle tagged template where cooked value is different from raw value",
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
@@ -1800,7 +1800,7 @@ function lowerAssignment(
|
||||
if (!property.isExpression()) {
|
||||
builder.errors.push({
|
||||
reason:
|
||||
"Expected private name to appear as a non-computed property",
|
||||
"(BuildHIR::lowerAssignment) Expected private name to appear as a non-computed property",
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: property,
|
||||
});
|
||||
|
||||
@@ -32,8 +32,12 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
for (; i < 3; i += 1) {
|
||||
x.push(i);
|
||||
}
|
||||
for (; i < 3; ) {}
|
||||
for (;;) {}
|
||||
for (; i < 3; ) {
|
||||
break;
|
||||
}
|
||||
for (;;) {
|
||||
break;
|
||||
}
|
||||
|
||||
graphql`
|
||||
${g}
|
||||
@@ -236,69 +240,69 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
| ^
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
31 | for (; i < 3; ) {
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
32 | for (;;) {}
|
||||
33 |
|
||||
34 | graphql`
|
||||
> 31 | for (; i < 3; ) {
|
||||
| ^
|
||||
32 | break;
|
||||
33 | }
|
||||
34 | for (;;) {
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
32 | for (;;) {}
|
||||
33 |
|
||||
34 | graphql`
|
||||
> 31 | for (; i < 3; ) {
|
||||
| ^
|
||||
32 | break;
|
||||
33 | }
|
||||
34 | for (;;) {
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 |
|
||||
34 | graphql`
|
||||
35 | ${g}
|
||||
32 | break;
|
||||
33 | }
|
||||
> 34 | for (;;) {
|
||||
| ^
|
||||
35 | break;
|
||||
36 | }
|
||||
37 |
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 |
|
||||
34 | graphql`
|
||||
35 | ${g}
|
||||
32 | break;
|
||||
33 | }
|
||||
> 34 | for (;;) {
|
||||
| ^
|
||||
35 | break;
|
||||
36 | }
|
||||
37 |
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty test in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
| ^^^^^^^^^^^
|
||||
33 |
|
||||
34 | graphql`
|
||||
35 | ${g}
|
||||
|
||||
[ReactForget] TodoError: Unhandled tagged template with interpolations
|
||||
32 | for (;;) {}
|
||||
33 |
|
||||
> 34 | graphql`
|
||||
32 | break;
|
||||
33 | }
|
||||
> 34 | for (;;) {
|
||||
| ^
|
||||
35 | ${g}
|
||||
36 | `;
|
||||
35 | break;
|
||||
36 | }
|
||||
37 |
|
||||
|
||||
[ReactForget] TodoError: Unhandled tagged template where cooked value is different from raw value
|
||||
36 | `;
|
||||
[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle tagged template with interpolations
|
||||
36 | }
|
||||
37 |
|
||||
> 38 | graphql`\\t\n`;
|
||||
> 38 | graphql`
|
||||
| ^
|
||||
39 | ${g}
|
||||
40 | `;
|
||||
41 |
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle tagged template where cooked value is different from raw value
|
||||
40 | `;
|
||||
41 |
|
||||
> 42 | graphql`\\t\n`;
|
||||
| ^^^^^^^^^^^^^^
|
||||
39 | }
|
||||
40 |
|
||||
43 | }
|
||||
44 |
|
||||
```
|
||||
|
||||
|
||||
@@ -28,8 +28,12 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
for (; i < 3; i += 1) {
|
||||
x.push(i);
|
||||
}
|
||||
for (; i < 3; ) {}
|
||||
for (;;) {}
|
||||
for (; i < 3; ) {
|
||||
break;
|
||||
}
|
||||
for (;;) {
|
||||
break;
|
||||
}
|
||||
|
||||
graphql`
|
||||
${g}
|
||||
|
||||
Reference in New Issue
Block a user