| 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 dart2js.elements; | 5 library elements; |
| 6 | 6 |
| 7 import 'package:sharedfrontend/elements.dart' as shared; | |
| 8 | 7 |
| 9 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 10 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 11 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| 12 import '../resolution/resolution.dart'; | 11 import '../resolution/resolution.dart'; |
| 13 | 12 |
| 14 import '../dart2jslib.dart' show InterfaceType, | 13 import '../dart2jslib.dart' show InterfaceType, |
| 15 DartType, | 14 DartType, |
| 16 TypeVariableType, | 15 TypeVariableType, |
| 17 TypedefType, | 16 TypedefType, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 * code generation. | 175 * code generation. |
| 177 * | 176 * |
| 178 * The front-end data structures are designed to be reusable by | 177 * The front-end data structures are designed to be reusable by |
| 179 * several back-ends. For example, we may want to support emitting | 178 * several back-ends. For example, we may want to support emitting |
| 180 * minified Dart and JavaScript code in one go. Also, we're planning | 179 * minified Dart and JavaScript code in one go. Also, we're planning |
| 181 * on adding an incremental compilation server that should be able to | 180 * on adding an incremental compilation server that should be able to |
| 182 * reuse elements between compilations. So to keep things simple, it | 181 * reuse elements between compilations. So to keep things simple, it |
| 183 * is best if the backends avoid setting state directly in elements. | 182 * is best if the backends avoid setting state directly in elements. |
| 184 * It is better to keep such state in a table on the side. | 183 * It is better to keep such state in a table on the side. |
| 185 */ | 184 */ |
| 186 abstract class Element implements shared.Element, Entity { | 185 abstract class Element implements Entity { |
| 187 String get name; | 186 String get name; |
| 188 ElementKind get kind; | 187 ElementKind get kind; |
| 189 Element get enclosingElement; | 188 Element get enclosingElement; |
| 190 Link<MetadataAnnotation> get metadata; | 189 Link<MetadataAnnotation> get metadata; |
| 191 | 190 |
| 192 /// Do not use [computeType] outside of the resolver; instead retrieve the | 191 /// Do not use [computeType] outside of the resolver; instead retrieve the |
| 193 /// type from the corresponding field: | 192 /// type from the corresponding field: |
| 194 /// - `type` for fields, variables, type variable, and function elements. | 193 /// - `type` for fields, variables, type variable, and function elements. |
| 195 /// - `thisType` or `rawType` for [TypeDeclarationElement]s (classes and | 194 /// - `thisType` or `rawType` for [TypeDeclarationElement]s (classes and |
| 196 /// typedefs), depending on the use case. | 195 /// typedefs), depending on the use case. |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 | 840 |
| 842 void forEachLocalMember(f(Element element)); | 841 void forEachLocalMember(f(Element element)); |
| 843 void addMember(Element element, DiagnosticListener listener); | 842 void addMember(Element element, DiagnosticListener listener); |
| 844 void setPartOf(PartOf tag, DiagnosticListener listener); | 843 void setPartOf(PartOf tag, DiagnosticListener listener); |
| 845 bool get hasMembers; | 844 bool get hasMembers; |
| 846 | 845 |
| 847 int compareTo(CompilationUnitElement other); | 846 int compareTo(CompilationUnitElement other); |
| 848 } | 847 } |
| 849 | 848 |
| 850 abstract class LibraryElement extends Element | 849 abstract class LibraryElement extends Element |
| 851 implements ScopeContainerElement, AnalyzableElement, shared.LibraryElement { | 850 implements ScopeContainerElement, AnalyzableElement { |
| 852 /** | 851 /** |
| 853 * The canonical uri for this library. | 852 * The canonical uri for this library. |
| 854 * | 853 * |
| 855 * For user libraries the canonical uri is the script uri. For platform | 854 * For user libraries the canonical uri is the script uri. For platform |
| 856 * libraries the canonical uri is of the form [:dart:x:]. | 855 * libraries the canonical uri is of the form [:dart:x:]. |
| 857 */ | 856 */ |
| 858 Uri get canonicalUri; | 857 Uri get canonicalUri; |
| 859 | 858 |
| 860 /// Returns `true` if this library is 'dart:core'. | 859 /// Returns `true` if this library is 'dart:core'. |
| 861 bool get isDartCore; | 860 bool get isDartCore; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 List<DartType> get typeVariables; | 1296 List<DartType> get typeVariables; |
| 1298 | 1297 |
| 1299 bool get isResolved; | 1298 bool get isResolved; |
| 1300 | 1299 |
| 1301 int get resolutionState; | 1300 int get resolutionState; |
| 1302 | 1301 |
| 1303 void ensureResolved(Compiler compiler); | 1302 void ensureResolved(Compiler compiler); |
| 1304 } | 1303 } |
| 1305 | 1304 |
| 1306 abstract class ClassElement extends TypeDeclarationElement | 1305 abstract class ClassElement extends TypeDeclarationElement |
| 1307 implements ScopeContainerElement, shared.ClassElement { | 1306 implements ScopeContainerElement { |
| 1308 int get id; | 1307 int get id; |
| 1309 | 1308 |
| 1310 /// The length of the longest inheritance path from [:Object:]. | 1309 /// The length of the longest inheritance path from [:Object:]. |
| 1311 int get hierarchyDepth; | 1310 int get hierarchyDepth; |
| 1312 | 1311 |
| 1313 InterfaceType get rawType; | 1312 InterfaceType get rawType; |
| 1314 InterfaceType get thisType; | 1313 InterfaceType get thisType; |
| 1315 ClassElement get superclass; | 1314 ClassElement get superclass; |
| 1316 | 1315 |
| 1317 /// The direct supertype of this class. | 1316 /// The direct supertype of this class. |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 bool get isDeclaredByField; | 1621 bool get isDeclaredByField; |
| 1623 | 1622 |
| 1624 /// Returns `true` if this member is abstract. | 1623 /// Returns `true` if this member is abstract. |
| 1625 bool get isAbstract; | 1624 bool get isAbstract; |
| 1626 | 1625 |
| 1627 /// If abstract, [implementation] points to the overridden concrete member, | 1626 /// If abstract, [implementation] points to the overridden concrete member, |
| 1628 /// if any. Otherwise [implementation] points to the member itself. | 1627 /// if any. Otherwise [implementation] points to the member itself. |
| 1629 Member get implementation; | 1628 Member get implementation; |
| 1630 } | 1629 } |
| 1631 | 1630 |
| OLD | NEW |