Update NamespaceDirective.uriElement to return LibraryElement?

Change-Id: Ief36ea6d6dc0fab4a1f6976e034418695bd2e128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196043
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2021-04-20 16:27:49 +00:00 committed by commit-bot@chromium.org
parent 351de9e165
commit af4b4d9575
2 changed files with 4 additions and 2 deletions

View file

@ -7,7 +7,6 @@ import 'package:analysis_server/src/protocol_server.dart'
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
/// A contributor that produces suggestions based on the members of a library
/// when the completion is in a show or hide combinator of an import or export.
@ -22,7 +21,7 @@ class CombinatorContributor extends DartCompletionContributor {
// Build the list of suggestions.
var directive = node.thisOrAncestorOfType<NamespaceDirective>();
if (directive is NamespaceDirective) {
var library = directive.uriElement as LibraryElement?;
var library = directive.uriElement;
if (library != null) {
var existingNames = _getCombinatorNames(directive);
for (var element in library.exportNamespace.definedNames.values) {

View file

@ -4293,6 +4293,9 @@ abstract class NamespaceDirective implements UriBasedDirective {
/// Set the semicolon terminating the directive to the given [token].
@Deprecated('Clients should not build AST manually')
set semicolon(Token token);
@override
LibraryElement? get uriElement;
}
/// The "native" clause in an class declaration.