This repository was archived by the owner on Feb 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
pkgs/_analyzer_cfe_macros Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -502,7 +502,10 @@ T? convert<T>(Object? object) => switch (object) {
502502 front_end.TypedefReference o =>
503503 dart_model.TypedefReference (name: convert (o.name)) as T ,
504504 front_end.TypeLiteral o =>
505- dart_model.TypeLiteral (typeAnnotation: convert (o.typeAnnotation)) as T ,
505+ dart_model.TypeLiteral (
506+ typeAnnotation: convertToTypeAnnotation (o.typeAnnotation),
507+ )
508+ as T ,
506509 front_end.TypeReference o => dart_model.TypeReference () as T ,
507510 front_end.UnaryExpression o =>
508511 dart_model.UnaryExpression (
Original file line number Diff line number Diff line change @@ -81,4 +81,28 @@ void main() {
8181 });
8282 });
8383 });
84+
85+ test ('converts a type literal' , () {
86+ final invocation = TypeLiteral (NamedTypeAnnotation (TestClassReference ()));
87+
88+ Scope .query.run (() {
89+ expect (convert <Object >(invocation), < String , Object ? > {
90+ 'typeAnnotation' : {
91+ 'type' : 'NamedTypeAnnotation' ,
92+ 'value' : {
93+ 'reference' : {
94+ 'type' : 'ClassReference' ,
95+ 'value' : {'name' : 'Test' },
96+ },
97+ 'typeArguments' : < Object > [],
98+ },
99+ },
100+ });
101+ });
102+ });
103+ }
104+
105+ class TestClassReference implements ClassReference {
106+ @override
107+ String get name => 'Test' ;
84108}
You can’t perform that action at this time.
0 commit comments