Actions
Bug #19966
closedPrism defines global method instead of singleton method
Bug #19966: Prism defines global method instead of singleton method
Description
The receiver is ignored and compiled to definemethod instead of definesmethod.
$ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile_prism("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,13)> 0000 definemethod :foo, foo 0003 putobject :foo 0005 leave == disasm: #<ISeq:foo@<compiled>:0 (0,0)-(0,13)> 0000 putnil 0001 leave $ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,13)> 0000 putself ( 1)[Li] 0001 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0003 definesmethod :foo, foo 0006 putobject :foo 0008 leave == disasm: #<ISeq:foo@<compiled>:1 (1,0)-(1,13)> 0000 putnil ( 1)[Ca] 0001 leave [Re] Actions