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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart

Issue 288343014: dart2dart: Test cases for better code coverage in dart_tree rewritings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: SVN rebase Created 6 years, 6 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 dart_tree; 5 library dart_tree;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../elements/elements.dart' 8 import '../elements/elements.dart'
9 show Element, FunctionElement, FunctionSignature, ParameterElement, 9 show Element, FunctionElement, FunctionSignature, ParameterElement,
10 ClassElement; 10 ClassElement;
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 makeCondition(node.condition, false, liftNots: false), 1395 makeCondition(node.condition, false, liftNots: false),
1396 putInBooleanContext(node.thenExpression)); 1396 putInBooleanContext(node.thenExpression));
1397 } 1397 }
1398 // x ? true : y ==> x || y (if y if known to be boolean) 1398 // x ? true : y ==> x || y (if y if known to be boolean)
1399 if (isBooleanValued(node.elseExpression) && isTrue(node.thenExpression)) { 1399 if (isBooleanValued(node.elseExpression) && isTrue(node.thenExpression)) {
1400 return new LogicalOperator.or( 1400 return new LogicalOperator.or(
1401 makeCondition(node.condition, true, liftNots: false), 1401 makeCondition(node.condition, true, liftNots: false),
1402 putInBooleanContext(node.elseExpression)); 1402 putInBooleanContext(node.elseExpression));
1403 } 1403 }
1404 // x ? false : y ==> !x && y (if y is known to be a boolean) 1404 // x ? false : y ==> !x && y (if y is known to be a boolean)
1405 if (isBooleanValued(node.elseExpression) && isTrue(node.thenExpression)) { 1405 if (isBooleanValued(node.elseExpression) && isFalse(node.thenExpression)) {
1406 return new LogicalOperator.and( 1406 return new LogicalOperator.and(
1407 makeCondition(node.condition, false, liftNots: false), 1407 makeCondition(node.condition, false, liftNots: false),
1408 putInBooleanContext(node.elseExpression)); 1408 putInBooleanContext(node.elseExpression));
1409 } 1409 }
1410 1410
1411 node.condition = makeCondition(node.condition, true); 1411 node.condition = makeCondition(node.condition, true);
1412 1412
1413 // !x ? y : z ==> x ? z : y 1413 // !x ? y : z ==> x ? z : y
1414 if (node.condition is Not) { 1414 if (node.condition is Not) {
1415 node.condition = (node.condition as Not).operand; 1415 node.condition = (node.condition as Not).operand;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 } 1571 }
1572 } 1572 }
1573 1573
1574 /// Destructively updates each entry of [l] with the result of visiting it. 1574 /// Destructively updates each entry of [l] with the result of visiting it.
1575 void _rewriteList(List<Expression> l) { 1575 void _rewriteList(List<Expression> l) {
1576 for (int i = 0; i < l.length; i++) { 1576 for (int i = 0; i < l.length; i++) {
1577 l[i] = visitExpression(l[i]); 1577 l[i] = visitExpression(l[i]);
1578 } 1578 }
1579 } 1579 }
1580 } 1580 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart2js_profile_many.dart ('k') | tests/language/if_flatten1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698