Browse files

* 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.
  • Loading branch information...
1 parent d5266bb commit 3fa5d7dd9a996c915b4c7415283b493de0790ede _why committed May 15, 2008
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/unholy/pyasm.rb
  2. +1 −1 python/Kernel.py
  3. +2 −2 tests/04block.rb
View
2 lib/unholy/pyasm.rb
@@ -107,7 +107,7 @@ def store_fast(n)
bc 0x7d, n, 0x0
end
def call_func(arity)
- dump_stack
+ (arity + 2).times { @stack.pop }
stack_push Object.new, bc(0x83, arity, 0x0)
end
def make_func(arity)
View
2 python/Kernel.py
@@ -2,7 +2,7 @@ class Proc:
def __init__(self, code):
self.code = code
def call(self, *args):
- exec self.code in dict(zip(self.code.co_varnames, args))
+ return eval(self.code, dict(zip(self.code.co_varnames, args)))
def proc(func):
return Proc(func)
View
4 tests/04block.rb
@@ -1,3 +1,3 @@
# 3
-a = proc { |x| print(x + 1) }
-a.call(2)
+a = proc { |x| x + 1 }
+puts a.call(2)

0 comments on commit 3fa5d7d

Please sign in to comment.