Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use Module#dynamic_method for ASM dsl.

  • Loading branch information...
commit 67448dfa9ca80f533f8c01c64b9ffdf119f3865f 1 parent 84641c5
@rkh authored
Showing with 4 additions and 24 deletions.
  1. +4 −24 lib/convinius/asm.rb
View
28 lib/convinius/asm.rb
@@ -3,31 +3,11 @@ module ASM
extend self
def asm(file = "(asm)", line = 1, method = :call, &block)
- g = Rubinius::Generator.new
- g.name = method.to_sym
- g.file = file.to_sym
- g.set_line line
-
- g.required_args = 0
- g.total_args = 0
- g.splat_index = nil
-
- g.local_count = 0
- g.local_names = []
-
- block.arity > 0 ? yield(g) : g.instance_eval(&block)
-
- g.ret
- g.close
-
- g.encode
- cm = g.package Rubinius::CompiledMethod
- puts cm.decode if $DEBUG
-
code = Object.new
- ss = Rubinius::StaticScope.new Object
- Rubinius.attach_method g.name, cm, ss, code
-
+ Rubinius.object_metaclass(code).dynamic_method(method, file, line) do |g|
+ block.arity > 0 ? yield(g) : g.instance_eval(&block)
+ g.ret
+ end
code
end
Please sign in to comment.
Something went wrong with that request. Please try again.