[pypy-commit] lang-js default: fixed useage of js.completion

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:34:39 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r258:6c46c4d65e29
Date: 2012-06-06 12:27 +0200
http://bitbucket.org/pypy/lang-js/changeset/6c46c4d65e29/

Log:	fixed useage of js.completion

diff --git a/js/builtins_function.py b/js/builtins_function.py
--- a/js/builtins_function.py
+++ b/js/builtins_function.py
@@ -2,6 +2,7 @@
 from js.execution import JsTypeError
 from js.jsobj import w_Undefined, _w, isnull_or_undefined
 from js.builtins import get_arg
+from js.completion import NormalCompletion
 
 def to_string(this, args):
     from js.jsobj import W_BasicFunction
@@ -25,7 +26,8 @@
     arg_list = args[1:]
 
     res = func.Call(args = arg_list, this = this_arg, calling_context = ctx)
-    return _w(res)
+    compl = NormalCompletion(value = _w(res))
+    return compl
 
 # 15.3.4.3 Function.prototype.apply (thisArg, argArray)
 def apply(ctx):
@@ -54,4 +56,5 @@
         index += 1
 
     res = func.Call(args = arg_list, this = this_arg, calling_context = ctx)
-    return _w(res)
+    compl = NormalCompletion(value = _w(res))
+    return compl
diff --git a/js/test/test_jsfunciton.py b/js/test/test_jsfunciton.py
--- a/js/test/test_jsfunciton.py
+++ b/js/test/test_jsfunciton.py
@@ -20,7 +20,7 @@
         f = JsExecutableCode(code)
         ctx = ExecutionContext()
         res = f.run(ctx)
-        assert res == _w(2)
+        assert res.value == _w(2)
 
     def test_foo2(self):
         code = JsCode()
@@ -33,7 +33,7 @@
         ctx = FunctionExecutionContext(f)
         res = f.run(ctx)
 
-        assert res == _w(2)
+        assert res.value == _w(2)
 
     def test_foo3(self):
         symbol_map = SymbolMap()
@@ -47,7 +47,7 @@
         ctx = FunctionExecutionContext(f, argv = [_w(42)], formal_parameters = ['a'])
 
         res = f.run(ctx)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo4(self):
         symbol_map = SymbolMap()
@@ -69,7 +69,7 @@
         env_rec.set_mutable_binding('a', _w(21))
 
         res = f.run(ctx)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo5(self):
         symbol_map = SymbolMap()
@@ -93,7 +93,7 @@
         res = f.run(ctx)
 
         assert env_rec.get_binding_value('a') == _w(42)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo6(self):
         symbol_map = SymbolMap()
@@ -126,7 +126,7 @@
 
         assert env_rec.get_binding_value('a') == _w(42)
         assert outer_env_rec.get_binding_value('b') == _w(21)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo7(self):
         symbol_map = SymbolMap()
@@ -159,7 +159,7 @@
 
         assert env_rec.get_binding_value('a') == _w(21)
         assert outer_env_rec.get_binding_value('b') == _w(42)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo8(self):
         symbol_map = SymbolMap()
@@ -193,7 +193,7 @@
         assert env_rec.get_binding_value('a') == _w(21)
         assert env_rec.get_binding_value('b') == _w(21)
         assert env_rec.get_binding_value('c') == _w(42)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo9(self):
         src = '''
@@ -219,7 +219,7 @@
         assert env_rec.get_binding_value('a') == _w(21)
         assert env_rec.get_binding_value('b') == _w(21)
         assert env_rec.get_binding_value('c') == _w(42)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo10(self):
         src = '''
@@ -243,7 +243,7 @@
         env_rec = lex_env.environment_record
 
         assert env_rec.get_binding_value('a') == _w(42)
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo10(self):
         src = '''
@@ -271,7 +271,7 @@
         assert env_rec.get_binding_value('a') == _w(42)
         assert env_rec.has_binding('b') is False
         assert env_rec.has_binding('c') is False
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo11(self):
         src = '''
@@ -295,7 +295,7 @@
         ctx = GlobalExecutionContext(f, w_global)
         res = f.run(ctx)
 
-        assert res == _w(55)
+        assert res.value == _w(55)
 
     def test_foo12(self):
         def f(this, args):
@@ -306,7 +306,7 @@
         ctx = FunctionExecutionContext(func, argv=[_w(41)])
         res = func.run(ctx)
 
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo13(self):
         def f(this, args):
@@ -333,7 +333,7 @@
         ctx = GlobalExecutionContext(c, w_global)
         res = c.run(ctx)
 
-        assert res == _w(42)
+        assert res.value == _w(42)
 
     def test_foo14(self):
         code = JsCode()
@@ -344,7 +344,7 @@
         f = JsExecutableCode(code)
         ctx = ExecutionContext()
         res = f.run(ctx)
-        assert res == _w(2)
+        assert res.value == _w(2)
 
     def test_foo15(self):
         src = '''
@@ -410,7 +410,7 @@
         ctx = EvalExecutionContext(f, calling_context = global_ctx)
         res = f.run(ctx)
 
-        assert res == _w(1)
+        assert res.value == _w(1)
 
     def run_src(self, src):
         ast = parse_to_ast(src)
@@ -422,4 +422,4 @@
         w_global = W_BasicObject()
         ctx = GlobalExecutionContext(c, w_global)
         res = c.run(ctx)
-        return res
+        return res.value
diff --git a/js/test/test_jsobj.py b/js/test/test_jsobj.py
--- a/js/test/test_jsobj.py
+++ b/js/test/test_jsobj.py
@@ -30,8 +30,6 @@
     def test_put(self):
         obj = W_BasicObject()
 
-        desc = PropertyDescriptor(enumerable = True, configurable = True)
-        obj.define_own_property('foo', desc)
         obj.put('foo', 1)
         assert obj.get('foo') == 1
 


More information about the pypy-commit mailing list