@samitouri / QOS-React / commits / 1301e68ae6

Add todo for label as value block terminal

We need to revisit the conversion from value blocks into ReactiveFunction. Or just revisit ReactiveFunction altogether (see my post about what this would look like). For now, makes this case a todo.

Joe Savona committed Mar 13, 2024 at 22:20 UTC 1301e68ae6e47a9f67d9ca100e1d57668c993c9f
2 files changed +9 -1
compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts
+8
@@ -1069,6 +1069,14 @@ class Driver {
1069 suggestions: null,
1070 });
1071 }
1072 + case "label": {
1073 + CompilerError.throwTodo({
1074 + reason: `Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc)`,
1075 + description: null,
1076 + loc: terminal.loc,
1077 + suggestions: null,
1078 + });
1079 + }
1080 default: {
1081 CompilerError.invariant(false, {
1082 reason: `Unexpected value block terminal kind '${terminal.kind}'`,
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md
+1 -1
@@ -23,7 +23,7 @@ function Component(props) {
23 > 4 | return [props.value];
24 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 > 5 | }) || []
26 - | ^^^^^^^^^^^^^ [ReactForget] Invariant: Unexpected value block terminal kind 'label' (3:5)
26 + | ^^^^^^^^^^^^^ [ReactForget] Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (3:5)
27 6 | );
28 7 | }
29 8 |