diff options
author | Matt Valentine-House <[email protected]> | 2023-10-20 10:59:02 +0100 |
---|---|---|
committer | Matt Valentine-House <[email protected]> | 2023-10-30 19:44:42 +0000 |
commit | 5dfba84cffd149c97e1cb7a1cb3e40869e127c5f (patch) | |
tree | 37bddbeb86bec69f4745e2a82d13feb26284d626 /compile.c | |
parent | b0f715fa3bb5e89a11fa3449d216e77635426a58 (diff) |
[Prism] Compile ForNode
Fixes ruby/prism#1648
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -984,8 +984,14 @@ rb_iseq_compile_prism_node(rb_iseq_t * iseq, pm_scope_node_t *scope_node, pm_par constants[index] = rb_intern3((const char *) constant->start, constant->length, encoding); } - scope_node->constants = constants; + st_table *index_lookup_table = st_init_numtable(); + pm_constant_id_list_t *locals = &scope_node->locals; + for (size_t i = 0; i < locals->size; i++) { + st_insert(index_lookup_table, locals->ids[i], i); + } + scope_node->constants = (void *)constants; + scope_node->index_lookup_table = index_lookup_table; CHECK(rb_translate_prism(iseq, scope_node, ret)); free(constants); |