From 175ac32c62101c601ab701f08e3a781b3b088e62 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Wed, 27 Sep 2023 15:21:45 -0400 Subject: Use new constant pool layout for prism --- compile.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 9b77483bdb..c7bc538c09 100644 --- a/compile.c +++ b/compile.c @@ -874,12 +874,9 @@ rb_iseq_compile_prism_node(rb_iseq_t * iseq, const pm_node_t *node, pm_parser_t ID *constants = calloc(parser->constant_pool.size, sizeof(ID)); rb_encoding *encoding = rb_enc_find(parser->encoding.name); - for (size_t index = 0; index < parser->constant_pool.capacity; index++) { - pm_constant_t constant = parser->constant_pool.constants[index]; - - if (constant.id != 0) { - constants[constant.id - 1] = rb_intern3((const char *) constant.start, constant.length, encoding); - } + for (uint32_t index = 0; index < parser->constant_pool.size; index++) { + pm_constant_t *constant = &parser->constant_pool.constants[index]; + constants[index] = rb_intern3((const char *) constant->start, constant->length, encoding); } pm_compile_context_t compile_context = { -- cgit v1.2.3