本文整理汇总了C#中Mono.CSharp.HoistedParameter类的典型用法代码示例。如果您正苦于以下问题:C# HoistedParameter类的具体用法?C# HoistedParameter怎么用?C# HoistedParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HoistedParameter类属于Mono.CSharp命名空间,在下文中一共展示了HoistedParameter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HoistedParameter
public HoistedParameter (HoistedParameter hp, string name)
: base (hp.storey, name, hp.parameter.Type)
{
this.parameter = hp.parameter;
}
示例2: CaptureParameter
public void CaptureParameter (ResolveContext ec, ParametersBlock.ParameterInfo parameterInfo, ParameterReference parameterReference)
{
if (!(this is StateMachine)) {
ec.CurrentBlock.Explicit.HasCapturedVariable = true;
}
var hoisted = parameterInfo.Parameter.HoistedVariant;
if (parameterInfo.Block.StateMachine != null) {
//
// Another storey in same block exists but state machine does not
// have parameter captured. We need to add it there as well to
// proxy parameter value correctly.
//
if (hoisted == null && parameterInfo.Block.StateMachine != this) {
var storey = parameterInfo.Block.StateMachine;
hoisted = new HoistedParameter (storey, parameterReference);
parameterInfo.Parameter.HoistedVariant = hoisted;
if (storey.hoisted_params == null)
storey.hoisted_params = new List<HoistedParameter> ();
storey.hoisted_params.Add (hoisted);
}
//
// Lift captured parameter from value type storey to reference type one. Otherwise
// any side effects would be done on a copy
//
if (hoisted != null && hoisted.Storey != this && hoisted.Storey is StateMachine) {
if (hoisted_local_params == null)
hoisted_local_params = new List<HoistedParameter> ();
hoisted_local_params.Add (hoisted);
hoisted = null;
}
}
if (hoisted == null) {
hoisted = new HoistedParameter (this, parameterReference);
parameterInfo.Parameter.HoistedVariant = hoisted;
if (hoisted_params == null)
hoisted_params = new List<HoistedParameter> ();
hoisted_params.Add (hoisted);
}
//
// Register link between current block and parameter storey. It will
// be used when setting up storey definition to deploy storey reference
// when parameters are used from multiple blocks
//
if (ec.CurrentBlock.Explicit != parameterInfo.Block) {
hoisted.Storey.AddReferenceFromChildrenBlock (ec.CurrentBlock.Explicit);
}
}
示例3: CaptureParameter
public void CaptureParameter (ResolveContext ec, ParametersBlock.ParameterInfo parameterInfo, ParameterReference parameterReference)
{
if (!(this is StateMachine)) {
ec.CurrentBlock.Explicit.HasCapturedVariable = true;
}
var hoisted = parameterInfo.Parameter.HoistedVariant;
if (hoisted == null) {
var storey = parameterInfo.Block.StateMachine ?? this;
var hp = new HoistedParameter (storey, parameterReference);
hoisted = hp;
parameterInfo.Parameter.HoistedVariant = hoisted;
if (storey.hoisted_params == null)
storey.hoisted_params = new List<HoistedParameter> (2);
storey.hoisted_params.Add (hp);
}
//
// Register link between current block and parameter storey. It will
// be used when setting up storey definition to deploy storey reference
// when parameters are used from multiple blocks
//
if (ec.CurrentBlock.Explicit != parameterInfo.Block) {
hoisted.Storey.AddReferenceFromChildrenBlock (ec.CurrentBlock.Explicit);
}
}
示例4: CaptureParameter
public void CaptureParameter (ResolveContext ec, ParameterReference param_ref)
{
ec.CurrentBlock.Explicit.HasCapturedVariable = true;
AddReferenceFromChildrenBlock (ec.CurrentBlock.Explicit);
if (param_ref.GetHoistedVariable (ec) != null)
return;
if (hoisted_params == null)
hoisted_params = new List<HoistedParameter> (2);
var expr = new HoistedParameter (this, param_ref);
param_ref.Parameter.HoistedVariant = expr;
hoisted_params.Add (expr);
}
示例5: CaptureParameter
public void CaptureParameter (EmitContext ec, ParameterReference param_ref)
{
if (param_ref.HoistedVariable != null)
return;
if (hoisted_params == null)
hoisted_params = new ArrayList (2);
HoistedVariable expr = new HoistedParameter (this, param_ref);
param_ref.Parameter.HoistedVariableReference = expr;
hoisted_params.Add (expr);
}