| 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 import 'dart:collection' show HashSet; | 5 import 'dart:collection' show HashSet; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart' show Identifier; | 7 import 'package:analyzer/dart/ast/ast.dart' show Identifier; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 | 9 |
| 10 import 'extension_types.dart'; | 10 import 'extension_types.dart'; |
| 11 | 11 |
| 12 class PropertyOverrideResult { | 12 class PropertyOverrideResult { |
| 13 final bool foundGetter; | 13 final bool foundGetter; |
| 14 final bool foundSetter; | 14 final bool foundSetter; |
| 15 | 15 |
| 16 PropertyOverrideResult(this.foundGetter, this.foundSetter); | 16 PropertyOverrideResult(this.foundGetter, this.foundSetter); |
| 17 } | 17 } |
| 18 | 18 |
| 19 PropertyOverrideResult checkForPropertyOverride(FieldElement field, | 19 PropertyOverrideResult checkForPropertyOverride(FieldElement field, |
| 20 List<ClassElement> superclasses, ExtensionTypeSet extensionTypes) { | 20 List<ClassElement> superclasses, ExtensionTypeSet extensionTypes) { |
| 21 bool foundGetter = false; | 21 bool foundGetter = false; |
| 22 bool foundSetter = false; | 22 bool foundSetter = false; |
| 23 | 23 |
| 24 for (var superclass in superclasses) { | 24 for (var superclass in superclasses) { |
| 25 // Stop if we reach a native type. | 25 // Stop if we reach a native type. |
| 26 if (extensionTypes.contains(superclass)) break; | 26 if (extensionTypes.isNativeClass(superclass)) break; |
| 27 | 27 |
| 28 var superprop = getProperty(superclass, field.library, field.name); | 28 var superprop = getProperty(superclass, field.library, field.name); |
| 29 if (superprop == null) continue; | 29 if (superprop == null) continue; |
| 30 | 30 |
| 31 // Static fields can override superclass static fields. However, we need to | 31 // Static fields can override superclass static fields. However, we need to |
| 32 // handle the case where they override a getter or setter. | 32 // handle the case where they override a getter or setter. |
| 33 if (field.isStatic && !superprop.isSynthetic) continue; | 33 if (field.isStatic && !superprop.isSynthetic) continue; |
| 34 | 34 |
| 35 var getter = superprop.getter; | 35 var getter = superprop.getter; |
| 36 bool hasGetter = getter != null && !getter.isAbstract; | 36 bool hasGetter = getter != null && !getter.isAbstract; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (mixin != null) result.add(mixin); | 70 if (mixin != null) result.add(mixin); |
| 71 } | 71 } |
| 72 var supertype = cls.supertype; | 72 var supertype = cls.supertype; |
| 73 if (supertype == null) break; | 73 if (supertype == null) break; |
| 74 | 74 |
| 75 cls = supertype.element; | 75 cls = supertype.element; |
| 76 result.add(cls); | 76 result.add(cls); |
| 77 } | 77 } |
| 78 return result; | 78 return result; |
| 79 } | 79 } |
| OLD | NEW |