[pypy-svn] r53309 - pypy/branch/js-refactoring/pypy/lang/js

fijal at codespeak.net fijal at codespeak.net
Fri Apr 4 04:24:37 CEST 2008


Author: fijal
Date: Fri Apr  4 04:24:35 2008
New Revision: 53309

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/astbuilder.py
   pypy/branch/js-refactoring/pypy/lang/js/jscode.py
   pypy/branch/js-refactoring/pypy/lang/js/operations.py
Log:
another passing test


Modified: pypy/branch/js-refactoring/pypy/lang/js/astbuilder.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/astbuilder.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/astbuilder.py	Fri Apr  4 04:24:35 2008
@@ -345,7 +345,6 @@
         if len(node.children) == 1:
             return self.dispatch(node.children[0])
         else:
-            raise NotImplementedError
             pos = self.get_pos(node)
             val = self.dispatch(node.children[1])
             return operations.New(pos, val)

Modified: pypy/branch/js-refactoring/pypy/lang/js/jscode.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jscode.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jscode.py	Fri Apr  4 04:24:35 2008
@@ -766,6 +766,11 @@
         args = y.get_args()
         stack.append(commonnew(ctx, x, args))
 
+class NEW_NO_ARGS(Opcode):
+    def eval(self, ctx, stack):
+        x = stack.pop()
+        stack.append(commonnew(ctx, x, []))
+
 # ------------ iterator support ----------------
 
 class LOAD_ITERATOR(Opcode):

Modified: pypy/branch/js-refactoring/pypy/lang/js/operations.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/operations.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/operations.py	Fri Apr  4 04:24:35 2008
@@ -526,10 +526,14 @@
 #
 ##############################################################################
 
-#class New(UnaryOp):
-#    def eval(self, ctx):
-#        x = self.expr.eval(ctx).GetValue()
-#        return commonnew(ctx, x, [])
+class New(Expression):
+    def __init__(self, pos, left):
+        self.pos = pos
+        self.left = left
+
+    def emit(self, bytecode):
+        self.left.emit(bytecode)
+        bytecode.emit('NEW_NO_ARGS')
     
 class NewWithArgs(Expression):
     def __init__(self, pos, left, right):



More information about the Pypy-commit mailing list