aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-27 15:21:45 -0400
committerKevin Newton <kddnewton@gmail.com>2023-09-27 15:41:05 -0400
commit175ac32c62101c601ab701f08e3a781b3b088e62 (patch)
treedacebc635daa881df3c5b616b54a1089645c59c7 /compile.c
parent29555130951435c57fd9a6ab932192a3d180ee0d (diff)
downloadruby-175ac32c62101c601ab701f08e3a781b3b088e62.tar.gz
Use new constant pool layout for prism
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c9
1 files changed, 3 insertions, 6 deletions
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 = {