diff --git a/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts index daae03b26b..e8eddd0509 100644 --- a/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -493,6 +493,12 @@ function codegenInstruction( cx.temp.set(instr.lvalue.place.identifier.id, value); return t.emptyStatement(); } else { + if (instr.lvalue.kind !== InstructionKind.Const) { + CompilerError.invariant( + `Expected all instruction lvalues to be const declarations`, + instr.lvalue.place.loc + ); + } const kind = cx.hasDeclared(instr.lvalue.place.identifier) ? InstructionKind.Reassign : instr.lvalue.kind; @@ -502,11 +508,6 @@ function codegenInstruction( t.variableDeclarator(codegenLVal(instr.lvalue), value), ]); } - case InstructionKind.Let: { - return createVariableDeclaration(instr.loc, "let", [ - t.variableDeclarator(codegenLVal(instr.lvalue), value), - ]); - } case InstructionKind.Reassign: { return createExpressionStatement( instr.loc,