protected override Expression DoResolve (ResolveContext rc)
{
if (rc.HasSet (ResolveContext.Options.ConstantScope)) {
rc.Report.Error (1706, loc, "Anonymous methods and lambda expressions cannot be used in the current context");
return null;
}
//
// Update top-level block generated duting parsing with actual top-level block
//
if (rc.HasAny (ResolveContext.Options.FieldInitializerScope | ResolveContext.Options.BaseInitializer) && rc.CurrentMemberDefinition.Parent.PartialContainer.PrimaryConstructorParameters != null) {
var tb = rc.ConstructorBlock.ParametersBlock.TopBlock;
if (Block.TopBlock != tb) {
Block b = Block;
while (b.Parent != Block.TopBlock && b != Block.TopBlock)
b = b.Parent;
b.Parent = tb;
tb.IncludeBlock (Block, Block.TopBlock);
b.ParametersBlock.TopBlock = tb;
}
}
eclass = ExprClass.Value;
//
// This hack means `The type is not accessible
// anywhere', we depend on special conversion
// rules.
//
type = InternalType.AnonymousMethod;
if (!DoResolveParameters (rc))
return null;
return this;
}