Skip to content

Commit

Permalink
[api] Remove deprecated conversion functions
Browse files Browse the repository at this point in the history
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/+/1585735
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61071}
  • Loading branch information
danelphick authored and Commit Bot committed Apr 29, 2019
1 parent edffb7d commit c76f377
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
16 changes: 0 additions & 16 deletions include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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.
Expand All @@ -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;
Expand Down
41 changes: 0 additions & 41 deletions src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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>(
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit c76f377

Please sign in to comment.