本文整理汇总了C#中IScriptContext.IsReturn方法的典型用法代码示例。如果您正苦于以下问题:C# IScriptContext.IsReturn方法的具体用法?C# IScriptContext.IsReturn怎么用?C# IScriptContext.IsReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScriptContext
的用法示例。
在下文中一共展示了IScriptContext.IsReturn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
//TODO: Refactor
public override void Evaluate(IScriptContext context)
{
if (ChildNodes.Count == 0) return;
//Create local scope
if (ShouldCreateScope)
{
IScriptScope scope = RuntimeHost.ScopeFactory.Create(ScopeTypes.Local, context.Scope);
context.CreateScope(scope);
}
try
{
int index = 0;
while (index < ChildNodes.Count)
{
var node = (ScriptAst)ChildNodes[index];
node.Evaluate(context);
if (context.IsBreak() || context.IsReturn() || context.IsContinue())
{
break;
}
index++;
}
}
finally
{
if (ShouldCreateScope)
context.RemoveLocalScope();
}
}
示例2: Evaluate
public override void Evaluate(IScriptContext context)
{
bool condBool;
object result = RuntimeHost.NullValue;
init.Evaluate(context);
cond.Evaluate(context);
condBool = context.Result == null ? true : (bool)context.Result;
while (condBool)
{
statement.Evaluate(context);
result = context.Result;
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
break;
}
if (context.IsContinue())
{
context.SetContinue(false);
}
next.Evaluate(context);
cond.Evaluate(context);
condBool = context.Result == null ? true : (bool)context.Result;
}
context.Result = result;
}
示例3: Evaluate
public override void Evaluate(IScriptContext context)
{
condition.Evaluate(context);
object lastResult = RuntimeHost.NullValue;
while ((bool)context.Result)
{
statement.Evaluate(context);
lastResult = context.Result;
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
break;
}
if (context.IsContinue())
{
context.SetContinue(false);
}
condition.Evaluate(context);
}
context.Result = lastResult;
}
示例4: Evaluate
public override void Evaluate(IScriptContext context)
{
foreach (ScriptSwitchCaseStatement caseStatement in cases)
{
caseStatement.Evaluate(context);
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
return;
}
}
if (defaultCase != null)
defaultCase.Evaluate(context);
}
示例5: Evaluate
//TODO: Refactor
public override void Evaluate(IScriptContext context)
{
if (ChildNodes.Count == 0) return;
int index = 0;
while (index < ChildNodes.Count)
{
ScriptAst node = (ScriptAst)ChildNodes[index];
node.Evaluate(context);
if (context.IsBreak() || context.IsReturn() || context.IsContinue())
{
break;
}
index++;
}
}
示例6: Evaluate
public override void Evaluate(IScriptContext context)
{
var result = RuntimeHost.NullValue;
//Create local scope
var scope = RuntimeHost.ScopeFactory.Create(ScopeTypes.Local, context.Scope);
context.CreateScope(scope);
try
{
_init.Evaluate(context);
_cond.Evaluate(context);
bool condBool = context.Result == null ? true : (bool)context.Result;
while (condBool)
{
_statement.Evaluate(context);
result = context.Result;
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
break;
}
if (context.IsContinue())
{
context.SetContinue(false);
}
_next.Evaluate(context);
_cond.Evaluate(context);
condBool = context.Result == null ? true : (bool)context.Result;
}
context.Result = result;
}
finally
{
context.RemoveLocalScope();
}
}
示例7: Evaluate
public override void Evaluate(IScriptContext context)
{
_expr.Evaluate(context);
if (context.Result == null) throw new NullReferenceException(string.Format(Strings.NullReferenceInCode, Code(context)));
var enumeration = context.Result as IEnumerable;
IEnumerator enumerator = null;
if (enumeration != null)
{
enumerator = enumeration.GetEnumerator();
}
else
{
IBinding bind = RuntimeHost.Binder.BindToMethod(context.Result, "GetEnumerator", new Type[0], new object[0]);
if (bind != null)
enumerator = bind.Invoke(context, null) as IEnumerator;
}
if (enumerator == null)
throw new ScriptExecutionException(string.Format(Strings.ForEachMethodNotFound, context.Result));
enumerator.Reset();
while (enumerator.MoveNext())
{
context.SetItem(_name.Text, enumerator.Current);
_statement.Evaluate(context);
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
break;
}
if (context.IsContinue())
{
context.SetContinue(false);
}
}
}
示例8: Evaluate
public override void Evaluate(IScriptContext context)
{
expr.Evaluate(context);
IEnumerable enumeration = context.Result as IEnumerable;
IEnumerator enumerator = null;
if (enumeration != null)
{
enumerator = enumeration.GetEnumerator();
}
else
{
IObjectBind bind = RuntimeHost.Binder.BindToMethod(context.Result, "GetEnumerator",new Type[0], new object[0]);
if (bind != null)
enumerator = bind.Invoke(context, null) as IEnumerator;
}
if (enumerator == null)
throw new ScriptException("GetEnumerator() method did not found in object: " + context.Result.ToString());
enumerator.Reset();
while(enumerator.MoveNext())
{
context.SetItem(name.Text, enumerator.Current);
statement.Evaluate(context);
if (context.IsBreak() || context.IsReturn())
{
context.SetBreak(false);
break;
}
if (context.IsContinue())
{
context.SetContinue(false);
}
}
}