Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: src/d8-readline.cc

Issue 17162002: Version 3.19.17. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cpu-profiler.h ('k') | src/data-flow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8-readline.cc
diff --git a/src/d8-readline.cc b/src/d8-readline.cc
index 298518d72ab4ab31ebab2ee90ba208d23ea8b231..5226364c649d80db3c5d2b8120f472af5932fbf7 100644
--- a/src/d8-readline.cc
+++ b/src/d8-readline.cc
@@ -150,19 +150,18 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
static Persistent<Array> current_completions;
Isolate* isolate = read_line_editor.isolate_;
Locker lock(isolate);
- HandleScope scope;
- Handle<Array> completions;
if (state == 0) {
+ HandleScope scope;
Local<String> full_text = String::New(rl_line_buffer, rl_point);
- completions = Shell::GetCompletions(isolate, String::New(text), full_text);
- current_completions.Reset(isolate, completions);
+ Handle<Array> completions =
+ Shell::GetCompletions(isolate, String::New(text), full_text);
+ current_completions = Persistent<Array>::New(isolate, completions);
current_index = 0;
- } else {
- completions = Local<Array>::New(isolate, current_completions);
}
- if (current_index < completions->Length()) {
+ if (current_index < current_completions->Length()) {
+ HandleScope scope;
Handle<Integer> index = Integer::New(current_index);
- Handle<Value> str_obj = completions->Get(index);
+ Handle<Value> str_obj = current_completions->Get(index);
current_index++;
String::Utf8Value str(str_obj);
return strdup(*str);
« no previous file with comments | « src/cpu-profiler.h ('k') | src/data-flow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698