public AnonymousExpression Compatible (ResolveContext ec, AnonymousExpression ae)
{
if (block.Resolved)
return this;
// TODO: Implement clone
BlockContext aec = new BlockContext (ec, block, ReturnType);
aec.CurrentAnonymousMethod = ae;
ResolveContext.Options flags = 0;
var am = this as AnonymousMethodBody;
if (ec.HasSet (ResolveContext.Options.InferReturnType) && am != null) {
am.ReturnTypeInference = new TypeInferenceContext ();
}
if (ec.IsInProbingMode)
flags |= ResolveContext.Options.ProbingMode;
if (ec.HasSet (ResolveContext.Options.FieldInitializerScope))
flags |= ResolveContext.Options.FieldInitializerScope;
if (ec.HasSet (ResolveContext.Options.ExpressionTreeConversion))
flags |= ResolveContext.Options.ExpressionTreeConversion;
aec.Set (flags);
var errors = ec.Report.Errors;
bool res = Block.Resolve (ec.CurrentBranching, aec, null);
if (aec.HasReturnLabel)
return_label = aec.ReturnLabel;
if (am != null && am.ReturnTypeInference != null) {
am.ReturnTypeInference.FixAllTypes (ec);
ReturnType = am.ReturnTypeInference.InferredTypeArguments [0];
am.ReturnTypeInference = null;
}
if (res && errors != ec.Report.Errors)
return null;
return res ? this : null;
}