Sha256: 76eea6dbfea68f447a68411d2f05973b41e1740f7348bc0d81aa9a452a08ea04

Contents?: true

Size: 933 Bytes

Versions: 4

Compression:

Stored size: 933 Bytes

Contents

class Fancy
  class AST

    class SingletonMethodDef < Rubinius::AST::DefineSingleton
      def initialize(line, obj_ident, method_ident, args, body, access = :public)
        @line = line
        @receiver = obj_ident
        @name = method_ident.method_name(@receiver)
        @arguments = args
        @body = SingletonMethodDefScope.new line, @name, args, body
        @access = access
      end

      def bytecode(g)
        g.push_self
        g.send @access, 0
        g.pop
        super(g)
      end
    end

    class SingletonMethodDefScope < Rubinius::AST::DefineSingletonScope
      def initialize(line, name, args, body)
        @line = line
        @name = name
        @arguments = args
        @body = body
      end

      def bytecode(g, recv)
        #docstring = @body.shift_docstring
        super(g, recv)
        #MethodDef.set_docstring(g, docstring, @line, @arguments.names)
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fancy-0.3.3 boot/rbx-compiler/compiler/ast/singleton_method_def.rb
fancy-0.3.2 boot/rbx-compiler/compiler/ast/singleton_method_def.rb
fancy-0.3.1 boot/rbx-compiler/compiler/ast/singleton_method_def.rb
fancy-0.3.0 boot/rbx-compiler/compiler/ast/singleton_method_def.rb