Exemple #1
0
        private static string ModifyMatch(string Key, int Index, string Value)
        {
            Modifiers.ForEach((K, V) => {
                if (Key.Compare(K, Index))
                {
                    Value = V(Value);
                }
            });

            return(Value);
        }
Exemple #2
0
        public CustomTypeInstance CreateInstance(jsObject Args)
        {
            Function           Func;
            CustomTypeInstance Instance = new CustomTypeInstance(this);

            Properties.ForEach((K, V) => {
                V.Evaluate(Instance);
            });

            if (Functions.TryGetValue(ShortName, out Func))
            {
                Args.Set("this", Instance);

                Func.Evaluate(Args);
            }

            return(Instance);
        }
Exemple #3
0
        public static object[] GetArguments(jsObject Context)
        {
            var Args  = new object[Context.Count];
            var Index = 0;

            Context.ForEach((Key, Value) => {
                Node Node = Value as Node;

                if (Node != null)
                {
                    Value = Node.GetSystemHandler();
                }

                Args[Index++] = Value;
            });

            return(Args);
        }
Exemple #4
0
        public static jsObject GetFunctionArguments(Function This, jsObject Context, jsObject ArgList)
        {
            var Args  = new jsObject();
            var Index = 0;

            ArgList.ForEach((Key, Value) => {
                var Name = "";

                if (This != null)
                {
                    if (Index >= This.Arguments.Length)
                    {
                        Name = Key;
                    }
                    else
                    {
                        Name = This.Arguments[Index];
                    }
                }
                else
                {
                    Name = Key;
                }

                var VFunc = Value as Function;

                if (VFunc != null)
                {
                    if (VFunc.Arguments.Length > 0)
                    {
                        Value = GetFunctionHandler(VFunc, Context);
                    }
                    else
                    {
                        Value = VFunc.GetSystemHandler();
                    }
                }

                Variable.Set(Name, Args, GetValue(Value, Context));
                Index++;
            });

            return(Args);
        }