Handle private AREF call in compile.c
This commit is contained in:
parent
160f83ba55
commit
b82c06a711
Notes:
git
2023-04-30 17:00:35 +00:00
5
parse.y
5
parse.y
@ -4249,10 +4249,7 @@ method_call : fcall paren_args
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
{
|
||||
/*%%%*/
|
||||
if ($1 && nd_type_p($1, NODE_SELF))
|
||||
$$ = NEW_FCALL(tAREF, $3, &@$);
|
||||
else
|
||||
$$ = NEW_CALL($1, tAREF, $3, &@$);
|
||||
$$ = NEW_CALL($1, tAREF, $3, &@$);
|
||||
fixpos($$, $1);
|
||||
/*% %*/
|
||||
/*% ripper: aref!($1, escape_Qundef($3)) %*/
|
||||
|
@ -771,6 +771,14 @@ class TestMethod < Test::Unit::TestCase
|
||||
assert_raise(NoMethodError) { (self).mv2 }
|
||||
assert_nothing_raised { self.mv3 }
|
||||
|
||||
class << (obj = Object.new)
|
||||
private def [](x) x end
|
||||
def mv1(x) self[x] end
|
||||
def mv2(x) (self)[x] end
|
||||
end
|
||||
assert_nothing_raised { obj.mv1(0) }
|
||||
assert_raise(NoMethodError) { obj.mv2(0) }
|
||||
|
||||
v = Visibility.new
|
||||
|
||||
assert_equal('method', defined?(v.mv1))
|
||||
|
Loading…
x
Reference in New Issue
Block a user