Skip to content

Commit 3c60075

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Switch away from TypeAliasElement.aliasedElement
Change-Id: I2ddc4c1a850871d63c0b12f0a14293fff888d523 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441440 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 43b8d45 commit 3c60075

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ class DeclarationHelper {
709709
TypeAliasElement alias,
710710
ImportData? importData,
711711
) {
712-
var aliasedElement = alias.aliasedElement;
712+
var aliasedElement = alias.aliasedType.element;
713713
if (aliasedElement is ClassElement) {
714714
_suggestConstructors(
715715
aliasedElement.constructors,

pkg/analysis_server/lib/src/services/correction/dart/convert_to_function_declaration.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ class ConvertToFunctionDeclaration extends ResolvedCorrectionProducer {
8383
DartType? returnType;
8484
List<FormalParameterElement?>? parameterList;
8585
if (type case NamedType(
86-
element: TypeAliasElement(:GenericFunctionTypeElement aliasedElement),
86+
element: TypeAliasElement(:FunctionType aliasedType),
8787
)) {
88-
returnType = aliasedElement.returnType;
89-
parameterList = aliasedElement.formalParameters;
88+
returnType = aliasedType.returnType;
89+
parameterList = aliasedType.formalParameters;
9090
} else if (type is GenericFunctionType) {
9191
returnType = type.returnType?.type;
9292
parameterList =

pkg/analyzer_plugin/lib/src/utilities/completion/suggestion_builder.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/element/element.dart';
6+
import 'package:analyzer/dart/element/type.dart';
67
import 'package:analyzer/file_system/file_system.dart';
78
import 'package:analyzer_plugin/protocol/protocol_common.dart'
89
hide Element, ElementKind;
@@ -139,13 +140,10 @@ class SuggestionBuilderImpl implements SuggestionBuilder {
139140
var type = element.type;
140141
return type.getDisplayString();
141142
} else if (element is TypeAliasElement) {
142-
var aliasedElement = element.aliasedElement;
143-
if (aliasedElement is GenericFunctionTypeElement) {
144-
var returnType = aliasedElement.returnType;
145-
return returnType.getDisplayString();
146-
} else {
147-
return null;
143+
if (element.aliasedType case FunctionType aliasedType) {
144+
return aliasedType.returnType.getDisplayString();
148145
}
146+
return null;
149147
} else {
150148
return null;
151149
}

0 commit comments

Comments
 (0)