本文整理汇总了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);
}
示例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"));
}
示例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);
}
示例4: Emit
internal override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
ig.Emit (OpCodes.Ldstr, str);
if (no_effect)
ig.Emit (OpCodes.Pop);
}
示例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);
}
示例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);
}
示例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);
}
}
示例8:
void ICanModifyContext.EmitDecls (EmitContext ec)
{
if (lhs is ICanModifyContext)
((ICanModifyContext) lhs).EmitDecls (ec);
if (body is ICanModifyContext)
((ICanModifyContext) body).EmitDecls (ec);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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"));
}