[pypy-svn] r36713 - pypy/dist/pypy/lang/js

santagada at codespeak.net santagada at codespeak.net
Sun Jan 14 10:25:06 CET 2007


Author: santagada
Date: Sun Jan 14 10:25:05 2007
New Revision: 36713

Modified:
   pypy/dist/pypy/lang/js/js_interactive.py
Log:
js interactive prompt updated.


Modified: pypy/dist/pypy/lang/js/js_interactive.py
==============================================================================
--- pypy/dist/pypy/lang/js/js_interactive.py	(original)
+++ pypy/dist/pypy/lang/js/js_interactive.py	Sun Jan 14 10:25:05 2007
@@ -21,7 +21,8 @@
     def __init__(self, msg):
         self.msg = msg
 
-def loadjs(ctx, filename):
+def loadjs(ctx, args, this):
+    filename = args[0]
     f = open(filename.ToString())
     t = load_source(f.read())
     f.close()
@@ -50,14 +51,18 @@
         return 2
     
     interp = Interpreter()
-    def quiter():
+    def quiter(ctx, args, this):
         sys.exit(0)
         return "this should not be printed"
     
-    interp.w_Global.Put('quit', W_Builtin(quiter))
-    interp.w_Global.Put('load', W_Builtin(loadjs, context=True, args=1))
+    quitbi = W_Builtin()
+    quitbi.set_builtin_call(quiter)
+    loadbi = W_Builtin()
+    loadbi.set_builtin_call(loadjs)
+    interp.w_Global.Put('quit', quitbi)
+    interp.w_Global.Put('load', loadbi)
     for filename in filenames:
-        loadjs(interp.global_context, W_String(filename))
+        loadjs(interp.global_context, [W_String(filename)], None)
     
     while 1:
         res = interp.run(load_source(raw_input("pypy-js> ")))



More information about the Pypy-commit mailing list