diff --git a/compiler/forget/src/HIR/BuildHIR.ts b/compiler/forget/src/HIR/BuildHIR.ts
index 7059c26495..968e19ac31 100644
--- a/compiler/forget/src/HIR/BuildHIR.ts
+++ b/compiler/forget/src/HIR/BuildHIR.ts
@@ -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);
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 948e5eeff6..0f834380cd 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
@@ -25,6 +25,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
;
;
;
+ ;
const j = function bar([quz, qux], ...args) {};
@@ -148,7 +149,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
| ^^^^^^^^^
22 | ;
23 | ;
- 24 |
+ 24 | ;
[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 | ;
| ^^^^^^^^^^
23 | ;
- 24 |
- 25 | const j = function bar([quz, qux], ...args) {};
+ 24 | ;
+ 25 |
+
+[ReactForget] TodoError: Handle non-identifier tags
+ 22 | ;
+ 23 | ;
+> 24 | ;
+ | ^^^^^^^^^^^^^^^^^^^
+ 25 |
+ 26 | const j = function bar([quz, qux], ...args) {};
+ 27 |
[ReactForget] TodoError: Handle non identifier params
- 23 | ;
- 24 |
-> 25 | const j = function bar([quz, qux], ...args) {};
+ 24 | ;
+ 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 | ;
- 24 |
-> 25 | const j = function bar([quz, qux], ...args) {};
+ 24 | ;
+ 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 |
```
\ 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 26e8fc5c25..6e76f4e91b 100644
--- a/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js
+++ b/compiler/forget/src/__tests__/fixtures/hir/error.todo-kitchensink.js
@@ -21,6 +21,7 @@ function foo([a, b], { c, d, e = "e" }, f = "f", ...args) {
;
;
;
+ ;
const j = function bar([quz, qux], ...args) {};