summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-24 13:35:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-26 09:33:48 +0900
commit54eac83b2ad77ddea84fa6d66c09e0bb014cf61e (patch)
tree01dd78aef4d8a7ee300ff086b8a99e13ef8ecd42 /parse.y
parent5689c46457e6b078ac83b08b7e881e0050ebdfaa (diff)
Hide internal IDs
* parse.y (internal_id): number the ID serial for internal use by counting down from the neary maximum value, not to accidentally match permanent IDs. [Bug #15768]
Notes
Notes: Fixed: [Bug #15786]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index c769ffe485..7c5e8c3772 100644
--- a/parse.y
+++ b/parse.y
@@ -11812,8 +11812,9 @@ 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 += ((tLAST_TOKEN - ID_INTERNAL) >> ID_SCOPE_SHIFT) + 1;
+ id = max_id - id;
return ID_STATIC_SYM | ID_INTERNAL | (id << ID_SCOPE_SHIFT);
}
#endif /* !RIPPER */