Author: Stephan <[email protected]>
Branch: 
Changeset: r245:5f9527a84e4a
Date: 2012-06-03 15:22 +0200
http://bitbucket.org/pypy/lang-js/changeset/5f9527a84e4a/

Log:    added debug() statement

diff --git a/js/functions.py b/js/functions.py
--- a/js/functions.py
+++ b/js/functions.py
@@ -95,6 +95,9 @@
             from js.jsobj import w_Undefined
             return w_Undefined
 
+        if DEBUG:
+            print('start running %s' % (str(self)))
+
         pc = 0
         while True:
             if pc >= len(self.opcodes):
diff --git a/js/interpreter.py b/js/interpreter.py
--- a/js/interpreter.py
+++ b/js/interpreter.py
@@ -37,6 +37,12 @@
 
         put_native_function(global_object, 'load', js_load)
 
+        def js_debug(this, args):
+            import js.globals
+            js.globals.DEBUG = not js.globals.DEBUG
+            return js.globals.DEBUG
+
+        put_native_function(global_object, 'debug', js_debug)
 
     def js_load(self, filename):
         ast = load_file(filename)
diff --git a/js/js_interactive.py b/js/js_interactive.py
--- a/js/js_interactive.py
+++ b/js/js_interactive.py
@@ -32,16 +32,6 @@
 except ImportError:
     pass
 
-def debugjs(this, args):
-    from js.globals import DEBUG
-    DEBUG = not DEBUG
-    return W_Boolean(DEBUG)
-
-def tracejs(this, args):
-    arguments = args
-    import pdb
-    pdb.set_trace()
-    return w_Undefined
 
 def quitjs(this, args):
     sys.exit(0)
@@ -53,8 +43,6 @@
         #ctx = self.interpreter.global_context
         #from builtins import new_native_function
         #self.interpreter.w_Global.Put('quit', new_native_function(ctx, 
quitjs))
-        #self.interpreter.w_Global.Put('trace', new_native_function(ctx, 
tracejs))
-        #self.interpreter.w_Global.Put('debug', new_native_function(ctx, 
debugjs))
 
     def runcodefromfile(self, filename):
         f = open_file_as_stream(filename)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to