Avoid creating shell name every time in shell sample.

R=mnaganov@chromium.org
Signed-off-by: 's avatarThiago Farina <tfarina@chromium.org>

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9121 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5105a20d
...@@ -250,16 +250,14 @@ void RunShell(v8::Handle<v8::Context> context) { ...@@ -250,16 +250,14 @@ void RunShell(v8::Handle<v8::Context> context) {
static const int kBufferSize = 256; static const int kBufferSize = 256;
// Enter the execution environment before evaluating any code. // Enter the execution environment before evaluating any code.
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
v8::Local<v8::String> name(v8::String::New("(shell)"));
while (true) { while (true) {
char buffer[kBufferSize]; char buffer[kBufferSize];
printf("> "); printf("> ");
char* str = fgets(buffer, kBufferSize, stdin); char* str = fgets(buffer, kBufferSize, stdin);
if (str == NULL) break; if (str == NULL) break;
v8::HandleScope handle_scope; v8::HandleScope handle_scope;
ExecuteString(v8::String::New(str), ExecuteString(v8::String::New(str), name, true, true);
v8::String::New("(shell)"),
true,
true);
} }
printf("\n"); printf("\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment