本文整理汇总了C#中Mono.CSharp.SimpleAssign.EmitStatement方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleAssign.EmitStatement方法的具体用法?C# SimpleAssign.EmitStatement怎么用?C# SimpleAssign.EmitStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.SimpleAssign
的用法示例。
在下文中一共展示了SimpleAssign.EmitStatement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitHoistedFieldsInitialization
void EmitHoistedFieldsInitialization (ResolveContext rc, EmitContext ec)
{
//
// Initialize all storey reference fields by using local or hoisted variables
//
if (used_parent_storeys != null) {
foreach (StoreyFieldPair sf in used_parent_storeys) {
//
// Get instance expression of storey field
//
Expression instace_expr = GetStoreyInstanceExpression (ec);
var fs = sf.Field.Spec;
if (TypeManager.IsGenericType (instace_expr.Type))
fs = MemberCache.GetMember (instace_expr.Type, fs);
FieldExpr f_set_expr = new FieldExpr (fs, Location);
f_set_expr.InstanceExpression = instace_expr;
// TODO: CompilerAssign expression
SimpleAssign a = new SimpleAssign (f_set_expr, sf.Storey.GetStoreyInstanceExpression (ec));
if (a.Resolve (rc) != null)
a.EmitStatement (ec);
}
}
//
// Initialize hoisted `this' only once, everywhere else will be
// referenced indirectly
//
if (initialize_hoisted_this) {
rc.CurrentBlock.AddScopeStatement (new ThisInitializer (hoisted_this));
}
//
// Setting currect anonymous method to null blocks any further variable hoisting
//
AnonymousExpression ae = ec.CurrentAnonymousMethod;
ec.CurrentAnonymousMethod = null;
if (hoisted_params != null) {
EmitHoistedParameters (ec, hoisted_params);
}
ec.CurrentAnonymousMethod = ae;
}
示例2: EmitHoistingAssignment
public void EmitHoistingAssignment (EmitContext ec)
{
SimpleAssign a = new SimpleAssign (GetFieldExpression (ec), new CompilerGeneratedThis (ec.CurrentType, field.Location));
if (a.Resolve (new ResolveContext (ec.MemberContext)) != null)
a.EmitStatement (ec);
}
示例3: EmitHoistingAssignment
public void EmitHoistingAssignment (EmitContext ec)
{
SimpleAssign a = new SimpleAssign (GetFieldExpression (ec), this_reference);
if (a.Resolve (ec) != null)
a.EmitStatement (ec);
}
示例4: EmitHoistedFieldsInitialization
void EmitHoistedFieldsInitialization (ResolveContext rc, EmitContext ec)
{
//
// Initialize all storey reference fields by using local or hoisted variables
//
if (used_parent_storeys != null) {
foreach (StoreyFieldPair sf in used_parent_storeys) {
//
// Get instance expression of storey field
//
Expression instace_expr = GetStoreyInstanceExpression (ec);
var fs = sf.Field.Spec;
if (TypeManager.IsGenericType (instace_expr.Type))
fs = MemberCache.GetMember (instace_expr.Type, fs);
FieldExpr f_set_expr = new FieldExpr (fs, Location);
f_set_expr.InstanceExpression = instace_expr;
SimpleAssign a = new SimpleAssign (f_set_expr, sf.Storey.GetStoreyInstanceExpression (ec));
if (a.Resolve (rc) != null)
a.EmitStatement (ec);
}
}
//
// Define hoisted `this' in top-level storey only
//
if (OriginalSourceBlock.Explicit.HasCapturedThis && !(Parent is AnonymousMethodStorey)) {
AddCapturedThisField (ec);
rc.CurrentBlock.AddScopeStatement (new ThisInitializer (hoisted_this));
}
//
// Setting currect anonymous method to null blocks any further variable hoisting
//
AnonymousExpression ae = ec.CurrentAnonymousMethod;
ec.CurrentAnonymousMethod = null;
if (hoisted_params != null) {
EmitHoistedParameters (ec, hoisted_params);
}
ec.CurrentAnonymousMethod = ae;
}
示例5: EmitHoistedFieldsInitialization
void EmitHoistedFieldsInitialization (EmitContext ec)
{
//
// Initialize all storey reference fields by using local or hoisted variables
//
if (used_parent_storeys != null) {
foreach (StoreyFieldPair sf in used_parent_storeys) {
//
// Setting local field
//
Expression instace_expr = GetStoreyInstanceExpression (ec);
FieldExpr f_set_expr = TypeManager.IsGenericType (instace_expr.Type) ?
new FieldExpr (sf.Field.FieldBuilder, instace_expr.Type, Location) :
new FieldExpr (sf.Field.FieldBuilder, Location);
f_set_expr.InstanceExpression = instace_expr;
SimpleAssign a = new SimpleAssign (f_set_expr, sf.Storey.GetStoreyInstanceExpression (ec));
if (a.Resolve (ec) != null)
a.EmitStatement (ec);
}
}
//
// Setting currect anonymous method to null blocks any further variable hoisting
//
AnonymousExpression ae = ec.CurrentAnonymousMethod;
ec.CurrentAnonymousMethod = null;
if (hoisted_params != null) {
EmitHoistedParameters (ec, hoisted_params);
}
ec.CurrentAnonymousMethod = ae;
}