From 2ea9813e2ef2b5bd5328e8b64422fd072f7ba5f4 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Tue, 18 Mar 2025 14:34:05 -0700 Subject: [PATCH] Remove some usages of analyzer private types and APIs --- lib/src/model/canonicalization.dart | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/src/model/canonicalization.dart b/lib/src/model/canonicalization.dart index 81b459a67e..5aa5b02c4d 100644 --- a/lib/src/model/canonicalization.dart +++ b/lib/src/model/canonicalization.dart @@ -92,7 +92,7 @@ final class _Canonicalization { Element2? ancestor = element; while (ancestor != null) { if (ancestor is! ElementImpl2) { - if (ancestor is LibraryElementImpl) { + if (ancestor is LibraryElement2) { components.insert(0, ancestor.identifier); } else { throw Exception('${ancestor.runtimeType} is not an ElementImpl2'); @@ -100,13 +100,7 @@ final class _Canonicalization { ancestor = ancestor.enclosingElement2; } else { components.insert(0, ancestor.identifier); - if (ancestor is LocalFunctionElementImpl) { - ancestor = (ancestor.wrappedElement.enclosingElement2 - as ExecutableElementImpl) - .element; - } else { - ancestor = ancestor.enclosingElement2; - } + ancestor = ancestor.enclosingElement2; } } var buffer = StringBuffer();