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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart

Issue 923013002: dart2dart: Implementation of simple try/catch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 tree_ir_tracer; 5 library tree_ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'tree_ir_nodes.dart'; 9 import 'tree_ir_nodes.dart';
10 import 'optimization/optimization.dart'; 10 import 'optimization/optimization.dart';
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 _addBlock(bodyBlock); 134 _addBlock(bodyBlock);
135 visitStatement(node.body); 135 visitStatement(node.body);
136 136
137 _addBlock(nextBlock); 137 _addBlock(nextBlock);
138 visitStatement(node.next); 138 visitStatement(node.next);
139 139
140 ifTargets[node.body] = bodyBlock; 140 ifTargets[node.body] = bodyBlock;
141 ifTargets[node.next] = nextBlock; 141 ifTargets[node.next] = nextBlock;
142 } 142 }
143 143
144 visitTryStatement(TryStatement node) {
145 // It's not obvious how we want to represent try statements here.
karlklose 2015/02/16 10:15:48 Do you know what V8 or the SSA based backend do? M
146 // TODO(kmillikin).
147 }
148
144 visitExpressionStatement(ExpressionStatement node) { 149 visitExpressionStatement(ExpressionStatement node) {
145 _addStatement(node); 150 _addStatement(node);
146 visitStatement(node.next); 151 visitStatement(node.next);
147 } 152 }
148 153
149 visitFunctionDeclaration(FunctionDeclaration node) { 154 visitFunctionDeclaration(FunctionDeclaration node) {
150 _addStatement(node); 155 _addStatement(node);
151 visitStatement(node.next); 156 visitStatement(node.next);
152 } 157 }
153 158
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 272 }
268 273
269 visitWhileCondition(WhileCondition node) { 274 visitWhileCondition(WhileCondition node) {
270 String bodyTarget = collector.ifTargets[node.body].name; 275 String bodyTarget = collector.ifTargets[node.body].name;
271 String nextTarget = collector.ifTargets[node.next].name; 276 String nextTarget = collector.ifTargets[node.next].name;
272 printStatement(null, "while ${expr(node.condition)}"); 277 printStatement(null, "while ${expr(node.condition)}");
273 printStatement(null, "do $bodyTarget"); 278 printStatement(null, "do $bodyTarget");
274 printStatement(null, "then $nextTarget" ); 279 printStatement(null, "then $nextTarget" );
275 } 280 }
276 281
282 visitTryStatement(TryStatement node) {
283 // It's not obvious how we want to represent try statements here.
284 // TODO(kmillikin).
285 }
286
277 visitExpressionStatement(ExpressionStatement node) { 287 visitExpressionStatement(ExpressionStatement node) {
278 printStatement(null, expr(node.expression)); 288 printStatement(null, expr(node.expression));
279 } 289 }
280 290
281 visitFunctionDeclaration(FunctionDeclaration node) { 291 visitFunctionDeclaration(FunctionDeclaration node) {
282 printStatement(null, 'function ${node.definition.element.name}'); 292 printStatement(null, 'function ${node.definition.element.name}');
283 } 293 }
284 294
285 visitSetField(SetField node) { 295 visitSetField(SetField node) {
286 String object = expr(node.object); 296 String object = expr(node.object);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 483 String prefix = v.element == null ? 'v' : '${v.element.name}_';
474 while (name == null || _usedNames.contains(name)) { 484 while (name == null || _usedNames.contains(name)) {
475 name = "$prefix${_counter++}"; 485 name = "$prefix${_counter++}";
476 } 486 }
477 _names[v] = name; 487 _names[v] = name;
478 _usedNames.add(name); 488 _usedNames.add(name);
479 } 489 }
480 return name; 490 return name;
481 } 491 }
482 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698