| Index: src/d8.cc
|
| diff --git a/src/d8.cc b/src/d8.cc
|
| index 3ef0d54d209cea247cb95499e249c8a3b027b5f8..6d1e9d0be8c801ac8a3bbb017260299dd412f9d8 100644
|
| --- a/src/d8.cc
|
| +++ b/src/d8.cc
|
| @@ -123,44 +123,23 @@ class Symbols {
|
| };
|
|
|
|
|
| -LineEditor *LineEditor::first_ = NULL;
|
| +#ifndef USE_READLINE_CONSOLE
|
|
|
| +void LineEditor::Open() { }
|
|
|
| -LineEditor::LineEditor(Type type, const char* name)
|
| - : type_(type),
|
| - name_(name),
|
| - next_(first_) {
|
| - first_ = this;
|
| -}
|
| -
|
| +LineEditor::~LineEditor() { }
|
|
|
| -LineEditor* LineEditor::Get() {
|
| - LineEditor* current = first_;
|
| - LineEditor* best = current;
|
| - while (current != NULL) {
|
| - if (current->type_ > best->type_)
|
| - best = current;
|
| - current = current->next_;
|
| - }
|
| - return best;
|
| -}
|
| +const char* LineEditor::name() { return "dumb"; }
|
|
|
| +void LineEditor::AddHistory(const char* str) { }
|
|
|
| -class DumbLineEditor: public LineEditor {
|
| - public:
|
| - explicit DumbLineEditor(Isolate* isolate)
|
| - : LineEditor(LineEditor::DUMB, "dumb"), isolate_(isolate) { }
|
| - virtual Handle<String> Prompt(const char* prompt);
|
| - private:
|
| - Isolate* isolate_;
|
| -};
|
| -
|
| -
|
| -Handle<String> DumbLineEditor::Prompt(const char* prompt) {
|
| +Handle<String> LineEditor::Prompt(const char* prompt) {
|
| printf("%s", prompt);
|
| return Shell::ReadFromStdin(isolate_);
|
| }
|
|
|
| +#endif // USE_READLINE_CONSOLE
|
| +
|
|
|
| #ifndef V8_SHARED
|
| CounterMap* Shell::counter_map_;
|
| @@ -1354,8 +1333,6 @@ int CompareKeys(const void* a, const void* b) {
|
|
|
|
|
| void Shell::OnExit() {
|
| - LineEditor* line_editor = LineEditor::Get();
|
| - if (line_editor) line_editor->Close();
|
| #ifndef V8_SHARED
|
| if (i::FLAG_dump_counters) {
|
| int number_of_counters = 0;
|
| @@ -1509,12 +1486,11 @@ void Shell::RunShell(Isolate* isolate) {
|
| Context::Scope context_scope(evaluation_context_);
|
| HandleScope outer_scope;
|
| Handle<String> name = String::New("(d8)");
|
| - LineEditor* console = LineEditor::Get();
|
| - printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name());
|
| - console->Open();
|
| + LineEditor console(isolate);
|
| + printf("V8 version %s [console: %s]\n", V8::GetVersion(), console.name());
|
| while (true) {
|
| HandleScope inner_scope;
|
| - Handle<String> input = console->Prompt(Shell::kPrompt);
|
| + Handle<String> input = console.Prompt(Shell::kPrompt);
|
| if (input.IsEmpty()) break;
|
| ExecuteString(input, name, true, true);
|
| }
|
| @@ -1913,7 +1889,6 @@ int Shell::Main(int argc, char* argv[]) {
|
| if (!SetOptions(argc, argv)) return 1;
|
| int result = 0;
|
| Isolate* isolate = Isolate::GetCurrent();
|
| - DumbLineEditor dumb_line_editor(isolate);
|
| {
|
| Initialize(isolate);
|
| Symbols symbols(isolate);
|
|
|