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

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

Issue 1405503003: dart2js cps: Some fixes for yield. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 visitExpressionStatement(ExpressionStatement node) { 173 visitExpressionStatement(ExpressionStatement node) {
174 _addStatement(node); 174 _addStatement(node);
175 visitStatement(node.next); 175 visitStatement(node.next);
176 } 176 }
177 177
178 visitForeignStatement(ForeignStatement node) { 178 visitForeignStatement(ForeignStatement node) {
179 _addStatement(node); 179 _addStatement(node);
180 } 180 }
181 181
182 @override
183 visitYield(Yield node) { 182 visitYield(Yield node) {
184 _addStatement(node); 183 _addStatement(node);
184 visitStatement(node.next);
185 } 185 }
186 } 186 }
187 187
188 class TreeTracer extends TracerUtil with StatementVisitor { 188 class TreeTracer extends TracerUtil with StatementVisitor {
189 String get passName => null; 189 String get passName => null;
190 190
191 final EventSink<String> output; 191 final EventSink<String> output;
192 192
193 TreeTracer(this.output); 193 TreeTracer(this.output);
194 194
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return e.accept(new SubexpressionVisitor(names)); 337 return e.accept(new SubexpressionVisitor(names));
338 } 338 }
339 339
340 @override 340 @override
341 visitForeignStatement(ForeignStatement node) { 341 visitForeignStatement(ForeignStatement node) {
342 printStatement(null, 'foreign ${node.codeTemplate.source}'); 342 printStatement(null, 'foreign ${node.codeTemplate.source}');
343 } 343 }
344 344
345 @override 345 @override
346 visitYield(Yield node) { 346 visitYield(Yield node) {
347 printStatement(null, 'yield ${expr(node.input)}'); 347 String name = node.hasStar ? 'yield*' : 'yield';
348 printStatement(null, '$name ${expr(node.input)}');
348 } 349 }
349 } 350 }
350 351
351 class SubexpressionVisitor extends ExpressionVisitor<String> { 352 class SubexpressionVisitor extends ExpressionVisitor<String> {
352 Names names; 353 Names names;
353 354
354 SubexpressionVisitor(this.names); 355 SubexpressionVisitor(this.names);
355 356
356 String visitVariableUse(VariableUse node) { 357 String visitVariableUse(VariableUse node) {
357 return names.varName(node.variable); 358 return names.varName(node.variable);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 615 String prefix = v.element == null ? 'v' : '${v.element.name}_';
615 while (name == null || _usedNames.contains(name)) { 616 while (name == null || _usedNames.contains(name)) {
616 name = "$prefix${_counter++}"; 617 name = "$prefix${_counter++}";
617 } 618 }
618 _names[v] = name; 619 _names[v] = name;
619 _usedNames.add(name); 620 _usedNames.add(name);
620 } 621 }
621 return name; 622 return name;
622 } 623 }
623 } 624 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698