From 1301e68ae6e47a9f67d9ca100e1d57668c993c9f Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Wed, 13 Mar 2024 22:20:59 -0700 Subject: [PATCH] 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. --- .../src/ReactiveScopes/BuildReactiveFunction.ts | 8 ++++++++ .../compiler/error.todo-useMemo-with-optional.expect.md | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts index ffafa50172..ccfd758eb5 100644 --- a/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/BuildReactiveFunction.ts @@ -1069,6 +1069,14 @@ class Driver { suggestions: null, }); } + case "label": { + CompilerError.throwTodo({ + reason: `Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc)`, + description: null, + loc: terminal.loc, + suggestions: null, + }); + } default: { CompilerError.invariant(false, { reason: `Unexpected value block terminal kind '${terminal.kind}'`, diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md index ceb037506a..758e31f276 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.todo-useMemo-with-optional.expect.md @@ -23,7 +23,7 @@ function Component(props) { > 4 | return [props.value]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 5 | }) || [] - | ^^^^^^^^^^^^^ [ReactForget] Invariant: Unexpected value block terminal kind 'label' (3:5) + | ^^^^^^^^^^^^^ [ReactForget] Todo: Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc) (3:5) 6 | ); 7 | } 8 |