summaryrefslogtreecommitdiff
path: root/method.h
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2022-03-13 11:52:53 +0900
committernagachika <nagachika@ruby-lang.org>2022-03-13 11:52:53 +0900
commit6175823bab28b5d12f66371d67d006df37751fbc (patch)
treecc11803c188d24590f4e008fbf814fb9f7996bcc /method.h
parent9c2213f6695a16917dbe7b5a3a334116d6d8bbf6 (diff)
merge revision(s) 7ff1bf317887c0d7b21e91ad548d07b9f05c540c,e89d80702bd98a8276243a7fcaa2a158b3bfb659: [Backport #18516]
An alias can suppress method redefinition warning --- test/ruby/test_alias.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) Fix memory leak at the same named alias [Bug #18516] When aliasing a method to the same name method, set a separate bit flag on that method definition, instead of the reference count increment. Although this kind of alias has no actual effect at runtime, is used as the hack to suppress the method re-definition warning. --- method.h | 1 + test/ruby/test_alias.rb | 18 ++++++++++++++++++ vm_method.c | 9 ++++++++- 3 files changed, 27 insertions(+), 1 deletion(-)
Diffstat (limited to 'method.h')
-rw-r--r--method.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/method.h b/method.h
index 5b6fe2d800..16a48ccf88 100644
--- a/method.h
+++ b/method.h
@@ -173,6 +173,7 @@ struct rb_method_definition_struct {
BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
int alias_count : 28;
int complemented_count : 28;
+ unsigned int no_redef_warning: 1;
union {
rb_method_iseq_t iseq;