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


C# CSharp.EmitContext類代碼示例

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


EmitContext類屬於Mono.CSharp命名空間,在下文中一共展示了EmitContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Emit

 public override void Emit(EmitContext ec)
 {
     if (Value)
         ec.Emit (OpCodes.Ldc_I4_1);
     else
         ec.Emit (OpCodes.Ldc_I4_0);
 }
開發者ID:speier,項目名稱:shake,代碼行數:7,代碼來源:constant.cs

示例2: DoResolve

		public override Expression DoResolve (EmitContext ec)
		{
			//
			// We are born fully resolved
			//
			return this;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:7,代碼來源:expression.cs

示例3: CloseCompilerGeneratedBlock

 public static void CloseCompilerGeneratedBlock(EmitContext ec)
 {
     if (symwriter != null) {
         int offset = symwriter.GetILOffset (ec.ig);
         symwriter.CloseCompilerGeneratedBlock (offset);
     }
 }
開發者ID:speier,項目名稱:shake,代碼行數:7,代碼來源:symbolwriter.cs

示例4: Resolve

		public override bool Resolve (EmitContext ec)
		{
			expr = expr.Resolve (ec);
			if (expr == null)
				return false;

			Report.Debug (64, "RESOLVE YIELD #1", this, ec, expr, expr.GetType (),
				      ec.CurrentAnonymousMethod, ec.CurrentIterator);

			if (!CheckContext (ec, loc))
				return false;

			Iterator iterator = ec.CurrentIterator;
			if (expr.Type != iterator.OriginalIteratorType) {
				expr = Convert.ImplicitConversionRequired (
					ec, expr, iterator.OriginalIteratorType, loc);
				if (expr == null)
					return false;
			}

			if (!ec.CurrentBranching.CurrentUsageVector.IsUnreachable)
				unwind_protect = ec.CurrentBranching.AddResumePoint (this, loc, out resume_pc);

			return true;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:25,代碼來源:iterators.cs

示例5: Emit

		public override void Emit (EmitContext ec)
		{
			//
			// Emits null pointer
			//
			ec.Emit (OpCodes.Ldc_I4_0);
			ec.Emit (OpCodes.Conv_U);
		}
開發者ID:nickname100,項目名稱:monodevelop,代碼行數:8,代碼來源:literal.cs

示例6: Emit

		public override void Emit (EmitContext ec)
		{
			if (args != null) 
				Invocation.EmitArguments (ec, mi, args);

			ec.ig.Emit (OpCodes.Call, mi);
			return;
		}
開發者ID:emtees,項目名稱:old-code,代碼行數:8,代碼來源:expression.cs

示例7: Emit

		public override void Emit (EmitContext ec)
		{
			ec.ig.Emit (OpCodes.Ldnull);

#if GMCS_SOURCE
			// Only to make verifier happy
			if (TypeManager.IsGenericParameter (type))
				ec.ig.Emit (OpCodes.Unbox_Any, type);
#endif
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:10,代碼來源:literal.cs

示例8: Emit

        public override void Emit(EmitContext ec)
        {
            if (statement != null) {
                statement.EmitStatement (ec);
                ec.Emit (OpCodes.Ret);
                return;
            }

            base.Emit (ec);
        }
開發者ID:RainsSoft,項目名稱:MonoCompilerAsAService,代碼行數:10,代碼來源:lambda.cs

示例9: Error_ValueCannotBeConverted

		public override void Error_ValueCannotBeConverted (EmitContext ec, Location loc, Type target, bool expl)
		{
			if (!expl && IsLiteral && 
				(TypeManager.IsPrimitiveType (target) || type == TypeManager.decimal_type) &&
				(TypeManager.IsPrimitiveType (type) || type == TypeManager.decimal_type)) {
				Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
					AsString (), TypeManager.CSharpName (target));
			} else {
				base.Error_ValueCannotBeConverted (ec, loc, target, expl);
			}
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:11,代碼來源:constant.cs

示例10: Error_ValueCannotBeConverted

		public override void Error_ValueCannotBeConverted (EmitContext ec, Location loc, Type t, bool expl)
		{
			if (TypeManager.IsGenericParameter (t)) {
				Report.Error(403, loc,
					"Cannot convert null to the type parameter `{0}' because it could be a value " +
					"type. Consider using `default ({0})' instead", t.Name);
			} else {
				Report.Error(37, loc, "Cannot convert null to `{0}' because it is a value type",
					TypeManager.CSharpName(t));
			}
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:11,代碼來源:literal.cs

示例11: CreateExpressionTree

		public override Expression CreateExpressionTree (EmitContext ec)
		{
			if (expr_tree != null)
				return expr_tree (ec, mg);

			ArrayList args = new ArrayList (arguments.Count + 1);
			args.Add (new Argument (new NullLiteral (loc)));
			args.Add (new Argument (mg.CreateExpressionTree (ec)));
			foreach (Argument a in arguments) {
				args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
			}

			return CreateExpressionFactoryCall ("Call", args);
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:14,代碼來源:expression.cs

示例12: DoEmit

        protected override void DoEmit(EmitContext ec)
        {
            if (statement != null) {
                statement.EmitStatement (ec);
                if (unwind_protect)
                    ec.Emit (OpCodes.Leave, ec.CreateReturnLabel ());
                else {
                    ec.Emit (OpCodes.Ret);
                }
                return;
            }

            base.DoEmit (ec);
        }
開發者ID:segaman,項目名稱:NRefactory,代碼行數:14,代碼來源:lambda.cs

示例13: MakeSimpleCall

		static public Expression MakeSimpleCall (EmitContext ec, MethodGroupExpr mg,
							 Expression e, Location loc)
		{
			ArrayList args;
			MethodBase method;
			
			args = new ArrayList (1);
			args.Add (new Argument (e, Argument.AType.Expression));
			method = Invocation.OverloadResolve (ec, (MethodGroupExpr) mg, args, loc);

			if (method == null)
				return null;

			return new StaticCallExpr ((MethodInfo) method, args, loc);
		}
開發者ID:emtees,項目名稱:old-code,代碼行數:15,代碼來源:expression.cs

示例14: ResolveParameters

		protected override Parameters ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegateType)
		{
			if (!TypeManager.IsDelegateType (delegateType))
				return null;

			AParametersCollection d_params = TypeManager.GetDelegateParameters (delegateType);

			if (HasExplicitParameters) {
				if (!VerifyExplicitParameters (delegateType, d_params, ec.IsInProbingMode))
					return null;

				return Parameters;
			}

			//
			// If L has an implicitly typed parameter list we make implicit parameters explicit
			// Set each parameter of L is given the type of the corresponding parameter in D
			//
			if (!VerifyParameterCompatibility (delegateType, d_params, ec.IsInProbingMode))
				return null;

			Type [] ptypes = new Type [Parameters.Count];
			for (int i = 0; i < d_params.Count; i++) {
				// D has no ref or out parameters
				if ((d_params.FixedParameters [i].ModFlags & Parameter.Modifier.ISBYREF) != 0)
					return null;

				Type d_param = d_params.Types [i];

#if MS_COMPATIBLE
				// Blablabla, because reflection does not work with dynamic types
				if (d_param.IsGenericParameter)
					d_param = delegateType.GetGenericArguments () [d_param.GenericParameterPosition];
#endif
				//
				// When type inference context exists try to apply inferred type arguments
				//
				if (tic != null) {
					d_param = tic.InflateGenericArgument (d_param);
				}

				ptypes [i] = d_param;
				((ImplicitLambdaParameter) Parameters.FixedParameters [i]).Type = d_param;
			}

			Parameters.Types = ptypes;
			return Parameters;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:48,代碼來源:lambda.cs

示例15: GetAttributableValue

		public override bool GetAttributableValue (EmitContext ec, Type value_type, out object value)
		{
			if (value_type == TypeManager.object_type) {
				value = GetTypedValue ();
				return true;
			}

			Constant c = ImplicitConversionRequired (ec, value_type, loc);
			if (c == null) {
				value = null;
				return false;
			}

			value = c.GetTypedValue ();
			return true;
		}
開發者ID:lewurm,項目名稱:benchmarker,代碼行數:16,代碼來源:constant.cs


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