Add PrefixFragment without implementing it

This is to make sure that we're in agreement about the changes we
discussed yesterday and to capture them before I forgot.

Change-Id: I629bc97122c688f70af701b1c6c6e32801a77311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379222
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson
2024-08-07 17:28:43 +00:00
committed by Commit Queue
parent d9b5eec829
commit d0b0e84027
2 changed files with 31 additions and 5 deletions
+23 -5
View File
@@ -54,7 +54,6 @@ import 'package:analyzer/dart/element/element.dart'
ElementAnnotation,
ElementKind,
ElementLocation,
ImportElementPrefix,
LibraryLanguageVersion,
NamespaceCombinator;
import 'package:analyzer/dart/element/nullability_suffix.dart';
@@ -839,10 +838,10 @@ abstract class LibraryImport {
/// The [Namespace] that this directive contributes to the containing library.
Namespace get namespace;
/// The prefix that was specified as part of the import directive.
/// The prefix fragment that was specified as part of the import directive.
///
/// Returns `null` if there was no prefix specified.
ImportElementPrefix? get prefix;
PrefixFragment? get prefix2;
/// The interpretation of the URI specified in the directive.
DirectiveUri get uri;
@@ -919,11 +918,13 @@ abstract class PatternVariableElement2 implements LocalVariableElement2 {
/// A prefix used to import one or more libraries into another library.
///
/// Clients may not extend, implement or mix-in this class.
abstract class PrefixElement2 implements Element2 {
/// The library that encloses this element.
abstract class PrefixElement2 implements Element2, _Fragmented {
@override
LibraryElement2 get enclosingElement2;
@override
PrefixFragment get firstFragment;
/// The imports that share this prefix.
List<LibraryImport> get imports2;
@@ -938,6 +939,23 @@ abstract class PrefixElement2 implements Element2 {
Scope get scope;
}
/// The portion of a [PrefixElement2] contributed by a single declaration.
///
/// Clients may not extend, implement or mix-in this class.
abstract class PrefixFragment implements Fragment {
@override
PrefixElement2 get element;
@override
LibraryFragment? get enclosingFragment;
@override
PrefixFragment? get nextFragment;
@override
PrefixFragment? get previousFragment;
}
abstract class PromotableElement2 implements VariableElement2 {}
abstract class PromotableFragment implements VariableFragment {}
@@ -5272,6 +5272,10 @@ class LibraryImportElementImpl extends _ExistingElementImpl
return Namespace.EMPTY;
}
@override
PrefixFragment? get prefix2 =>
throw UnimplementedError('Prefix fragments are not yet supported');
@override
bool operator ==(Object other) {
return identical(this, other);
@@ -6983,6 +6987,10 @@ class PrefixElementImpl extends _ExistingElementImpl
return _enclosingElement3 as CompilationUnitElementImpl;
}
@override
PrefixFragment get firstFragment =>
throw UnimplementedError('Prefix fragments are not yet supported');
@override
List<LibraryImportElementImpl> get imports {
return enclosingElement.libraryImports