Skip to content

Commit 48ef8b0

Browse files
committed
callTarget needs to ignore visibility if it is prefixed with self. as an explicit receiver
1 parent 5fdb09c commit 48ef8b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/jruby/prism/builder/IRBuilderPrism.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,15 +1695,18 @@ protected void buildAssignment(Map<Node, Operand> reads, List<Tuple<Node, Result
16951695

16961696
switch (node) {
16971697
case CallTargetNode call -> {
1698+
CallType callType = call.isIgnoreVisibility() ? CallType.FUNCTIONAL : CallType.NORMAL;
16981699
var receiver = reads.get(call.receiver);
16991700
if (call.isSafeNavigation()) {
17001701
if_not(receiver, nil(),
1701-
() -> call(temp(), receiver, call.name, rhs));
1702+
() -> _call(temp(), callType, receiver, call.name, rhs));
17021703
} else {
1703-
call(temp(), receiver, call.name, rhs);
1704+
_call(temp(), callType, receiver, call.name, rhs);
17041705
}
17051706
}
17061707
case IndexTargetNode index -> {
1708+
// FIXME: we determine self.foo[] by requiring receiver to be `self` in AttrAssignInstr but we could
1709+
// use isIgnoreVisibility() that the parser provides. We have no code path to do this though in AttrAssignInstr.
17071710
var receiver = reads.get(index.receiver);
17081711
Array holders = (Array) reads.get(index.arguments);
17091712
int flags = ((Integer) holders.get(holders.size() - 1)).value;

0 commit comments

Comments
 (0)