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

Unified Diff: lib/src/info.dart

Issue 13592003: add support for template repeat (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 9 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: lib/src/info.dart
diff --git a/lib/src/info.dart b/lib/src/info.dart
index c01bbcfe2de52d5e4b98f1c1807a2d5eeb78575e..60629f4a4ccadd78cf6bf032516a099e91566a46 100644
--- a/lib/src/info.dart
+++ b/lib/src/info.dart
@@ -374,10 +374,10 @@ class ElementInfo extends NodeInfo<Element> {
final Set<String> removeAttributes = new Set<String>();
/** Whether the template element has `iterate="... in ...". */
- bool get hasIterate => false;
+ bool get hasLoop => false;
/** Whether the template element has an `if="..."` conditional. */
- bool get hasIfCondition => false;
+ bool get hasCondition => false;
bool get isTemplateElement => false;
@@ -397,8 +397,8 @@ class ElementInfo extends NodeInfo<Element> {
'childrenCreatedInCode: $childrenCreatedInCode, '
'component: $component, '
'descendantHasBinding: $descendantHasBinding, '
- 'hasIterate: $hasIterate, '
- 'hasIfCondition: $hasIfCondition, '
+ 'hasLoop: $hasLoop, '
+ 'hasCondition: $hasCondition, '
'attributes: $attributes, '
'events: $events>';
}
@@ -546,10 +546,18 @@ class TemplateInfo extends ElementInfo {
*/
final String loopItems;
+ /**
+ * True if this is a repeat. Otherwise, it is an iterate.
Siggi Cherem (dart-lang) 2013/04/05 20:09:24 maybe clarify that this is only if 'hasLoop' is tr
Jennifer Messerly 2013/04/05 20:34:36 thanks, clarified.
+ *
+ * For template elements, the two are equivalent, but for template attributes
+ * repeat is more expressive.
+ */
+ final bool isRepeat;
+
TemplateInfo(Node node, ElementInfo parent,
- {this.ifCondition, this.loopVariable, this.loopItems})
+ {this.ifCondition, this.loopVariable, this.loopItems, this.isRepeat})
: super(node, parent) {
- childrenCreatedInCode = hasIfCondition || hasIterate;
+ childrenCreatedInCode = hasCondition || hasLoop;
}
/**
@@ -558,9 +566,9 @@ class TemplateInfo extends ElementInfo {
*/
bool get isTemplateElement => node.tagName == 'template';
- bool get hasIfCondition => ifCondition != null;
+ bool get hasCondition => ifCondition != null;
- bool get hasIterate => loopVariable != null;
+ bool get hasLoop => loopVariable != null;
String toString() => '#<TemplateInfo ${super.toString()}'
'ifCondition: $ifCondition, '

Powered by Google App Engine
This is Rietveld 408576698