void ProcessCallForSimple()
{
CodeForSimple code = (CodeForSimple)m_scriptInstruction.operand0;
ScriptNumber beginNumber = ResolveOperand(code.Begin) as ScriptNumber;
if (beginNumber == null)
{
throw new ExecutionException(m_script, "forsimple 初始值必须是number");
}
ScriptNumber finishedNumber = ResolveOperand(code.Finished) as ScriptNumber;
if (finishedNumber == null)
{
throw new ExecutionException(m_script, "forsimple 最大值必须是number");
}
int begin = beginNumber.ToInt32();
int finished = finishedNumber.ToInt32();
int step;
if (code.Step != null)
{
ScriptNumber stepNumber = ResolveOperand(code.Step) as ScriptNumber;
if (stepNumber == null)
{
throw new ExecutionException(m_script, "forsimple Step必须是number");
}
step = stepNumber.ToInt32();
}
else
{
step = 1;
}
ScriptContext context;
for (double i = begin; i <= finished; i += step)
{
context = new ScriptContext(m_script, code.BlockExecutable, this, Executable_Block.For);
context.Initialize(code.Identifier, new ScriptNumberDouble(m_script, i));
context.Execute();
if (context.IsOver)
{
break;
}
}
}