Chromium Code Reviews| 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 6539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6550 } | 6550 } |
| 6551 } | 6551 } |
| 6552 } | 6552 } |
| 6553 | 6553 |
| 6554 /** | 6554 /** |
| 6555 * Given the declared return type of a function, compute the type of the | 6555 * Given the declared return type of a function, compute the type of the |
| 6556 * values which should be returned or yielded as appropriate. If a type | 6556 * values which should be returned or yielded as appropriate. If a type |
| 6557 * cannot be computed from the declared return type, return null. | 6557 * cannot be computed from the declared return type, return null. |
| 6558 */ | 6558 */ |
| 6559 DartType _computeReturnOrYieldType(DartType declaredType) { | 6559 DartType _computeReturnOrYieldType(DartType declaredType) { |
| 6560 if (_enclosingFunction == null) { | |
| 6561 print('aaa'); | |
|
Brian Wilkerson
2016/10/18 00:18:29
I assume this is debugging code that should be rem
scheglov
2016/10/18 01:50:58
Acknowledged.
| |
| 6562 } | |
| 6560 bool isGenerator = _enclosingFunction.isGenerator; | 6563 bool isGenerator = _enclosingFunction.isGenerator; |
| 6561 bool isAsynchronous = _enclosingFunction.isAsynchronous; | 6564 bool isAsynchronous = _enclosingFunction.isAsynchronous; |
| 6562 | 6565 |
| 6563 // Ordinary functions just return their declared types. | 6566 // Ordinary functions just return their declared types. |
| 6564 if (!isGenerator && !isAsynchronous) { | 6567 if (!isGenerator && !isAsynchronous) { |
| 6565 return declaredType; | 6568 return declaredType; |
| 6566 } | 6569 } |
| 6567 if (declaredType is InterfaceType) { | 6570 if (declaredType is InterfaceType) { |
| 6568 if (isGenerator) { | 6571 if (isGenerator) { |
| 6569 // If it's sync* we expect Iterable<T> | 6572 // If it's sync* we expect Iterable<T> |
| (...skipping 4006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10576 return null; | 10579 return null; |
| 10577 } | 10580 } |
| 10578 if (identical(node.staticElement, variable)) { | 10581 if (identical(node.staticElement, variable)) { |
| 10579 if (node.inSetterContext()) { | 10582 if (node.inSetterContext()) { |
| 10580 result = true; | 10583 result = true; |
| 10581 } | 10584 } |
| 10582 } | 10585 } |
| 10583 return null; | 10586 return null; |
| 10584 } | 10587 } |
| 10585 } | 10588 } |
| OLD | NEW |