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/element/type.dart'; | 7 import 'package:analyzer/dart/element/type.dart'; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.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; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 * represent the semantic structure of the program. | 531 * represent the semantic structure of the program. |
532 * | 532 * |
533 * Clients may not extend, implement or mix-in this class. | 533 * Clients may not extend, implement or mix-in this class. |
534 */ | 534 */ |
535 abstract class Element implements AnalysisTarget { | 535 abstract class Element implements AnalysisTarget { |
536 /** | 536 /** |
537 * A comparator that can be used to sort elements by their name offset. | 537 * 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 | 538 * Elements with a smaller offset will be sorted to be before elements with a |
539 * larger name offset. | 539 * larger name offset. |
540 */ | 540 */ |
541 static final Comparator<Element> SORT_BY_OFFSET = (Element firstElement, | 541 static final Comparator<Element> SORT_BY_OFFSET = |
542 Element secondElement) => | 542 (Element firstElement, Element secondElement) => |
543 firstElement.nameOffset - secondElement.nameOffset; | 543 firstElement.nameOffset - secondElement.nameOffset; |
544 | 544 |
545 /** | 545 /** |
546 * Return the analysis context in which this element is defined. | 546 * Return the analysis context in which this element is defined. |
547 */ | 547 */ |
548 AnalysisContext get context; | 548 AnalysisContext get context; |
549 | 549 |
550 /** | 550 /** |
551 * Return the display name of this element, or `null` if this element does not | 551 * Return the display name of this element, or `null` if this element does not |
552 * have a name. | 552 * have a name. |
553 * | 553 * |
554 * In most cases the name and the display name are the same. Differences | 554 * In most cases the name and the display name are the same. Differences |
555 * though are cases such as setters where the name of some setter `set f(x)` | 555 * though are cases such as setters where the name of some setter `set f(x)` |
556 * is `f=`, instead of `f`. | 556 * is `f=`, instead of `f`. |
557 */ | 557 */ |
558 String get displayName; | 558 String get displayName; |
559 | 559 |
560 /** | 560 /** |
| 561 * Return the content of the documentation comment (including delimiters) for |
| 562 * this element, or `null` if this element does not or cannot have |
| 563 * documentation. |
| 564 */ |
| 565 String get documentationComment; |
| 566 |
| 567 /** |
561 * Return the source range of the documentation comment for this element, | 568 * Return the source range of the documentation comment for this element, |
562 * or `null` if this element does not or cannot have a documentation. | 569 * or `null` if this element does not or cannot have a documentation. |
| 570 * |
| 571 * Deprecated. Use [documentationComment] instead. |
563 */ | 572 */ |
| 573 @deprecated |
564 SourceRange get docRange; | 574 SourceRange get docRange; |
565 | 575 |
566 /** | 576 /** |
567 * Return the element that either physically or logically encloses this | 577 * Return the element that either physically or logically encloses this |
568 * element. This will be `null` if this element is a library because libraries | 578 * element. This will be `null` if this element is a library because libraries |
569 * are the top-level elements in the model. | 579 * are the top-level elements in the model. |
570 */ | 580 */ |
571 Element get enclosingElement; | 581 Element get enclosingElement; |
572 | 582 |
573 /** | 583 /** |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 680 |
671 /** | 681 /** |
672 * Return the documentation comment for this element as it appears in the | 682 * Return the documentation comment for this element as it appears in the |
673 * original source (complete with the beginning and ending delimiters), or | 683 * original source (complete with the beginning and ending delimiters), or |
674 * `null` if this element does not have a documentation comment associated | 684 * `null` if this element does not have a documentation comment associated |
675 * with it. This can be a long-running operation if the information needed to | 685 * with it. This can be a long-running operation if the information needed to |
676 * access the comment is not cached. | 686 * access the comment is not cached. |
677 * | 687 * |
678 * Throws [AnalysisException] if the documentation comment could not be | 688 * Throws [AnalysisException] if the documentation comment could not be |
679 * determined because the analysis could not be performed | 689 * determined because the analysis could not be performed |
| 690 * |
| 691 * Deprecated. Use [documentationComment] instead. |
680 */ | 692 */ |
| 693 @deprecated |
681 String computeDocumentationComment(); | 694 String computeDocumentationComment(); |
682 | 695 |
683 /** | 696 /** |
684 * Return the resolved [AstNode] node that declares this element, or `null` if | 697 * Return the resolved [AstNode] node that declares this element, or `null` if |
685 * this element is synthetic or isn't contained in a compilation unit, such as | 698 * this element is synthetic or isn't contained in a compilation unit, such as |
686 * a [LibraryElement]. | 699 * a [LibraryElement]. |
687 * | 700 * |
688 * This method is expensive, because resolved AST might be evicted from cache, | 701 * This method is expensive, because resolved AST might be evicted from cache, |
689 * so parsing and resolving will be performed. | 702 * so parsing and resolving will be performed. |
690 * | 703 * |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 */ | 2042 */ |
2030 bool get isStatic; | 2043 bool get isStatic; |
2031 | 2044 |
2032 /** | 2045 /** |
2033 * Return the declared type of this variable, or `null` if the variable did | 2046 * Return the declared type of this variable, or `null` if the variable did |
2034 * not have a declared type (such as if it was declared using the keyword | 2047 * not have a declared type (such as if it was declared using the keyword |
2035 * 'var'). | 2048 * 'var'). |
2036 */ | 2049 */ |
2037 DartType get type; | 2050 DartType get type; |
2038 } | 2051 } |
OLD | NEW |