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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 if (superElement != null) { | 693 if (superElement != null) { |
694 classesToVisit.add(superElement); | 694 classesToVisit.add(superElement); |
695 } | 695 } |
696 } | 696 } |
697 } | 697 } |
698 } | 698 } |
699 // not found | 699 // not found |
700 return false; | 700 return false; |
701 } | 701 } |
702 | 702 |
| 703 /** |
| 704 * Return `true` if the class has a `noSuchMethod()` method distinct from the |
| 705 * one declared in class `Object`, as per the Dart Language Specification |
| 706 * (section 10.4). |
| 707 */ |
| 708 bool get hasNoSuchMethod { |
| 709 MethodElement method = |
| 710 lookUpMethod(FunctionElement.NO_SUCH_METHOD_METHOD_NAME, library); |
| 711 ClassElement definingClass = method?.enclosingElement; |
| 712 return definingClass != null && !definingClass.type.isObject; |
| 713 } |
| 714 |
703 @override | 715 @override |
704 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); | 716 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); |
705 | 717 |
706 /** | 718 /** |
707 * Set whether this class references 'super'. | 719 * Set whether this class references 'super'. |
708 */ | 720 */ |
709 void set hasReferenceToSuper(bool isReferencedSuper) { | 721 void set hasReferenceToSuper(bool isReferencedSuper) { |
710 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); | 722 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
711 } | 723 } |
712 | 724 |
(...skipping 7702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8415 | 8427 |
8416 @override | 8428 @override |
8417 void visitElement(Element element) { | 8429 void visitElement(Element element) { |
8418 int offset = element.nameOffset; | 8430 int offset = element.nameOffset; |
8419 if (offset != -1) { | 8431 if (offset != -1) { |
8420 map[offset] = element; | 8432 map[offset] = element; |
8421 } | 8433 } |
8422 super.visitElement(element); | 8434 super.visitElement(element); |
8423 } | 8435 } |
8424 } | 8436 } |
OLD | NEW |