Chromium Code Reviews| Index: Source/bindings/templates/union.cpp |
| diff --git a/Source/bindings/templates/union.cpp b/Source/bindings/templates/union.cpp |
| index bc478bac4b083aa66b32e331a1eef86baa82715a..677d6fc5429e9127c93b624e0a0086c728026d54 100644 |
| --- a/Source/bindings/templates/union.cpp |
| +++ b/Source/bindings/templates/union.cpp |
| @@ -7,6 +7,13 @@ |
| #include "config.h" |
| #include "{{header_filename}}" |
| +{% macro install_hasinstance_check(member) %} |
|
haraken
2014/11/04 02:20:14
"install_" sounds a bit strange. hasinstance_check
bashi
2014/11/04 02:30:32
Done.
Yuki
2014/11/04 06:35:14
We already have to_impl_with_type_check block in i
Jens Widell
2014/11/04 07:22:56
Oh, naming of things is always fun! :-)
How about
bashi
2014/11/04 08:35:05
"assign_and_return_if_hasinstnace" sounds good:) D
|
| +if (V8{{member.type_name}}::hasInstance(v8Value, isolate)) { |
| + {{member.cpp_local_type}} cppValue = V8{{member.type_name}}::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| + impl.set{{member.type_name}}(cppValue); |
| + return; |
| +} |
| +{% endmacro %} |
| {% for filename in cpp_includes %} |
| #include "{{filename}}" |
| {% endfor %} |
| @@ -56,13 +63,20 @@ void V8{{container.cpp_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Valu |
| FIXME: Implement all necessary steps #} |
| {# 3. Platform objects (interfaces) #} |
| {% for interface in container.interface_types %} |
| - if (V8{{interface.type_name}}::hasInstance(v8Value, isolate)) { |
| - {{interface.cpp_local_type}} cppValue = V8{{interface.type_name}}::toImpl(v8::Handle<v8::Object>::Cast(v8Value)); |
| - impl.set{{interface.type_name}}(cppValue); |
| - return; |
| - } |
| + {{install_hasinstance_check(interface) | indent}} |
| {% endfor %} |
| + {# 8. ArrayBuffer #} |
| + {% if container.array_buffer_type %} |
| + {{install_hasinstance_check(container.array_buffer_type) | indent}} |
| + |
| + {% endif %} |
| + {# 9., 10. ArrayBufferView #} |
| + {# FIXME: Individual typed arrays (e.g. Uint8Array) aren't supported yet. #} |
| + {% if container.array_buffer_view_type %} |
| + {{install_hasinstance_check(container.array_buffer_view_type) | indent}} |
| + |
| + {% endif %} |
| {% if container.dictionary_type %} |
| {# 12. Dictionaries #} |
| {# FIXME: This should also check "object but not Date or RegExp". Add checks |