summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-23 00:09:41 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-23 21:03:19 +0900
commitc14f230b26aa4f8abe9ecf3814cfebbe584d77c9 (patch)
treeb4d605d19bc2db444a24d41251e7d204bf3a0d30 /parse.y
parenteb301d8aecf454681e78cd7ad6d027e67b121857 (diff)
Assign temporary ID to anonymous ID [Bug #18250]
Dumped iseq binary can not have unnamed symbols/IDs, and ID 0 is stored instead. As `struct rb_id_table` disallows ID 0, also for the distinction, re-assign a new temporary ID based on the local variable table index when loading from the binary, as well as the parser.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5157
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y5
1 files changed, 1 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index d386561f6a..29517daa20 100644
--- a/parse.y
+++ b/parse.y
@@ -13090,10 +13090,7 @@ rb_init_parse(void)
static ID
internal_id(struct parser_params *p)
{
- const ID max_id = RB_ID_SERIAL_MAX & ~0xffff;
- ID id = (ID)vtable_size(p->lvtbl->args) + (ID)vtable_size(p->lvtbl->vars);
- id = max_id - id;
- return ID_STATIC_SYM | ID_INTERNAL | (id << ID_SCOPE_SHIFT);
+ return rb_make_temporary_id(vtable_size(p->lvtbl->args) + vtable_size(p->lvtbl->vars));
}
#endif /* !RIPPER */