@@ -276,14 +276,6 @@ class BodyBuilder extends StackListenerImpl
276
276
277
277
int functionNestingLevel = 0 ;
278
278
279
- // Set when a spread element is encountered in a collection so the collection
280
- // needs to be desugared after type inference.
281
- bool transformCollections = false ;
282
-
283
- // Set by type inference when a set literal is encountered that needs to be
284
- // transformed because the backend target does not support set literals.
285
- bool transformSetLiterals = false ;
286
-
287
279
Statement ? problemInLoopOrSwitch;
288
280
289
281
Scope ? switchScope;
@@ -806,8 +798,6 @@ class BodyBuilder extends StackListenerImpl
806
798
void inferAnnotations (TreeNode ? parent, List <Expression >? annotations) {
807
799
if (annotations != null ) {
808
800
typeInferrer.inferMetadata (this , parent, annotations);
809
- libraryBuilder.loader.transformListPostInference (annotations,
810
- transformSetLiterals, transformCollections, libraryBuilder.library);
811
801
}
812
802
}
813
803
@@ -1007,18 +997,6 @@ class BodyBuilder extends StackListenerImpl
1007
997
initializer = typeInferrer
1008
998
.inferFieldInitializer (this , fieldBuilder.builtType, initializer)
1009
999
.expression;
1010
-
1011
- if (transformCollections || transformSetLiterals) {
1012
- // Wrap the initializer in a temporary parent expression; the
1013
- // transformations need a parent relation.
1014
- Not wrapper = new Not (initializer);
1015
- libraryBuilder.loader.transformPostInference (
1016
- wrapper,
1017
- transformSetLiterals,
1018
- transformCollections,
1019
- libraryBuilder.library);
1020
- initializer = wrapper.operand;
1021
- }
1022
1000
fieldBuilder.buildBody (coreTypes, initializer);
1023
1001
}
1024
1002
} else if (! fieldBuilder.hasBodyBeenBuilt) {
@@ -1299,11 +1277,6 @@ class BodyBuilder extends StackListenerImpl
1299
1277
originParameter.type,
1300
1278
parameter.hasDeclaredInitializer);
1301
1279
originParameter.initializer = initializer..parent = originParameter;
1302
- libraryBuilder.loader.transformPostInference (
1303
- originParameter,
1304
- transformSetLiterals,
1305
- transformCollections,
1306
- libraryBuilder.library);
1307
1280
}
1308
1281
1309
1282
VariableDeclaration ? tearOffParameter =
@@ -1313,11 +1286,6 @@ class BodyBuilder extends StackListenerImpl
1313
1286
_cloner.cloneInContext (initializer! );
1314
1287
tearOffParameter.initializer = tearOffInitializer
1315
1288
..parent = tearOffParameter;
1316
- libraryBuilder.loader.transformPostInference (
1317
- tearOffParameter,
1318
- transformSetLiterals,
1319
- transformCollections,
1320
- libraryBuilder.library);
1321
1289
}
1322
1290
}
1323
1291
}
@@ -1348,8 +1316,6 @@ class BodyBuilder extends StackListenerImpl
1348
1316
! (builder.function.asyncMarker == AsyncMarker .Async &&
1349
1317
builder.function.futureValueType == null ),
1350
1318
"No future value type computed." );
1351
- libraryBuilder.loader.transformPostInference (body, transformSetLiterals,
1352
- transformCollections, libraryBuilder.library);
1353
1319
}
1354
1320
1355
1321
if (builder.returnType is ! OmittedTypeBuilder ) {
@@ -1846,8 +1812,6 @@ class BodyBuilder extends StackListenerImpl
1846
1812
"not returning anything different." );
1847
1813
1848
1814
performBacklogComputations (allowFurtherDelays: false );
1849
- libraryBuilder.loader.transformPostInference (fakeReturn,
1850
- transformSetLiterals, transformCollections, libraryBuilder.library);
1851
1815
1852
1816
return fakeReturn.expression! ;
1853
1817
}
@@ -2164,8 +2128,6 @@ class BodyBuilder extends StackListenerImpl
2164
2128
}
2165
2129
}
2166
2130
setParents (constructor.initializers, constructor);
2167
- libraryBuilder.loader.transformListPostInference (constructor.initializers,
2168
- transformSetLiterals, transformCollections, libraryBuilder.library);
2169
2131
if (body == null ) {
2170
2132
/// >If a generative constructor c is not a redirecting constructor
2171
2133
/// >and no body is provided, then c implicitly has an empty body {}.
@@ -3949,7 +3911,6 @@ class BodyBuilder extends StackListenerImpl
3949
3911
Object ? variableOrExpression = pop ();
3950
3912
exitLocalScope ();
3951
3913
3952
- transformCollections = true ;
3953
3914
List <VariableDeclaration > variables =
3954
3915
_buildForLoopVariableDeclarations (variableOrExpression)! ;
3955
3916
typeInferrer.assignedVariables.pushNode (assignedVariablesNodeInfo);
@@ -6303,7 +6264,6 @@ class BodyBuilder extends StackListenerImpl
6303
6264
"Unexpected pattern in control flow if: ${condition .pattern }." );
6304
6265
Token ifToken = pop () as Token ;
6305
6266
6306
- transformCollections = true ;
6307
6267
TreeNode node;
6308
6268
if (entry is MapLiteralEntry ) {
6309
6269
node = forest.createIfMapEntry (
@@ -6348,7 +6308,6 @@ class BodyBuilder extends StackListenerImpl
6348
6308
"Unexpected pattern in control flow if: ${condition .pattern }." );
6349
6309
Token ifToken = pop () as Token ;
6350
6310
6351
- transformCollections = true ;
6352
6311
TreeNode node;
6353
6312
if (thenEntry is MapLiteralEntry ) {
6354
6313
if (elseEntry is MapLiteralEntry ) {
@@ -6417,7 +6376,6 @@ class BodyBuilder extends StackListenerImpl
6417
6376
void handleSpreadExpression (Token spreadToken) {
6418
6377
debugEvent ("SpreadExpression" );
6419
6378
Object ? expression = pop ();
6420
- transformCollections = true ;
6421
6379
push (forest.createSpreadElement (
6422
6380
offsetForToken (spreadToken), toValue (expression),
6423
6381
isNullAware: spreadToken.lexeme == '...?' ));
@@ -6837,7 +6795,6 @@ class BodyBuilder extends StackListenerImpl
6837
6795
Object ? lvalue = pop (); // lvalue
6838
6796
exitLocalScope ();
6839
6797
6840
- transformCollections = true ;
6841
6798
ForInElements elements =
6842
6799
_computeForInElements (forToken, inToken, lvalue, null );
6843
6800
typeInferrer.assignedVariables.pushNode (assignedVariablesNodeInfo);
0 commit comments