[pypy-svn] r53317 - in pypy/branch/js-refactoring/pypy/lang/js: . test/ecma
fijal at codespeak.net
fijal at codespeak.net
Fri Apr 4 06:30:07 CEST 2008
Author: fijal
Date: Fri Apr 4 06:30:06 2008
New Revision: 53317
Modified:
pypy/branch/js-refactoring/pypy/lang/js/js_interactive.py
pypy/branch/js-refactoring/pypy/lang/js/jscode.py
pypy/branch/js-refactoring/pypy/lang/js/test/ecma/conftest.py
pypy/branch/js-refactoring/pypy/lang/js/test/ecma/shell.js
Log:
few minor fixes, print what ecma scripts do
Modified: pypy/branch/js-refactoring/pypy/lang/js/js_interactive.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/js_interactive.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/js_interactive.py Fri Apr 4 06:30:06 2008
@@ -66,7 +66,7 @@
traceback.
"""
try:
- res = self.interpreter.run(ast)
+ res = self.interpreter.run(ast, interactive=True)
if res not in (None, w_Undefined):
try:
print res.ToString(self.interpreter.w_Global)
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 06:30:06 2008
@@ -2,7 +2,7 @@
from pypy.lang.js.jsobj import W_IntNumber, W_FloatNumber, W_String,\
W_Array, W_PrimitiveObject, ActivationObject,\
create_object, W_Object, w_Undefined, newbool,\
- w_True, w_False, W_List, w_Null, W_Iterator
+ w_True, w_False, W_List, w_Null, W_Iterator, W_Root
from pypy.lang.js.execution import JsTypeError, ReturnException, ThrowException
from pypy.rlib.unroll import unrolling_iterable
from pypy.lang.js.baseop import plus, sub, compare, AbstractEC, StrictEC,\
@@ -46,9 +46,16 @@
if check_stack:
assert not stack
+#def run_bytecode_unguarded(opcodes, ctx, stack, check_stack=True, retlast=False):
+# try:
+# run_bytecode(opcodes, ctx, stack, check_stack, retlast)
+# except ThrowException:
+# print
+# raise
+
class T(list):
def append(self, element):
- assert element is not None
+ assert isinstance(element, W_Root)
super(T, self).append(element)
class JsCode(object):
@@ -111,7 +118,12 @@
def run(self, ctx, check_stack=True, retlast=False):
if self.has_labels:
self.remove_labels()
- return run_bytecode(self.opcodes, ctx, self.stack, check_stack, retlast)
+ if 1:
+ return run_bytecode(self.opcodes, ctx, self.stack, check_stack,
+ retlast)
+ else:
+ return run_bytecode_unguarded(self.opcodes, ctx, self,stack,
+ check_stack, retlast)
def remove_labels(self):
""" Basic optimization to remove all labels and change
@@ -395,9 +407,9 @@
def eval(self, ctx, stack):
try:
var = ctx.resolve_identifier(self.name)
- stack.append(var.type())
+ stack.append(W_String(var.type()))
except ThrowException:
- stack.append(w_Undefined)
+ stack.append(W_String('undefined'))
#class Typeof(UnaryOp):
# def eval(self, ctx):
Modified: pypy/branch/js-refactoring/pypy/lang/js/test/ecma/conftest.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/test/ecma/conftest.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/test/ecma/conftest.py Fri Apr 4 06:30:06 2008
@@ -66,7 +66,7 @@
raise Failed(excinfo=py.code.ExceptionInfo())
testcases = self.interp.global_context.resolve_identifier('testcases')
self.tc = self.interp.global_context.resolve_identifier('tc')
- testcount = testcases.GetValue().Get('length').GetValue().ToInt32()
+ testcount = testcases.Get('length').ToInt32()
self.testcases = testcases
return range(testcount)
@@ -80,9 +80,9 @@
def run(self):
ctx = JSTestFile.interp.global_context
- r3 = ctx.resolve_identifier('run_test').GetValue()
+ r3 = ctx.resolve_identifier('run_test')
w_test_number = W_IntNumber(self.number)
- result = r3.Call(ctx=ctx, args=[w_test_number,]).GetValue().ToString()
+ result = r3.Call(ctx=ctx, args=[w_test_number,]).ToString()
if result != "passed":
raise Failed(msg=result)
elif result == -1:
Modified: pypy/branch/js-refactoring/pypy/lang/js/test/ecma/shell.js
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/test/ecma/shell.js (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/test/ecma/shell.js Fri Apr 4 06:30:06 2008
@@ -218,7 +218,7 @@
}
function writeHeaderToLog( string ) {
- // print( string );
+ print( string );
}
/* end of print functions */
More information about the Pypy-commit
mailing list