Fix d8's interactive shell.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 May 2014 07:19:32 +0000 (07:19 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 May 2014 07:19:32 +0000 (07:19 +0000)
R=danno@chromium.org

Review URL: https://codereview.chromium.org/305553002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21510 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/d8.cc
src/d8.h

index d0ef477..73bde94 100644 (file)
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -1345,7 +1345,7 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
   {
     HandleScope scope(isolate);
     Local<Context> context = CreateEvaluationContext(isolate);
-    if (options.last_run && options.interactive_shell) {
+    if (options.last_run && options.use_interactive_shell()) {
       // Keep using the same context in the interactive shell.
       evaluation_context_.Reset(isolate, context);
 #ifndef V8_SHARED
@@ -1524,8 +1524,7 @@ int Shell::Main(int argc, char* argv[]) {
 
     // Run interactive shell if explicitly requested or if no script has been
     // executed, but never on --test
-    if (( options.interactive_shell || !options.script_executed )
-        && !options.test_shell ) {
+    if (options.use_interactive_shell()) {
 #ifndef V8_SHARED
       if (!i::FLAG_debugger) {
         InstallUtilityScript(isolate);
index 014bda0..2c7513f 100644 (file)
--- a/src/d8.h
+++ b/src/d8.h
@@ -213,6 +213,10 @@ class ShellOptions {
     delete[] isolate_sources;
   }
 
+  bool use_interactive_shell() {
+    return (interactive_shell || !script_executed) && !test_shell;
+  }
+
   bool script_executed;
   bool last_run;
   bool send_idle_notification;