Exemple #1
0
        protected override Expression DoResolve(ResolveContext ec)
        {
            TypeSpec del_type = InstanceExpr.Type;

            if (del_type == null)
            {
                return(null);
            }

            //
            // Do only core overload resolution the rest of the checks has been
            // done on primary expression
            //
            method = Delegate.GetInvokeMethod(del_type);
            var res   = new OverloadResolver(new MemberSpec[] { method }, OverloadResolver.Restrictions.DelegateInvoke, loc);
            var valid = res.ResolveMember <MethodSpec> (ec, ref arguments);

            if (valid == null && !res.BestCandidateIsDynamic)
            {
                return(null);
            }

            type = method.ReturnType;
            if (conditionalAccessReceiver)
            {
                type = LiftMemberType(ec, type);
            }

            eclass = ExprClass.Value;
            return(this);
        }
Exemple #2
0
		protected override Expression DoResolve (ResolveContext ec)
		{		
			TypeSpec del_type = InstanceExpr.Type;
			if (del_type == null)
				return null;

			//
			// Do only core overload resolution the rest of the checks has been
			// done on primary expression
			//
			method = Delegate.GetInvokeMethod (del_type);
			var res = new OverloadResolver (new MemberSpec[] { method }, OverloadResolver.Restrictions.DelegateInvoke, loc);
			var valid = res.ResolveMember<MethodSpec> (ec, ref arguments);
			if (valid == null && !res.BestCandidateIsDynamic)
				return null;

			type = method.ReturnType;
			if (conditionalAccessReceiver)
				type = LiftMemberType (ec, type);

			eclass = ExprClass.Value;
			return this;
		}
Exemple #3
0
		protected override Expression DoResolve (ResolveContext ec)
		{
			if (InstanceExpr is EventExpr) {
				((EventExpr) InstanceExpr).Error_CannotAssign (ec);
				return null;
			}
			
			TypeSpec del_type = InstanceExpr.Type;
			if (del_type == null)
				return null;

			//
			// Do only core overload resolution the rest of the checks has been
			// done on primary expression
			//
			method = Delegate.GetInvokeMethod (ec.Compiler, del_type);
			var res = new OverloadResolver (new MemberSpec[] { method }, OverloadResolver.Restrictions.DelegateInvoke, loc);
			var valid = res.ResolveMember<MethodSpec> (ec, ref arguments);
			if (valid == null && !res.BestCandidateIsDynamic)
				return null;

			type = method.ReturnType;
			eclass = ExprClass.Value;
			return this;
		}