Permalink
Browse files

Globals not necessary for call() with hokey eval

  • Loading branch information...
jondistad committed Mar 28, 2012
1 parent e79bb44 commit de07be10827e300200442de588ad3133e604eea0
Showing with 2 additions and 9 deletions.
  1. +2 −9 javascripts/repl.js
View
@@ -108,18 +108,11 @@ function Fn(form, fn) {
} catch(err) { // Some native functions can't be called with #apply
console.log(err);
var dateStr = (new Date()).toJSON().replace(/\W/g, "");
- var argsContainer = "__native_function_args__"+dateStr;
- var fnContainer = "__native_function__"+dateStr;
- eval(argsContainer+" = args");
- eval(fnContainer+" = jsFn");
var strArgs = [];
- for (i in args) strArgs.push(argsContainer+"["+i+"]");
+ for (i in args) strArgs.push("args["+i+"]");
- return eval(fnContainer+"("+strArgs.join(",")+")");
- } finally {
- eval("delete "+fnContainer);
- eval("delete "+argsContainer);
+ return eval("jsFn("+strArgs.join(",")+")");
}
}

0 comments on commit de07be1

Please sign in to comment.