Skip to content

Commit

Permalink
[js] Fix evalling JavaScript in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Oct 15, 2018
1 parent fbd00db commit a011f98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vm/js/nqp-runtime/core.js
Expand Up @@ -847,7 +847,10 @@ class JavaScriptCompiler extends NQPObject {
}

compile(ctx, _NAMED, self, code) {
const compiled = vm.compileFunction(this.$$fixupRun(code));
const codeStr = this.$$fixupRun(nqp.arg_s(ctx, code));
const compiled = process.browser
? eval('(function() {' + codeStr + '})')
: vm.compileFunction(codeStr);

const codeRef = new CodeRef();
codeRef.$$call = function(ctx, _NAMED) {
Expand Down

0 comments on commit a011f98

Please sign in to comment.