vidarh / writing-a-compiler-in-ruby

Code from my series on writing a Ruby compiler in Ruby
http://www.hokstad.com/compiler
273 stars 22 forks source link

Method call in method body (e.g: attr_accessor) causes "nested" calls #9

Open vidarh opened 15 years ago

vidarh commented 15 years ago
class Foo
  attr_accessor :seq
end

the attr_accessor bit turns into:

    # callm :self.:attr_accessor
    subl    $20, %esp
    movl    $2, %ebx
    movl    Foo, %eax
    movl    %eax, (%esp)
    movl    $3481, 4(%esp)
    movl    (%eax), %edx
    movl    12(%edx), %eax
    call    *%eax
    addl    $20, %esp
    # callm self.attr_accessor END
    call    *%eax
vidarh commented 15 years ago

(notice the second call &%eax)