@@ -477,26 +477,44 @@ class ClassElementImpl extends ClassOrMixinElementImpl
477477 ConstructorMember .from (superclassConstructor, superType);
478478
479479 var isNamed = superclassConstructor.name.isNotEmpty;
480- implicitConstructor.constantInitializers = [
481- SuperConstructorInvocationImpl (
482- superKeyword: Tokens .super_ (),
483- period: isNamed ? Tokens .period () : null ,
484- constructorName: isNamed
485- ? (SimpleIdentifierImpl (
486- StringToken (TokenType .STRING , superclassConstructor.name, - 1 ),
487- )..element = superclassConstructor.asElement2)
488- : null ,
489- argumentList: ArgumentListImpl (
490- leftParenthesis: Tokens .openParenthesis (),
491- arguments: argumentsForSuperInvocation,
492- rightParenthesis: Tokens .closeParenthesis (),
493- ),
494- )..element = superclassConstructor.asElement2,
495- ];
480+ var superInvocation = SuperConstructorInvocationImpl (
481+ superKeyword: Tokens .super_ (),
482+ period: isNamed ? Tokens .period () : null ,
483+ constructorName: isNamed
484+ ? (SimpleIdentifierImpl (
485+ StringToken (TokenType .STRING , superclassConstructor.name, - 1 ),
486+ )..element = superclassConstructor.asElement2)
487+ : null ,
488+ argumentList: ArgumentListImpl (
489+ leftParenthesis: Tokens .openParenthesis (),
490+ arguments: argumentsForSuperInvocation,
491+ rightParenthesis: Tokens .closeParenthesis (),
492+ ),
493+ );
494+ _linkTokens (superInvocation);
495+ superInvocation.element = superclassConstructor.asElement2;
496+ implicitConstructor.constantInitializers = [superInvocation];
496497
497498 return implicitConstructor;
498499 }).toList (growable: false );
499500 }
501+
502+ static void _linkTokens (AstNode parent) {
503+ Token ? lastToken;
504+ for (var entity in parent.childEntities) {
505+ switch (entity) {
506+ case Token token:
507+ lastToken? .next = token;
508+ token.previous = lastToken;
509+ lastToken = token;
510+ case AstNode node:
511+ _linkTokens (node);
512+ lastToken? .next = node.beginToken;
513+ node.beginToken.previous = lastToken;
514+ lastToken = node.endToken;
515+ }
516+ }
517+ }
500518}
501519
502520class ClassElementImpl2 extends InterfaceElementImpl2 implements ClassElement2 {
0 commit comments