當前位置: 首頁>>代碼示例>>C#>>正文


C# Expression.Error118方法代碼示例

本文整理匯總了C#中Mono.CSharp.Expression.Error118方法的典型用法代碼示例。如果您正苦於以下問題:C# Expression.Error118方法的具體用法?C# Expression.Error118怎麽用?C# Expression.Error118使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.CSharp.Expression的用法示例。


在下文中一共展示了Expression.Error118方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DoResolve

		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;
		}
開發者ID:emtees,項目名稱:old-code,代碼行數:81,代碼來源:expression.cs


注:本文中的Mono.CSharp.Expression.Error118方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。