Reviewers: Sven Panne,

Description:
invert Eternal::IsEmpty logic

[email protected]
BUG=

Please review this at https://codereview.chromium.org/23914004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M include/v8.h
  M test/cctest/test-global-handles.cc


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 53e5929bd43646e1abb9344a11945a5ecbe89e0e..ba4d19b01d45bba7981f4849eafcd81acc49ad37 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -458,7 +458,7 @@ template <class T> class Eternal {
   }
   // Can only be safely called if already set.
   V8_INLINE(Local<T> Get(Isolate* isolate));
-  V8_INLINE(bool IsEmpty()) { return index_ != kInitialValue; }
+  V8_INLINE(bool IsEmpty()) { return index_ == kInitialValue; }
   template<class S>
   V8_INLINE(void Set(Isolate* isolate, Local<S> handle));

Index: test/cctest/test-global-handles.cc
diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc index d3fc25c7d718e61542f5412fec1bc7015673607b..1d33a8c86b7c9581949a33df1698b8d6f652d339 100644
--- a/test/cctest/test-global-handles.cc
+++ b/test/cctest/test-global-handles.cc
@@ -338,9 +338,9 @@ TEST(EternalHandles) {
     eternal_handles->Create(
         isolate, *v8::Utils::OpenHandle(*object), &indices[i]);
     // Create with external api
-    CHECK(!eternals[i].IsEmpty());
-    eternals[i].Set(v8_isolate, object);
     CHECK(eternals[i].IsEmpty());
+    eternals[i].Set(v8_isolate, object);
+    CHECK(!eternals[i].IsEmpty());
   }

   isolate->heap()->CollectAllAvailableGarbage();
@@ -370,7 +370,7 @@ TEST(EternalHandles) {
     HandleScope scope(isolate);
     v8::Local<v8::Object> object = v8::Object::New();
     v8::Eternal<v8::Object> eternal(v8_isolate, object);
-    CHECK(eternal.IsEmpty());
+    CHECK(!eternal.IsEmpty());
     CHECK(object == eternal.Get(v8_isolate));
   }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to