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

Unified Diff: Source/bindings/templates/methods.cpp

Issue 335113002: IDL: Support argument default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index ae5bfbd527bd6b238a2662ce2f2303b54adba2ed..0650c48664fea7f36890f858e7e8521d162a5d84 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -84,7 +84,15 @@ if (listener && !impl->toNode())
V8RethrowTryCatchScope rethrow(block);
{% endif %}
{% for argument in method.arguments %}
+ {% if argument.default_value %}
+ if (info.Length() > {{argument.index}}) {
+ {{generate_argument(method, argument, world_suffix) | indent(8)}}
+ } else {
+ {{argument.name}} = {{argument.default_value}};
+ }
+ {% else %}
{{generate_argument(method, argument, world_suffix) | indent}}
+ {% endif %}
{% endfor %}
}
{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698