protected override Expression DoResolve(ResolveContext rc)
{
if (rc.HasSet(ResolveContext.Options.LockScope))
{
rc.Report.Error(1996, loc,
"The `await' operator cannot be used in the body of a lock statement");
}
if (rc.IsUnsafe)
{
rc.Report.Error(4004, loc,
"The `await' operator cannot be used in an unsafe context");
}
var bc = (BlockContext)rc;
stmt = new AwaitStatement(expr, loc);
if (!stmt.Resolve(bc))
{
return(null);
}
if (rc.HasSet(ResolveContext.Options.FinallyScope) && rc.CurrentAnonymousMethod != null)
{
var ats = (AsyncTaskStorey)rc.CurrentAnonymousMethod.Storey;
ats.HasAwaitInsideFinally = true;
}
type = stmt.ResultType;
eclass = ExprClass.Variable;
return(this);
}