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

Side by Side Diff: Source/bindings/templates/methods.cpp

Issue 713683003: IDL: Support optional union type arguments with default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add unit tests Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 {% endmacro %} 57 {% endmacro %}
58 58
59 59
60 {######################################} 60 {######################################}
61 {% macro generate_arguments(method, world_suffix) %} 61 {% macro generate_arguments(method, world_suffix) %}
62 {% for argument in method.arguments %} 62 {% for argument in method.arguments %}
63 {{generate_argument_var_declaration(argument)}}; 63 {{generate_argument_var_declaration(argument)}};
64 {% endfor %} 64 {% endfor %}
65 { 65 {
66 {% for argument in method.arguments %} 66 {% for argument in method.arguments %}
67 {% if argument.default_value %} 67 {% if argument.set_default_value %}
68 if (!info[{{argument.index}}]->IsUndefined()) { 68 if (!info[{{argument.index}}]->IsUndefined()) {
69 {{generate_argument(method, argument, world_suffix) | indent(8)}} 69 {{generate_argument(method, argument, world_suffix) | indent(8)}}
70 } else { 70 } else {
71 {{argument.name}} = {{argument.default_value}}; 71 {{argument.set_default_value}};
72 } 72 }
73 {% else %} 73 {% else %}
74 {{generate_argument(method, argument, world_suffix) | indent}} 74 {{generate_argument(method, argument, world_suffix) | indent}}
75 {% endif %} 75 {% endif %}
76 {% endfor %} 76 {% endfor %}
77 } 77 }
78 {% endmacro %} 78 {% endmacro %}
79 79
80 80
81 {######################################} 81 {######################################}
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 {% for method in conditionally_enabled_methods %} 629 {% for method in conditionally_enabled_methods %}
630 {% filter per_context_enabled(method.per_context_enabled_function) %} 630 {% filter per_context_enabled(method.per_context_enabled_function) %}
631 {% filter exposed(method.exposed_test) %} 631 {% filter exposed(method.exposed_test) %}
632 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction()); 632 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction());
633 {% endfilter %} 633 {% endfilter %}
634 {% endfilter %} 634 {% endfilter %}
635 {% endfor %} 635 {% endfor %}
636 {% endif %} 636 {% endif %}
637 } 637 }
638 {%- endmacro %} 638 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698