Index: Source/bindings/templates/union.cpp |
diff --git a/Source/bindings/templates/union.cpp b/Source/bindings/templates/union.cpp |
index cd9c3692ade642b49edda25d197be29a7bb62923..2ccb8f612deb198a85d57dc4b7edf2041630ab7d 100644 |
--- a/Source/bindings/templates/union.cpp |
+++ b/Source/bindings/templates/union.cpp |
@@ -11,7 +11,7 @@ |
if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { |
{{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Local<v8::Object>::Cast(v8Value)); |
impl.set{{member.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{% endmacro %} |
{% for filename in cpp_includes %} |
@@ -64,10 +64,10 @@ void {{container.cpp_class}}::trace(Visitor* visitor) |
} |
{% endif %} |
-void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState) |
+bool V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{container.cpp_class}}& impl, ExceptionState& exceptionState) |
{ |
if (v8Value.IsEmpty()) |
- return; |
+ return true; |
{# The numbers in the following comments refer to the steps described in |
http://heycam.github.io/webidl/#es-union |
@@ -99,7 +99,7 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
{% endif %} |
{{container.dictionary_type.v8_value_to_local_cpp_value}}; |
impl.set{{container.dictionary_type.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{% endif %} |
@@ -111,7 +111,7 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
if (v8Value->IsArray()) { |
{{container.array_or_sequence_type.v8_value_to_local_cpp_value}}; |
impl.set{{container.array_or_sequence_type.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{% endif %} |
@@ -121,7 +121,7 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
{# 14. Boolean #} |
if (v8Value->IsBoolean()) { |
impl.setBoolean(v8Value->ToBoolean()->Value()); |
- return; |
+ return true; |
} |
{% endif %} |
@@ -130,7 +130,7 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
if (v8Value->IsNumber()) { |
{{container.numeric_type.v8_value_to_local_cpp_value}}; |
impl.set{{container.numeric_type.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{% endif %} |
@@ -142,11 +142,11 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
String string = cppValue; |
if (!({{container.string_type.enum_validation_expression}})) { |
exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); |
- return; |
+ return false; |
} |
{% endif %} |
impl.set{{container.string_type.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{# 17. Number (fallback) #} |
@@ -154,19 +154,20 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value |
{ |
{{container.numeric_type.v8_value_to_local_cpp_value}}; |
impl.set{{container.numeric_type.type_name}}(cppValue); |
- return; |
+ return true; |
} |
{# 18. Boolean (fallback) #} |
{% elif container.boolean_type %} |
{ |
- impl.setBoolean(v8Value->ToBoolean()->Value()); |
- return; |
+ impl.setBoolean(v8Value->BooleanValue()); |
+ return true; |
} |
{% else %} |
{# 19. TypeError #} |
exceptionState.throwTypeError("The provided value is not of type '{{container.type_string}}'"); |
+ return false; |
{% endif %} |
} |