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.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (superElement != null) { | 692 if (superElement != null) { |
693 classesToVisit.add(superElement); | 693 classesToVisit.add(superElement); |
694 } | 694 } |
695 } | 695 } |
696 } | 696 } |
697 } | 697 } |
698 // not found | 698 // not found |
699 return false; | 699 return false; |
700 } | 700 } |
701 | 701 |
| 702 /** |
| 703 * Return `true` if the class has a `noSuchMethod()` method distinct from the |
| 704 * one declared in class `Object`, as per the Dart Language Specification |
| 705 * (section 10.4). |
| 706 */ |
| 707 bool get hasNoSuchMethod { |
| 708 MethodElement method = |
| 709 lookUpMethod(FunctionElement.NO_SUCH_METHOD_METHOD_NAME, library); |
| 710 ClassElement definingClass = method?.enclosingElement; |
| 711 return definingClass != null && !definingClass.type.isObject; |
| 712 } |
| 713 |
702 @override | 714 @override |
703 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); | 715 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); |
704 | 716 |
705 /** | 717 /** |
706 * Set whether this class references 'super'. | 718 * Set whether this class references 'super'. |
707 */ | 719 */ |
708 void set hasReferenceToSuper(bool isReferencedSuper) { | 720 void set hasReferenceToSuper(bool isReferencedSuper) { |
709 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); | 721 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
710 } | 722 } |
711 | 723 |
(...skipping 7721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8433 | 8445 |
8434 @override | 8446 @override |
8435 void visitElement(Element element) { | 8447 void visitElement(Element element) { |
8436 int offset = element.nameOffset; | 8448 int offset = element.nameOffset; |
8437 if (offset != -1) { | 8449 if (offset != -1) { |
8438 map[offset] = element; | 8450 map[offset] = element; |
8439 } | 8451 } |
8440 super.visitElement(element); | 8452 super.visitElement(element); |
8441 } | 8453 } |
8442 } | 8454 } |
OLD | NEW |