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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 737353002: cps-ir: Implement boolean conversion in and use it to implement '&&', '||', and '?:'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 dart2js.ir_nodes_sexpr; 5 library dart2js.ir_nodes_sexpr;
6 6
7 import '../util/util.dart'; 7 import '../util/util.dart';
8 import 'cps_ir_nodes.dart'; 8 import 'cps_ir_nodes.dart';
9 import 'package:compiler/src/js_backend/codegen/unsugar.dart';
sigurdm 2014/11/20 12:47:28 package import
9 10
10 /// Generate a Lisp-like S-expression representation of an IR node as a string. 11 /// Generate a Lisp-like S-expression representation of an IR node as a string.
11 class SExpressionStringifier extends Visitor<String> with Indentation { 12 class SExpressionStringifier extends Visitor<String> with Indentation {
12 final Map<Definition, String> names = <Definition, String>{}; 13 final Map<Definition, String> names = <Definition, String>{};
13 14
14 int _valueCounter = 0; 15 int _valueCounter = 0;
15 int _continuationCounter = 0; 16 int _continuationCounter = 0;
16 17
17 String newValueName() => 'v${_valueCounter++}'; 18 String newValueName() => 'v${_valueCounter++}';
18 String newContinuationName() => 'k${_continuationCounter++}'; 19 String newContinuationName() => 'k${_continuationCounter++}';
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return '$indentation(DeclareFunction ${node.variable.name} =\n' 190 return '$indentation(DeclareFunction ${node.variable.name} =\n'
190 '$function in\n' 191 '$function in\n'
191 '$body)'; 192 '$body)';
192 } 193 }
193 194
194 String visitIsTrue(IsTrue node) { 195 String visitIsTrue(IsTrue node) {
195 String value = names[node.value.definition]; 196 String value = names[node.value.definition];
196 return '(IsTrue $value)'; 197 return '(IsTrue $value)';
197 } 198 }
198 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698