mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Deprecate 'Directive.element2', use 'element' instead.
Change-Id: I2326b43381d1d3f84d74f69409bc688516f6a0d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262500 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
d643bcf9c7
commit
8a5725ad38
|
@ -342,7 +342,7 @@ class ImportElementsComputer {
|
||||||
/// [importedElements]. They will match if they import the same library using
|
/// [importedElements]. They will match if they import the same library using
|
||||||
/// the same prefix.
|
/// the same prefix.
|
||||||
bool _matches(ImportDirective import, ImportedElements importedElements) {
|
bool _matches(ImportDirective import, ImportedElements importedElements) {
|
||||||
var importElement = import.element2;
|
var importElement = import.element;
|
||||||
if (importElement == null) {
|
if (importElement == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ConvertToPackageImport extends CorrectionProducer {
|
||||||
targetNode = targetNode.parent!;
|
targetNode = targetNode.parent!;
|
||||||
}
|
}
|
||||||
if (targetNode is ImportDirective) {
|
if (targetNode is ImportDirective) {
|
||||||
final elementUri = targetNode.element2?.uri;
|
final elementUri = targetNode.element?.uri;
|
||||||
if (elementUri is! DirectiveUriWithSource) {
|
if (elementUri is! DirectiveUriWithSource) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ConvertToRelativeImport extends CorrectionProducer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore if invalid URI.
|
// Ignore if invalid URI.
|
||||||
final elementUri = targetNode.element2?.uri;
|
final elementUri = targetNode.element?.uri;
|
||||||
if (elementUri is! DirectiveUriWithSource) {
|
if (elementUri is! DirectiveUriWithSource) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ImportAddShow extends CorrectionProducer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// prepare whole import namespace
|
// prepare whole import namespace
|
||||||
var importElement = importDirective.element2;
|
var importElement = importDirective.element;
|
||||||
if (importElement == null) {
|
if (importElement == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ Element? getExportedElement(LibraryElement? library, String name) {
|
||||||
LibraryImportElement? getImportElement(SimpleIdentifier prefixNode) {
|
LibraryImportElement? getImportElement(SimpleIdentifier prefixNode) {
|
||||||
var parent = prefixNode.parent;
|
var parent = prefixNode.parent;
|
||||||
if (parent is ImportDirective) {
|
if (parent is ImportDirective) {
|
||||||
return parent.element2;
|
return parent.element;
|
||||||
}
|
}
|
||||||
return _getImportElementInfo(prefixNode);
|
return _getImportElementInfo(prefixNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,7 +558,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor<void> with OutputUtils {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
_handleUriReference(node.uri, node.element2?.exportedLibrary);
|
_handleUriReference(node.uri, node.element?.exportedLibrary);
|
||||||
|
|
||||||
super.visitExportDirective(node);
|
super.visitExportDirective(node);
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor<void> with OutputUtils {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
_handleUriReference(node.uri, node.element2?.importedLibrary);
|
_handleUriReference(node.uri, node.element?.importedLibrary);
|
||||||
|
|
||||||
// prefix
|
// prefix
|
||||||
var prefixIdentifier = node.prefix;
|
var prefixIdentifier = node.prefix;
|
||||||
|
|
|
@ -58,7 +58,7 @@ class AstWriter extends UnifyingAstVisitor with TreeWriter {
|
||||||
properties['element'] = node.declaredElement;
|
properties['element'] = node.declaredElement;
|
||||||
properties['keyword'] = node.keyword;
|
properties['keyword'] = node.keyword;
|
||||||
} else if (node is ExportDirective) {
|
} else if (node is ExportDirective) {
|
||||||
properties['element'] = node.element2;
|
properties['element'] = node.element;
|
||||||
} else if (node is FieldDeclaration) {
|
} else if (node is FieldDeclaration) {
|
||||||
properties['static keyword'] = node.staticKeyword;
|
properties['static keyword'] = node.staticKeyword;
|
||||||
} else if (node is FormalParameter) {
|
} else if (node is FormalParameter) {
|
||||||
|
@ -85,14 +85,14 @@ class AstWriter extends UnifyingAstVisitor with TreeWriter {
|
||||||
} else if (node is GenericFunctionType) {
|
} else if (node is GenericFunctionType) {
|
||||||
properties['type'] = node.type;
|
properties['type'] = node.type;
|
||||||
} else if (node is ImportDirective) {
|
} else if (node is ImportDirective) {
|
||||||
properties['element'] = node.element2;
|
properties['element'] = node.element;
|
||||||
} else if (node is IndexExpression) {
|
} else if (node is IndexExpression) {
|
||||||
properties['static element'] = node.staticElement;
|
properties['static element'] = node.staticElement;
|
||||||
properties['static type'] = node.staticType;
|
properties['static type'] = node.staticType;
|
||||||
} else if (node is InstanceCreationExpression) {
|
} else if (node is InstanceCreationExpression) {
|
||||||
properties['static type'] = node.staticType;
|
properties['static type'] = node.staticType;
|
||||||
} else if (node is LibraryDirective) {
|
} else if (node is LibraryDirective) {
|
||||||
properties['element'] = node.element2;
|
properties['element'] = node.element;
|
||||||
} else if (node is MethodDeclaration) {
|
} else if (node is MethodDeclaration) {
|
||||||
properties['declaredElement'] = node.declaredElement;
|
properties['declaredElement'] = node.declaredElement;
|
||||||
properties['external keyword'] = node.externalKeyword;
|
properties['external keyword'] = node.externalKeyword;
|
||||||
|
@ -103,9 +103,9 @@ class AstWriter extends UnifyingAstVisitor with TreeWriter {
|
||||||
properties['static invoke type'] = node.staticInvokeType;
|
properties['static invoke type'] = node.staticInvokeType;
|
||||||
properties['static type'] = node.staticType;
|
properties['static type'] = node.staticType;
|
||||||
} else if (node is PartDirective) {
|
} else if (node is PartDirective) {
|
||||||
properties['element'] = node.element2;
|
properties['element'] = node.element;
|
||||||
} else if (node is PartOfDirective) {
|
} else if (node is PartOfDirective) {
|
||||||
properties['element'] = node.element2;
|
properties['element'] = node.element;
|
||||||
} else if (node is PostfixExpression) {
|
} else if (node is PostfixExpression) {
|
||||||
properties['static element'] = node.staticElement;
|
properties['static element'] = node.staticElement;
|
||||||
properties['static type'] = node.staticType;
|
properties['static type'] = node.staticType;
|
||||||
|
|
|
@ -133,7 +133,7 @@ extension CompilationUnitExtension on CompilationUnit {
|
||||||
extension DirectiveExtensions on Directive {
|
extension DirectiveExtensions on Directive {
|
||||||
/// If the target imports or exports a [LibraryElement], returns it.
|
/// If the target imports or exports a [LibraryElement], returns it.
|
||||||
LibraryElement? get referencedLibrary {
|
LibraryElement? get referencedLibrary {
|
||||||
final element = element2;
|
final element = this.element;
|
||||||
if (element is LibraryExportElement) {
|
if (element is LibraryExportElement) {
|
||||||
return element.exportedLibrary;
|
return element.exportedLibrary;
|
||||||
} else if (element is LibraryImportElement) {
|
} else if (element is LibraryImportElement) {
|
||||||
|
@ -156,13 +156,13 @@ extension DirectiveExtensions on Directive {
|
||||||
DirectiveUri? get referencedUri {
|
DirectiveUri? get referencedUri {
|
||||||
final self = this;
|
final self = this;
|
||||||
if (self is AugmentationImportDirective) {
|
if (self is AugmentationImportDirective) {
|
||||||
return self.element2?.uri;
|
return self.element?.uri;
|
||||||
} else if (self is ExportDirective) {
|
} else if (self is ExportDirective) {
|
||||||
return self.element2?.uri;
|
return self.element?.uri;
|
||||||
} else if (self is ImportDirective) {
|
} else if (self is ImportDirective) {
|
||||||
return self.element2?.uri;
|
return self.element?.uri;
|
||||||
} else if (self is PartDirective) {
|
} else if (self is PartDirective) {
|
||||||
return self.element2?.uri;
|
return self.element?.uri;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,6 +236,6 @@ void f() {
|
||||||
|
|
||||||
void _createRefactoring(String search) {
|
void _createRefactoring(String search) {
|
||||||
var directive = findNode.import(search);
|
var directive = findNode.import(search);
|
||||||
createRenameRefactoringForElement(directive.element2);
|
createRenameRefactoringForElement(directive.element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
## 5.2.0-dev
|
## 5.2.0-dev
|
||||||
* Deprecated `Element.enclosingElement3`, use `enclosingElement` instead.
|
* Deprecated `Element.enclosingElement3`, use `enclosingElement` instead.
|
||||||
|
* Deprecated `Directive.element2`, use `element` instead.
|
||||||
|
|
||||||
## 5.1.0
|
## 5.1.0
|
||||||
* Deprecated `AstNode.name2`, use `name` instead.
|
* Deprecated `AstNode.name2`, use `name` instead.
|
||||||
|
|
|
@ -696,6 +696,10 @@ abstract class AugmentationImportDirective implements UriBasedDirective {
|
||||||
/// The token representing the 'augment' keyword.
|
/// The token representing the 'augment' keyword.
|
||||||
Token get augmentKeyword;
|
Token get augmentKeyword;
|
||||||
|
|
||||||
|
@override
|
||||||
|
AugmentationImportElement? get element;
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
@override
|
@override
|
||||||
AugmentationImportElement? get element2;
|
AugmentationImportElement? get element2;
|
||||||
|
|
||||||
|
@ -1754,6 +1758,11 @@ abstract class DefaultFormalParameter implements FormalParameter {
|
||||||
abstract class Directive implements AnnotatedNode {
|
abstract class Directive implements AnnotatedNode {
|
||||||
/// Return the element associated with this directive, or `null` if the AST
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
/// structure has not been resolved.
|
/// structure has not been resolved.
|
||||||
|
Element? get element;
|
||||||
|
|
||||||
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
|
/// structure has not been resolved.
|
||||||
|
@Deprecated('Use element instead')
|
||||||
Element? get element2;
|
Element? get element2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1939,6 +1948,12 @@ abstract class ExportDirective implements NamespaceDirective {
|
||||||
/// Return the element associated with this directive, or `null` if the AST
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
/// structure has not been resolved.
|
/// structure has not been resolved.
|
||||||
@override
|
@override
|
||||||
|
LibraryExportElement? get element;
|
||||||
|
|
||||||
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
|
/// structure has not been resolved.
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
LibraryExportElement? get element2;
|
LibraryExportElement? get element2;
|
||||||
|
|
||||||
/// The token representing the 'export' keyword.
|
/// The token representing the 'export' keyword.
|
||||||
|
@ -3090,6 +3105,12 @@ abstract class ImportDirective implements NamespaceDirective {
|
||||||
/// Return the element associated with this directive, or `null` if the AST
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
/// structure has not been resolved.
|
/// structure has not been resolved.
|
||||||
@override
|
@override
|
||||||
|
LibraryImportElement? get element;
|
||||||
|
|
||||||
|
/// Return the element associated with this directive, or `null` if the AST
|
||||||
|
/// structure has not been resolved.
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
LibraryImportElement? get element2;
|
LibraryImportElement? get element2;
|
||||||
|
|
||||||
/// The token representing the 'import' keyword.
|
/// The token representing the 'import' keyword.
|
||||||
|
@ -4022,6 +4043,10 @@ abstract class ParenthesizedPattern implements DartPattern {
|
||||||
///
|
///
|
||||||
/// Clients may not extend, implement or mix-in this class.
|
/// Clients may not extend, implement or mix-in this class.
|
||||||
abstract class PartDirective implements UriBasedDirective {
|
abstract class PartDirective implements UriBasedDirective {
|
||||||
|
@override
|
||||||
|
PartElement? get element;
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
@override
|
@override
|
||||||
PartElement? get element2;
|
PartElement? get element2;
|
||||||
|
|
||||||
|
|
|
@ -688,7 +688,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
final element = node.element2;
|
final element = node.element;
|
||||||
recordUriReference(element?.exportedLibrary, node.uri);
|
recordUriReference(element?.exportedLibrary, node.uri);
|
||||||
super.visitExportDirective(node);
|
super.visitExportDirective(node);
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
final element = node.element2;
|
final element = node.element;
|
||||||
recordUriReference(element?.importedLibrary, node.uri);
|
recordUriReference(element?.importedLibrary, node.uri);
|
||||||
super.visitImportDirective(node);
|
super.visitImportDirective(node);
|
||||||
}
|
}
|
||||||
|
@ -793,7 +793,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitPartDirective(PartDirective node) {
|
void visitPartDirective(PartDirective node) {
|
||||||
final partElement = node.element2;
|
final partElement = node.element;
|
||||||
if (partElement is PartElement) {
|
if (partElement is PartElement) {
|
||||||
final partElementUri = partElement.uri;
|
final partElementUri = partElement.uri;
|
||||||
if (partElementUri is DirectiveUriWithUnit) {
|
if (partElementUri is DirectiveUriWithUnit) {
|
||||||
|
|
|
@ -192,7 +192,7 @@ class LibraryAnalyzer {
|
||||||
|
|
||||||
for (var directive in libraryUnit.directives) {
|
for (var directive in libraryUnit.directives) {
|
||||||
if (directive is PartDirective) {
|
if (directive is PartDirective) {
|
||||||
final elementUri = directive.element2?.uri;
|
final elementUri = directive.element?.uri;
|
||||||
if (elementUri is DirectiveUriWithUnit) {
|
if (elementUri is DirectiveUriWithUnit) {
|
||||||
final partUnit = elementToUnit[elementUri.unit];
|
final partUnit = elementToUnit[elementUri.unit];
|
||||||
if (partUnit != null) {
|
if (partUnit != null) {
|
||||||
|
|
|
@ -619,7 +619,7 @@ class Search {
|
||||||
if (unitResult is ResolvedUnitResult) {
|
if (unitResult is ResolvedUnitResult) {
|
||||||
CompilationUnit unit = unitResult.unit;
|
CompilationUnit unit = unitResult.unit;
|
||||||
for (Directive directive in unit.directives) {
|
for (Directive directive in unit.directives) {
|
||||||
if (directive is PartOfDirective && directive.element2 == element) {
|
if (directive is PartOfDirective && directive.element == element) {
|
||||||
results.add(
|
results.add(
|
||||||
SearchResult._(
|
SearchResult._(
|
||||||
unit.declaredElement!,
|
unit.declaredElement!,
|
||||||
|
|
|
@ -917,10 +917,14 @@ class AugmentationImportDirectiveImpl extends UriBasedDirectiveImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AugmentationImportElement? get element2 {
|
AugmentationImportElement? get element {
|
||||||
return super.element2 as AugmentationImportElement?;
|
return super.element as AugmentationImportElement?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
|
AugmentationImportElement? get element2 => element;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Token get endToken => semicolon;
|
Token get endToken => semicolon;
|
||||||
|
|
||||||
|
@ -3573,13 +3577,17 @@ abstract class DirectiveImpl extends AnnotatedNodeImpl implements Directive {
|
||||||
required super.metadata,
|
required super.metadata,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Element? get element => _element;
|
||||||
|
|
||||||
/// Set the element associated with this directive to be the given [element].
|
/// Set the element associated with this directive to be the given [element].
|
||||||
set element(Element? element) {
|
set element(Element? element) {
|
||||||
_element = element;
|
_element = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
@override
|
@override
|
||||||
Element? get element2 => _element;
|
Element? get element2 => element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A do statement.
|
/// A do statement.
|
||||||
|
@ -4094,10 +4102,14 @@ class ExportDirectiveImpl extends NamespaceDirectiveImpl
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LibraryExportElementImpl? get element2 {
|
LibraryExportElementImpl? get element {
|
||||||
return super.element2 as LibraryExportElementImpl?;
|
return super.element as LibraryExportElementImpl?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
|
LibraryExportElementImpl? get element2 => element;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Token get firstTokenAfterCommentAndMetadata => exportKeyword;
|
Token get firstTokenAfterCommentAndMetadata => exportKeyword;
|
||||||
|
|
||||||
|
@ -6963,7 +6975,11 @@ class ImportDirectiveImpl extends NamespaceDirectiveImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LibraryImportElement? get element2 => super.element2 as LibraryImportElement?;
|
LibraryImportElement? get element => super.element as LibraryImportElement?;
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
|
LibraryImportElement? get element2 => element;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Token get firstTokenAfterCommentAndMetadata => importKeyword;
|
Token get firstTokenAfterCommentAndMetadata => importKeyword;
|
||||||
|
@ -9580,10 +9596,14 @@ class PartDirectiveImpl extends UriBasedDirectiveImpl implements PartDirective {
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PartElement? get element2 {
|
PartElement? get element {
|
||||||
return super.element2 as PartElement?;
|
return super.element as PartElement?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated('Use element instead')
|
||||||
|
@override
|
||||||
|
PartElement? get element2 => element;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Token get endToken => semicolon;
|
Token get endToken => semicolon;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Element? visitExportDirective(ExportDirective node) {
|
Element? visitExportDirective(ExportDirective node) {
|
||||||
return node.element2;
|
return node.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -135,12 +135,12 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
} else if (parent is LibraryIdentifier) {
|
} else if (parent is LibraryIdentifier) {
|
||||||
var grandParent = parent.parent;
|
var grandParent = parent.parent;
|
||||||
if (grandParent is PartOfDirective) {
|
if (grandParent is PartOfDirective) {
|
||||||
var element = grandParent.element2;
|
var element = grandParent.element;
|
||||||
if (element is LibraryElement) {
|
if (element is LibraryElement) {
|
||||||
return element.definingCompilationUnit;
|
return element.definingCompilationUnit;
|
||||||
}
|
}
|
||||||
} else if (grandParent is LibraryDirective) {
|
} else if (grandParent is LibraryDirective) {
|
||||||
return grandParent.element2;
|
return grandParent.element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return node.writeOrReadElement;
|
return node.writeOrReadElement;
|
||||||
|
@ -148,7 +148,7 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Element? visitImportDirective(ImportDirective node) {
|
Element? visitImportDirective(ImportDirective node) {
|
||||||
return node.element2;
|
return node.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -163,7 +163,7 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Element? visitLibraryDirective(LibraryDirective node) {
|
Element? visitLibraryDirective(LibraryDirective node) {
|
||||||
return node.element2;
|
return node.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -183,7 +183,7 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Element? visitPartOfDirective(PartOfDirective node) {
|
Element? visitPartOfDirective(PartOfDirective node) {
|
||||||
return node.element2;
|
return node.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -205,11 +205,11 @@ class _ElementMapper extends GeneralizingAstVisitor<Element> {
|
||||||
Element? visitStringLiteral(StringLiteral node) {
|
Element? visitStringLiteral(StringLiteral node) {
|
||||||
final parent = node.parent;
|
final parent = node.parent;
|
||||||
if (parent is ExportDirective) {
|
if (parent is ExportDirective) {
|
||||||
return parent.element2?.exportedLibrary;
|
return parent.element?.exportedLibrary;
|
||||||
} else if (parent is ImportDirective) {
|
} else if (parent is ImportDirective) {
|
||||||
return parent.element2?.importedLibrary;
|
return parent.element?.importedLibrary;
|
||||||
} else if (parent is PartDirective) {
|
} else if (parent is PartDirective) {
|
||||||
final elementUri = parent.element2?.uri;
|
final elementUri = parent.element?.uri;
|
||||||
if (elementUri is DirectiveUriWithUnit) {
|
if (elementUri is DirectiveUriWithUnit) {
|
||||||
return elementUri.unit;
|
return elementUri.unit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ Element? getElementOfNode(AstNode? node) {
|
||||||
if (node is SimpleIdentifier && element is PrefixElement) {
|
if (node is SimpleIdentifier && element is PrefixElement) {
|
||||||
var parent = node.parent;
|
var parent = node.parent;
|
||||||
if (parent is ImportDirective) {
|
if (parent is ImportDirective) {
|
||||||
element = parent.element2;
|
element = parent.element;
|
||||||
} else {
|
} else {
|
||||||
element = _getImportElementInfo(node);
|
element = _getImportElementInfo(node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitAugmentationImportDirective(AugmentationImportDirective node) {
|
void visitAugmentationImportDirective(AugmentationImportDirective node) {
|
||||||
final element = node.element2;
|
final element = node.element;
|
||||||
if (element is AugmentationImportElementImpl) {
|
if (element is AugmentationImportElementImpl) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
var element = node.element2;
|
var element = node.element;
|
||||||
if (element is LibraryExportElementImpl) {
|
if (element is LibraryExportElementImpl) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
@ -810,7 +810,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
var element = node.element2;
|
var element = node.element;
|
||||||
if (element is LibraryImportElementImpl) {
|
if (element is LibraryImportElementImpl) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitLibraryAugmentationDirective(LibraryAugmentationDirective node) {
|
void visitLibraryAugmentationDirective(LibraryAugmentationDirective node) {
|
||||||
final element = node.element2;
|
final element = node.element;
|
||||||
if (element is LibraryOrAugmentationElementImpl) {
|
if (element is LibraryOrAugmentationElementImpl) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
@ -884,7 +884,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
@override
|
@override
|
||||||
void visitLibraryDirective(LibraryDirective node) {
|
void visitLibraryDirective(LibraryDirective node) {
|
||||||
++_libraryDirectiveIndex;
|
++_libraryDirectiveIndex;
|
||||||
var element = node.element2;
|
var element = node.element;
|
||||||
if (element is LibraryElementImpl && _libraryDirectiveIndex == 1) {
|
if (element is LibraryElementImpl && _libraryDirectiveIndex == 1) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitPartDirective(PartDirective node) {
|
void visitPartDirective(PartDirective node) {
|
||||||
var element = node.element2;
|
var element = node.element;
|
||||||
if (element is PartElementImpl) {
|
if (element is PartElementImpl) {
|
||||||
_setOrCreateMetadataElements(element, node.metadata);
|
_setOrCreateMetadataElements(element, node.metadata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
_deprecatedVerifier.importDirective(node);
|
_deprecatedVerifier.importDirective(node);
|
||||||
var importElement = node.element2;
|
var importElement = node.element;
|
||||||
if (importElement != null &&
|
if (importElement != null &&
|
||||||
importElement.prefix is DeferredImportElementPrefix) {
|
importElement.prefix is DeferredImportElementPrefix) {
|
||||||
_checkForLoadLibraryFunction(node, importElement);
|
_checkForLoadLibraryFunction(node, importElement);
|
||||||
|
@ -1073,7 +1073,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var importElement = node.element2;
|
var importElement = node.element;
|
||||||
if (importElement == null) {
|
if (importElement == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1095,7 +1095,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
||||||
void _checkForInternalExport(ExportDirective node) {
|
void _checkForInternalExport(ExportDirective node) {
|
||||||
if (!_inPublicPackageApi) return;
|
if (!_inPublicPackageApi) return;
|
||||||
|
|
||||||
var libraryElement = node.element2?.exportedLibrary;
|
var libraryElement = node.element?.exportedLibrary;
|
||||||
if (libraryElement == null) return;
|
if (libraryElement == null) return;
|
||||||
if (libraryElement.hasInternal) {
|
if (libraryElement.hasInternal) {
|
||||||
_errorReporter.reportErrorForNode(
|
_errorReporter.reportErrorForNode(
|
||||||
|
@ -1104,7 +1104,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
||||||
[libraryElement.displayName]);
|
[libraryElement.displayName]);
|
||||||
}
|
}
|
||||||
var exportNamespace =
|
var exportNamespace =
|
||||||
NamespaceBuilder().createExportNamespaceForDirective(node.element2!);
|
NamespaceBuilder().createExportNamespaceForDirective(node.element!);
|
||||||
exportNamespace.definedNames.forEach((String name, Element element) {
|
exportNamespace.definedNames.forEach((String name, Element element) {
|
||||||
if (element.hasInternal) {
|
if (element.hasInternal) {
|
||||||
_errorReporter.reportErrorForNode(
|
_errorReporter.reportErrorForNode(
|
||||||
|
@ -1932,7 +1932,7 @@ class _InvalidAccessVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyImport(ImportDirective node) {
|
void verifyImport(ImportDirective node) {
|
||||||
var element = node.element2?.importedLibrary;
|
var element = node.element?.importedLibrary;
|
||||||
if (_hasInternal(element) &&
|
if (_hasInternal(element) &&
|
||||||
!_isLibraryInWorkspacePackage(element!.library)) {
|
!_isLibraryInWorkspacePackage(element!.library)) {
|
||||||
// The only way for an import directive's URI to have a `null`
|
// The only way for an import directive's URI to have a `null`
|
||||||
|
|
|
@ -47,7 +47,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
final exportElement = node.element2;
|
final exportElement = node.element;
|
||||||
if (exportElement != null) {
|
if (exportElement != null) {
|
||||||
// The element is null when the URI is invalid.
|
// The element is null when the URI is invalid.
|
||||||
LibraryElement? library = exportElement.exportedLibrary;
|
LibraryElement? library = exportElement.exportedLibrary;
|
||||||
|
@ -62,7 +62,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
final importElement = node.element2;
|
final importElement = node.element;
|
||||||
if (importElement != null) {
|
if (importElement != null) {
|
||||||
// The element is null when the URI is invalid, but not when the URI is
|
// The element is null when the URI is invalid, but not when the URI is
|
||||||
// valid but refers to a non-existent file.
|
// valid but refers to a non-existent file.
|
||||||
|
|
|
@ -30,7 +30,7 @@ abstract class BaseDeprecatedMemberUseVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
void exportDirective(ExportDirective node) {
|
void exportDirective(ExportDirective node) {
|
||||||
_checkForDeprecated(node.element2?.exportedLibrary, node);
|
_checkForDeprecated(node.element?.exportedLibrary, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void functionExpressionInvocation(FunctionExpressionInvocation node) {
|
void functionExpressionInvocation(FunctionExpressionInvocation node) {
|
||||||
|
@ -42,7 +42,7 @@ abstract class BaseDeprecatedMemberUseVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
void importDirective(ImportDirective node) {
|
void importDirective(ImportDirective node) {
|
||||||
_checkForDeprecated(node.element2?.importedLibrary, node);
|
_checkForDeprecated(node.element?.importedLibrary, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void indexExpression(IndexExpression node) {
|
void indexExpression(IndexExpression node) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ class ImportsVerifier {
|
||||||
final importsWithLibraries = <_ImportDirective>[];
|
final importsWithLibraries = <_ImportDirective>[];
|
||||||
for (Directive directive in node.directives) {
|
for (Directive directive in node.directives) {
|
||||||
if (directive is ImportDirective) {
|
if (directive is ImportDirective) {
|
||||||
var libraryElement = directive.element2?.importedLibrary;
|
var libraryElement = directive.element?.importedLibrary;
|
||||||
if (libraryElement == null) {
|
if (libraryElement == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ class ImportsVerifier {
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
ImportDirective unusedImport = _unusedImports[i];
|
ImportDirective unusedImport = _unusedImports[i];
|
||||||
// Check that the imported URI exists and isn't dart:core
|
// Check that the imported URI exists and isn't dart:core
|
||||||
var importElement = unusedImport.element2;
|
var importElement = unusedImport.element;
|
||||||
if (importElement != null) {
|
if (importElement != null) {
|
||||||
var libraryElement = importElement.importedLibrary;
|
var libraryElement = importElement.importedLibrary;
|
||||||
if (libraryElement == null ||
|
if (libraryElement == null ||
|
||||||
|
@ -784,7 +784,7 @@ extension on Map<ImportDirective, Namespace> {
|
||||||
Namespace? computeNamespace(ImportDirective importDirective) {
|
Namespace? computeNamespace(ImportDirective importDirective) {
|
||||||
var namespace = this[importDirective];
|
var namespace = this[importDirective];
|
||||||
if (namespace == null) {
|
if (namespace == null) {
|
||||||
var importElement = importDirective.element2;
|
var importElement = importDirective.element;
|
||||||
if (importElement != null) {
|
if (importElement != null) {
|
||||||
namespace = importElement.namespace;
|
namespace = importElement.namespace;
|
||||||
this[importDirective] = namespace;
|
this[importDirective] = namespace;
|
||||||
|
|
|
@ -192,7 +192,7 @@ class ElementResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
var exportElement = node.element2;
|
var exportElement = node.element;
|
||||||
if (exportElement != null) {
|
if (exportElement != null) {
|
||||||
// The element is null when the URI is invalid
|
// The element is null when the URI is invalid
|
||||||
// TODO(brianwilkerson) Figure out whether the element can ever be
|
// TODO(brianwilkerson) Figure out whether the element can ever be
|
||||||
|
@ -244,7 +244,7 @@ class ElementResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var importElement = node.element2;
|
var importElement = node.element;
|
||||||
if (importElement != null) {
|
if (importElement != null) {
|
||||||
// The element is null when the URI is invalid
|
// The element is null when the URI is invalid
|
||||||
var library = importElement.importedLibrary;
|
var library = importElement.importedLibrary;
|
||||||
|
|
|
@ -629,7 +629,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
var exportElement = node.element2;
|
var exportElement = node.element;
|
||||||
if (exportElement != null) {
|
if (exportElement != null) {
|
||||||
var exportedLibrary = exportElement.exportedLibrary;
|
var exportedLibrary = exportElement.exportedLibrary;
|
||||||
_checkForAmbiguousExport(node, exportElement, exportedLibrary);
|
_checkForAmbiguousExport(node, exportElement, exportedLibrary);
|
||||||
|
@ -867,7 +867,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
var importElement = node.element2;
|
var importElement = node.element;
|
||||||
if (node.prefix != null) {
|
if (node.prefix != null) {
|
||||||
_checkForBuiltInIdentifierAsName(node.prefix!.token,
|
_checkForBuiltInIdentifierAsName(node.prefix!.token,
|
||||||
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME);
|
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME);
|
||||||
|
@ -2547,7 +2547,7 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var element = node.element2!;
|
var element = node.element!;
|
||||||
// TODO(scheglov) Expose from ExportElement.
|
// TODO(scheglov) Expose from ExportElement.
|
||||||
var namespace =
|
var namespace =
|
||||||
NamespaceBuilder().createExportNamespaceForDirective(element);
|
NamespaceBuilder().createExportNamespaceForDirective(element);
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
|
||||||
_container.documentationComment = getCommentNodeRawText(
|
_container.documentationComment = getCommentNodeRawText(
|
||||||
firstDirective.documentationComment,
|
firstDirective.documentationComment,
|
||||||
);
|
);
|
||||||
var firstDirectiveMetadata = firstDirective.element2?.metadata;
|
var firstDirectiveMetadata = firstDirective.element?.metadata;
|
||||||
if (firstDirectiveMetadata != null) {
|
if (firstDirectiveMetadata != null) {
|
||||||
_container.metadata = firstDirectiveMetadata;
|
_container.metadata = firstDirectiveMetadata;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||||
// We might have already accessed metadata flags, e.g. `hasDeprecated`,
|
// We might have already accessed metadata flags, e.g. `hasDeprecated`,
|
||||||
// before we finished metadata resolution, during `PrefixScope` building.
|
// before we finished metadata resolution, during `PrefixScope` building.
|
||||||
// So, these flags are not accurate anymore, and we need to reset them.
|
// So, these flags are not accurate anymore, and we need to reset them.
|
||||||
node.element2!.resetMetadataFlags();
|
node.element!.resetMetadataFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -373,7 +373,7 @@ export 'dart:math' hide pi;
|
||||||
await assertNoErrorsInCode('''
|
await assertNoErrorsInCode('''
|
||||||
export 'dart:math';
|
export 'dart:math';
|
||||||
''');
|
''');
|
||||||
expect(findNode.export('dart:math').element2!.exportedLibrary!.name,
|
expect(findNode.export('dart:math').element!.exportedLibrary!.name,
|
||||||
'dart.math');
|
'dart.math');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ import 'dart:math';
|
||||||
''', [
|
''', [
|
||||||
error(HintCode.UNUSED_IMPORT, 7, 11),
|
error(HintCode.UNUSED_IMPORT, 7, 11),
|
||||||
]);
|
]);
|
||||||
expect(findNode.import('dart:math').element2!.importedLibrary!.name,
|
expect(findNode.import('dart:math').element!.importedLibrary!.name,
|
||||||
'dart.math');
|
'dart.math');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ import 'dart:math' as p;
|
||||||
''', [
|
''', [
|
||||||
error(HintCode.UNUSED_IMPORT, 7, 11),
|
error(HintCode.UNUSED_IMPORT, 7, 11),
|
||||||
]);
|
]);
|
||||||
expect(findNode.import('dart:math').element2!.importedLibrary!.name,
|
expect(findNode.import('dart:math').element!.importedLibrary!.name,
|
||||||
'dart.math');
|
'dart.math');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ import 'lib1.dart' show v1, v2;
|
||||||
]);
|
]);
|
||||||
var importedVariables = findNode
|
var importedVariables = findNode
|
||||||
.import('lib1.dart')
|
.import('lib1.dart')
|
||||||
.element2!
|
.element!
|
||||||
.importedLibrary!
|
.importedLibrary!
|
||||||
.definingCompilationUnit
|
.definingCompilationUnit
|
||||||
.topLevelVariables;
|
.topLevelVariables;
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
_checkResolved(node, node.element2, (node) => node is LibraryExportElement);
|
_checkResolved(node, node.element, (node) => node is LibraryExportElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -111,7 +111,7 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
// Not sure how to test the combinators given that it isn't an error if the
|
// Not sure how to test the combinators given that it isn't an error if the
|
||||||
// names are not defined.
|
// names are not defined.
|
||||||
_checkResolved(node, node.element2, (node) => node is LibraryImportElement);
|
_checkResolved(node, node.element, (node) => node is LibraryImportElement);
|
||||||
var prefix = node.prefix;
|
var prefix = node.prefix;
|
||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -136,7 +136,7 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitLibraryDirective(LibraryDirective node) {
|
void visitLibraryDirective(LibraryDirective node) {
|
||||||
_checkResolved(node, node.element2, (node) => node is LibraryElement);
|
_checkResolved(node, node.element, (node) => node is LibraryElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -147,12 +147,12 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
|
||||||
@override
|
@override
|
||||||
void visitPartDirective(PartDirective node) {
|
void visitPartDirective(PartDirective node) {
|
||||||
_checkResolved(
|
_checkResolved(
|
||||||
node, node.element2, (node) => node is CompilationUnitElement);
|
node, node.element, (node) => node is CompilationUnitElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitPartOfDirective(PartOfDirective node) {
|
void visitPartOfDirective(PartOfDirective node) {
|
||||||
_checkResolved(node, node.element2, (node) => node is LibraryElement);
|
_checkResolved(node, node.element, (node) => node is LibraryElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -3295,7 +3295,7 @@ main() {
|
||||||
await resolveTestFile();
|
await resolveTestFile();
|
||||||
expect(result.errors, isNotEmpty);
|
expect(result.errors, isNotEmpty);
|
||||||
|
|
||||||
final import = findNode.import('dart:math').element2!;
|
final import = findNode.import('dart:math').element!;
|
||||||
|
|
||||||
var pRef = findNode.simple('p(a)');
|
var pRef = findNode.simple('p(a)');
|
||||||
assertElement(pRef, import.prefix);
|
assertElement(pRef, import.prefix);
|
||||||
|
@ -3504,7 +3504,7 @@ main() {
|
||||||
await resolveTestFile();
|
await resolveTestFile();
|
||||||
expect(result.errors, isNotEmpty);
|
expect(result.errors, isNotEmpty);
|
||||||
|
|
||||||
final import = findNode.import('dart:math').element2!;
|
final import = findNode.import('dart:math').element!;
|
||||||
|
|
||||||
var invocation = findNode.methodInvocation('p(a)');
|
var invocation = findNode.methodInvocation('p(a)');
|
||||||
expect(invocation.staticType, isDynamicType);
|
expect(invocation.staticType, isDynamicType);
|
||||||
|
@ -3677,7 +3677,7 @@ main() {
|
||||||
await resolveTestFile();
|
await resolveTestFile();
|
||||||
expect(result.errors, isNotEmpty);
|
expect(result.errors, isNotEmpty);
|
||||||
|
|
||||||
final import = findNode.import('a.dart').element2!;
|
final import = findNode.import('a.dart').element!;
|
||||||
var tElement = import.importedLibrary!.publicNamespace.get('T');
|
var tElement = import.importedLibrary!.publicNamespace.get('T');
|
||||||
|
|
||||||
var prefixedName = findNode.prefixed('p.T');
|
var prefixedName = findNode.prefixed('p.T');
|
||||||
|
@ -3745,7 +3745,7 @@ main() {
|
||||||
await resolveTestFile();
|
await resolveTestFile();
|
||||||
expect(result.errors, isNotEmpty);
|
expect(result.errors, isNotEmpty);
|
||||||
|
|
||||||
final import = findNode.import('a.dart').element2!;
|
final import = findNode.import('a.dart').element!;
|
||||||
var tElement = import.importedLibrary!.publicNamespace.get('T');
|
var tElement = import.importedLibrary!.publicNamespace.get('T');
|
||||||
|
|
||||||
var prefixedName = findNode.prefixed('p.T');
|
var prefixedName = findNode.prefixed('p.T');
|
||||||
|
|
|
@ -3570,7 +3570,7 @@ var v = 0
|
||||||
LibraryImportElement _getImportElement(
|
LibraryImportElement _getImportElement(
|
||||||
CompilationUnit unit, int directiveIndex) {
|
CompilationUnit unit, int directiveIndex) {
|
||||||
var import = unit.directives[directiveIndex] as ImportDirective;
|
var import = unit.directives[directiveIndex] as ImportDirective;
|
||||||
return import.element2!;
|
return import.element!;
|
||||||
}
|
}
|
||||||
|
|
||||||
Source _getImportSource(CompilationUnit unit, int directiveIndex) {
|
Source _getImportSource(CompilationUnit unit, int directiveIndex) {
|
||||||
|
|
|
@ -2234,7 +2234,7 @@ main() {
|
||||||
V(); // nq
|
V(); // nq
|
||||||
}
|
}
|
||||||
''');
|
''');
|
||||||
final importElement = findNode.import('show V').element2!;
|
final importElement = findNode.import('show V').element!;
|
||||||
CompilationUnitElement impUnit =
|
CompilationUnitElement impUnit =
|
||||||
importElement.importedLibrary!.definingCompilationUnit;
|
importElement.importedLibrary!.definingCompilationUnit;
|
||||||
TopLevelVariableElement variable = impUnit.topLevelVariables[0];
|
TopLevelVariableElement variable = impUnit.topLevelVariables[0];
|
||||||
|
|
|
@ -130,7 +130,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('AugmentationImportDirective');
|
_writeln('AugmentationImportDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('ExportDirective');
|
_writeln('ExportDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('ImportDirective');
|
_writeln('ImportDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,7 +818,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('LibraryAugmentationDirective');
|
_writeln('LibraryAugmentationDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('LibraryDirective');
|
_writeln('LibraryDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,7 +977,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('PartDirective');
|
_writeln('PartDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,7 +986,7 @@ class ResolvedAstPrinter extends ThrowingAstVisitor<void> {
|
||||||
_writeln('PartOfDirective');
|
_writeln('PartOfDirective');
|
||||||
_withIndent(() {
|
_withIndent(() {
|
||||||
_writeNamedChildEntities(node);
|
_writeNamedChildEntities(node);
|
||||||
_writeElement('element', node.element2);
|
_writeElement('element', node.element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitExportDirective(ExportDirective node) {
|
void visitExportDirective(ExportDirective node) {
|
||||||
var exportElement = node.element2;
|
var exportElement = node.element;
|
||||||
if (exportElement != null) {
|
if (exportElement != null) {
|
||||||
Element? libraryElement = exportElement.exportedLibrary;
|
Element? libraryElement = exportElement.exportedLibrary;
|
||||||
_addUriDirectiveRegion(node, libraryElement);
|
_addUriDirectiveRegion(node, libraryElement);
|
||||||
|
@ -419,7 +419,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitImportDirective(ImportDirective node) {
|
void visitImportDirective(ImportDirective node) {
|
||||||
var importElement = node.element2;
|
var importElement = node.element;
|
||||||
if (importElement != null) {
|
if (importElement != null) {
|
||||||
Element? libraryElement = importElement.importedLibrary;
|
Element? libraryElement = importElement.importedLibrary;
|
||||||
_addUriDirectiveRegion(node, libraryElement);
|
_addUriDirectiveRegion(node, libraryElement);
|
||||||
|
@ -437,7 +437,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitLibraryDirective(LibraryDirective node) {
|
void visitLibraryDirective(LibraryDirective node) {
|
||||||
computer._addRegionForNode(node.name2, node.element2);
|
computer._addRegionForNode(node.name2, node.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -448,7 +448,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitPartDirective(PartDirective node) {
|
void visitPartDirective(PartDirective node) {
|
||||||
final element = node.element2;
|
final element = node.element;
|
||||||
if (element is PartElement) {
|
if (element is PartElement) {
|
||||||
final uri = element.uri;
|
final uri = element.uri;
|
||||||
if (uri is DirectiveUriWithUnit) {
|
if (uri is DirectiveUriWithUnit) {
|
||||||
|
@ -471,7 +471,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitPartOfDirective(PartOfDirective node) {
|
void visitPartOfDirective(PartOfDirective node) {
|
||||||
computer._addRegionForNode(node.libraryName ?? node.uri, node.element2);
|
computer._addRegionForNode(node.libraryName ?? node.uri, node.element);
|
||||||
super.visitPartOfDirective(node);
|
super.visitPartOfDirective(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue