| 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 'elements.dart' show Entity; | 7 import '../common.dart'; |
| 8 |
| 9 /// Abstract interface for entities. |
| 10 /// |
| 11 /// Implement this directly if the entity is not a Dart language entity. |
| 12 /// Entities defined within the Dart language should implement [Element]. |
| 13 /// |
| 14 /// For instance, the JavaScript backend need to create synthetic variables for |
| 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 |
| 17 /// and should therefore implement [Entity] directly. |
| 18 abstract class Entity implements Spannable { |
| 19 String get name; |
| 20 } |
| 8 | 21 |
| 9 /// Stripped down super interface for library like entities. | 22 /// Stripped down super interface for library like entities. |
| 10 /// | 23 /// |
| 11 /// Currently only [LibraryElement] but later also kernel based Dart classes | 24 /// Currently only [LibraryElement] but later also kernel based Dart classes |
| 12 /// and/or Dart-in-JS classes. | 25 /// and/or Dart-in-JS classes. |
| 13 abstract class LibraryEntity extends Entity { | 26 abstract class LibraryEntity extends Entity { |
| 14 String get libraryName; | 27 String get libraryName; |
| 15 } | 28 } |
| 16 | 29 |
| 17 /// Stripped down super interface for class like entities. | 30 /// Stripped down super interface for class like entities. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /// Stripped down super interface for constructor like entities. | 73 /// Stripped down super interface for constructor like entities. |
| 61 /// | 74 /// |
| 62 /// Currently only [ConstructorElement] but later also kernel based Dart | 75 /// Currently only [ConstructorElement] but later also kernel based Dart |
| 63 /// constructors and methods and/or Dart-in-JS function-like properties. | 76 /// constructors and methods and/or Dart-in-JS function-like properties. |
| 64 // TODO(johnniwinther): Remove factory constructors from the set of | 77 // TODO(johnniwinther): Remove factory constructors from the set of |
| 65 // constructors. | 78 // constructors. |
| 66 abstract class ConstructorEntity extends FunctionEntity { | 79 abstract class ConstructorEntity extends FunctionEntity { |
| 67 bool get isGenerativeConstructor; | 80 bool get isGenerativeConstructor; |
| 68 bool get isFactoryConstructor; | 81 bool get isFactoryConstructor; |
| 69 } | 82 } |
| 83 |
| 84 /// An entity that defines a local entity (memory slot) in generated code. |
| 85 /// |
| 86 /// Parameters, local variables and local functions (can) define local entity |
| 87 /// and thus implement [Local] through [LocalElement]. For non-element locals, |
| 88 /// like `this` and boxes, specialized [Local] classes are created. |
| 89 /// |
| 90 /// Type variables can introduce locals in factories and constructors |
| 91 /// but since one type variable can introduce different locals in different |
| 92 /// factories and constructors it is not itself a [Local] but instead |
| 93 /// a non-element [Local] is created through a specialized class. |
| 94 // TODO(johnniwinther): Should [Local] have `isAssignable` or `type`? |
| 95 abstract class Local extends Entity { |
| 96 /// The context in which this local is defined. |
| 97 Entity get executableContext; |
| 98 |
| 99 /// The outermost member that contains this element. |
| 100 /// |
| 101 /// For top level, static or instance members, the member context is the |
| 102 /// element itself. For parameters, local variables and nested closures, the |
| 103 /// member context is the top level, static or instance member in which it is |
| 104 /// defined. |
| 105 MemberEntity get memberContext; |
| 106 } |
| OLD | NEW |