| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 entities; | 5 library entities; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 | 8 |
| 9 /// Abstract interface for entities. | 9 /// Abstract interface for entities. |
| 10 /// | 10 /// |
| 11 /// Implement this directly if the entity is not a Dart language entity. | 11 /// Implement this directly if the entity is not a Dart language entity. |
| 12 /// Entities defined within the Dart language should implement [Element]. | 12 /// Entities defined within the Dart language should implement [Element]. |
| 13 /// | 13 /// |
| 14 /// For instance, the JavaScript backend need to create synthetic variables for | 14 /// For instance, the JavaScript backend need to create synthetic variables for |
| 15 /// calling intercepted classes and such variables do not correspond to an | 15 /// calling intercepted classes and such variables do not correspond to an |
| 16 /// entity in the Dart source code nor in the terminology of the Dart language | 16 /// entity in the Dart source code nor in the terminology of the Dart language |
| 17 /// and should therefore implement [Entity] directly. | 17 /// and should therefore implement [Entity] directly. |
| 18 abstract class Entity implements Spannable { | 18 abstract class Entity implements Spannable { |
| 19 String get name; | 19 String get name; |
| 20 } | 20 } |
| 21 | 21 |
| 22 /// Stripped down super interface for library like entities. | 22 /// Stripped down super interface for library like entities. |
| 23 /// | 23 /// |
| 24 /// Currently only [LibraryElement] but later also kernel based Dart classes | 24 /// Currently only [LibraryElement] but later also kernel based Dart classes |
| 25 /// and/or Dart-in-JS classes. | 25 /// and/or Dart-in-JS classes. |
| 26 abstract class LibraryEntity extends Entity {} | 26 abstract class LibraryEntity extends Entity { |
| 27 /// Return the canonical uri that identifies this library. |
| 28 Uri get canonicalUri; |
| 29 } |
| 27 | 30 |
| 28 /// Stripped down super interface for class like entities. | 31 /// Stripped down super interface for class like entities. |
| 29 /// | 32 /// |
| 30 /// Currently only [ClassElement] but later also kernel based Dart classes | 33 /// Currently only [ClassElement] but later also kernel based Dart classes |
| 31 /// and/or Dart-in-JS classes. | 34 /// and/or Dart-in-JS classes. |
| 32 abstract class ClassEntity extends Entity { | 35 abstract class ClassEntity extends Entity { |
| 33 /// If this is a normal class, the enclosing library for this class. If this | 36 /// If this is a normal class, the enclosing library for this class. If this |
| 34 /// is a closure class, the enclosing class of the closure for which it was | 37 /// is a closure class, the enclosing class of the closure for which it was |
| 35 /// created. | 38 /// created. |
| 36 LibraryEntity get library; | 39 LibraryEntity get library; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 79 |
| 77 /// Whether this is a getter. | 80 /// Whether this is a getter. |
| 78 bool get isGetter; | 81 bool get isGetter; |
| 79 | 82 |
| 80 /// Whether this is a setter. | 83 /// Whether this is a setter. |
| 81 bool get isSetter; | 84 bool get isSetter; |
| 82 | 85 |
| 83 /// Whether this member is assignable, i.e. a non-final field. | 86 /// Whether this member is assignable, i.e. a non-final field. |
| 84 bool get isAssignable; | 87 bool get isAssignable; |
| 85 | 88 |
| 86 /// The enclosing class if this is a constuctor, instance member or | 89 /// Whether this member is constant, i.e. a constant field or constructor. |
| 90 bool get isConst; |
| 91 |
| 92 /// The enclosing class if this is a constructor, instance member or |
| 87 /// static member of a class. | 93 /// static member of a class. |
| 88 ClassEntity get enclosingClass; | 94 ClassEntity get enclosingClass; |
| 89 | 95 |
| 90 /// The enclosing library if this is a library member, otherwise the | 96 /// The enclosing library if this is a library member, otherwise the |
| 91 /// enclosing library of the [enclosingClass]. | 97 /// enclosing library of the [enclosingClass]. |
| 92 LibraryEntity get library; | 98 LibraryEntity get library; |
| 93 } | 99 } |
| 94 | 100 |
| 95 /// Stripped down super interface for field like entities. | 101 /// Stripped down super interface for field like entities. |
| 96 /// | 102 /// |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 Entity get executableContext; | 144 Entity get executableContext; |
| 139 | 145 |
| 140 /// The outermost member that contains this element. | 146 /// The outermost member that contains this element. |
| 141 /// | 147 /// |
| 142 /// For top level, static or instance members, the member context is the | 148 /// For top level, static or instance members, the member context is the |
| 143 /// element itself. For parameters, local variables and nested closures, the | 149 /// element itself. For parameters, local variables and nested closures, the |
| 144 /// member context is the top level, static or instance member in which it is | 150 /// member context is the top level, static or instance member in which it is |
| 145 /// defined. | 151 /// defined. |
| 146 MemberEntity get memberContext; | 152 MemberEntity get memberContext; |
| 147 } | 153 } |
| OLD | NEW |