| 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 computer.overrides; | 5 library computer.overrides; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/collections.dart'; | 7 import 'package:analysis_server/src/collections.dart'; |
| 8 import 'package:analysis_server/src/protocol_server.dart' as proto; | 8 import 'package:analysis_server/src/protocol_server.dart' as proto; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 String _name; | 131 String _name; |
| 132 List<ElementKind> _kinds; | 132 List<ElementKind> _kinds; |
| 133 | 133 |
| 134 List<Element> _superElements = <Element>[]; | 134 List<Element> _superElements = <Element>[]; |
| 135 List<Element> _interfaceElements = <Element>[]; | 135 List<Element> _interfaceElements = <Element>[]; |
| 136 Set<InterfaceType> _visited = new Set<InterfaceType>(); | 136 Set<InterfaceType> _visited = new Set<InterfaceType>(); |
| 137 | 137 |
| 138 _OverriddenElementsFinder(Element seed) { | 138 _OverriddenElementsFinder(Element seed) { |
| 139 _seed = seed; | 139 _seed = seed; |
| 140 _class = seed.enclosingElement; | 140 _class = seed.enclosingElement; |
| 141 if (_class == null) { |
| 142 // TODO(brianwilkerson) Remove this code when the issue has been fixed |
| 143 // (https://github.com/dart-lang/sdk/issues/25884) |
| 144 Type type = seed.runtimeType; |
| 145 String name = seed.name; |
| 146 throw new ArgumentError( |
| 147 'The $type named $name does not have an enclosing element'); |
| 148 } |
| 141 _library = _class.library; | 149 _library = _class.library; |
| 142 _name = seed.displayName; | 150 _name = seed.displayName; |
| 143 if (seed is MethodElement) { | 151 if (seed is MethodElement) { |
| 144 _kinds = METHOD_KINDS; | 152 _kinds = METHOD_KINDS; |
| 145 } else if (seed is PropertyAccessorElement) { | 153 } else if (seed is PropertyAccessorElement) { |
| 146 _kinds = seed.isGetter ? GETTER_KINDS : SETTER_KINDS; | 154 _kinds = seed.isGetter ? GETTER_KINDS : SETTER_KINDS; |
| 147 } else { | 155 } else { |
| 148 _kinds = FIELD_KINDS; | 156 _kinds = FIELD_KINDS; |
| 149 } | 157 } |
| 150 } | 158 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (_kinds.contains(ElementKind.SETTER)) { | 230 if (_kinds.contains(ElementKind.SETTER)) { |
| 223 member = classElement.lookUpSetter(_name + '=', _library); | 231 member = classElement.lookUpSetter(_name + '=', _library); |
| 224 if (member != null) { | 232 if (member != null) { |
| 225 return member; | 233 return member; |
| 226 } | 234 } |
| 227 } | 235 } |
| 228 // not found | 236 // not found |
| 229 return null; | 237 return null; |
| 230 } | 238 } |
| 231 } | 239 } |
| OLD | NEW |