public override Expression DoResolve (EmitContext ec) { // // First, resolve the expression that is used to // trigger the invocation // if (expr is BaseAccess) is_base = true; Expression old = expr; expr = expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup); if (expr == null) return null; if (!(expr is MethodGroupExpr)) { Type expr_type = expr.Type; if (expr_type != null){ bool IsDelegate = TypeManager.IsDelegateType (expr_type); if (IsDelegate) return (new DelegateInvocation ( this.expr, Arguments, loc)).Resolve (ec); } } if (!(expr is MethodGroupExpr)){ expr.Error118 (ResolveFlags.MethodGroup); return null; } // // Next, evaluate all the expressions in the argument list // if (Arguments != null){ foreach (Argument a in Arguments){ if (!a.Resolve (ec, loc)) return null; } } MethodGroupExpr mg = (MethodGroupExpr) expr; method = OverloadResolve (ec, mg, Arguments, loc); if (method == null){ Error (-6, "Could not find any applicable function for this argument list"); return null; } MethodInfo mi = method as MethodInfo; if (mi != null) { type = TypeManager.TypeToCoreType (mi.ReturnType); if (!mi.IsStatic && !mg.IsExplicitImpl && (mg.InstanceExpression == null)) SimpleName.Error_ObjectRefRequired (ec, loc, mi.Name); } if (type.IsPointer){ if (!ec.InUnsafe){ UnsafeError (loc); return null; } } // // Only base will allow this invocation to happen. // if (is_base && method.IsAbstract){ Report.Error (205, loc, "Cannot call an abstract base member: " + FullMethodDesc (method)); return null; } if ((method.Attributes & MethodAttributes.SpecialName) != 0){ if (TypeManager.IsSpecialMethod (method)) Report.Error (571, loc, method.Name + ": can not call operator or accessor"); } eclass = ExprClass.Value; return this; }