Пример #1
0
        public static ScopeContext GetPopulatedScope(SkryptMethod m)
        {
            var s = new ScopeContext();

            if (m.GetType() == typeof(UserFunction))
            {
                for (int i = 0; i < m.Parameters.Count; i++)
                {
                    s.SetVariable(m.Parameters[i], new Null());
                }
            }

            return(s);
        }
Пример #2
0
        public static ScopeContext GetPopulatedScope(SkryptMethod m, SkryptObject[] a = null)
        {
            var s = new ScopeContext();

            if (m.GetType() == typeof(UserFunction))
            {
                for (int i = 0; i < m.Parameters.Count; i++)
                {
                    s.SetVariable(m.Parameters[i], a[i]);
                }
            }
            else
            {
                for (int i = 0; i < a.Length; i++)
                {
                    s.SetVariable(a[i].GetHashCode() + "", a[i]);
                }
            }

            return(s);
        }