| OLD | NEW |
| 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 analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 3559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3570 } | 3570 } |
| 3571 | 3571 |
| 3572 @override | 3572 @override |
| 3573 bool visitContinueStatement(ContinueStatement node) => false; | 3573 bool visitContinueStatement(ContinueStatement node) => false; |
| 3574 | 3574 |
| 3575 @override | 3575 @override |
| 3576 bool visitDoStatement(DoStatement node) { | 3576 bool visitDoStatement(DoStatement node) { |
| 3577 bool outerBreakValue = _enclosingBlockContainsBreak; | 3577 bool outerBreakValue = _enclosingBlockContainsBreak; |
| 3578 _enclosingBlockContainsBreak = false; | 3578 _enclosingBlockContainsBreak = false; |
| 3579 try { | 3579 try { |
| 3580 if (_nodeExits(node.body)) { |
| 3581 return true; |
| 3582 } |
| 3580 Expression conditionExpression = node.condition; | 3583 Expression conditionExpression = node.condition; |
| 3581 if (_nodeExits(conditionExpression)) { | 3584 if (_nodeExits(conditionExpression)) { |
| 3582 return true; | 3585 return true; |
| 3583 } | 3586 } |
| 3584 // TODO(jwren) Do we want to take all constant expressions into account? | 3587 // TODO(jwren) Do we want to take all constant expressions into account? |
| 3585 if (conditionExpression is BooleanLiteral) { | 3588 if (conditionExpression is BooleanLiteral) { |
| 3586 // If do {} while (true), and the body doesn't return or the body | 3589 // If do {} while (true), and the body doesn't break, then return true. |
| 3587 // doesn't have a break, then return true. | 3590 if (conditionExpression.value && !_enclosingBlockContainsBreak) { |
| 3588 bool blockReturns = _nodeExits(node.body); | |
| 3589 if (conditionExpression.value && | |
| 3590 (blockReturns || !_enclosingBlockContainsBreak)) { | |
| 3591 return true; | 3591 return true; |
| 3592 } | 3592 } |
| 3593 } | 3593 } |
| 3594 return false; | 3594 return false; |
| 3595 } finally { | 3595 } finally { |
| 3596 _enclosingBlockContainsBreak = outerBreakValue; | 3596 _enclosingBlockContainsBreak = outerBreakValue; |
| 3597 } | 3597 } |
| 3598 } | 3598 } |
| 3599 | 3599 |
| 3600 @override | 3600 @override |
| (...skipping 7370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10971 return null; | 10971 return null; |
| 10972 } | 10972 } |
| 10973 if (identical(node.staticElement, variable)) { | 10973 if (identical(node.staticElement, variable)) { |
| 10974 if (node.inSetterContext()) { | 10974 if (node.inSetterContext()) { |
| 10975 result = true; | 10975 result = true; |
| 10976 } | 10976 } |
| 10977 } | 10977 } |
| 10978 return null; | 10978 return null; |
| 10979 } | 10979 } |
| 10980 } | 10980 } |
| OLD | NEW |