@@ -770,10 +770,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
770770 required LibraryFragmentImpl unitElement,
771771 }) : _libraryBuilder = libraryBuilder,
772772 _unitElement = unitElement,
773- _enclosingContext = _EnclosingContext (
774- instanceElementBuilder: null ,
775- fragment: unitElement,
776- );
773+ _enclosingContext = _EnclosingContext (fragment: unitElement);
777774
778775 Linker get _linker => _libraryBuilder.linker;
779776
@@ -853,10 +850,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
853850
854851 _libraryBuilder.addTopFragment (_unitElement, fragment);
855852
856- var holder = _EnclosingContext (
857- instanceElementBuilder: null ,
858- fragment: fragment,
859- );
853+ var holder = _EnclosingContext (fragment: fragment);
860854 _withEnclosing (holder, () {
861855 node.typeParameters? .accept (this );
862856 node.members.accept (this );
@@ -894,10 +888,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
894888
895889 _libraryBuilder.addTopFragment (_unitElement, fragment);
896890
897- var holder = _EnclosingContext (
898- instanceElementBuilder: null ,
899- fragment: fragment,
900- );
891+ var holder = _EnclosingContext (fragment: fragment);
901892 _withEnclosing (holder, () {
902893 var typeParameters = node.typeParameters;
903894 if (typeParameters != null ) {
@@ -943,13 +934,11 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
943934 node.declaredFragment = fragment;
944935 _linker.elementNodes[fragment] = node;
945936
946- var reference = Reference .root (); // TODO(scheglov): remove this
947937 var parentFragment = _enclosingContext.fragment;
948938 _libraryBuilder.addFragmentChild (parentFragment, fragment);
949939 (parentFragment as InterfaceFragmentImpl ).addConstructor (fragment);
950940
951941 _buildExecutableElementChildren (
952- reference: reference,
953942 fragment: fragment,
954943 formalParameters: node.parameters,
955944 );
@@ -974,10 +963,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
974963
975964 _libraryBuilder.addTopFragment (_unitElement, fragment);
976965
977- var holder = _EnclosingContext (
978- instanceElementBuilder: null ,
979- fragment: fragment,
980- );
966+ var holder = _EnclosingContext (fragment: fragment);
981967
982968 // Build fields for all enum constants.
983969 var constants = node.constants;
@@ -1167,10 +1153,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
11671153
11681154 _libraryBuilder.addTopFragment (_unitElement, fragment);
11691155
1170- var holder = _EnclosingContext (
1171- instanceElementBuilder: null ,
1172- fragment: fragment,
1173- );
1156+ var holder = _EnclosingContext (fragment: fragment);
11741157 _withEnclosing (holder, () {
11751158 node.typeParameters? .accept (this );
11761159 node.members.accept (this );
@@ -1204,10 +1187,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
12041187
12051188 _libraryBuilder.addTopFragment (_unitElement, fragment);
12061189
1207- var holder = _EnclosingContext (
1208- instanceElementBuilder: null ,
1209- fragment: fragment,
1210- );
1190+ var holder = _EnclosingContext (fragment: fragment);
12111191 _withEnclosing (holder, () {
12121192 node.typeParameters? .accept (this );
12131193 _builtRepresentationDeclaration (
@@ -1291,10 +1271,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
12911271 node.declaredFragment = fragment;
12921272
12931273 // TODO(scheglov): check that we don't set reference for parameters
1294- var holder = _EnclosingContext (
1295- instanceElementBuilder: null ,
1296- fragment: fragment,
1297- );
1274+ var holder = _EnclosingContext (fragment: fragment);
12981275 _withEnclosing (holder, () {
12991276 var formalParameters = node.parameters;
13001277 if (formalParameters != null ) {
@@ -1375,7 +1352,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
13751352 _linker.elementNodes[executableFragment] = node;
13761353
13771354 _buildExecutableElementChildren (
1378- reference: Reference .root (), // TODO(scheglov): remove this
13791355 fragment: executableFragment,
13801356 formalParameters: functionExpression.parameters,
13811357 typeParameters: functionExpression.typeParameters,
@@ -1401,10 +1377,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
14011377
14021378 _libraryBuilder.addTopFragment (_unitElement, fragment);
14031379
1404- var holder = _EnclosingContext (
1405- instanceElementBuilder: null ,
1406- fragment: fragment,
1407- );
1380+ var holder = _EnclosingContext (fragment: fragment);
14081381 _withEnclosing (holder, () {
14091382 node.typeParameters? .accept (this );
14101383 node.returnType? .accept (this );
@@ -1446,10 +1419,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
14461419
14471420 node.declaredFragment = fragment;
14481421
1449- var holder = _EnclosingContext (
1450- instanceElementBuilder: null ,
1451- fragment: fragment,
1452- );
1422+ var holder = _EnclosingContext (fragment: fragment);
14531423 _withEnclosing (holder, () {
14541424 var formalParameters = node.parameters;
14551425 formalParameters.accept (this );
@@ -1473,10 +1443,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
14731443 node.declaredFragment = fragment;
14741444 _linker.elementNodes[fragment] = node;
14751445
1476- var holder = _EnclosingContext (
1477- instanceElementBuilder: null ,
1478- fragment: fragment,
1479- );
1446+ var holder = _EnclosingContext (fragment: fragment);
14801447 _withEnclosing (holder, () {
14811448 var formalParameters = node.parameters;
14821449 formalParameters.accept (this );
@@ -1509,10 +1476,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
15091476
15101477 _libraryBuilder.addTopFragment (_unitElement, fragment);
15111478
1512- var holder = _EnclosingContext (
1513- instanceElementBuilder: null ,
1514- fragment: fragment,
1515- );
1479+ var holder = _EnclosingContext (fragment: fragment);
15161480 _withEnclosing (holder, () {
15171481 node.typeParameters? .accept (this );
15181482 });
@@ -1546,7 +1510,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
15461510 void visitMethodDeclaration (covariant MethodDeclarationImpl node) {
15471511 var nameToken = node.name;
15481512
1549- Reference reference;
15501513 ExecutableFragmentImpl executableFragment;
15511514 if (node.isGetter) {
15521515 var fragment = GetterFragmentImpl (
@@ -1557,7 +1520,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
15571520 fragment.isAugmentation = node.augmentKeyword != null ;
15581521 fragment.isStatic = node.isStatic;
15591522
1560- reference = Reference .root (); // TODO(scheglov): remove this
15611523 var parentFragment = _enclosingContext.fragment;
15621524 fragment.enclosingFragment = parentFragment;
15631525 _libraryBuilder.addFragmentChild (parentFragment, fragment);
@@ -1572,7 +1534,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
15721534 fragment.isAugmentation = node.augmentKeyword != null ;
15731535 fragment.isStatic = node.isStatic;
15741536
1575- reference = Reference .root (); // TODO(scheglov): remove this
15761537 var parentFragment = _enclosingContext.fragment;
15771538 fragment.enclosingFragment = parentFragment;
15781539 _libraryBuilder.addFragmentChild (parentFragment, fragment);
@@ -1587,7 +1548,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
15871548 fragment.isAugmentation = node.augmentKeyword != null ;
15881549 fragment.isStatic = node.isStatic;
15891550
1590- reference = Reference .root (); // TODO(scheglov): remove this
15911551 var parentFragment = _enclosingContext.fragment;
15921552 fragment.enclosingFragment = parentFragment;
15931553 _libraryBuilder.addFragmentChild (parentFragment, fragment);
@@ -1606,7 +1566,6 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
16061566 _linker.elementNodes[executableFragment] = node;
16071567
16081568 _buildExecutableElementChildren (
1609- reference: reference,
16101569 fragment: executableFragment,
16111570 formalParameters: node.parameters,
16121571 typeParameters: node.typeParameters,
@@ -1633,10 +1592,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
16331592
16341593 _libraryBuilder.addTopFragment (_unitElement, fragment);
16351594
1636- var holder = _EnclosingContext (
1637- instanceElementBuilder: null ,
1638- fragment: fragment,
1639- );
1595+ var holder = _EnclosingContext (fragment: fragment);
16401596 _withEnclosing (holder, () {
16411597 node.typeParameters? .accept (this );
16421598 node.members.accept (this );
@@ -1752,10 +1708,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
17521708 node.declaredFragment = fragment;
17531709
17541710 // TODO(scheglov): check that we don't set reference for parameters
1755- var holder = _EnclosingContext (
1756- instanceElementBuilder: null ,
1757- fragment: fragment,
1758- );
1711+ var holder = _EnclosingContext (fragment: fragment);
17591712 _withEnclosing (holder, () {
17601713 var formalParameters = node.parameters;
17611714 if (formalParameters != null ) {
@@ -1848,13 +1801,11 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
18481801 }
18491802
18501803 void _buildExecutableElementChildren ({
1851- required Reference reference,
18521804 required ExecutableFragmentImpl fragment,
18531805 FormalParameterList ? formalParameters,
18541806 TypeParameterList ? typeParameters,
18551807 }) {
18561808 var holder = _EnclosingContext (
1857- instanceElementBuilder: null ,
18581809 fragment: fragment,
18591810 hasDefaultFormalParameters: true ,
18601811 );
@@ -1968,15 +1919,13 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
19681919}
19691920
19701921class _EnclosingContext {
1971- final Object ? instanceElementBuilder; // TODO(scheglov): remove it
19721922 final FragmentImpl fragment;
19731923 final bool hasDefaultFormalParameters;
19741924
19751925 final List <FormalParameterFragmentImpl > parameters = [];
19761926 final List <TypeParameterFragmentImpl > typeParameters = [];
19771927
19781928 _EnclosingContext ({
1979- required this .instanceElementBuilder,
19801929 required this .fragment,
19811930 this .hasDefaultFormalParameters = false ,
19821931 });
0 commit comments