Commit 5e5fadb7 authored by binji's avatar binji Committed by Commit bot

[d8] Remove deprecated calls from d8-readline

R=jochen@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#29767}
parent 1eb8fa78
...@@ -85,7 +85,8 @@ Local<String> ReadLineEditor::Prompt(const char* prompt) { ...@@ -85,7 +85,8 @@ Local<String> ReadLineEditor::Prompt(const char* prompt) {
result = readline(prompt); result = readline(prompt);
if (result == NULL) return Local<String>(); if (result == NULL) return Local<String>();
AddHistory(result); AddHistory(result);
return String::NewFromUtf8(isolate_, result); return String::NewFromUtf8(isolate_, result, NewStringType::kNormal)
.ToLocalChecked();
} }
...@@ -123,21 +124,23 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) { ...@@ -123,21 +124,23 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
HandleScope scope(isolate); HandleScope scope(isolate);
Local<Array> completions; Local<Array> completions;
if (state == 0) { if (state == 0) {
Local<String> full_text = String::NewFromUtf8(isolate, Local<String> full_text =
rl_line_buffer, String::NewFromUtf8(isolate, rl_line_buffer, NewStringType::kNormal,
String::kNormalString, rl_point)
rl_point); .ToLocalChecked();
completions = Shell::GetCompletions(isolate, completions = Shell::GetCompletions(
String::NewFromUtf8(isolate, text), isolate, String::NewFromUtf8(isolate, text, NewStringType::kNormal)
full_text); .ToLocalChecked(),
full_text);
current_completions.Reset(isolate, completions); current_completions.Reset(isolate, completions);
current_index = 0; current_index = 0;
} else { } else {
completions = Local<Array>::New(isolate, current_completions); completions = Local<Array>::New(isolate, current_completions);
} }
if (current_index < completions->Length()) { if (current_index < completions->Length()) {
Local<Context> context(isolate->GetCurrentContext());
Local<Integer> index = Integer::New(isolate, current_index); Local<Integer> index = Integer::New(isolate, current_index);
Local<Value> str_obj = completions->Get(index); Local<Value> str_obj = completions->Get(context, index).ToLocalChecked();
current_index++; current_index++;
String::Utf8Value str(str_obj); String::Utf8Value str(str_obj);
return strdup(*str); return strdup(*str);
......
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