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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/logical_rewriter.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 logical_rewriter; 5 library logical_rewriter;
6 6
7 import '../constants/values.dart' as values; 7 import '../constants/values.dart' as values;
8 import 'tree_ir_nodes.dart'; 8 import 'tree_ir_nodes.dart';
9 9
10 /// Rewrites logical expressions to be more compact in the Tree IR. 10 /// Rewrites logical expressions to be more compact in the Tree IR.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 _rewriteList(node.arguments); 190 _rewriteList(node.arguments);
191 return node; 191 return node;
192 } 192 }
193 193
194 Expression visitLiteralList(LiteralList node) { 194 Expression visitLiteralList(LiteralList node) {
195 _rewriteList(node.values); 195 _rewriteList(node.values);
196 return node; 196 return node;
197 } 197 }
198 198
199 Expression visitLiteralMap(LiteralMap node) { 199 Expression visitLiteralMap(LiteralMap node) {
200 _rewriteList(node.keys); 200 node.entries.forEach((LiteralMapEntry entry) {
201 _rewriteList(node.values); 201 entry.key = visitExpression(entry.key);
202 entry.value = visitExpression(entry.value);
203 });
202 return node; 204 return node;
203 } 205 }
204 206
205 Expression visitTypeOperator(TypeOperator node) { 207 Expression visitTypeOperator(TypeOperator node) {
206 node.receiver = visitExpression(node.receiver); 208 node.receiver = visitExpression(node.receiver);
207 return node; 209 return node;
208 } 210 }
209 211
210 Expression visitConstant(Constant node) { 212 Expression visitConstant(Constant node) {
211 return node; 213 return node;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 444 }
443 445
444 /// Destructively updates each entry of [l] with the result of visiting it. 446 /// Destructively updates each entry of [l] with the result of visiting it.
445 void _rewriteList(List<Expression> l) { 447 void _rewriteList(List<Expression> l) {
446 for (int i = 0; i < l.length; i++) { 448 for (int i = 0; i < l.length; i++) {
447 l[i] = visitExpression(l[i]); 449 l[i] = visitExpression(l[i]);
448 } 450 }
449 } 451 }
450 } 452 }
451 453
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698