Writing a very basic REPL.
Here's the code:
std::cout << "> ";
while (std::getline(std::cin, input)) {
const char *eval_code = ("'typeof:' + typeof []").c_str();
v8::Handle<v8::String> eval_source = v8::String::NewFromUtf8(isolate,
eval_code);
v8::Handle<v8::Script> eval_script = v8::Script::Compile(eval_source);
v8::Handle<v8::Value> eval_result = eval_script->Run();
if (!eval_result.IsEmpty()) {
v8::String::Utf8Value eval_utf8(eval_result);
std::cout << *eval_utf8 << std::endl;
}
std::cout << "> ";
}
Works only SOME of the time. Sometimes, the result for *eval_utf8 is
"typeof:object" as expected. Sometimes, all I get is "undefined" (no
"typeof:" string prefix so I know the code never really ran. Otherwise, I
would expect at least "typeof:undefined")
Is this a bug with v8 or is this a bug with my code?
Thanks.
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.