本文整理汇总了C#中Mono.CSharp.FieldExpr.EmitAssign方法的典型用法代码示例。如果您正苦于以下问题:C# FieldExpr.EmitAssign方法的具体用法?C# FieldExpr.EmitAssign怎么用?C# FieldExpr.EmitAssign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.FieldExpr
的用法示例。
在下文中一共展示了FieldExpr.EmitAssign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitStoreyInstantiation
//
// Initializes all hoisted variables
//
public void EmitStoreyInstantiation (EmitContext ec, ExplicitBlock block)
{
// There can be only one instance variable for each storey type
if (Instance != null)
throw new InternalErrorException ();
//
// Create an instance of this storey
//
ResolveContext rc = new ResolveContext (ec.MemberContext);
rc.CurrentBlock = block;
var storey_type_expr = CreateStoreyTypeExpression (ec);
var source = new New (storey_type_expr, null, Location).Resolve (rc);
//
// When the current context is async (or iterator) lift local storey
// instantiation to the currect storey
//
if (ec.CurrentAnonymousMethod is StateMachineInitializer && (block.HasYield || block.HasAwait)) {
//
// Unfortunately, normal capture mechanism could not be used because we are
// too late in the pipeline and standart assign cannot be used either due to
// recursive nature of GetStoreyInstanceExpression
//
var field = ec.CurrentAnonymousMethod.Storey.AddCompilerGeneratedField (
LocalVariable.GetCompilerGeneratedName (block), storey_type_expr, true);
field.Define ();
field.Emit ();
var fexpr = new FieldExpr (field, Location);
fexpr.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, Location);
fexpr.EmitAssign (ec, source, false, false);
Instance = fexpr;
} else {
var local = TemporaryVariableReference.Create (source.Type, block, Location);
if (source.Type.IsStruct) {
local.LocalInfo.CreateBuilder (ec);
} else {
local.EmitAssign (ec, source);
}
Instance = local;
}
EmitHoistedFieldsInitialization (rc, ec);
// TODO: Implement properly
//SymbolWriter.DefineScopeVariable (ID, Instance.Builder);
}