> v8::Script::Compile(v8::String::New("eval('1 + 1\n')"));

Try instead:

v8::Script::Compile(v8::String::New("eval('1 + 1\\n')"));

Note that you need to escape \ on the C level otherwise you pass:

eval('1 + 1
')

to the v8::Script::Compile which is obviously incorrect.

--
Vyacheslav Egorov



On Thu, May 26, 2011 at 6:09 PM, mcot <[email protected]> wrote:
> In the chrome dev shell this compiles and runs fine:
>
> "eval('1 + 1\n')"
>
> chrome = v8 version 3.1.8.14
>
> Testing on v8 release 7918 (3.7.7???) I get:
>
> ...
> v8::Handle<v8::Script> script =
> v8::Script::Compile(v8::String::New("eval('1 + 1\n')"));
> v8::Handle<v8::Value> result = script->Run();
> ...
>
> <unknown>:5: Uncaught SyntaxError: Unexpected token ILLEGAL
>
> So is this a regression, or is it more compliant with ES5 now?  What
> is the best way to go back to the old behavior?
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to