git » jacl.git » commit 85a6155

eval => new Function() to avoid lexical capture

author Alan Dipert
2020-05-13 04:45:48 UTC
committer Alan Dipert
2020-05-13 04:45:48 UTC
parent c4a8e206b3c29fecce8b3dd98f5b45a4d63104af

eval => new Function() to avoid lexical capture

jacl.js +1 -1

diff --git a/jacl.js b/jacl.js
index 3235279..8569af2 100644
--- a/jacl.js
+++ b/jacl.js
@@ -2212,7 +2212,7 @@ const startRepl = async () => {
       emitNode(sb.append.bind(sb), node);
       const code = sb.toString();
       // console.log('code="',code,'"');
-      const result = eval(code);
+      const result = (new Function(`return ${code}`))();
       console.log(result);
     }
   } catch (e) {