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>
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
index 3f08723..12fe155 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
@@ -7,7 +7,6 @@
 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 @@
     // 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) {
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 41b1d1c..4253d6f 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -4293,6 +4293,9 @@
   /// 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.