Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 15076011: Support union return type for anonymous named/indexed getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: updated Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index 604ac1076004b94dd463a262023cd03223fd5fd6..d7592916ff96cb5f009817848dd9d96458495447 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -28,6 +28,7 @@
#include "V8Document.h"
#include "V8Float32Array.h"
#include "V8Node.h"
+#include "V8NodeList.h"
#include "V8SVGDocument.h"
#include "V8SVGPoint.h"
#include "V8ScriptProfile.h"
@@ -4301,10 +4302,15 @@ v8::Handle<v8::Value> V8TestObject::indexedPropertyGetter(uint32_t index, const
{
ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
TestObj* collection = toNative(info.Holder());
- RefPtr<Node> element = collection->item(index);
- if (!element)
+ WTF::UnionType2<NodeList, Node> element = collection->item(index);
+ if (element.isNull())
return v8Undefined();
- return toV8Fast(element.release(), info, collection);
+ if (element.enabledValue0())
+ return toV8Fast(element.enabledValue0(), info, collection);
+ if (element.enabledValue1())
haraken 2013/05/15 12:09:43 Nit: if => else if (or else)
jsbell 2013/05/15 21:37:52 This is generated in a loop... IMHO the if/return
+ return toV8Fast(element.enabledValue1(), info, collection);
+ return v8Undefined();
jsbell 2013/05/15 21:37:52 But maybe generate a ASSERT_NOT_REACHED() before t
+
}
v8::Handle<v8::Value> V8TestObject::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)

Powered by Google App Engine
This is Rietveld 408576698