Commit 922efe43 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Simplify line editor choice in d8.

R=rossberg@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/12330171

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13782 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 55f93b55
......@@ -123,26 +123,12 @@ class Symbols {
};
LineEditor *LineEditor::first_ = NULL;
LineEditor *LineEditor::current_ = NULL;
LineEditor::LineEditor(Type type, const char* name)
: type_(type),
name_(name),
next_(first_) {
first_ = this;
}
LineEditor* LineEditor::Get() {
LineEditor* current = first_;
LineEditor* best = current;
while (current != NULL) {
if (current->type_ > best->type_)
best = current;
current = current->next_;
}
return best;
: type_(type), name_(name) {
if (current_ == NULL || current_->type_ < type) current_ = this;
}
......
......@@ -128,12 +128,11 @@ class LineEditor {
virtual void AddHistory(const char* str) { }
const char* name() { return name_; }
static LineEditor* Get();
static LineEditor* Get() { return current_; }
private:
Type type_;
const char* name_;
LineEditor* next_;
static LineEditor* first_;
static LineEditor* current_;
};
......
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