mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Consistency pass for error messages in BuildHIR
This commit is contained in:
@@ -72,7 +72,7 @@ export function lower(
|
||||
params.push(place);
|
||||
} else {
|
||||
builder.pushError({
|
||||
reason: `Support non-identifier params: ${param.node.type}`,
|
||||
reason: `(BuildHIR::lower) Handle ${param.node.type} params`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: param,
|
||||
});
|
||||
@@ -93,7 +93,7 @@ export function lower(
|
||||
lowerStatement(builder, body);
|
||||
} else {
|
||||
builder.pushError({
|
||||
reason: `Unexpected function body kind: ${body.type}}`,
|
||||
reason: `(BuildHIR::lower) Unexpected function body kind: ${body.type}}`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: body,
|
||||
});
|
||||
@@ -337,7 +337,8 @@ function lowerStatement(
|
||||
const init = stmt.get("init");
|
||||
if (!init.isVariableDeclaration()) {
|
||||
builder.pushError({
|
||||
reason: "Support non-variable initialization in for",
|
||||
reason:
|
||||
"(BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement",
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: stmt,
|
||||
});
|
||||
@@ -356,7 +357,7 @@ function lowerStatement(
|
||||
const update = stmt.get("update");
|
||||
if (update.node == null) {
|
||||
builder.pushError({
|
||||
reason: "Handle empty for updater",
|
||||
reason: `(BuildHIR::lowerStatement) Handle empty update in ForStatement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: stmt,
|
||||
});
|
||||
@@ -400,7 +401,7 @@ function lowerStatement(
|
||||
const test = stmt.get("test");
|
||||
if (test.node == null) {
|
||||
builder.pushError({
|
||||
reason: "ForStatement without test",
|
||||
reason: `(BuildHIR::lowerStatement) Handle empty test in ForStatement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: stmt,
|
||||
});
|
||||
@@ -490,7 +491,7 @@ function lowerStatement(
|
||||
const loc = stmt.node.loc;
|
||||
if (loc == null) {
|
||||
builder.pushError({
|
||||
reason: "while statement must have a location",
|
||||
reason: `(BuildHIR::lowerStatement) Expected WhileStatement to have a location, got ${loc}`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: stmt,
|
||||
});
|
||||
@@ -584,7 +585,7 @@ function lowerStatement(
|
||||
if (hasDefault) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Expected at most one `default` branch, this code should have failed to parse",
|
||||
"(BuildHIR::lowerStatement) Expected at most one `default` branch in SwitchStatement, this code should have failed to parse",
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: case_,
|
||||
});
|
||||
@@ -670,11 +671,10 @@ function lowerStatement(
|
||||
const nodeKind: string = stmt.node.kind;
|
||||
if (nodeKind === "var") {
|
||||
builder.pushError({
|
||||
reason: "`var` declarations are not supported, use let or const",
|
||||
reason: `(BuildHIR::lowerStatement) Handle ${nodeKind} kinds in VariableDeclaration`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: stmt,
|
||||
});
|
||||
// TODO: should we lower this to an error variant
|
||||
return;
|
||||
}
|
||||
const kind =
|
||||
@@ -754,7 +754,7 @@ function lowerStatement(
|
||||
case "TSTypeAliasDeclaration":
|
||||
case "WithStatement": {
|
||||
builder.pushError({
|
||||
reason: `Unhandled statement type: ${stmtPath.type}`,
|
||||
reason: `(BuildHIR::lowerStatement) Handle ${stmtPath.type} statements`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: stmtPath,
|
||||
});
|
||||
@@ -826,7 +826,7 @@ function lowerExpression(
|
||||
for (const propertyPath of propertyPaths) {
|
||||
if (!propertyPath.isObjectProperty()) {
|
||||
builder.pushError({
|
||||
reason: "Handle object property spread",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${propertyPath.type} properties in ObjectExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: propertyPath,
|
||||
});
|
||||
@@ -836,7 +836,7 @@ function lowerExpression(
|
||||
const key = propertyPath.node.key;
|
||||
if (key.type !== "Identifier") {
|
||||
builder.pushError({
|
||||
reason: "Unexpected private name",
|
||||
reason: `(BuildHIR::lowerExpression) Expected Identifier, got ${key.type} key in ObjectExpression`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: propertyPath,
|
||||
});
|
||||
@@ -846,7 +846,7 @@ function lowerExpression(
|
||||
const valuePath = propertyPath.get("value");
|
||||
if (!valuePath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Handle non-expression object values",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${valuePath.type} values in ObjectExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: valuePath,
|
||||
});
|
||||
@@ -871,7 +871,7 @@ function lowerExpression(
|
||||
for (const element of expr.get("elements")) {
|
||||
if (element.node == null || !element.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Handle non-expression array elements",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${element.type} elements in ArrayExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: element,
|
||||
});
|
||||
@@ -895,8 +895,7 @@ function lowerExpression(
|
||||
const calleePath = expr.get("callee");
|
||||
if (!calleePath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Call expressions only support callees that are expressions (v8 intrinsics not supported)",
|
||||
reason: `(BuildHIR::lowerExpression) Expected Expression, got ${calleePath.type} in NewExpression (v8 intrinsics not supported): ${calleePath.type}`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: calleePath,
|
||||
});
|
||||
@@ -908,7 +907,7 @@ function lowerExpression(
|
||||
for (const argPath of expr.get("arguments")) {
|
||||
if (!argPath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Support non-expression arguments to NewExpression",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in NewExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: argPath,
|
||||
});
|
||||
@@ -933,8 +932,7 @@ function lowerExpression(
|
||||
let hasError = false;
|
||||
if (!calleePath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Call expressions only support callees that are expressions (v8 intrinsics not supported)",
|
||||
reason: `(BuildHIR::lowerExpression) Expected Expression, got ${calleePath.type} in CallExpression (v8 intrinsics not supported)`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: calleePath,
|
||||
});
|
||||
@@ -949,7 +947,7 @@ function lowerExpression(
|
||||
for (const argPath of expr.get("arguments")) {
|
||||
if (!argPath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Support non-expression arguments to CallExpression",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in CallExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: argPath,
|
||||
});
|
||||
@@ -981,7 +979,7 @@ function lowerExpression(
|
||||
for (const argPath of expr.get("arguments")) {
|
||||
if (!argPath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Support non-expression arguments to CallExpression",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${argPath.type} arguments in CallExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: argPath,
|
||||
});
|
||||
@@ -1005,8 +1003,7 @@ function lowerExpression(
|
||||
const leftPath = expr.get("left");
|
||||
if (!leftPath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Private names may not appear as the left hand side of a binary expression",
|
||||
reason: `(BuildHIR::lowerExpression) Expected Expression, got ${leftPath.type} lval in BinaryExpression`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: leftPath,
|
||||
});
|
||||
@@ -1026,15 +1023,6 @@ function lowerExpression(
|
||||
case "LogicalExpression": {
|
||||
const expr = exprPath as NodePath<t.LogicalExpression>;
|
||||
const leftPath = expr.get("left");
|
||||
if (!leftPath.isExpression()) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Private names may not appear as the left hand side of a logical expression",
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: leftPath,
|
||||
});
|
||||
return { kind: "UnsupportedNode", node: exprNode, loc: exprLoc };
|
||||
}
|
||||
const operator = expr.node.operator;
|
||||
switch (operator) {
|
||||
case "||": {
|
||||
@@ -1139,8 +1127,8 @@ function lowerExpression(
|
||||
const binaryOperator = operators[operator];
|
||||
if (binaryOperator == null) {
|
||||
builder.pushError({
|
||||
reason: `Unhandled assignment operator '${operator}'`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${operator} operaators in AssignmentExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: expr.get("operator"),
|
||||
});
|
||||
return { kind: "UnsupportedNode", node: exprNode, loc: exprLoc };
|
||||
@@ -1178,8 +1166,7 @@ function lowerExpression(
|
||||
const property = leftExpr.get("property");
|
||||
if (!property.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Assignment expression to dynamic properties is not yet supported",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${property.type} properties in MemberExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: property,
|
||||
});
|
||||
@@ -1237,8 +1224,7 @@ function lowerExpression(
|
||||
}
|
||||
default: {
|
||||
builder.pushError({
|
||||
reason:
|
||||
"Assignment update expressions require the lvalue to be an identifier or member expression",
|
||||
reason: `(BuildHIR::lowerExpression) Expected Identifier or MemberExpression, got ${expr.type} lval in AssignmentExpression`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: expr,
|
||||
});
|
||||
@@ -1270,7 +1256,7 @@ function lowerExpression(
|
||||
for (const attribute of opening.get("attributes")) {
|
||||
if (!attribute.isJSXAttribute()) {
|
||||
builder.pushError({
|
||||
reason: "Handle spread attributes",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${attribute.type} attributes in JSXElement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: attribute,
|
||||
});
|
||||
@@ -1280,7 +1266,7 @@ function lowerExpression(
|
||||
const name = attribute.get("name");
|
||||
if (!name.isJSXIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Handle non-identifier jsx attribute names",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${name.type} attribute names in JSXElement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: name,
|
||||
});
|
||||
@@ -1294,7 +1280,7 @@ function lowerExpression(
|
||||
} else {
|
||||
if (!valueExpr.isJSXExpressionContainer()) {
|
||||
builder.pushError({
|
||||
reason: "Handle other non expr containers",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${valueExpr.type} attribute values in JSXElement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: valueExpr,
|
||||
});
|
||||
@@ -1304,7 +1290,7 @@ function lowerExpression(
|
||||
const expression = valueExpr.get("expression");
|
||||
if (!expression.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Handle empty expressions",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${expression.type} expressions in JSXExpressionContainer within JSXElement`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: valueExpr,
|
||||
});
|
||||
@@ -1369,7 +1355,7 @@ function lowerExpression(
|
||||
for (const p of expr.get("params")) {
|
||||
if (!p.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: `Support non identifier params: ${p.type}`,
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${p.type} params in FunctionExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: p,
|
||||
});
|
||||
@@ -1393,7 +1379,7 @@ function lowerExpression(
|
||||
}
|
||||
default: {
|
||||
builder.pushError({
|
||||
reason: `Unhandled expression type: ${exprPath.type}`,
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${exprPath.type} expressions`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
@@ -1413,7 +1399,7 @@ function lowerMemberExpression(
|
||||
if (!expr.node.computed) {
|
||||
if (!property.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Support private names",
|
||||
reason: `(BuildHIR::lowerExpression) Handle ${property.type} property`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: property,
|
||||
});
|
||||
@@ -1433,7 +1419,7 @@ function lowerMemberExpression(
|
||||
} else {
|
||||
if (!property.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Expected private names to be non-computed",
|
||||
reason: `(BuildHIR::lowerMemberExpression) Expected Expression, got ${property.type} property`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: property,
|
||||
});
|
||||
@@ -1522,7 +1508,7 @@ function lowerJsxElementName(
|
||||
const exprLoc = exprNode.loc ?? GeneratedSource;
|
||||
if (!exprPath.isJSXIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Handle non-identifier tags",
|
||||
reason: `(BuildHIR::lowerJsxElementName) Handle ${exprPath.type} tags`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
@@ -1583,7 +1569,7 @@ function lowerJsxElement(
|
||||
const expression = exprPath.get("expression");
|
||||
if (!expression.isExpression()) {
|
||||
builder.pushError({
|
||||
reason: "Handle empty expressions",
|
||||
reason: `(BuildHIR::lowerJsxElement) Handle ${expression.type} expressions`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: expression,
|
||||
});
|
||||
@@ -1617,7 +1603,7 @@ function lowerJsxElement(
|
||||
} else {
|
||||
if (!(t.isJSXFragment(exprNode) || t.isJSXSpreadChild(exprNode))) {
|
||||
builder.pushError({
|
||||
reason: "Expected refinement to work",
|
||||
reason: `(BuildHIR::lowerJsxElement) Expected refinement to work, got: ${exprPath.type}`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: exprPath,
|
||||
});
|
||||
@@ -1744,7 +1730,7 @@ function lowerAssignment(
|
||||
if (!lvalue.node.computed) {
|
||||
if (!property.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Support private names",
|
||||
reason: `(BuildHIR::lowerAssignment) Handle ${property.type} properties in MemberExpression`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: property,
|
||||
});
|
||||
@@ -1795,7 +1781,7 @@ function lowerAssignment(
|
||||
}
|
||||
if (element.node.type === "RestElement") {
|
||||
builder.pushError({
|
||||
reason: "Rest elements are not supported yet",
|
||||
reason: `(BuildHIR::lowerAssignment) Handle ${element.type} in ArrayPattern`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: element,
|
||||
});
|
||||
@@ -1843,7 +1829,7 @@ function lowerAssignment(
|
||||
const property = properties[i];
|
||||
if (!property.isObjectProperty()) {
|
||||
builder.pushError({
|
||||
reason: "Rest elements are not supported yet",
|
||||
reason: `(BuildHIR::lowerAssignment) Handle ${property.type} properties in ObjectPattern`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: property,
|
||||
});
|
||||
@@ -1853,7 +1839,7 @@ function lowerAssignment(
|
||||
const key = property.get("key");
|
||||
if (!key.isIdentifier()) {
|
||||
builder.pushError({
|
||||
reason: "Support non-identifier object property keys",
|
||||
reason: `(BuildHIR::lowerAssignment) Handle ${key.type} keys in ObjectPattern`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: key,
|
||||
});
|
||||
@@ -1863,7 +1849,7 @@ function lowerAssignment(
|
||||
const element = property.get("value");
|
||||
if (!element.isLVal()) {
|
||||
builder.pushError({
|
||||
reason: "Expected object property value to be an lvalue",
|
||||
reason: `(BuildHIR::lowerAssignment) Expected object property value to be an LVal, got: ${element.type}`,
|
||||
severity: ErrorSeverity.InvalidInput,
|
||||
nodePath: element,
|
||||
});
|
||||
@@ -1884,7 +1870,7 @@ function lowerAssignment(
|
||||
}
|
||||
default: {
|
||||
builder.pushError({
|
||||
reason: "Support other lvalue types beyond identifier",
|
||||
reason: `(BuildHIR::lowerAssignment) Handle ${lvaluePath.type} assignments`,
|
||||
severity: ErrorSeverity.Todo,
|
||||
nodePath: lvaluePath,
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
}
|
||||
}
|
||||
|
||||
const g = { ...a };
|
||||
const g = { ...a, b() {}, c: () => {} };
|
||||
const h = [...b];
|
||||
new c(...args);
|
||||
c(...args);
|
||||
@@ -42,35 +42,35 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
## Error
|
||||
|
||||
```
|
||||
[ReactForget] TodoError: Support non-identifier params: ArrayPattern
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle ArrayPattern params
|
||||
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
| ^^^^^^
|
||||
2 | let i = 0;
|
||||
3 | var x = [];
|
||||
4 |
|
||||
|
||||
[ReactForget] TodoError: Support non-identifier params: ObjectPattern
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle ObjectPattern params
|
||||
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
2 | let i = 0;
|
||||
3 | var x = [];
|
||||
4 |
|
||||
|
||||
[ReactForget] TodoError: Support non-identifier params: AssignmentPattern
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle AssignmentPattern params
|
||||
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
| ^^^^^^^
|
||||
2 | let i = 0;
|
||||
3 | var x = [];
|
||||
4 |
|
||||
|
||||
[ReactForget] TodoError: Support non-identifier params: RestElement
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle RestElement params
|
||||
> 1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
| ^^^^^^^
|
||||
2 | let i = 0;
|
||||
3 | var x = [];
|
||||
4 |
|
||||
|
||||
[ReactForget] TodoError: `var` declarations are not supported, use let or const
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration
|
||||
1 | function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
2 | let i = 0;
|
||||
> 3 | var x = [];
|
||||
@@ -79,7 +79,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
5 | class Bar {
|
||||
6 | #secretSauce = 42;
|
||||
|
||||
[ReactForget] TodoError: Unhandled statement type: ClassDeclaration
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle ClassDeclaration statements
|
||||
3 | var x = [];
|
||||
4 |
|
||||
> 5 | class Bar {
|
||||
@@ -88,26 +88,35 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
7 | constructor() {
|
||||
8 | console.log(this.#secretSauce);
|
||||
|
||||
[ReactForget] TodoError: Handle object property spread
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement properties in ObjectExpression
|
||||
10 | }
|
||||
11 |
|
||||
> 12 | const g = { ...a };
|
||||
> 12 | const g = { ...a, b() {}, c: () => {} };
|
||||
| ^^^^
|
||||
13 | const h = [...b];
|
||||
14 | new c(...args);
|
||||
15 | c(...args);
|
||||
|
||||
[ReactForget] TodoError: Handle non-expression array elements
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle ObjectMethod properties in ObjectExpression
|
||||
10 | }
|
||||
11 |
|
||||
12 | const g = { ...a };
|
||||
> 12 | const g = { ...a, b() {}, c: () => {} };
|
||||
| ^^^^^^
|
||||
13 | const h = [...b];
|
||||
14 | new c(...args);
|
||||
15 | c(...args);
|
||||
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement elements in ArrayExpression
|
||||
11 |
|
||||
12 | const g = { ...a, b() {}, c: () => {} };
|
||||
> 13 | const h = [...b];
|
||||
| ^^^^
|
||||
14 | new c(...args);
|
||||
15 | c(...args);
|
||||
16 | g["e"] += 1;
|
||||
|
||||
[ReactForget] TodoError: Support non-expression arguments to NewExpression
|
||||
12 | const g = { ...a };
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement arguments in NewExpression
|
||||
12 | const g = { ...a, b() {}, c: () => {} };
|
||||
13 | const h = [...b];
|
||||
> 14 | new c(...args);
|
||||
| ^^^^^^^
|
||||
@@ -115,7 +124,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
16 | g["e"] += 1;
|
||||
17 | const [y, ...yy] = useState(0);
|
||||
|
||||
[ReactForget] TodoError: Support non-expression arguments to CallExpression
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle SpreadElement arguments in CallExpression
|
||||
13 | const h = [...b];
|
||||
14 | new c(...args);
|
||||
> 15 | c(...args);
|
||||
@@ -124,7 +133,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
17 | const [y, ...yy] = useState(0);
|
||||
18 | const { z, aa = "aa", ...zz } = useCustom();
|
||||
|
||||
[ReactForget] TodoError: Assignment expression to dynamic properties is not yet supported
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle StringLiteral properties in MemberExpression
|
||||
14 | new c(...args);
|
||||
15 | c(...args);
|
||||
> 16 | g["e"] += 1;
|
||||
@@ -133,7 +142,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
18 | const { z, aa = "aa", ...zz } = useCustom();
|
||||
19 |
|
||||
|
||||
[ReactForget] TodoError: Rest elements are not supported yet
|
||||
[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle RestElement in ArrayPattern
|
||||
15 | c(...args);
|
||||
16 | g["e"] += 1;
|
||||
> 17 | const [y, ...yy] = useState(0);
|
||||
@@ -142,7 +151,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
19 |
|
||||
20 | <Button {...args}></Button>;
|
||||
|
||||
[ReactForget] TodoError: Support other lvalue types beyond identifier
|
||||
[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle AssignmentPattern assignments
|
||||
16 | g["e"] += 1;
|
||||
17 | const [y, ...yy] = useState(0);
|
||||
> 18 | const { z, aa = "aa", ...zz } = useCustom();
|
||||
@@ -151,7 +160,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
20 | <Button {...args}></Button>;
|
||||
21 | <Button xlink:href="localhost:3000"></Button>;
|
||||
|
||||
[ReactForget] TodoError: Rest elements are not supported yet
|
||||
[ReactForget] TodoError: (BuildHIR::lowerAssignment) Handle RestElement properties in ObjectPattern
|
||||
16 | g["e"] += 1;
|
||||
17 | const [y, ...yy] = useState(0);
|
||||
> 18 | const { z, aa = "aa", ...zz } = useCustom();
|
||||
@@ -160,7 +169,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
20 | <Button {...args}></Button>;
|
||||
21 | <Button xlink:href="localhost:3000"></Button>;
|
||||
|
||||
[ReactForget] TodoError: Handle spread attributes
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle JSXSpreadAttribute attributes in JSXElement
|
||||
18 | const { z, aa = "aa", ...zz } = useCustom();
|
||||
19 |
|
||||
> 20 | <Button {...args}></Button>;
|
||||
@@ -169,7 +178,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
22 | <Button haha={1}></Button>;
|
||||
23 | <Button>{/** empty */}</Button>;
|
||||
|
||||
[ReactForget] TodoError: Handle non-identifier jsx attribute names
|
||||
[ReactForget] TodoError: (BuildHIR::lowerExpression) Handle JSXNamespacedName attribute names in JSXElement
|
||||
19 |
|
||||
20 | <Button {...args}></Button>;
|
||||
> 21 | <Button xlink:href="localhost:3000"></Button>;
|
||||
@@ -178,7 +187,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
23 | <Button>{/** empty */}</Button>;
|
||||
24 | <DesignSystem.Button />;
|
||||
|
||||
[ReactForget] TodoError: Handle empty expressions
|
||||
[ReactForget] TodoError: (BuildHIR::lowerJsxElement) Handle JSXEmptyExpression expressions
|
||||
21 | <Button xlink:href="localhost:3000"></Button>;
|
||||
22 | <Button haha={1}></Button>;
|
||||
> 23 | <Button>{/** empty */}</Button>;
|
||||
@@ -187,7 +196,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
25 |
|
||||
26 | const j = function bar([quz, qux], ...args) {};
|
||||
|
||||
[ReactForget] TodoError: Handle non-identifier tags
|
||||
[ReactForget] TodoError: (BuildHIR::lowerJsxElementName) Handle JSXMemberExpression tags
|
||||
22 | <Button haha={1}></Button>;
|
||||
23 | <Button>{/** empty */}</Button>;
|
||||
> 24 | <DesignSystem.Button />;
|
||||
@@ -196,7 +205,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
26 | const j = function bar([quz, qux], ...args) {};
|
||||
27 |
|
||||
|
||||
[ReactForget] TodoError: Support non-identifier params: ArrayPattern
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle ArrayPattern params
|
||||
24 | <DesignSystem.Button />;
|
||||
25 |
|
||||
> 26 | const j = function bar([quz, qux], ...args) {};
|
||||
@@ -205,7 +214,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
28 | for (; i < 3; i += 1) {
|
||||
29 | x.push(i);
|
||||
|
||||
[ReactForget] TodoError: Support non-identifier params: RestElement
|
||||
[ReactForget] TodoError: (BuildHIR::lower) Handle RestElement params
|
||||
24 | <DesignSystem.Button />;
|
||||
25 |
|
||||
> 26 | const j = function bar([quz, qux], ...args) {};
|
||||
@@ -214,7 +223,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
28 | for (; i < 3; i += 1) {
|
||||
29 | x.push(i);
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
|
||||
26 | const j = function bar([quz, qux], ...args) {};
|
||||
27 |
|
||||
> 28 | for (; i < 3; i += 1) {
|
||||
@@ -223,7 +232,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
@@ -232,7 +241,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
33 | }
|
||||
34 |
|
||||
|
||||
[ReactForget] TodoError: Handle empty for updater
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
|
||||
29 | x.push(i);
|
||||
30 | }
|
||||
> 31 | for (; i < 3; ) {}
|
||||
@@ -241,7 +250,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
33 | }
|
||||
34 |
|
||||
|
||||
[ReactForget] TodoError: Support non-variable initialization in for
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle non-variable initialization in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
@@ -249,7 +258,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
33 | }
|
||||
34 |
|
||||
|
||||
[ReactForget] TodoError: Handle empty for updater
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty update in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
@@ -257,7 +266,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
33 | }
|
||||
34 |
|
||||
|
||||
[ReactForget] TodoError: ForStatement without test
|
||||
[ReactForget] TodoError: (BuildHIR::lowerStatement) Handle empty test in ForStatement
|
||||
30 | }
|
||||
31 | for (; i < 3; ) {}
|
||||
> 32 | for (;;) {}
|
||||
|
||||
@@ -9,7 +9,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
|
||||
}
|
||||
}
|
||||
|
||||
const g = { ...a };
|
||||
const g = { ...a, b() {}, c: () => {} };
|
||||
const h = [...b];
|
||||
new c(...args);
|
||||
c(...args);
|
||||
|
||||
Reference in New Issue
Block a user