diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts index debfd64109..25935d2aeb 100644 --- a/compiler/forget/src/HIR/BuildHIR.ts +++ b/compiler/forget/src/HIR/BuildHIR.ts @@ -1391,7 +1391,8 @@ function lowerExpression( const expr = exprPath as NodePath; 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, }); diff --git a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md index 5b036a7af7..abfb9ef530 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.expect.md @@ -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 | ``` \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js index 884dba20f6..88bef9f811 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js +++ b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js @@ -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}