Reviewers: danno,

Description:
Fix d8's interactive shell.

[email protected]

Please review this at https://codereview.chromium.org/305553002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -3 lines):
  M src/d8.h
  M src/d8.cc


Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index b04fa71bdf5e7025851b6af6dcda38eb6ed6d22c..8bd5bb72fe063717d3355faf579c19637a34b70f 100644
--- 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: src/d8.h
diff --git a/src/d8.h b/src/d8.h
index 014bda05c62f23f42e0055821009dde1b6b53036..2c7513f553dff17a1935a9ee2b736c54467853e2 100644
--- 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;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" 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.

Reply via email to