From 9aa1dac802112e8fc3c805286c314335edef1bdf Mon Sep 17 00:00:00 2001 From: adamk Date: Wed, 15 Jul 2015 13:17:51 -0700 Subject: [PATCH] [api] Deprecate unused Map/Set FromArray factory methods These were added when I thought they would be useful in Blink, but as it turned out they were not. They could likely be deleted immediately, but to play it safe I'll go through the usual deprecation process. Review URL: https://codereview.chromium.org/1236263004 Cr-Commit-Position: refs/heads/master@{#29690} --- include/v8.h | 10 ++++++---- test/cctest/test-api.cc | 12 ------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/include/v8.h b/include/v8.h index 222dd2a..9bcb7ef 100644 --- a/include/v8.h +++ b/include/v8.h @@ -3015,8 +3015,9 @@ class V8_EXPORT Map : public Object { * in the same manner as the array returned from AsArray(). * Guaranteed to be side-effect free if the array contains no holes. */ - static V8_WARN_UNUSED_RESULT MaybeLocal FromArray(Local context, - Local array); + static V8_WARN_UNUSED_RESULT V8_DEPRECATED( + "Use mutation methods instead", + MaybeLocal FromArray(Local context, Local array)); V8_INLINE static Map* Cast(Value* obj); @@ -3054,8 +3055,9 @@ class V8_EXPORT Set : public Object { * Creates a new Set containing the items in array. * Guaranteed to be side-effect free if the array contains no holes. */ - static V8_WARN_UNUSED_RESULT MaybeLocal FromArray(Local context, - Local array); + static V8_WARN_UNUSED_RESULT V8_DEPRECATED( + "Use mutation methods instead", + MaybeLocal FromArray(Local context, Local array)); V8_INLINE static Set* Cast(Value* obj); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 9337ef4..4f38198 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -21735,7 +21735,6 @@ TEST(Map) { CHECK_EQ(3, contents->Get(2).As()->Value()); CHECK_EQ(4, contents->Get(3).As()->Value()); - map = v8::Map::FromArray(env.local(), contents).ToLocalChecked(); CHECK_EQ(2U, map->Size()); CHECK(map->Has(env.local(), v8::Integer::New(isolate, 1)).FromJust()); @@ -21769,16 +21768,6 @@ TEST(Map) { } -TEST(MapFromArrayOddLength) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handle_scope(isolate); - LocalContext env; - // Odd lengths result in a null MaybeLocal. - Local contents = v8::Array::New(isolate, 41); - CHECK(v8::Map::FromArray(env.local(), contents).IsEmpty()); -} - - TEST(Set) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope handle_scope(isolate); @@ -21800,7 +21789,6 @@ TEST(Set) { CHECK_EQ(1, keys->Get(0).As()->Value()); CHECK_EQ(2, keys->Get(1).As()->Value()); - set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); CHECK_EQ(2U, set->Size()); CHECK(set->Has(env.local(), v8::Integer::New(isolate, 1)).FromJust()); -- 2.7.4