Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-line exec #21

Closed
wants to merge 2 commits into from
Closed

multi-line exec #21

wants to merge 2 commits into from

Conversation

duralog
Copy link

@duralog duralog commented Jun 15, 2014

this fixes #12

I tried putting it on my gh-pages so you could try it out first there, but I accidentally made the PR from my gh-pages branch. either way, it works.


var lala = 1234;
alert('lalaa');
return "lala"+lala;
> TypeError: alert is not a function
var lala = 1234;
return "lala"+lala;
> lala1234
var lala = 1234;
"lala"+lala;
> undefined

@natevw
Copy link
Owner

natevw commented Feb 4, 2015

Sorry, I really want to go down the route of trying to parse JS code. For that there are more robust alternatives that do this using what amounts to full-fledged JS compilers.

evel is intended to remain an "as tiny as possible" implementation. Things like #12 may just remain known caveats.

I would entertain doing something like this if it were a minimal change [this patch includes a lot of unrelated stuff] and I could be convinced that it would never cause the sandbox code to be corrupted (For example, do your regexes handle parentheses that occur in strings/comments/etc.?). I'd rather have a hard parse error from the browser's JS engine, than edge cases where some incorrectly-changed source code might still "successfully" execute and return a bogus result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot evel multiple lines of code
3 participants