本文整理汇总了C#中Microsoft.JScript.EmitContext类的典型用法代码示例。如果您正苦于以下问题:C# EmitContext类的具体用法?C# EmitContext怎么用?C# EmitContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmitContext类属于Microsoft.JScript命名空间,在下文中一共展示了EmitContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Emit
internal override void Emit(EmitContext ec)
{
ILGenerator ig = ec.ig;
if (exp != null)
exp.Emit (ec);
ig.Emit (OpCodes.Ldarg_0);
ig.Emit (OpCodes.Ldfld, typeof (ScriptObject).GetField ("engine"));
ig.Emit (OpCodes.Call, typeof (With).GetMethod ("JScriptWith"));
ig.Emit (OpCodes.Pop);
ig.BeginExceptionBlock ();
if (stm != null)
stm.Emit (ec);
ig.BeginFinallyBlock ();
ig.Emit (OpCodes.Ldarg_0);
ig.Emit (OpCodes.Ldfld, typeof (ScriptObject).GetField ("engine"));
ig.Emit (OpCodes.Call, typeof (VsaEngine).GetMethod ("PopScriptObject"));
ig.Emit (OpCodes.Pop);
ig.EndExceptionBlock ();
}
开发者ID:mayatforest,项目名称:Refractor,代码行数:24,代码来源:With.cs
示例17:
void ICanModifyContext.EmitDecls(EmitContext ec)
{
if (stm is ICanModifyContext)
((ICanModifyContext) stm).EmitDecls (ec);
}
开发者ID:mayatforest,项目名称:Refractor,代码行数:5,代码来源:With.cs
示例18:
void ICanModifyContext.EmitDecls (EmitContext ec)
{
foreach (VariableDeclaration var_decl in var_decls)
((ICanModifyContext) var_decl).EmitDecls (ec);
}
开发者ID:nickchal,项目名称:pash,代码行数:5,代码来源:VariableStatement.cs
示例19:
void ICanModifyContext.EmitDecls(EmitContext ec)
{
((ICanModifyContext) func_obj.body).EmitDecls (ec);
}
开发者ID:mayatforest,项目名称:Refractor,代码行数:4,代码来源:FunctionDeclaration.cs
示例20: Emit
internal override void Emit(EmitContext ec)
{
TypeManager.BeginScope ();
ILGenerator old_ig = ec.ig;
ec.ig = this.ig;
((ICanModifyContext) func_obj.body).EmitDecls (ec);
func_obj.body.Emit (ec);
string func_name = func_obj.name;
if (SemanticAnalyser.MethodContainsEval (func_name))
CodeGenerator.load_local_vars (ec.ig, true);
else {
VariableDeclaration decl = SemanticAnalyser.OutterScopeVar (func_name);
if (decl == null) {
decl = SemanticAnalyser.VarUsedNested (func_name);
if (decl != null)
CodeGenerator.load_local_vars (ec.ig, InFunction);
} else
CodeGenerator.locals_to_stack_frame (ec.ig, decl.lexical_depth, lexical_depth - decl.lexical_depth, true);
}
this.ig.Emit (OpCodes.Ret);
ec.ig = old_ig;
TypeManager.EndScope ();
}
开发者ID:mayatforest,项目名称:Refractor,代码行数:26,代码来源:FunctionDeclaration.cs
注:本文中的Microsoft.JScript.EmitContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论