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]
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
- Status changed from Open to Closed
Applied in changeset git|9d1940ba3c3bd08a8f2c630e51524186e350fdd5.
[Bug #19966] [PRISM] Fix singleton method definition
Actions