@@ -1329,18 +1329,30 @@ protected virtual ParametersCompiled ResolveParameters (ResolveContext ec, TypeI
1329
1329
return Parameters ;
1330
1330
}
1331
1331
1332
- protected override Expression DoResolve ( ResolveContext ec )
1332
+ protected override Expression DoResolve ( ResolveContext rc )
1333
1333
{
1334
- var isPlayScript = ec . FileType == SourceFileType . PlayScript ;
1334
+ var isPlayScript = rc . FileType == SourceFileType . PlayScript ;
1335
1335
1336
- if ( ec . HasSet ( ResolveContext . Options . ConstantScope ) ) {
1337
- ec . Report . Error ( 1706 , loc , "Anonymous methods and lambda expressions cannot be used in the current context" ) ;
1336
+ if ( rc . HasSet ( ResolveContext . Options . ConstantScope ) ) {
1337
+ rc . Report . Error ( 1706 , loc , "Anonymous methods and lambda expressions cannot be used in the current context" ) ;
1338
1338
return null ;
1339
1339
}
1340
1340
1341
1341
//
1342
- // Set class type, set type
1342
+ // Update top-level block generated duting parsing with actual top-level block
1343
1343
//
1344
+ if ( rc . HasAny ( ResolveContext . Options . FieldInitializerScope | ResolveContext . Options . BaseInitializer ) && rc . CurrentMemberDefinition . Parent . PartialContainer . PrimaryConstructorParameters != null ) {
1345
+ var tb = rc . ConstructorBlock . ParametersBlock . TopBlock ;
1346
+ if ( Block . TopBlock != tb ) {
1347
+ Block b = Block ;
1348
+ while ( b . Parent != Block . TopBlock && b != Block . TopBlock )
1349
+ b = b . Parent ;
1350
+
1351
+ b . Parent = tb ;
1352
+ tb . IncludeBlock ( Block , Block . TopBlock ) ;
1353
+ b . ParametersBlock . TopBlock = tb ;
1354
+ }
1355
+ }
1344
1356
1345
1357
eclass = ExprClass . Value ;
1346
1358
@@ -1351,25 +1363,14 @@ protected override Expression DoResolve (ResolveContext ec)
1351
1363
//
1352
1364
type = InternalType . AnonymousMethod ;
1353
1365
1354
- if ( ! DoResolveParameters ( ec ) )
1366
+ if ( ! DoResolveParameters ( rc ) )
1355
1367
return null ;
1356
1368
1357
- //<<<<<<< HEAD
1358
- //#if !STATIC
1359
- // // FIXME: The emitted code isn't very careful about reachability
1360
- // // so, ensure we have a 'ret' at the end
1361
- // BlockContext bc = ec as BlockContext;
1362
- // if (bc != null && bc.CurrentBranching != null && bc.CurrentBranching.CurrentUsageVector.IsUnreachable)
1363
- // bc.NeedReturnLabel ();
1364
- //#endif
1365
- //
1366
1369
// Cast to Delgate for PlayScript (forces implicit conversion to Func<> or Action<> delegate types).
1367
1370
if ( isPlayScript ) {
1368
- return new Cast ( new TypeExpression ( ec . BuiltinTypes . Delegate , this . Location ) , this , this . Location ) . Resolve ( ec ) ;
1371
+ return new Cast ( new TypeExpression ( rc . BuiltinTypes . Delegate , this . Location ) , this , this . Location ) . Resolve ( rc ) ;
1369
1372
}
1370
1373
1371
- //=======
1372
- //>>>>>>> d12330eda7746321b4611865d11e932e53ac55b8
1373
1374
return this ;
1374
1375
}
1375
1376
0 commit comments