8000 [PRISM] If receiver on CallNode is SelfNode, use FCALL flags by jemmaissroff · Pull Request #9210 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

[PRISM] If receiver on CallNode is SelfNode, use FCALL flags #9210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,7 @@ pm_compile_call(rb_iseq_t *iseq, const pm_call_node_t *call_node, LINK_ANCHOR *c
}
}

if (call_node->receiver == NULL) {
if (call_node->receiver == NULL || PM_NODE_TYPE_P(call_node->receiver, PM_SELF_NODE)) {
flags |= VM_CALL_FCALL;
}

Expand Down
12 changes: 12 additions & 0 deletions test/ruby/test_compile_prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,18 @@ def self.prism_opt_var_trail_hash(a = nil, *b, c, **d); end
prism_opt_var_trail_hash("a", "b", "c", c: 1)
prism_opt_var_trail_hash("a", "b", "c", "c" => 0, c: 1)
CODE

assert_prism_eval(<<-CODE)
class PrivateMethod
def initialize
self.instance_var
end
private
attr_accessor :instance_var
end
pm = PrivateMethod.new
pm.send(:instance_var)
CODE
end

def test_CallAndWriteNode
Expand Down
0