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

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

Issue 937773002: IDL: Support default values for dictionary members of union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/union.cpp
diff --git a/Source/bindings/templates/union.cpp b/Source/bindings/templates/union.cpp
index 6369c04ead868da3be67c05a3ac965b31f4175f2..cd9c3692ade642b49edda25d197be29a7bb62923 100644
--- a/Source/bindings/templates/union.cpp
+++ b/Source/bindings/templates/union.cpp
@@ -47,6 +47,13 @@ void {{container.cpp_class}}::set{{member.type_name}}({{member.rvalue_cpp_type}}
m_type = {{member.specific_type_enum}};
}
+{{container.cpp_class}} {{container.cpp_class}}::from{{member.type_name}}({{member.rvalue_cpp_type}} value)
+{
+ {{container.cpp_class}} container;
+ container.set{{member.type_name}}(value);
+ return container;
+}
+
{% endfor %}
{% if container.needs_trace %}
void {{container.cpp_class}}::trace(Visitor* visitor)

Powered by Google App Engine
This is Rietveld 408576698