本文整理汇总了C#中Mono.CSharp.New.Emit方法的典型用法代码示例。如果您正苦于以下问题:C# New.Emit方法的具体用法?C# New.Emit怎么用?C# New.Emit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.New
的用法示例。
在下文中一共展示了New.Emit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitStoreyInstantiation
//
// Initializes all hoisted variables
//
public void EmitStoreyInstantiation (EmitContext ec)
{
// There can be only one instance variable for each storey type
if (Instance != null)
throw new InternalErrorException ();
SymbolWriter.OpenCompilerGeneratedBlock (ec.ig);
//
// Create an instance of storey type
//
Expression storey_type_expr;
if (is_generic) {
//
// Use current method type parameter (MVAR) for top level storey only. All
// nested storeys use class type parameter (VAR)
//
TypeParameter[] tparams = ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.Storey != null ?
ec.CurrentAnonymousMethod.Storey.TypeParameters :
ec.CurrentTypeParameters;
TypeArguments targs = new TypeArguments ();
if (tparams.Length < CountTypeParameters) {
TypeParameter[] parent_tparams = ec.MemberContext.CurrentTypeDefinition.TypeParameters;
for (int i = 0; i < parent_tparams.Length; ++i)
targs.Add (new TypeParameterExpr (parent_tparams[i], Location));
}
for (int i = 0; i < tparams.Length; ++i)
targs.Add (new TypeParameterExpr (tparams[i], Location));
storey_type_expr = new GenericTypeExpr (TypeBuilder, targs, Location);
} else {
storey_type_expr = new TypeExpression (TypeBuilder, Location);
}
ResolveContext rc = new ResolveContext (this);
Expression e = new New (storey_type_expr, null, Location).Resolve (rc);
e.Emit (ec);
Instance = new LocalTemporary (storey_type_expr.Type);
Instance.Store (ec);
EmitHoistedFieldsInitialization (ec);
SymbolWriter.DefineScopeVariable (ID, Instance.Builder);
SymbolWriter.CloseCompilerGeneratedBlock (ec.ig);
}
示例2: EmitStoreyInstantiation
//
// Initializes all hoisted variables
//
public void EmitStoreyInstantiation (EmitContext ec)
{
// There can be only one instance variable for each storey type
if (Instance != null)
throw new InternalErrorException ();
SymbolWriter.OpenCompilerGeneratedBlock (ec);
//
// Create an instance of a storey
//
var storey_type_expr = CreateStoreyTypeExpression (ec);
ResolveContext rc = new ResolveContext (ec.MemberContext);
Expression e = new New (storey_type_expr, null, Location).Resolve (rc);
e.Emit (ec);
Instance = new LocalTemporary (storey_type_expr.Type);
Instance.Store (ec);
EmitHoistedFieldsInitialization (ec);
SymbolWriter.DefineScopeVariable (ID, Instance.Builder);
SymbolWriter.CloseCompilerGeneratedBlock (ec);
}
示例3: EmitNew
public void EmitNew (EmitContext ec, New source, bool leave_copy)
{
if (!source.Emit (ec, this)) {
if (leave_copy)
throw new NotImplementedException ();
return;
}
throw new NotImplementedException ();
}