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

Unified Diff: pkg/dev_compiler/lib/src/js_ast/nodes.dart

Issue 2822633003: fix #29346, ensure all nodes are implemented by DDC's code generator (Closed)
Patch Set: fix Created 3 years, 8 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: pkg/dev_compiler/lib/src/js_ast/nodes.dart
diff --git a/pkg/dev_compiler/lib/src/js_ast/nodes.dart b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
index 3d339ff291b577fbd913f878cca378feb41ba2be..29aa1b50ffd19aa94e116c088242c78a407d0960 100644
--- a/pkg/dev_compiler/lib/src/js_ast/nodes.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
@@ -1443,23 +1443,33 @@ class TemplateString extends Expression {
*
* `foo${1 + 2} bar ${'hi'}`
*
- * would be represented by:
+ * would be represented by [strings]:
*
- * ['foo', new JS.Binary('+', js.number(1), js.number(2)),
- * ' bar ', new JS.LiteralString("'hi'")]
+ * ['foo', ' bar ', '']
+ *
+ * and [interpolations]:
+ *
+ * [new JS.Binary('+', js.number(1), js.number(2)),
+ * new JS.LiteralString("'hi'")]
+ *
+ * There should be exactly one more string than interpolation expression.
*/
- final List elements;
- TemplateString(this.elements);
+ final List<String> strings;
+ final List<Expression> interpolations;
+
+ TemplateString(this.strings, this.interpolations) {
+ assert(strings.length == interpolations.length + 1);
+ }
accept(NodeVisitor visitor) => visitor.visitTemplateString(this);
void visitChildren(NodeVisitor visitor) {
- for (var element in elements) {
- if (element is Expression) element.accept(visitor);
+ for (var element in interpolations) {
+ element.accept(visitor);
}
}
- TemplateString _clone() => new TemplateString(elements);
+ TemplateString _clone() => new TemplateString(strings, interpolations);
int get precedenceLevel => PRIMARY;
}

Powered by Google App Engine
This is Rietveld 408576698