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

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

Issue 284213002: dart2dart: Logical operators and related rewrite rules in dart_tree. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bugfix in iteration of tryCollapseIf Created 6 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 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 dart_codegen; 5 library dart_codegen;
6 6
7 import 'dart_tree.dart' as tree; 7 import 'dart_tree.dart' as tree;
8 import 'dart_printer.dart'; 8 import 'dart_printer.dart';
9 import 'dart_tree_printer.dart' show TreePrinter; 9 import 'dart_tree_printer.dart' show TreePrinter;
10 import '../tree/tree.dart' as frontend; 10 import '../tree/tree.dart' as frontend;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return new StringConcat(args); 256 return new StringConcat(args);
257 } 257 }
258 258
259 Expression visitConditional(tree.Conditional exp) { 259 Expression visitConditional(tree.Conditional exp) {
260 return new Conditional( 260 return new Conditional(
261 visitExpression(exp.condition), 261 visitExpression(exp.condition),
262 visitExpression(exp.thenExpression), 262 visitExpression(exp.thenExpression),
263 visitExpression(exp.elseExpression)); 263 visitExpression(exp.elseExpression));
264 } 264 }
265 265
266 Expression visitLogicalOperator(tree.LogicalOperator exp) {
267 return new BinaryOperator(visitExpression(exp.left),
268 exp.operator,
269 visitExpression(exp.right));
270 }
271
272 Expression visitNot(tree.Not exp) {
273 return new UnaryOperator('!', visitExpression(exp.operand));
274 }
275
266 Expression visitVariable(tree.Variable exp) { 276 Expression visitVariable(tree.Variable exp) {
267 return new Identifier(exp.name) 277 return new Identifier(exp.name)
268 ..element = exp.element; 278 ..element = exp.element;
269 } 279 }
270 280
271 TypeAnnotation emitType(DartType type) { 281 TypeAnnotation emitType(DartType type) {
272 if (type is GenericType) { // TODO(asgerf): faster Link.map 282 if (type is GenericType) { // TODO(asgerf): faster Link.map
273 return new TypeAnnotation( 283 return new TypeAnnotation(
274 type.element.name, 284 type.element.name,
275 type.typeArguments.toList(growable:false) 285 type.typeArguments.toList(growable:false)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 emitConstant(constant.keys.entries[i]), 317 emitConstant(constant.keys.entries[i]),
308 emitConstant(constant.values[i]))); 318 emitConstant(constant.values[i])));
309 } 319 }
310 return new LiteralMap(entries, isConst: true); 320 return new LiteralMap(entries, isConst: true);
311 } else { 321 } else {
312 throw "Unsupported constant: $constant"; 322 throw "Unsupported constant: $constant";
313 } 323 }
314 } 324 }
315 } 325 }
316 326
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698