| Index: pkg/analyzer/lib/src/dart/element/element.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
|
| index 516aa1f14f06b5bfec872794a4cd30fabf0a5c73..ce19fe3fac5844cbe2a4ee9ea62f3d38dbb6499c 100644
|
| --- a/pkg/analyzer/lib/src/dart/element/element.dart
|
| +++ b/pkg/analyzer/lib/src/dart/element/element.dart
|
| @@ -1730,6 +1730,17 @@ abstract class ElementImpl implements Element {
|
| int _docRangeLength;
|
|
|
| /**
|
| + * The offset of the beginning of the element's code in the file that contains
|
| + * the element, or `null` if the element is synthetic.
|
| + */
|
| + int _codeOffset;
|
| +
|
| + /**
|
| + * The length of the element's code, or `null` if the element is synthetic.
|
| + */
|
| + int _codeLength;
|
| +
|
| + /**
|
| * Initialize a newly created element to have the given [name] at the given
|
| * [_nameOffset].
|
| */
|
| @@ -1743,6 +1754,17 @@ abstract class ElementImpl implements Element {
|
| ElementImpl.forNode(Identifier name)
|
| : this(name == null ? "" : name.name, name == null ? -1 : name.offset);
|
|
|
| + /**
|
| + * The length of the element's code, or `null` if the element is synthetic.
|
| + */
|
| + int get codeLength => _codeLength;
|
| +
|
| + /**
|
| + * The offset of the beginning of the element's code in the file that contains
|
| + * the element, or `null` if the element is synthetic.
|
| + */
|
| + int get codeOffset => _codeOffset;
|
| +
|
| @override
|
| AnalysisContext get context {
|
| if (_enclosingElement == null) {
|
| @@ -2023,6 +2045,14 @@ abstract class ElementImpl implements Element {
|
| }
|
|
|
| /**
|
| + * Set the code range for this element.
|
| + */
|
| + void setCodeRange(int offset, int length) {
|
| + _codeOffset = offset;
|
| + _codeLength = length;
|
| + }
|
| +
|
| + /**
|
| * Set the documentation comment source range for this element.
|
| */
|
| void setDocRange(int offset, int length) {
|
| @@ -3102,6 +3132,24 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
|
| nameLength = name != null ? name.length : 0;
|
|
|
| @override
|
| + int get codeLength {
|
| + if (_definingCompilationUnit is CompilationUnitElementImpl) {
|
| + return (_definingCompilationUnit as CompilationUnitElementImpl)
|
| + .codeLength;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + int get codeOffset {
|
| + if (_definingCompilationUnit is CompilationUnitElementImpl) {
|
| + return (_definingCompilationUnit as CompilationUnitElementImpl)
|
| + .codeOffset;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| CompilationUnitElement get definingCompilationUnit =>
|
| _definingCompilationUnit;
|
|
|
|
|