@@ -278,7 +278,7 @@ When specifying fields in non-factory constructor then specifying factory constr
278278
279279 _assertValidFreezedConstructorUsage (
280280 constructor,
281- className: declaration.name .lexeme,
281+ className: declaration.namePart.typeName .lexeme,
282282 );
283283
284284 final excludedProperties =
@@ -299,7 +299,7 @@ When specifying fields in non-factory constructor then specifying factory constr
299299 final isEjected = unitsExcludingGeneratedFiles.any (
300300 (e) => e.declarations
301301 .whereType <ClassDeclaration >()
302- .map ((e) => e.name .lexeme)
302+ .map ((e) => e.namePart.typeName .lexeme)
303303 .contains (redirectedName),
304304 );
305305
@@ -522,7 +522,7 @@ class CopyWithTarget {
522522
523523extension on NamedType {
524524 bool isSuperMixin (ClassDeclaration declaration) =>
525- name.lexeme == '_\$ ${declaration .name .lexeme .public }' ;
525+ name.lexeme == '_\$ ${declaration .namePart . typeName .lexeme .public }' ;
526526}
527527
528528class Class {
@@ -582,7 +582,7 @@ class Class {
582582 false ;
583583 if (! has$ClassMixin) {
584584 throw InvalidGenerationSourceError (
585- 'Classes using @freezed must use `with _\$ ${declaration .name .lexeme .public }`.' ,
585+ 'Classes using @freezed must use `with _\$ ${declaration .namePart . typeName .lexeme .public }`.' ,
586586 element: declaration.declaredFragment? .element,
587587 node: declaration,
588588 );
@@ -624,7 +624,7 @@ class Class {
624624 if (cloneableProperty == null ) {
625625 throw InvalidGenerationSourceError (
626626 '''
627- The class ${declaration .name .lexeme } requested a copyWith implementation, yet the parameter `${param .name }` is not cloneable.
627+ The class ${declaration .namePart . typeName .lexeme } requested a copyWith implementation, yet the parameter `${param .name }` is not cloneable.
628628
629629To fix, either:
630630- Disable copyWith using @Freezed(copyWith: false)
@@ -669,7 +669,7 @@ To fix, either:
669669
670670 return Class (
671671 node: declaration,
672- name: declaration.name .lexeme,
672+ name: declaration.namePart.typeName .lexeme,
673673 copyWithTarget: copyWithInvocation,
674674 properties: properties,
675675 superCall: superCall,
@@ -1076,7 +1076,7 @@ To fix, either:
10761076 if (! shouldUseExtends &&
10771077 field.getter != null &&
10781078 ! field.getter! .isAbstract &&
1079- ! field.getter! .isSynthetic ) {
1079+ field.getter! .isOriginDeclaration ) {
10801080 throw InvalidGenerationSourceError (
10811081 'Getters require a MyClass._() constructor' ,
10821082 element: field,
@@ -1332,14 +1332,26 @@ extension ClassDeclarationX on ClassDeclaration {
13321332 }
13331333
13341334 Iterable <ConstructorDeclaration > get constructors {
1335- return members.whereType <ConstructorDeclaration >();
1335+ final that = body;
1336+ switch (that) {
1337+ case BlockClassBody ():
1338+ return that.members.whereType <ConstructorDeclaration >();
1339+ default :
1340+ return const [];
1341+ }
13361342 }
13371343
13381344 Iterable <(FieldDeclaration , VariableDeclaration )> get properties {
1339- return members
1340- .whereType <FieldDeclaration >()
1341- .where ((e) => ! e.isStatic)
1342- .expand ((e) => e.fields.variables.map ((f) => (e, f)));
1345+ final that = body;
1346+ switch (that) {
1347+ case BlockClassBody ():
1348+ return that.members
1349+ .whereType <FieldDeclaration >()
1350+ .where ((e) => ! e.isStatic)
1351+ .expand ((e) => e.fields.variables.map ((f) => (e, f)));
1352+ default :
1353+ return const [];
1354+ }
13431355 }
13441356
13451357 bool needsJsonSerializable (Library library) {
0 commit comments