コード例 #1
0
        public ScriptObject Call(ScriptContext parentContext, ScorpioDictionary <ScriptObject> objs, ScriptObject[] parameters)
        {
            int length = parameters.Length;

            if (m_Params)
            {
                ScriptArray paramsArray = m_Script.CreateArray();
                for (int i = 0; i < m_ParameterCount - 1; ++i)
                {
                    objs[m_ListParameters[i]] = (parameters != null && length > i) ? parameters[i] : m_Script.Null;
                }
                for (int i = m_ParameterCount - 1; i < length; ++i)
                {
                    paramsArray.Add(parameters[i]);
                }
                objs[m_ListParameters[m_ParameterCount - 1]] = paramsArray;
            }
            else
            {
                for (int i = 0; i < m_ParameterCount; ++i)
                {
                    objs[m_ListParameters[i]] = (parameters != null && length > i) ? parameters[i] : m_Script.Null;
                }
            }
            ScriptContext context = new ScriptContext(m_Script, m_ScriptExecutable, parentContext, Executable_Block.Function);

            context.Initialize(objs);
            return(context.Execute());
        }
コード例 #2
0
 public ScriptContext(Script script, ScriptExecutable scriptExecutable, ScriptContext parent, Executable_Block block)
 {
     m_script             = script;
     m_parent             = parent;
     m_block              = block;
     m_variableDictionary = new ScorpioDictionary <string, ScriptObject>();
     if (scriptExecutable != null)
     {
         m_scriptInstructions = scriptExecutable.ScriptInstructions;
         m_InstructionCount   = m_scriptInstructions.Length;
     }
 }
コード例 #3
0
 }                                                                               //continue break return 当前模块是否执行完成
 public void Initialize(ScorpioDictionary <string, ScriptObject> variable)
 {
     m_variableDictionary.Set(variable);
 }