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

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

Issue 1584253003: dart2js cps: Fix traversal order in statement rewriter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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.optimization.statement_rewriter; 5 library tree_ir.optimization.statement_rewriter;
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 import '../../io/source_information.dart'; 9 import '../../io/source_information.dart';
10 import '../../elements/elements.dart'; 10 import '../../elements/elements.dart';
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // 572 //
573 // - Other visit methods assume that all subexpressions are variable uses 573 // - Other visit methods assume that all subexpressions are variable uses
574 // because they come fresh out of the tree IR builder. 574 // because they come fresh out of the tree IR builder.
575 // 575 //
576 // - Reprocessing can be expensive. 576 // - Reprocessing can be expensive.
577 // 577 //
578 return node; 578 return node;
579 } 579 }
580 580
581 Expression visitLogicalOperator(LogicalOperator node) { 581 Expression visitLogicalOperator(LogicalOperator node) {
582 node.left = visitExpression(node.left);
583
584 // Impure expressions may not propagate across the branch. 582 // Impure expressions may not propagate across the branch.
585 inEmptyEnvironment(() { 583 inEmptyEnvironment(() {
586 node.right = visitExpression(node.right); 584 node.right = visitExpression(node.right);
587 }); 585 });
588 586 node.left = visitExpression(node.left);
589 return node; 587 return node;
590 } 588 }
591 589
592 Expression visitNot(Not node) { 590 Expression visitNot(Not node) {
593 node.operand = visitExpression(node.operand); 591 node.operand = visitExpression(node.operand);
594 return node; 592 return node;
595 } 593 }
596 594
597 bool isNullConstant(Expression node) { 595 bool isNullConstant(Expression node) {
598 return node is Constant && node.value.isNull; 596 return node is Constant && node.value.isNull;
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1235 }
1238 1236
1239 @override 1237 @override
1240 Expression visitAwait(Await node) { 1238 Expression visitAwait(Await node) {
1241 node.input = visitExpression(node.input); 1239 node.input = visitExpression(node.input);
1242 return node; 1240 return node;
1243 } 1241 }
1244 1242
1245 @override 1243 @override
1246 Statement visitYield(Yield node) { 1244 Statement visitYield(Yield node) {
1245 node.next = visitStatement(node.next);
1247 node.input = visitExpression(node.input); 1246 node.input = visitExpression(node.input);
1248 node.next = visitStatement(node.next);
1249 return node; 1247 return node;
1250 } 1248 }
1251 1249
1252 @override 1250 @override
1253 Statement visitNullCheck(NullCheck node) { 1251 Statement visitNullCheck(NullCheck node) {
1254 inEmptyEnvironment(() { 1252 inEmptyEnvironment(() {
1255 node.next = visitStatement(node.next); 1253 node.next = visitStatement(node.next);
1256 }); 1254 });
1257 if (node.condition != null) { 1255 if (node.condition != null) {
1258 inEmptyEnvironment(() { 1256 inEmptyEnvironment(() {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 VariableUseCallback callback; 1349 VariableUseCallback callback;
1352 1350
1353 VariableUseVisitor(this.callback); 1351 VariableUseVisitor(this.callback);
1354 1352
1355 visitVariableUse(VariableUse use) => callback(use); 1353 visitVariableUse(VariableUse use) => callback(use);
1356 1354
1357 static void visit(Expression node, VariableUseCallback callback) { 1355 static void visit(Expression node, VariableUseCallback callback) {
1358 new VariableUseVisitor(callback).visitExpression(node); 1356 new VariableUseVisitor(callback).visitExpression(node);
1359 } 1357 }
1360 } 1358 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698