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


C# JScript.EmitContext類代碼示例

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


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

示例1: Emit

		internal override void Emit (EmitContext ec)
		{
			if (InFunction)
				ec.ig.Emit (OpCodes.Ldarg_0);
			else
				CodeGenerator.emit_get_default_this (ec.ig, InFunction);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:Literal.cs

示例2: Emit

 internal override void Emit(EmitContext ec)
 {
     ILGenerator ig = ec.ig;
     ig.Emit (OpCodes.Ldstr, name);
     CodeGenerator.load_engine (false, ig);
     ig.Emit (OpCodes.Call, GetType ().GetMethod ("JScriptImport"));
 }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:7,代碼來源:Import.cs

示例3: Emit

		internal override void Emit (EmitContext ec)
		{
			ILGenerator ig = ec.ig;
			expression.Emit (ec);
			ig.Emit (OpCodes.Call, typeof (Throw).GetMethod ("JScriptThrow"));
			ig.Emit (OpCodes.Throw);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:Throw.cs

示例4: Emit

		internal override void Emit (EmitContext ec)
		{
			ILGenerator ig = ec.ig;
			ig.Emit (OpCodes.Ldstr, str);
			if (no_effect)
				ig.Emit (OpCodes.Pop);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:StringLiteral.cs

示例5: create_closure

		internal void create_closure (EmitContext ec)
		{
			string name = func_obj.name;
			string full_name;
			TypeBuilder type = ec.type_builder;
			ILGenerator ig = ec.ig;			
		
			if (prefix == String.Empty) 
				full_name = name;
			else 
				full_name = prefix + "." + name;

			MethodBuilder method_builder = type.DefineMethod (full_name, func_obj.attr, HandleReturnType,
								  func_obj.params_types ());
			MethodBuilder tmp = (MethodBuilder) TypeManager.Get (name);


			if (tmp == null)
				TypeManager.Add (name, method_builder);
			else 
				TypeManager.Set (name, method_builder);

			set_custom_attr (method_builder);
			this.ig = method_builder.GetILGenerator ();

			if (parent == null || parent.GetType () == typeof (ScriptBlock))
				type.DefineField (name, typeof (Microsoft.JScript.ScriptFunction),
						  FieldAttributes.Public | FieldAttributes.Static);
			else {
				local_func = ig.DeclareLocal (typeof (Microsoft.JScript.ScriptFunction));
				TypeManager.AddLocalScriptFunction (name, local_func);
			}
			build_closure (ec, full_name, func_obj.source);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:34,代碼來源:FunctionDeclaration.cs

示例6: Emit

		internal override void Emit (EmitContext ec)
		{
			int i, size = var_decls.Count;

			for (i = 0; i < size; i++)
				((VariableDeclaration) var_decls [i]).Emit (ec);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:7,代碼來源:VariableStatement.cs

示例7: if

        void ICanModifyContext.EmitDecls(EmitContext ec)
        {
            object var;

            if ((var = CodeGenerator.variable_defined_in_current_scope (id)) != null) {
                Type t = var.GetType ();
                if (t == typeof (FieldBuilder))
                    field_info = (FieldBuilder) var;
                else if (t == typeof (LocalBuilder))
                    local_builder = (LocalBuilder) var;
                return;
            }

            ILGenerator ig = ec.ig;
            if (parent == null || (parent.GetType () != typeof (FunctionDeclaration)
                           && parent.GetType () != typeof (FunctionExpression))) {
                FieldBuilder field_builder;
                TypeBuilder type_builder  = ec.type_builder;

                field_builder = type_builder.DefineField (id, this.type, FieldAttributes.Public | FieldAttributes.Static);
                TypeManager.Add (id, field_builder);
                field_info = field_builder;
            } else {
                local_builder = ig.DeclareLocal (type);
                TypeManager.Add (id, local_builder);
            }
        }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:27,代碼來源:VariableDeclaration.cs

示例8:

		void ICanModifyContext.EmitDecls (EmitContext ec)
		{
			if (lhs is ICanModifyContext)
				((ICanModifyContext) lhs).EmitDecls (ec);

			if (body is ICanModifyContext)
				((ICanModifyContext) body).EmitDecls (ec);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:8,代碼來源:ForIn.cs

示例9: Emit

 internal override void Emit(EmitContext ec)
 {
     if (label == String.Empty) {
         ec.ig.Emit (OpCodes.Br, ec.LoopEnd);
         return;
     }
     ec.ig.Emit (OpCodes.Br, (binding as Labelled).EndAddrs);
 }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:8,代碼來源:Statement.cs

示例10:

		void ICanModifyContext.EmitDecls (EmitContext ec)
		{
			if (true_stm is ICanModifyContext)
				((ICanModifyContext) true_stm).EmitDecls (ec);

			if (false_stm is ICanModifyContext)
				((ICanModifyContext) false_stm).EmitDecls (ec);
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:8,代碼來源:Statement.cs

示例11: foreach

        void ICanModifyContext.EmitDecls(EmitContext ec)
        {
            if (guarded_block is ICanModifyContext)
                ((ICanModifyContext) guarded_block).EmitDecls (ec);

            foreach (AST ast in catch_blocks)
                if (ast is ICanModifyContext)
                    ((ICanModifyContext) ast).EmitDecls (ec);

            if (finally_block is ICanModifyContext)
                ((ICanModifyContext) finally_block).EmitDecls (ec);
        }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:12,代碼來源:Try.cs

示例12: if

 void ICanModifyContext.EmitDecls(EmitContext ec)
 {
     //
     // Emit variable declarations and function's closure first
     // because of posible free occurrences inside a method.
     //
     foreach (AST ast in elems)
         if (ast is FunctionDeclaration)
             ((FunctionDeclaration) ast).create_closure (ec);
         else if (ast is ICanModifyContext)
             ((ICanModifyContext) ast).EmitDecls (ec);
 }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:12,代碼來源:Block.cs

示例13: Emit

        internal override void Emit(EmitContext ec)
        {
            ILGenerator ig = ec.ig;

            if (Value)
                ig.Emit (OpCodes.Ldc_I4_1);
            else
                ig.Emit (OpCodes.Ldc_I4_0);

            if (no_effect)
                ig.Emit (OpCodes.Pop);
        }
開發者ID:mayatforest,項目名稱:Refractor,代碼行數:12,代碼來源:Literal.cs

示例14: Emit

		internal override void Emit (EmitContext ec)
		{
			int n = elems.Count;
			object e;

			//
			// Emit the rest of expressions and statements.
			//
			for (int i = 0; i < n; i++) {
				e = elems [i];
				((AST) e).Emit (ec);
			}
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:13,代碼來源:Block.cs

示例15: Emit

		internal override void Emit (EmitContext ec)
		{
			int i = 0;
			ILGenerator ig = ec.ig;
			ArrayList exps = elems.elems;
			FieldInfo missing = null;
			if (skip_count != 0)
				missing = typeof (Missing).GetField ("Value");
			ig.Emit (OpCodes.Ldc_I4, elems.Size);
			ig.Emit (OpCodes.Newarr, typeof (object));
			foreach (AST ast in exps) {
				ig.Emit (OpCodes.Dup);
 				ig.Emit (OpCodes.Ldc_I4, i);
				if (ast != null) {
					ast.Emit (ec);
					CodeGenerator.EmitBox (ig, ast);
				} else 
					ig.Emit (OpCodes.Ldsfld, missing);
 				ig.Emit (OpCodes.Stelem_Ref);
				i++;
			}
 			ig.Emit (OpCodes.Call, typeof (Globals).GetMethod ("ConstructArrayLiteral"));
		}
開發者ID:nickchal,項目名稱:pash,代碼行數:23,代碼來源:ArrayLiteral.cs


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