Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be | 5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be |
| 6 // refactored to fit into analyzer. | 6 // refactored to fit into analyzer. |
| 7 library analyzer.src.task.strong.checker; | 7 library analyzer.src.task.strong.checker; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 DartType _elementType(Element e) { | 46 DartType _elementType(Element e) { |
| 47 if (e == null) { | 47 if (e == null) { |
| 48 // Malformed code - just return dynamic. | 48 // Malformed code - just return dynamic. |
| 49 return DynamicTypeImpl.instance; | 49 return DynamicTypeImpl.instance; |
| 50 } | 50 } |
| 51 return (e as dynamic).type; | 51 return (e as dynamic).type; |
| 52 } | 52 } |
| 53 | 53 |
| 54 Element _getKnownElement(Expression expression) { | 54 Element _getKnownElement(Expression expression) { |
| 55 if (expression is ParenthesizedExpression) { | 55 if (expression is ParenthesizedExpression) { |
| 56 expression = (expression as ParenthesizedExpression).expression; | 56 return _getKnownElement(expression.expression); |
| 57 } | 57 } else if (expression is NamedExpression) { |
|
Leaf
2017/02/06 18:27:15
This fixes 28630, where we were not treating named
Jennifer Messerly
2017/02/06 20:08:09
wow this bug has been here for like ever. nice fix
| |
| 58 if (expression is FunctionExpression) { | 58 return _getKnownElement(expression.expression); |
| 59 } else if (expression is FunctionExpression) { | |
| 59 return expression.element; | 60 return expression.element; |
| 60 } else if (expression is PropertyAccess) { | 61 } else if (expression is PropertyAccess) { |
| 61 return expression.propertyName.staticElement; | 62 return expression.propertyName.staticElement; |
| 62 } else if (expression is Identifier) { | 63 } else if (expression is Identifier) { |
| 63 return expression.staticElement; | 64 return expression.staticElement; |
| 64 } | 65 } |
| 65 return null; | 66 return null; |
| 66 } | 67 } |
| 67 | 68 |
| 68 /// Return the field on type corresponding to member, or null if none | 69 /// Return the field on type corresponding to member, or null if none |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1492 var visited = new Set<InterfaceType>(); | 1493 var visited = new Set<InterfaceType>(); |
| 1493 do { | 1494 do { |
| 1494 visited.add(current); | 1495 visited.add(current); |
| 1495 current.mixins.reversed.forEach( | 1496 current.mixins.reversed.forEach( |
| 1496 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); | 1497 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); |
| 1497 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); | 1498 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); |
| 1498 current = current.superclass; | 1499 current = current.superclass; |
| 1499 } while (!current.isObject && !visited.contains(current)); | 1500 } while (!current.isObject && !visited.contains(current)); |
| 1500 } | 1501 } |
| 1501 } | 1502 } |
| OLD | NEW |