Skip to content

Commit 562afe3

Browse files
committed
Fix captures capturing constants
1 parent e4c8fd8 commit 562afe3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/typechecking.pr

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4348,7 +4348,11 @@ export def lookup_identifier_types(node: &parser::Node, state: &State) {
43484348
def get_value(node: &parser::Node, state: &State, force_compile: bool = true, dry_run: bool = false) -> &scope::Value {
43494349
var value = scope::get(state.scope, node, force_compile = force_compile, dry_run = dry_run) !&scope::Value
43504350
let current_function = state.current_function()
4351-
if current_function.is_closure and value and not value.global and value.current_function != current_function {
4351+
if current_function.is_closure and value and
4352+
value.kind == scope::ValueKind::VALUE and
4353+
value.modifier != parser::VarDecl::CONST and
4354+
not value.global and value.current_function != current_function {
4355+
43524356
let len = state.function_stack.length
43534357
for var i in 0..len {
43544358
node.svalue = null

0 commit comments

Comments
 (0)