Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Syntax error calling eval() on anonymous functions #4

Closed
kmosher opened this Issue Jun 7, 2011 · 1 comment

Comments

Projects
None yet
2 participants

kmosher commented Jun 7, 2011

The version of spidermonkey I have (custom compile of 1.8.1) is unhappy with the eval function used to parse the jsawk script.

line 933:

window.makeFilter = function(fun) {
  try {
    return eval("function() { "+fun+"; return this }");
  } catch (e) {
    err("jsawk: script parse error: '"+fun+"'");
    quit(3); 
  }
}; 

Wrapping the anonymous function creation in parentheses works for me.
return eval("(function() { "+fun+"; return this })");

Owner

micha commented Jun 17, 2011

Cool, thanks, I'll apply your patch ;)

@micha micha closed this Jul 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment