js-eval uses globalEval
authorDavid Vázquez <davazp@gmail.com>
Fri, 26 Apr 2013 10:32:21 +0000 (11:32 +0100)
committerDavid Vázquez <davazp@gmail.com>
Fri, 26 Apr 2013 10:32:21 +0000 (11:32 +0100)
src/compiler.lisp
src/prelude.js

index 961d3a0..27cc37b 100644 (file)
   (type-check (("string" "string" string))
     (if *multiple-value-p*
         (js!selfcall
-          "var v = eval.apply(window, [string]);" *newline*
+          "var v = globalEval(string);" *newline*
           "if (typeof v !== 'object' || !('multiple-value' in v)){" *newline*
           (indent "v = [v];" *newline*
                   "v['multiple-value'] = true;" *newline*)
           "}" *newline*
           "return values.apply(this, v);" *newline*)
-        "eval.apply(window, [string])")))
+        "globalEval(string)")))
 
 (define-builtin error (string)
   (js!selfcall "throw " string ";" *newline*))
index 9a8d363..277a9d9 100644 (file)
@@ -4,9 +4,7 @@
 var window = this;
 var nil;
 
-function globalEval (x) {
-    return eval.call (window, x);
-}
+globalEval = eval;  // Just an indirect eval
 
 function pv (x) { return x==undefined? nil: x; }