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 | |
715 @override | 703 @override |
716 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); | 704 bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER); |
717 | 705 |
718 /** | 706 /** |
719 * Set whether this class references 'super'. | 707 * Set whether this class references 'super'. |
720 */ | 708 */ |
721 void set hasReferenceToSuper(bool isReferencedSuper) { | 709 void set hasReferenceToSuper(bool isReferencedSuper) { |
722 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); | 710 setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper); |
723 } | 711 } |
724 | 712 |
(...skipping 7702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8427 | 8415 |
8428 @override | 8416 @override |
8429 void visitElement(Element element) { | 8417 void visitElement(Element element) { |
8430 int offset = element.nameOffset; | 8418 int offset = element.nameOffset; |
8431 if (offset != -1) { | 8419 if (offset != -1) { |
8432 map[offset] = element; | 8420 map[offset] = element; |
8433 } | 8421 } |
8434 super.visitElement(element); | 8422 super.visitElement(element); |
8435 } | 8423 } |
8436 } | 8424 } |
OLD | NEW |