ResolveOperand() private method

private ResolveOperand ( CodeObject value ) : ScriptObject
value Scorpio.CodeDom.CodeObject
return Scorpio.ScriptObject
示例#1
0
        void ProcessCallFor()
        {
            CodeFor       code         = (CodeFor)m_scriptInstruction.Operand0;
            ScriptContext context      = code.Context;
            ScriptContext blockContext = code.BlockContext;

            context.Initialize(this);
            context.Execute(code.BeginExecutable);
            ScriptBoolean Condition;

            for ( ; ;)
            {
                if (code.Condition != null)
                {
                    Condition = context.ResolveOperand(code.Condition) as ScriptBoolean;
                    if (Condition == null)
                    {
                        throw new ExecutionException("for 跳出条件必须是一个bool型");
                    }
                    if (!Condition.Value)
                    {
                        break;
                    }
                }
                blockContext.Initialize(context);
                blockContext.Execute();
                if (blockContext.IsBreak)
                {
                    break;
                }
                context.Execute(code.LoopExecutable);
            }
        }
示例#2
0
        ScriptTable ParseTable(CodeTable table)
        {
            ScriptContext context = new ScriptContext(m_script, null, this, Executable_Block.None);
            ScriptTable   ret     = m_script.CreateTable();

            foreach (ScriptScriptFunction func in table.Functions)
            {
                func.SetTable(ret);
                ret.SetValue(func.Name, func);
                context.SetVariableForce(func.Name, func);
            }
            foreach (CodeTable.TableVariable variable in table.Variables)
            {
                ScriptObject value = context.ResolveOperand(variable.value);
                if (value is ScriptScriptFunction)
                {
                    ScriptScriptFunction func = (ScriptScriptFunction)value;
                    if (func.IsStaticFunction)
                    {
                        func.SetTable(ret);
                    }
                }
                ret.SetValue(variable.key, value);
                context.SetVariableForce(variable.key.ToString(), value);
            }
            return(ret);
        }
示例#3
0
        private void ProcessCallFor()
        {
            CodeFor       @for   = (CodeFor)this.m_scriptInstruction.operand0;
            ScriptContext parent = new ScriptContext(this.m_script, null, this, Executable_Block.For);

            parent.Execute(@for.BeginExecutable);
            while ((@for.Condition == null) || parent.ResolveOperand(@for.Condition).LogicOperation())
            {
                ScriptContext context2 = new ScriptContext(this.m_script, @for.BlockExecutable, parent, Executable_Block.For);
                context2.Execute();
                if (context2.IsOver)
                {
                    return;
                }
                parent.Execute(@for.LoopExecutable);
            }
            return;
        }
示例#4
0
        void ProcessCallFor()
        {
            CodeFor       code    = (CodeFor)m_scriptInstruction.operand0;
            ScriptContext context = new ScriptContext(m_script, null, this, Executable_Block.For);

            context.Execute(code.BeginExecutable);
            ScriptContext blockContext;

            while (code.Condition == null || context.ResolveOperand(code.Condition).LogicOperation())
            {
                blockContext = new ScriptContext(m_script, code.BlockExecutable, context, Executable_Block.For);
                blockContext.Execute();
                if (blockContext.IsOver)
                {
                    break;
                }
                context.Execute(code.LoopExecutable);
            }
        }
示例#5
0
        private ScriptTable ParseTable(CodeTable table)
        {
            ScriptContext context = new ScriptContext(this.m_script, null, this, Executable_Block.None);
            ScriptTable   table2  = this.m_script.CreateTable();

            //todo
            //table2.Name = table.StackInfo.Breviary.Substring(table.StackInfo.Breviary.LastIndexOf('/')+1);
            //UnityEngine.Debug.Log(table2.Name);
            foreach (ScriptScriptFunction function in table.Functions)
            {
                table2.SetValue(function.Name, function);
                context.SetVariableForce(function.Name, function);
            }
            foreach (CodeTable.TableVariable variable in table.Variables)
            {
                ScriptObject obj2 = context.ResolveOperand(variable.value);
                table2.SetValue(variable.key, obj2);
                context.SetVariableForce(variable.key.ToString(), obj2);
            }
            return(table2);
        }
 void ProcessCallFor()
 {
     CodeFor code = (CodeFor)m_scriptInstruction.Operand0;
     ScriptContext context = new ScriptContext(m_script, null, this, Executable_Block.For);
     context.Execute(code.BeginExecutable);
     for ( ; ; ) {
         if (code.Condition != null) {
             if (!context.ResolveOperand(code.Condition).LogicOperation()) break;
         }
         ScriptContext blockContext = new ScriptContext(m_script, code.BlockExecutable, context, Executable_Block.For);
         blockContext.Execute();
         if (blockContext.IsOver) break;
         context.Execute(code.LoopExecutable);
     }
 }