本文整理汇总了C#中Mono.CSharp.HoistedThis类的典型用法代码示例。如果您正苦于以下问题:C# HoistedThis类的具体用法?C# HoistedThis怎么用?C# HoistedThis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HoistedThis类属于Mono.CSharp命名空间,在下文中一共展示了HoistedThis类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ThisInitializer
public ThisInitializer (HoistedThis hoisted_this)
{
this.hoisted_this = hoisted_this;
}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:anonymous.cs
示例2: AddCapturedThisField
public void AddCapturedThisField (EmitContext ec)
{
TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
Field f = AddCompilerGeneratedField ("$this", type_expr);
hoisted_this = new HoistedThis (this, f);
initialize_hoisted_this = true;
}
开发者ID:rabink,项目名称:mono,代码行数:8,代码来源:anonymous.cs
示例3: ThisInitializer
public ThisInitializer (HoistedThis hoisted_this, AnonymousMethodStorey parent)
{
this.hoisted_this = hoisted_this;
this.parent = parent;
}
开发者ID:erik-kallen,项目名称:NRefactory,代码行数:5,代码来源:anonymous.cs
示例4: AddCapturedThisField
public void AddCapturedThisField (EmitContext ec)
{
TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
Field f = AddCompilerGeneratedField ("<>f__this", type_expr);
f.Define ();
hoisted_this = new HoistedThis (this, f);
// Inflated type instance has to be updated manually
if (Instance.Type is InflatedTypeSpec) {
var inflator = new TypeParameterInflator (this, Instance.Type, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes);
Instance.Type.MemberCache.AddMember (f.Spec.InflateMember (inflator));
inflator = new TypeParameterInflator (this, f.Parent.CurrentType, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes);
f.Parent.CurrentType.MemberCache.AddMember (f.Spec.InflateMember (inflator));
}
}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:16,代码来源:anonymous.cs
示例5: AddCapturedThisField
public void AddCapturedThisField (EmitContext ec)
{
TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location);
Field f = AddCompilerGeneratedField ("<>f__this", type_expr);
f.Define ();
hoisted_this = new HoistedThis (this, f);
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:anonymous.cs
示例6: CaptureThis
public HoistedThis CaptureThis (EmitContext ec, This t)
{
hoisted_this = new HoistedThis (this, t);
return hoisted_this;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:5,代码来源:anonymous.cs
示例7: 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 ();
//
// A storey with hoisted `this' is an instance method
//
if (!HasHoistedVariables) {
hoisted_this.RemoveHoisting ();
hoisted_this = null;
return;
}
SymbolWriter.OpenCompilerGeneratedBlock (ec.ig);
DefineStoreyReferences ();
//
// 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.GenericDeclContainer.TypeParameters;
TypeArguments targs = new TypeArguments ();
if (tparams.Length < CountTypeParameters) {
TypeParameter[] parent_tparams = ec.DeclContainer.Parent.CurrentTypeParameters;
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);
}
Expression e = new New (storey_type_expr, new ArrayList (0), Location).Resolve (ec);
e.Emit (ec);
Instance = new LocalTemporary (storey_type_expr.Type);
Instance.Store (ec);
EmitHoistedFieldsInitialization (ec);
SymbolWriter.DefineScopeVariable (ID, Instance.Builder);
SymbolWriter.CloseCompilerGeneratedBlock (ec.ig);
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:62,代码来源:anonymous.cs
注:本文中的Mono.CSharp.HoistedThis类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论