Prepare some ValueOf renamings.
R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/20992005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15945 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6ba502fa4d
commit
31e56df122
30
include/v8.h
30
include/v8.h
@ -2719,11 +2719,15 @@ class V8EXPORT Date : public Object {
|
||||
public:
|
||||
static Local<Value> New(double time);
|
||||
|
||||
// Deprecated, use Date::ValueOf() instead.
|
||||
// TODO(svenpanne) Actually deprecate when Chrome is adapted.
|
||||
double NumberValue() const { return ValueOf(); }
|
||||
|
||||
/**
|
||||
* A specialization of Value::NumberValue that is more efficient
|
||||
* because we know the structure of this object.
|
||||
*/
|
||||
double NumberValue() const;
|
||||
double ValueOf() const;
|
||||
|
||||
V8_INLINE(static Date* Cast(v8::Value* obj));
|
||||
|
||||
@ -2753,10 +2757,14 @@ class V8EXPORT NumberObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(double value);
|
||||
|
||||
// Deprecated, use NumberObject::ValueOf() instead.
|
||||
// TODO(svenpanne) Actually deprecate when Chrome is adapted.
|
||||
double NumberValue() const { return ValueOf(); }
|
||||
|
||||
/**
|
||||
* Returns the Number held by the object.
|
||||
*/
|
||||
double NumberValue() const;
|
||||
double ValueOf() const;
|
||||
|
||||
V8_INLINE(static NumberObject* Cast(v8::Value* obj));
|
||||
|
||||
@ -2772,10 +2780,14 @@ class V8EXPORT BooleanObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(bool value);
|
||||
|
||||
// Deprecated, use BooleanObject::ValueOf() instead.
|
||||
// TODO(svenpanne) Actually deprecate when Chrome is adapted.
|
||||
bool BooleanValue() const { return ValueOf(); }
|
||||
|
||||
/**
|
||||
* Returns the Boolean held by the object.
|
||||
*/
|
||||
bool BooleanValue() const;
|
||||
bool ValueOf() const;
|
||||
|
||||
V8_INLINE(static BooleanObject* Cast(v8::Value* obj));
|
||||
|
||||
@ -2791,10 +2803,14 @@ class V8EXPORT StringObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(Handle<String> value);
|
||||
|
||||
// Deprecated, use StringObject::ValueOf() instead.
|
||||
// TODO(svenpanne) Actually deprecate when Chrome is adapted.
|
||||
Local<String> StringValue() const { return ValueOf(); }
|
||||
|
||||
/**
|
||||
* Returns the String held by the object.
|
||||
*/
|
||||
Local<String> StringValue() const;
|
||||
Local<String> ValueOf() const;
|
||||
|
||||
V8_INLINE(static StringObject* Cast(v8::Value* obj));
|
||||
|
||||
@ -2812,10 +2828,14 @@ class V8EXPORT SymbolObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
|
||||
|
||||
// Deprecated, use SymbolObject::ValueOf() instead.
|
||||
// TODO(svenpanne) Actually deprecate when Chrome is adapted.
|
||||
Local<Symbol> SymbolValue() const { return ValueOf(); }
|
||||
|
||||
/**
|
||||
* Returns the Symbol held by the object.
|
||||
*/
|
||||
Local<Symbol> SymbolValue() const;
|
||||
Local<Symbol> ValueOf() const;
|
||||
|
||||
V8_INLINE(static SymbolObject* Cast(v8::Value* obj));
|
||||
|
||||
|
10
src/api.cc
10
src/api.cc
@ -6083,7 +6083,7 @@ Local<v8::Value> v8::NumberObject::New(double value) {
|
||||
}
|
||||
|
||||
|
||||
double v8::NumberObject::NumberValue() const {
|
||||
double v8::NumberObject::ValueOf() const {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0;
|
||||
LOG_API(isolate, "NumberObject::NumberValue");
|
||||
@ -6107,7 +6107,7 @@ Local<v8::Value> v8::BooleanObject::New(bool value) {
|
||||
}
|
||||
|
||||
|
||||
bool v8::BooleanObject::BooleanValue() const {
|
||||
bool v8::BooleanObject::ValueOf() const {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0;
|
||||
LOG_API(isolate, "BooleanObject::BooleanValue");
|
||||
@ -6128,7 +6128,7 @@ Local<v8::Value> v8::StringObject::New(Handle<String> value) {
|
||||
}
|
||||
|
||||
|
||||
Local<v8::String> v8::StringObject::StringValue() const {
|
||||
Local<v8::String> v8::StringObject::ValueOf() const {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) {
|
||||
return Local<v8::String>();
|
||||
@ -6152,7 +6152,7 @@ Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) {
|
||||
}
|
||||
|
||||
|
||||
Local<v8::Symbol> v8::SymbolObject::SymbolValue() const {
|
||||
Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()"))
|
||||
return Local<v8::Symbol>();
|
||||
@ -6181,7 +6181,7 @@ Local<v8::Value> v8::Date::New(double time) {
|
||||
}
|
||||
|
||||
|
||||
double v8::Date::NumberValue() const {
|
||||
double v8::Date::ValueOf() const {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0;
|
||||
LOG_API(isolate, "Date::NumberValue");
|
||||
|
@ -1488,13 +1488,13 @@ THREADED_TEST(StringObject) {
|
||||
CHECK(!not_object->IsStringObject());
|
||||
v8::Handle<v8::StringObject> as_boxed = boxed_string.As<v8::StringObject>();
|
||||
CHECK(!as_boxed.IsEmpty());
|
||||
Local<v8::String> the_string = as_boxed->StringValue();
|
||||
Local<v8::String> the_string = as_boxed->ValueOf();
|
||||
CHECK(!the_string.IsEmpty());
|
||||
ExpectObject("\"test\"", the_string);
|
||||
v8::Handle<v8::Value> new_boxed_string = v8::StringObject::New(the_string);
|
||||
CHECK(new_boxed_string->IsStringObject());
|
||||
as_boxed = new_boxed_string.As<v8::StringObject>();
|
||||
the_string = as_boxed->StringValue();
|
||||
the_string = as_boxed->ValueOf();
|
||||
CHECK(!the_string.IsEmpty());
|
||||
ExpectObject("\"test\"", the_string);
|
||||
}
|
||||
@ -1511,12 +1511,12 @@ THREADED_TEST(NumberObject) {
|
||||
CHECK(!boxed_not_number->IsNumberObject());
|
||||
v8::Handle<v8::NumberObject> as_boxed = boxed_number.As<v8::NumberObject>();
|
||||
CHECK(!as_boxed.IsEmpty());
|
||||
double the_number = as_boxed->NumberValue();
|
||||
double the_number = as_boxed->ValueOf();
|
||||
CHECK_EQ(42.0, the_number);
|
||||
v8::Handle<v8::Value> new_boxed_number = v8::NumberObject::New(43);
|
||||
CHECK(new_boxed_number->IsNumberObject());
|
||||
as_boxed = new_boxed_number.As<v8::NumberObject>();
|
||||
the_number = as_boxed->NumberValue();
|
||||
the_number = as_boxed->ValueOf();
|
||||
CHECK_EQ(43.0, the_number);
|
||||
}
|
||||
|
||||
@ -1533,16 +1533,16 @@ THREADED_TEST(BooleanObject) {
|
||||
v8::Handle<v8::BooleanObject> as_boxed =
|
||||
boxed_boolean.As<v8::BooleanObject>();
|
||||
CHECK(!as_boxed.IsEmpty());
|
||||
bool the_boolean = as_boxed->BooleanValue();
|
||||
bool the_boolean = as_boxed->ValueOf();
|
||||
CHECK_EQ(true, the_boolean);
|
||||
v8::Handle<v8::Value> boxed_true = v8::BooleanObject::New(true);
|
||||
v8::Handle<v8::Value> boxed_false = v8::BooleanObject::New(false);
|
||||
CHECK(boxed_true->IsBooleanObject());
|
||||
CHECK(boxed_false->IsBooleanObject());
|
||||
as_boxed = boxed_true.As<v8::BooleanObject>();
|
||||
CHECK_EQ(true, as_boxed->BooleanValue());
|
||||
CHECK_EQ(true, as_boxed->ValueOf());
|
||||
as_boxed = boxed_false.As<v8::BooleanObject>();
|
||||
CHECK_EQ(false, as_boxed->BooleanValue());
|
||||
CHECK_EQ(false, as_boxed->ValueOf());
|
||||
}
|
||||
|
||||
|
||||
@ -1567,7 +1567,9 @@ THREADED_TEST(PrimitiveAndWrappedBooleans) {
|
||||
Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>();
|
||||
CHECK(!false_boolean_object->IsBoolean());
|
||||
CHECK(false_boolean_object->IsBooleanObject());
|
||||
CHECK(!false_boolean_object->BooleanValue());
|
||||
// TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted.
|
||||
// CHECK(false_boolean_object->BooleanValue());
|
||||
CHECK(!false_boolean_object->ValueOf());
|
||||
CHECK(!false_boolean_object->IsTrue());
|
||||
CHECK(!false_boolean_object->IsFalse());
|
||||
|
||||
@ -1588,7 +1590,9 @@ THREADED_TEST(PrimitiveAndWrappedBooleans) {
|
||||
Local<BooleanObject> true_boolean_object = true_value.As<BooleanObject>();
|
||||
CHECK(!true_boolean_object->IsBoolean());
|
||||
CHECK(true_boolean_object->IsBooleanObject());
|
||||
CHECK(true_boolean_object->BooleanValue());
|
||||
// TODO(svenpanne) Uncomment when BooleanObject::BooleanValue() is deleted.
|
||||
// CHECK(true_boolean_object->BooleanValue());
|
||||
CHECK(true_boolean_object->ValueOf());
|
||||
CHECK(!true_boolean_object->IsTrue());
|
||||
CHECK(!true_boolean_object->IsFalse());
|
||||
}
|
||||
@ -2616,7 +2620,7 @@ THREADED_TEST(SymbolProperties) {
|
||||
CHECK(sym_obj->Equals(sym2));
|
||||
CHECK(!sym_obj->StrictEquals(sym2));
|
||||
CHECK(v8::SymbolObject::Cast(*sym_obj)->Equals(sym_obj));
|
||||
CHECK(v8::SymbolObject::Cast(*sym_obj)->SymbolValue()->Equals(sym2));
|
||||
CHECK(v8::SymbolObject::Cast(*sym_obj)->ValueOf()->Equals(sym2));
|
||||
|
||||
// Make sure delete of a non-existent symbol property works.
|
||||
CHECK(obj->Delete(sym1));
|
||||
@ -13224,7 +13228,7 @@ THREADED_TEST(DateAccess) {
|
||||
v8::HandleScope scope(context->GetIsolate());
|
||||
v8::Handle<v8::Value> date = v8::Date::New(1224744689038.0);
|
||||
CHECK(date->IsDate());
|
||||
CHECK_EQ(1224744689038.0, date.As<v8::Date>()->NumberValue());
|
||||
CHECK_EQ(1224744689038.0, date.As<v8::Date>()->ValueOf());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user