本文整理汇总了C#中Scope.Enter方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.Enter方法的具体用法?C# Scope.Enter怎么用?C# Scope.Enter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.Enter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public bool Apply(Scope scope, TextWriter output, out Value result)
{
bool halt;
foreach (Branch branch in this.branches)
{
if (branch.Test.Evaluate (scope, output).AsBoolean)
{
scope.Enter ();
halt = branch.Body.Apply (scope, output, out result);
scope.Leave ();
return halt;
}
}
if (this.fallback != null)
{
scope.Enter ();
halt = this.fallback.Apply (scope, output, out result);
scope.Leave ();
return halt;
}
result = UndefinedValue.Instance;
return false;
}
示例2: Apply
public bool Apply(Scope scope, TextWriter output, out Value result)
{
KeyValuePair<Value, Value>[] fields = this.from.Evaluate (scope, output).Fields;
if (fields.Length > 0)
{
foreach (KeyValuePair<Value, Value> pair in fields)
{
scope.Enter ();
if (this.key != null)
this.key.Set (scope, pair.Key, ScopeMode.Local);
if (this.value != null)
this.value.Set (scope, pair.Value, ScopeMode.Local);
if (this.body.Apply (scope, output, out result))
{
scope.Leave ();
return true;
}
scope.Leave ();
}
}
else if (this.empty != null)
{
scope.Enter ();
if (this.empty.Apply (scope, output, out result))
{
scope.Leave ();
return true;
}
scope.Leave ();
}
result = UndefinedValue.Instance;
return false;
}
示例3: Apply
public bool Apply(Scope scope, TextWriter output, out Value result)
{
while (this.test.Evaluate (scope, output).AsBoolean)
{
scope.Enter ();
if (this.body.Apply (scope, output, out result))
{
scope.Leave ();
return true;
}
scope.Leave ();
}
result = UndefinedValue.Instance;
return false;
}
示例4: Execute
public Value Execute(IList<Value> values, Scope scope, TextWriter output)
{
Value result;
int i = 0;
scope.Enter ();
foreach (NameExpression argument in this.arguments)
{
argument.Set (scope, i < values.Count ? values[i] : UndefinedValue.Instance, ScopeMode.Local);
++i;
}
this.body.Apply (scope, output, out result);
scope.Leave ();
return result;
}