[pypy-commit] lang-js default: 15.1.2.4

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


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r231:17bae57e1698
Date: 2012-05-24 18:46 +0200
http://bitbucket.org/pypy/lang-js/changeset/17bae57e1698/

Log:	15.1.2.4

diff --git a/js/astbuilder.py b/js/astbuilder.py
--- a/js/astbuilder.py
+++ b/js/astbuilder.py
@@ -289,10 +289,14 @@
     visit_objectliteral = listop
 
     def visit_block(self, node):
+        def isnotempty(node):
+            return node is not None and not isinstance(node, operations.Empty)
+
         op = node.children[0]
         pos = self.get_pos(op)
         l = [self.dispatch(child) for child in node.children[1:]]
-        return operations.Block(pos, l)
+        nodes = [node for node in l if isnotempty(node)]
+        return operations.Block(pos, nodes)
 
     def visit_arguments(self, node):
         pos = self.get_pos(node)
diff --git a/js/operations.py b/js/operations.py
--- a/js/operations.py
+++ b/js/operations.py
@@ -235,6 +235,8 @@
         if len(self.nodes) > 0:
             node = self.nodes[-1]
             node.emit(bytecode)
+        else:
+            bytecode.emit('LOAD_UNDEFINED')
 
 BitwiseAnd = create_binary_op('BITAND')
 BitwiseXor = create_binary_op('BITXOR')


More information about the pypy-commit mailing list