Commit 9fe417cb authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[api] Restore the simple version of Message::GetEndColumn API.

This also undeprecates Message::GetStartColumn API.

The simple versions are easier to use for the embedders and have the
same implementation as the complex versions.

Bug: v8:7560
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I656161b04c5d9de6d1de9435b7825009f96572a5
Reviewed-on: https://chromium-review.googlesource.com/963322
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51951}
parent e77eebfe
......@@ -1645,13 +1645,14 @@ class V8_EXPORT Message {
* Returns the index within the line of the first character where
* the error occurred.
*/
V8_DEPRECATED("Use maybe version", int GetStartColumn() const);
int GetStartColumn() const;
V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const;
/**
* Returns the index within the line of the last character where
* the error occurred.
*/
int GetEndColumn() const;
V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
/**
......
......@@ -2892,34 +2892,34 @@ int Message::ErrorLevel() const {
return self->error_level();
}
Maybe<int> Message::GetStartColumn(Local<Context> context) const {
int Message::GetStartColumn() const {
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate));
auto msg = i::Handle<i::JSMessageObject>::cast(self);
return Just(msg->GetColumnNumber());
return msg->GetColumnNumber();
}
int Message::GetStartColumn() const {
auto context = ContextFromHeapObject(Utils::OpenHandle(this));
const int default_value = kNoColumnInfo;
return GetStartColumn(context).FromMaybe(default_value);
Maybe<int> Message::GetStartColumn(Local<Context> context) const {
return Just(GetStartColumn());
}
Maybe<int> Message::GetEndColumn(Local<Context> context) const {
int Message::GetEndColumn() const {
auto self = Utils::OpenHandle(this);
i::Isolate* isolate = self->GetIsolate();
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
EscapableHandleScope handle_scope(reinterpret_cast<Isolate*>(isolate));
auto msg = i::Handle<i::JSMessageObject>::cast(self);
const int column_number = msg->GetColumnNumber();
if (column_number == -1) return Just(-1);
if (column_number == -1) return -1;
const int start = self->start_position();
const int end = self->end_position();
return Just(column_number + (end - start));
return column_number + (end - start);
}
Maybe<int> Message::GetEndColumn(Local<Context> context) const {
return Just(GetEndColumn());
}
......
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