@@ -1634,23 +1634,38 @@ class AstBuilder extends StackListener {
1634
1634
Token typeKeyword, Token endToken) {
1635
1635
final implementsClause =
1636
1636
pop (NullValues .IdentifierList ) as ImplementsClauseImpl ? ;
1637
- final representation = pop (const NullValue <RepresentationDeclarationImpl >())
1637
+ var representation = pop (const NullValue <RepresentationDeclarationImpl >())
1638
1638
as RepresentationDeclarationImpl ? ;
1639
1639
final constKeyword = pop () as Token ? ;
1640
1640
1641
1641
if (enableInlineClass) {
1642
1642
final builder = _classLikeBuilder as _ExtensionTypeDeclarationBuilder ;
1643
- if (representation != null ) {
1644
- // TODO(scheglov): Handle missing primary constructor.
1645
- declarations.add (
1646
- builder.build (
1647
- typeKeyword: typeKeyword,
1648
- constKeyword: constKeyword,
1649
- representation: representation,
1650
- implementsClause: implementsClause,
1651
- ),
1643
+ if (representation == null ) {
1644
+ var leftParenthesis = parser.rewriter.insertParens (builder.name, true );
1645
+ var typeName = leftParenthesis.next! ;
1646
+ var rightParenthesis = leftParenthesis.endGroup! ;
1647
+ var fieldName = parser.rewriter.insertSyntheticIdentifier (typeName);
1648
+ representation = RepresentationDeclarationImpl (
1649
+ constructorName: null ,
1650
+ leftParenthesis: leftParenthesis,
1651
+ fieldMetadata: [],
1652
+ fieldType: NamedTypeImpl (
1653
+ importPrefix: null ,
1654
+ name2: typeName,
1655
+ question: null ,
1656
+ typeArguments: null ),
1657
+ fieldName: fieldName,
1658
+ rightParenthesis: rightParenthesis,
1652
1659
);
1653
1660
}
1661
+ declarations.add (
1662
+ builder.build (
1663
+ typeKeyword: typeKeyword,
1664
+ constKeyword: constKeyword,
1665
+ representation: representation,
1666
+ implementsClause: implementsClause,
1667
+ ),
1668
+ );
1654
1669
} else {
1655
1670
_reportFeatureNotEnabled (
1656
1671
feature: ExperimentalFeatures .inline_class,
0 commit comments