public
Description: a ruby-to-pyc compiler
Clone URL: git://github.com/why/unholy.git
Search Repo:
 * python/Kernel.py: use `eval` in order to get the block's return val.
 * lib/unholy/pyasm.rb: `call_func` doesn't completely dump the stack.
why (author)
Thu May 15 07:47:56 -0700 2008
commit  3fa5d7dd9a996c915b4c7415283b493de0790ede
tree    c372617279cf8e1a029abc397bd71c6411d35f81
parent  d5266bb310536bd7899e9291bf05ddf1b79827fc
...
107
108
109
110
 
111
112
113
...
107
108
109
 
110
111
112
113
0
@@ -107,7 +107,7 @@
0
     bc 0x7d, n, 0x0
0
   end
0
   def call_func(arity)
0
- dump_stack
0
+ (arity + 2).times { @stack.pop }
0
     stack_push Object.new, bc(0x83, arity, 0x0)
0
   end
0
   def make_func(arity)
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@
0
   def __init__(self, code):
0
     self.code = code
0
   def call(self, *args):
0
- exec self.code in dict(zip(self.code.co_varnames, args))
0
+ return eval(self.code, dict(zip(self.code.co_varnames, args)))
0
 
0
 def proc(func):
0
   return Proc(func)
...
1
2
3
 
 
...
1
 
 
2
3
0
@@ -1,4 +1,4 @@
0
 # 3
0
-a = proc { |x| print(x + 1) }
0
-a.call(2)
0
+a = proc { |x| x + 1 }
0
+puts a.call(2)

Comments

    No one has commented yet.