public override bool Resolve(BlockContext ec)
{
TypeExpression storey_type_expr = new TypeExpression(host.Definition, loc);
List <Expression> init = null;
if (host.hoisted_this != null)
{
init = new List <Expression> (host.hoisted_params == null ? 1 : host.HoistedParameters.Count + 1);
HoistedThis ht = host.hoisted_this;
FieldExpr from = new FieldExpr(ht.Field, loc);
from.InstanceExpression = CompilerGeneratedThis.Instance;
init.Add(new ElementInitializer(ht.Field.Name, from, loc));
}
if (host.hoisted_params != null)
{
if (init == null)
{
init = new List <Expression> (host.HoistedParameters.Count);
}
for (int i = 0; i < host.hoisted_params.Count; ++i)
{
HoistedParameter hp = (HoistedParameter)host.hoisted_params [i];
HoistedParameter hp_cp = (HoistedParameter)host.hoisted_params_copy [i];
FieldExpr from = new FieldExpr(hp_cp.Field, loc);
from.InstanceExpression = CompilerGeneratedThis.Instance;
init.Add(new ElementInitializer(hp.Field.Name, from, loc));
}
}
if (init != null)
{
new_storey = new NewInitialize(storey_type_expr, null,
new CollectionOrObjectInitializers(init, loc), loc);
}
else
{
new_storey = new New(storey_type_expr, null, loc);
}
new_storey = new_storey.Resolve(ec);
if (new_storey != null)
{
new_storey = Convert.ImplicitConversionRequired(ec, new_storey, host_method.MemberType, loc);
}
var t = ec.Module.PredefinedTypes.Interlocked.Resolve(loc);
if (t != null)
{
var p = new ParametersImported(
new[] {
new ParameterData(null, Parameter.Modifier.REF),
new ParameterData(null, Parameter.Modifier.NONE),
new ParameterData(null, Parameter.Modifier.NONE)
},
new[] {
TypeManager.int32_type, TypeManager.int32_type, TypeManager.int32_type
},
false);
var f = new MemberFilter("CompareExchange", 0, MemberKind.Method, p, TypeManager.int32_type);
TypeManager.int_interlocked_compare_exchange = TypeManager.GetPredefinedMethod(t, f, loc);
}
ec.CurrentBranching.CurrentUsageVector.Goto();
return(true);
}