Created
June 29, 2011 06:31
-
-
Save brixen/1053269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ast = "def foo(a) p a end; foo(1)".to_ast | |
root = Rubinius::AST::Script.new ast | |
root.file = "(heckle)" | |
compiler = Rubinius::Compiler.new :bytecode, :compiled_method | |
compiler.generator.input root | |
cm = compiler.run | |
script = cm.create_script | |
Rubinius.run_script script.compiled_method | |
ast.array.first.body.array.unshift "a = :what?".to_ast | |
v = ast.array.first.body.array[1].arguments.array.first.variable | |
ast.array.first.body.array.first.variable = v | |
cm = compiler.run | |
script = cm.create_script | |
Rubinius.run_script script.compiled_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rbx rbx-heckle.rb | |
1 | |
:what? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment