| 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 class PropertyOverrideResult { | 10 class PropertyOverrideResult { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 var superprop = getProperty(superclass, field.library, field.name); | 23 var superprop = getProperty(superclass, field.library, field.name); |
| 24 if (superprop == null) continue; | 24 if (superprop == null) continue; |
| 25 | 25 |
| 26 var getter = superprop.getter; | 26 var getter = superprop.getter; |
| 27 bool hasGetter = getter != null && !getter.isAbstract; | 27 bool hasGetter = getter != null && !getter.isAbstract; |
| 28 if (hasGetter) foundGetter = true; | 28 if (hasGetter) foundGetter = true; |
| 29 | 29 |
| 30 var setter = superprop.setter; | 30 var setter = superprop.setter; |
| 31 bool hasSetter = setter != null && !setter.isAbstract; | 31 bool hasSetter = setter != null && !setter.isAbstract; |
| 32 if (hasSetter) foundSetter = true; | 32 if (hasSetter) foundSetter = true; |
| 33 | |
| 34 // Stop if this is an abstract getter/setter | |
| 35 // TODO(jmesserly): why were we doing this? | |
| 36 if (!hasGetter && !hasSetter) break; | |
| 37 } | 33 } |
| 38 | 34 |
| 39 return new PropertyOverrideResult(foundGetter, foundSetter); | 35 return new PropertyOverrideResult(foundGetter, foundSetter); |
| 40 } | 36 } |
| 41 | 37 |
| 42 FieldElement getProperty( | 38 FieldElement getProperty( |
| 43 ClassElement cls, LibraryElement fromLibrary, String name) { | 39 ClassElement cls, LibraryElement fromLibrary, String name) { |
| 44 // Properties from a different library are not accessible. | 40 // Properties from a different library are not accessible. |
| 45 if (Identifier.isPrivateName(name) && cls.library != fromLibrary) { | 41 if (Identifier.isPrivateName(name) && cls.library != fromLibrary) { |
| 46 return null; | 42 return null; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 if (mixin != null) result.add(mixin); | 57 if (mixin != null) result.add(mixin); |
| 62 } | 58 } |
| 63 var supertype = cls.supertype; | 59 var supertype = cls.supertype; |
| 64 if (supertype == null) break; | 60 if (supertype == null) break; |
| 65 | 61 |
| 66 cls = supertype.element; | 62 cls = supertype.element; |
| 67 result.add(cls); | 63 result.add(cls); |
| 68 } | 64 } |
| 69 return result; | 65 return result; |
| 70 } | 66 } |
| OLD | NEW |