Index: Source/bindings/tests/results/core/UnionTypesCore.cpp |
diff --git a/Source/bindings/tests/results/core/UnionTypesCore.cpp b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
index e8d6495039498fadcc08664c8c057b62b72af7c1..3fd6ee5ceb00083b08a6ab830325e6614aa2bed9 100644 |
--- a/Source/bindings/tests/results/core/UnionTypesCore.cpp |
+++ b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
@@ -373,6 +373,116 @@ DoubleOrString NativeValueTraits<DoubleOrString>::nativeValue(v8::Isolate* isola |
return impl; |
} |
+LongOrTestDictionary::LongOrTestDictionary() |
+ : m_type(SpecificTypeNone) |
+{ |
+} |
+ |
+int LongOrTestDictionary::getAsLong() const |
+{ |
+ ASSERT(isLong()); |
+ return m_long; |
+} |
+ |
+void LongOrTestDictionary::setLong(int value) |
+{ |
+ ASSERT(isNull()); |
+ m_long = value; |
+ m_type = SpecificTypeLong; |
+} |
+ |
+LongOrTestDictionary LongOrTestDictionary::fromLong(int value) |
+{ |
+ LongOrTestDictionary container; |
+ container.setLong(value); |
+ return container; |
+} |
+ |
+TestDictionary LongOrTestDictionary::getAsTestDictionary() const |
+{ |
+ ASSERT(isTestDictionary()); |
+ return m_testDictionary; |
+} |
+ |
+void LongOrTestDictionary::setTestDictionary(TestDictionary value) |
+{ |
+ ASSERT(isNull()); |
+ m_testDictionary = value; |
+ m_type = SpecificTypeTestDictionary; |
+} |
+ |
+LongOrTestDictionary LongOrTestDictionary::fromTestDictionary(TestDictionary value) |
+{ |
+ LongOrTestDictionary container; |
+ container.setTestDictionary(value); |
+ return container; |
+} |
+ |
+#if COMPILER(MSVC) && defined(COMPONENT_BUILD) && LINK_CORE_MODULES_SEPARATELY |
+LongOrTestDictionary::LongOrTestDictionary(const LongOrTestDictionary&) = default; |
+LongOrTestDictionary::~LongOrTestDictionary() = default; |
+LongOrTestDictionary& LongOrTestDictionary::operator=(const LongOrTestDictionary&) = default; |
+#endif |
+ |
+DEFINE_TRACE(LongOrTestDictionary) |
+{ |
+ visitor->trace(m_testDictionary); |
+} |
+ |
+void V8LongOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, LongOrTestDictionary& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty()) |
+ return; |
+ |
+ if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
+ TestDictionary cppValue; |
+ V8TestDictionary::toImpl(isolate, v8Value, cppValue, exceptionState); |
+ if (exceptionState.hadException()) |
+ return; |
+ impl.setTestDictionary(cppValue); |
+ return; |
+ } |
+ |
+ if (v8Value->IsNumber()) { |
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState); |
+ if (exceptionState.hadException()) |
+ return; |
+ impl.setLong(cppValue); |
+ return; |
+ } |
+ |
+ { |
+ int cppValue = toInt32(isolate, v8Value, NormalConversion, exceptionState); |
+ if (exceptionState.hadException()) |
+ return; |
+ impl.setLong(cppValue); |
+ return; |
+ } |
+ |
+} |
+ |
+v8::Local<v8::Value> toV8(const LongOrTestDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ switch (impl.m_type) { |
+ case LongOrTestDictionary::SpecificTypeNone: |
+ return v8::Null(isolate); |
+ case LongOrTestDictionary::SpecificTypeLong: |
+ return v8::Integer::New(isolate, impl.getAsLong()); |
+ case LongOrTestDictionary::SpecificTypeTestDictionary: |
+ return toV8(impl.getAsTestDictionary(), creationContext, isolate); |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ return v8::Local<v8::Value>(); |
+} |
+ |
+LongOrTestDictionary NativeValueTraits<LongOrTestDictionary>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) |
+{ |
+ LongOrTestDictionary impl; |
+ V8LongOrTestDictionary::toImpl(isolate, value, impl, exceptionState); |
+ return impl; |
+} |
+ |
NodeOrNodeList::NodeOrNodeList() |
: m_type(SpecificTypeNone) |
{ |