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

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

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.optimization.pull_into_initializers; 5 library tree_ir.optimization.pull_into_initializers;
6 6
7 import 'optimization.dart' show Pass; 7 import 'optimization.dart' show Pass;
8 import '../tree_ir_nodes.dart'; 8 import '../tree_ir_nodes.dart';
9 9
10 /// Where a variable has been assigned. 10 /// Where a variable has been assigned.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 /// baz(x, y, y); 50 /// baz(x, y, y);
51 /// 51 ///
52 /// ==> [StatementRewriter] 52 /// ==> [StatementRewriter]
53 /// 53 ///
54 /// var y; 54 /// var y;
55 /// baz(foo(), y = bar(), y); 55 /// baz(foo(), y = bar(), y);
56 /// 56 ///
57 /// [PullIntoInitializers] cannot pull `y` into an initializer because 57 /// [PullIntoInitializers] cannot pull `y` into an initializer because
58 /// the impure expressions `foo()` and `bar()` would then be swapped. 58 /// the impure expressions `foo()` and `bar()` would then be swapped.
59 /// 59 ///
60 class PullIntoInitializers extends RecursiveTransformer 60 class PullIntoInitializers extends RecursiveTransformer implements Pass {
61 implements Pass {
62 String get passName => 'Pull into initializers'; 61 String get passName => 'Pull into initializers';
63 62
64 /// Denotes where each variable is currently assigned. 63 /// Denotes where each variable is currently assigned.
65 /// 64 ///
66 /// Variables without assignments are absent from the map. 65 /// Variables without assignments are absent from the map.
67 Map<Variable, AssignArea> assignArea = <Variable, AssignArea>{}; 66 Map<Variable, AssignArea> assignArea = <Variable, AssignArea>{};
68 67
69 /// The fragment between [first] and [last] holds the statements 68 /// The fragment between [first] and [last] holds the statements
70 /// we pulled into the initializer block. 69 /// we pulled into the initializer block.
71 /// 70 ///
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 369
371 @override 370 @override
372 Expression visitForeignExpression(ForeignExpression node) { 371 Expression visitForeignExpression(ForeignExpression node) {
373 rewriteList(node.arguments); 372 rewriteList(node.arguments);
374 if (node.nativeBehavior.sideEffects.hasSideEffects()) { 373 if (node.nativeBehavior.sideEffects.hasSideEffects()) {
375 ++impureCounter; 374 ++impureCounter;
376 } 375 }
377 return node; 376 return node;
378 } 377 }
379 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698