| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 elements; | 5 library elements; |
| 6 | 6 |
| 7 | 7 |
| 8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
| 9 import '../util/util.dart'; | 9 import '../util/util.dart'; |
| 10 import '../resolution/resolution.dart'; | 10 import '../resolution/resolution.dart'; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 /// Returns true if this [Element] is a top level element. | 225 /// Returns true if this [Element] is a top level element. |
| 226 /// That is, if it is not defined within the scope of a class. | 226 /// That is, if it is not defined within the scope of a class. |
| 227 /// | 227 /// |
| 228 /// This means whether the enclosing element is a compilation unit. | 228 /// This means whether the enclosing element is a compilation unit. |
| 229 /// With the exception of [ClosureClassElement] that is considered top level | 229 /// With the exception of [ClosureClassElement] that is considered top level |
| 230 /// as all other classes. | 230 /// as all other classes. |
| 231 bool isTopLevel(); | 231 bool isTopLevel(); |
| 232 bool isAssignable(); | 232 bool isAssignable(); |
| 233 bool isNative(); | 233 bool isNative(); |
| 234 bool isDeferredLoaderFunction(); |
| 234 | 235 |
| 235 bool impliesType(); | 236 bool impliesType(); |
| 236 | 237 |
| 237 Token position(); | 238 Token position(); |
| 238 | 239 |
| 239 CompilationUnitElement getCompilationUnit(); | 240 CompilationUnitElement getCompilationUnit(); |
| 240 LibraryElement getLibrary(); | 241 LibraryElement getLibrary(); |
| 241 LibraryElement getImplementationLibrary(); | 242 LibraryElement getImplementationLibrary(); |
| 242 ClassElement getEnclosingClass(); | 243 ClassElement getEnclosingClass(); |
| 243 Element getEnclosingClassOrCompilationUnit(); | 244 Element getEnclosingClassOrCompilationUnit(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (!Elements.isUnresolved(element) | 330 if (!Elements.isUnresolved(element) |
| 330 && element.modifiers.isStatic()) { | 331 && element.modifiers.isStatic()) { |
| 331 return true; | 332 return true; |
| 332 } | 333 } |
| 333 return !Elements.isUnresolved(element) | 334 return !Elements.isUnresolved(element) |
| 334 && !element.isInstanceMember() | 335 && !element.isInstanceMember() |
| 335 && !element.isPrefix() | 336 && !element.isPrefix() |
| 336 && element.enclosingElement != null | 337 && element.enclosingElement != null |
| 337 && (element.enclosingElement.kind == ElementKind.CLASS || | 338 && (element.enclosingElement.kind == ElementKind.CLASS || |
| 338 element.enclosingElement.kind == ElementKind.COMPILATION_UNIT || | 339 element.enclosingElement.kind == ElementKind.COMPILATION_UNIT || |
| 339 element.enclosingElement.kind == ElementKind.LIBRARY); | 340 element.enclosingElement.kind == ElementKind.LIBRARY || |
| 341 element.enclosingElement.kind == ElementKind.PREFIX); |
| 340 } | 342 } |
| 341 | 343 |
| 342 static bool isInStaticContext(Element element) { | 344 static bool isInStaticContext(Element element) { |
| 343 if (isUnresolved(element)) return true; | 345 if (isUnresolved(element)) return true; |
| 344 if (element.enclosingElement.isClosure()) { | 346 if (element.enclosingElement.isClosure()) { |
| 345 var closureClass = element.enclosingElement; | 347 var closureClass = element.enclosingElement; |
| 346 element = closureClass.methodElement; | 348 element = closureClass.methodElement; |
| 347 } | 349 } |
| 348 Element outer = element.getOutermostEnclosingMemberOrTopLevel(); | 350 Element outer = element.getOutermostEnclosingMemberOrTopLevel(); |
| 349 if (isUnresolved(outer)) return true; | 351 if (isUnresolved(outer)) return true; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 String getLibraryOrScriptName(); | 741 String getLibraryOrScriptName(); |
| 740 | 742 |
| 741 int compareTo(LibraryElement other); | 743 int compareTo(LibraryElement other); |
| 742 } | 744 } |
| 743 | 745 |
| 744 abstract class PrefixElement extends Element { | 746 abstract class PrefixElement extends Element { |
| 745 void addImport(Element element, Import import, DiagnosticListener listener); | 747 void addImport(Element element, Import import, DiagnosticListener listener); |
| 746 Element lookupLocalMember(String memberName); | 748 Element lookupLocalMember(String memberName); |
| 747 /// Is true if this prefix belongs to a deferred import. | 749 /// Is true if this prefix belongs to a deferred import. |
| 748 bool get isDeferred; | 750 bool get isDeferred; |
| 749 void markAsDeferred(); | 751 void markAsDeferred(Import import); |
| 752 Import get import; |
| 750 } | 753 } |
| 751 | 754 |
| 752 abstract class TypedefElement extends Element | 755 abstract class TypedefElement extends Element |
| 753 implements TypeDeclarationElement { | 756 implements TypeDeclarationElement { |
| 754 TypedefType get thisType; | 757 TypedefType get thisType; |
| 755 TypedefType get rawType; | 758 TypedefType get rawType; |
| 756 DartType get alias; | 759 DartType get alias; |
| 757 FunctionSignature get functionSignature; | 760 FunctionSignature get functionSignature; |
| 758 Link<DartType> get typeVariables; | 761 Link<DartType> get typeVariables; |
| 759 | 762 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 InterfaceType get declarer; | 1127 InterfaceType get declarer; |
| 1125 | 1128 |
| 1126 /// Returns `true` if this member is static. | 1129 /// Returns `true` if this member is static. |
| 1127 bool get isStatic; | 1130 bool get isStatic; |
| 1128 | 1131 |
| 1129 /// Returns `true` if this member is a getter or setter implicitly declared | 1132 /// Returns `true` if this member is a getter or setter implicitly declared |
| 1130 /// by a field. | 1133 /// by a field. |
| 1131 bool get isDeclaredByField; | 1134 bool get isDeclaredByField; |
| 1132 } | 1135 } |
| 1133 | 1136 |
| OLD | NEW |