Chromium Code Reviews| 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.dart.element.element; | 5 library analyzer.dart.element.element; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/generated/constant.dart' show DartObject; | 9 import 'package:analyzer/src/generated/constant.dart' show DartObject; |
| 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 10 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| 11 import 'package:analyzer/src/generated/java_core.dart'; | 11 import 'package:analyzer/src/generated/java_core.dart'; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 12 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/resolver.dart'; | 13 import 'package:analyzer/src/generated/resolver.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/generated/utilities_dart.dart'; | 15 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 16 import 'package:analyzer/src/task/dart.dart'; | 16 import 'package:analyzer/src/task/dart.dart'; |
| 17 import 'package:analyzer/task/model.dart' show AnalysisTarget; | |
| 18 | 17 |
| 19 /** | 18 /** |
| 20 * An element that represents a class. | 19 * An element that represents a class. |
| 21 * | 20 * |
| 22 * Clients may not extend, implement or mix-in this class. | 21 * Clients may not extend, implement or mix-in this class. |
| 23 */ | 22 */ |
| 24 abstract class ClassElement | 23 abstract class ClassElement |
| 25 implements TypeDefiningElement, TypeParameterizedElement { | 24 implements TypeDefiningElement, TypeParameterizedElement { |
| 26 /** | 25 /** |
| 27 * An empty list of class elements. | 26 * An empty list of class elements. |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 * * fields that are induced by explicit declarations of getters and setters, | 524 * * fields that are induced by explicit declarations of getters and setters, |
| 526 * and | 525 * and |
| 527 * * functions representing the initialization expression for a variable. | 526 * * functions representing the initialization expression for a variable. |
| 528 * | 527 * |
| 529 * Second, there are elements in the element model that do not have a name. | 528 * Second, there are elements in the element model that do not have a name. |
| 530 * These correspond to unnamed functions and exist in order to more accurately | 529 * These correspond to unnamed functions and exist in order to more accurately |
| 531 * represent the semantic structure of the program. | 530 * represent the semantic structure of the program. |
| 532 * | 531 * |
| 533 * Clients may not extend, implement or mix-in this class. | 532 * Clients may not extend, implement or mix-in this class. |
| 534 */ | 533 */ |
| 535 abstract class Element implements AnalysisTarget { | 534 abstract class Element { |
| 536 /** | 535 /** |
| 537 * A comparator that can be used to sort elements by their name offset. | 536 * A comparator that can be used to sort elements by their name offset. |
| 538 * Elements with a smaller offset will be sorted to be before elements with a | 537 * Elements with a smaller offset will be sorted to be before elements with a |
| 539 * larger name offset. | 538 * larger name offset. |
| 540 */ | 539 */ |
| 541 static final Comparator<Element> SORT_BY_OFFSET = | 540 static final Comparator<Element> SORT_BY_OFFSET = |
| 542 (Element firstElement, Element secondElement) => | 541 (Element firstElement, Element secondElement) => |
| 543 firstElement.nameOffset - secondElement.nameOffset; | 542 firstElement.nameOffset - secondElement.nameOffset; |
| 544 | 543 |
| 545 /** | 544 /** |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 */ | 652 */ |
| 654 int get nameLength; | 653 int get nameLength; |
| 655 | 654 |
| 656 /** | 655 /** |
| 657 * Return the offset of the name of this element in the file that contains the | 656 * Return the offset of the name of this element in the file that contains the |
| 658 * declaration of this element, or `-1` if this element is synthetic, does not | 657 * declaration of this element, or `-1` if this element is synthetic, does not |
| 659 * have a name, or otherwise does not have an offset. | 658 * have a name, or otherwise does not have an offset. |
| 660 */ | 659 */ |
| 661 int get nameOffset; | 660 int get nameOffset; |
| 662 | 661 |
| 663 @override | |
| 664 Source get source; | 662 Source get source; |
|
Brian Wilkerson
2016/02/01 15:43:20
This needs to have a doc comment, and probably oug
| |
| 665 | 663 |
| 666 /** | 664 /** |
| 667 * Return the resolved [CompilationUnit] that declares this element, or `null` | 665 * Return the resolved [CompilationUnit] that declares this element, or `null` |
| 668 * if this element is synthetic. | 666 * if this element is synthetic. |
| 669 * | 667 * |
| 670 * This method is expensive, because resolved AST might have been already | 668 * This method is expensive, because resolved AST might have been already |
| 671 * evicted from cache, so parsing and resolving will be performed. | 669 * evicted from cache, so parsing and resolving will be performed. |
| 672 */ | 670 */ |
| 673 CompilationUnit get unit; | 671 CompilationUnit get unit; |
| 674 | 672 |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1901 */ | 1899 */ |
| 1902 bool get isStatic; | 1900 bool get isStatic; |
| 1903 | 1901 |
| 1904 /** | 1902 /** |
| 1905 * Return the declared type of this variable, or `null` if the variable did | 1903 * Return the declared type of this variable, or `null` if the variable did |
| 1906 * not have a declared type (such as if it was declared using the keyword | 1904 * not have a declared type (such as if it was declared using the keyword |
| 1907 * 'var'). | 1905 * 'var'). |
| 1908 */ | 1906 */ |
| 1909 DartType get type; | 1907 DartType get type; |
| 1910 } | 1908 } |
| OLD | NEW |