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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl

Issue 2879563002: Refactor code generation to allow us to diff generic expressions and not just fields (Closed)
Patch Set: Created 3 years, 7 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: third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
index f029a40e5c487708e30fb14dce93c5d416ef31a6..d47fcb20b7237d52e483445b0ea2b38ac00c0b1c 100644
--- a/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
@@ -87,16 +87,16 @@ unsigned {{field.name}} : {{field.size}}; // {{field.type_name}}
{% endfor %}
{% endmacro %}
-{% macro fieldwise_diff(group, fields_to_diff) %}
-{% for subgroup in group.subgroups %}
-{% if subgroup.all_fields|select("in", fields_to_diff)|list|length > 0 -%}
-if ({{subgroup.member_name}}.Get() != other.{{subgroup.member_name}}.Get()) {
-{{fieldwise_diff(subgroup, fields_to_diff)|indent(2, true)}}
-}
-{% endif -%}
+{% macro fieldwise_diff(groups_to_diff) %}
shend 2017/05/11 05:00:59 Would this be easier if you took in a single group
nainar 2017/05/11 06:00:08 Done.
+{% for group in groups_to_diff %}
+if ({{group.group_name}}.Get() != other.{{group.group_name}}.Get()) {
+{% if group.subgroups %}
+{{fieldwise_diff(group.subgroups)|indent(2, true)}}
+{% endif %}
+{% for expression in group.expressions %}
+ if ({{expression}} != other.{{expression}})
+ return true;
{% endfor %}
-{% for field in group.fields|select("in", fields_to_diff) %}
-if ({{getter_expression(field)}} != other.{{getter_expression(field)}})
- return true;
+}
{% endfor %}
{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698