Commit c76f377a authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[api] Remove deprecated conversion functions

Remove Isolate versions of
Value::ToNumber/ToString/ToObject/ToInteger/ToInt32 and Context versions
of ToBoolean and BooleanValue (which could never throw anyway).

Bug: v8:7279, v8:9183
Change-Id: Ib144f8894a2b37c44216ba2d0cb298e8f0c72a3e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585735Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61071}
parent edffb7d3
......@@ -2489,9 +2489,6 @@ class V8_EXPORT Value : public Data {
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
Local<Context> context) const;
V8_DEPRECATED("ToBoolean can never throw. Use Local version.",
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
Local<Context> context) const);
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
Local<Context> context) const;
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
......@@ -2507,16 +2504,6 @@ class V8_EXPORT Value : public Data {
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
Local<Boolean> ToBoolean(Isolate* isolate) const;
V8_DEPRECATED("Use maybe version",
Local<Number> ToNumber(Isolate* isolate) const);
V8_DEPRECATED("Use maybe version",
Local<String> ToString(Isolate* isolate) const);
V8_DEPRECATED("Use maybe version",
Local<Object> ToObject(Isolate* isolate) const);
V8_DEPRECATED("Use maybe version",
Local<Integer> ToInteger(Isolate* isolate) const);
V8_DEPRECATED("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const);
/**
* Attempts to convert a string to an array index.
......@@ -2527,9 +2514,6 @@ class V8_EXPORT Value : public Data {
bool BooleanValue(Isolate* isolate) const;
V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.",
V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
Local<Context> context) const);
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
Local<Context> context) const;
......
......@@ -3533,12 +3533,6 @@ MaybeLocal<String> Value::ToString(Local<Context> context) const {
RETURN_ESCAPED(result);
}
Local<String> Value::ToString(Isolate* isolate) const {
RETURN_TO_LOCAL_UNCHECKED(ToString(isolate->GetCurrentContext()), String);
}
MaybeLocal<String> Value::ToDetailString(Local<Context> context) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsString()) return ToApiHandle<String>(obj);
......@@ -3561,11 +3555,6 @@ MaybeLocal<Object> Value::ToObject(Local<Context> context) const {
RETURN_ESCAPED(result);
}
Local<v8::Object> Value::ToObject(Isolate* isolate) const {
RETURN_TO_LOCAL_UNCHECKED(ToObject(isolate->GetCurrentContext()), Object);
}
MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
if (obj->IsBigInt()) return ToApiHandle<BigInt>(obj);
......@@ -3582,11 +3571,6 @@ bool Value::BooleanValue(Isolate* v8_isolate) const {
reinterpret_cast<i::Isolate*>(v8_isolate));
}
MaybeLocal<Boolean> Value::ToBoolean(Local<Context> context) const {
return ToBoolean(context->GetIsolate());
}
Local<Boolean> Value::ToBoolean(Isolate* v8_isolate) const {
auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
return ToApiHandle<Boolean>(
......@@ -3605,12 +3589,6 @@ MaybeLocal<Number> Value::ToNumber(Local<Context> context) const {
RETURN_ESCAPED(result);
}
Local<Number> Value::ToNumber(Isolate* isolate) const {
RETURN_TO_LOCAL_UNCHECKED(ToNumber(isolate->GetCurrentContext()), Number);
}
MaybeLocal<Integer> Value::ToInteger(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return ToApiHandle<Integer>(obj);
......@@ -3622,12 +3600,6 @@ MaybeLocal<Integer> Value::ToInteger(Local<Context> context) const {
RETURN_ESCAPED(result);
}
Local<Integer> Value::ToInteger(Isolate* isolate) const {
RETURN_TO_LOCAL_UNCHECKED(ToInteger(isolate->GetCurrentContext()), Integer);
}
MaybeLocal<Int32> Value::ToInt32(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return ToApiHandle<Int32>(obj);
......@@ -3639,12 +3611,6 @@ MaybeLocal<Int32> Value::ToInt32(Local<Context> context) const {
RETURN_ESCAPED(result);
}
Local<Int32> Value::ToInt32(Isolate* isolate) const {
RETURN_TO_LOCAL_UNCHECKED(ToInt32(isolate->GetCurrentContext()), Int32);
}
MaybeLocal<Uint32> Value::ToUint32(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return ToApiHandle<Uint32>(obj);
......@@ -3904,13 +3870,6 @@ void v8::RegExp::CheckCast(v8::Value* that) {
"Could not convert to regular expression");
}
Maybe<bool> Value::BooleanValue(Local<Context> context) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
}
Maybe<double> Value::NumberValue(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(obj->Number());
......
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