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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/tree_ir_nodes.dart

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use LiteralMapEntry to ensure build order Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library tree_ir_nodes; 5 library tree_ir_nodes;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
10 import '../dart_types.dart' show DartType, GenericType; 10 import '../dart_types.dart' show DartType, GenericType;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 class LiteralList extends Expression { 217 class LiteralList extends Expression {
218 final GenericType type; 218 final GenericType type;
219 final List<Expression> values; 219 final List<Expression> values;
220 220
221 LiteralList(this.type, this.values); 221 LiteralList(this.type, this.values);
222 222
223 accept(ExpressionVisitor visitor) => visitor.visitLiteralList(this); 223 accept(ExpressionVisitor visitor) => visitor.visitLiteralList(this);
224 } 224 }
225 225
226 class LiteralMapEntry {
227 Expression key;
228 Expression value;
229
230 LiteralMapEntry(this.key, this.value);
231 }
232
226 class LiteralMap extends Expression { 233 class LiteralMap extends Expression {
227 final GenericType type; 234 final GenericType type;
228 final List<Expression> keys; 235 final List<LiteralMapEntry> entries;
229 final List<Expression> values;
230 236
231 LiteralMap(this.type, this.keys, this.values); 237 LiteralMap(this.type, this.entries);
232 238
233 accept(ExpressionVisitor visitor) => visitor.visitLiteralMap(this); 239 accept(ExpressionVisitor visitor) => visitor.visitLiteralMap(this);
234 } 240 }
235 241
236 class TypeOperator extends Expression { 242 class TypeOperator extends Expression {
237 Expression receiver; 243 Expression receiver;
238 final DartType type; 244 final DartType type;
239 final String operator; 245 final String operator;
240 246
241 TypeOperator(this.receiver, this.type, this.operator) ; 247 TypeOperator(this.receiver, this.type, this.operator) ;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 594
589 visitNot(Not node) { 595 visitNot(Not node) {
590 visitExpression(node.operand); 596 visitExpression(node.operand);
591 } 597 }
592 598
593 visitLiteralList(LiteralList node) { 599 visitLiteralList(LiteralList node) {
594 node.values.forEach(visitExpression); 600 node.values.forEach(visitExpression);
595 } 601 }
596 602
597 visitLiteralMap(LiteralMap node) { 603 visitLiteralMap(LiteralMap node) {
598 for (int i=0; i<node.keys.length; i++) { 604 node.entries.forEach((LiteralMapEntry entry) {
599 visitExpression(node.keys[i]); 605 visitExpression(entry.key);
600 visitExpression(node.values[i]); 606 visitExpression(entry.value);
601 } 607 });
602 } 608 }
603 609
604 visitTypeOperator(TypeOperator node) { 610 visitTypeOperator(TypeOperator node) {
605 visitExpression(node.receiver); 611 visitExpression(node.receiver);
606 } 612 }
607 613
608 visitFunctionExpression(FunctionExpression node) { 614 visitFunctionExpression(FunctionExpression node) {
609 visitFunctionDefinition(node.definition); 615 visitFunctionDefinition(node.definition);
610 } 616 }
611 617
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 visitFunctionDeclaration(FunctionDeclaration node) { 653 visitFunctionDeclaration(FunctionDeclaration node) {
648 visitFunctionDefinition(node.definition); 654 visitFunctionDefinition(node.definition);
649 visitStatement(node.next); 655 visitStatement(node.next);
650 } 656 }
651 657
652 visitExpressionStatement(ExpressionStatement node) { 658 visitExpressionStatement(ExpressionStatement node) {
653 visitExpression(node.expression); 659 visitExpression(node.expression);
654 visitStatement(node.next); 660 visitStatement(node.next);
655 } 661 }
656 } 662 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698