Chromium Code Reviews| Index: Source/bindings/templates/union.h |
| diff --git a/Source/bindings/templates/union.h b/Source/bindings/templates/union.h |
| index 62dd42703a9c344143a57ae8b1a94adfa4bb3793..78c810af077e31349d42fea52f0d4baf2db82250 100644 |
| --- a/Source/bindings/templates/union.h |
| +++ b/Source/bindings/templates/union.h |
| @@ -64,6 +64,21 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c |
| } |
| {% endfor %} |
| + |
| +{% for cpp_type in nullable_cpp_types %} |
| +class V8{{cpp_type}}OrNull final { |
|
bashi
2014/11/07 10:07:53
Maybe "IncludesNull" is accurate, but I'm not sure
Jens Widell
2014/11/07 10:58:19
"AOrBCommaOrNull" (for "A or B, or null")? ;-)
If
haraken
2014/11/07 18:06:31
I'm OK with AOrBOrNull :)
bashi
2014/11/08 07:10:34
Let's use "OrNull" suffix :)
|
| +public: |
| + static void toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {{cpp_type}}& impl, ExceptionState& exceptionState) |
| + { |
| + {# http://heycam.github.io/webidl/#es-union #} |
| + {# 1. null or undefined #} |
|
haraken
2014/11/07 18:06:31
Can we add unit tests for the following cases?
//
bashi
2014/11/08 07:10:34
Yes, that's what I'm going to add in a follow-up C
|
| + if (isUndefinedOrNull(v8Value)) |
| + return; |
| + V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState); |
| + } |
| +}; |
| + |
| +{% endfor %} |
| } // namespace blink |
| #endif // {{macro_guard}} |