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

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

Issue 756383004: Refactored treatment of closure variables in dart2js CPS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void _addGotoStatement(Block target) { 44 void _addGotoStatement(Block target) {
45 blocks.last.statements.add(target); 45 blocks.last.statements.add(target);
46 } 46 }
47 47
48 void _addBlock(Block block) { 48 void _addBlock(Block block) {
49 block.index = blocks.length; 49 block.index = blocks.length;
50 blocks.add(block); 50 blocks.add(block);
51 } 51 }
52 52
53 void collect(ExecutableDefinition node) { 53 void collect(ExecutableDefinition node) {
54 visitStatement(node.body); 54 if (node.body != null) {
55 visitStatement(node.body);
56 }
55 } 57 }
56 58
57 visitLabeledStatement(LabeledStatement node) { 59 visitLabeledStatement(LabeledStatement node) {
58 Block target = new Block(node.label); 60 Block target = new Block(node.label);
59 breakTargets[node.label] = target; 61 breakTargets[node.label] = target;
60 visitStatement(node.body); 62 visitStatement(node.body);
61 _addBlock(target); 63 _addBlock(target);
62 visitStatement(node.next); 64 visitStatement(node.next);
63 } 65 }
64 66
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 413 String prefix = v.element == null ? 'v' : '${v.element.name}_';
412 while (name == null || _usedNames.contains(name)) { 414 while (name == null || _usedNames.contains(name)) {
413 name = "$prefix${_counter++}"; 415 name = "$prefix${_counter++}";
414 } 416 }
415 _names[v] = name; 417 _names[v] = name;
416 _usedNames.add(name); 418 _usedNames.add(name);
417 } 419 }
418 return name; 420 return name;
419 } 421 }
420 } 422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698