예제 #1
0
파일: Evaluator.cs 프로젝트: helgihaf/Alpha
        public void Visit(ArrayMemberNode node)
        {
            AssertResolver();
            List<object> indexers = new List<object>();
            foreach (var indexerNode in node.Indexers)
            {
                indexerNode.Accept(this);
                indexers.Add(valueStack.Pop());
            }

            if (!node.LateEvaluation)
            {
                valueStack.Push(Resolver.ResolveArrayMember(node.Identifier, indexers));
            }
            else
            {
                var memberInfo =
                    new MemberInfo { Name = node.Identifier, MemberType = MemberType.Array };
                memberInfo.Arguments.AddRange(indexers);
                valueStack.Push(memberInfo);
            }
        }
예제 #2
0
파일: Evaluator.cs 프로젝트: helgihaf/Alpha
        public void Visit(FunctionNode node)
        {
            List<object> parameters = new List<object>();
            if (node.Parameters != null)
            {
                foreach (var paramNode in node.Parameters)
                {
                    paramNode.Accept(this);
                    parameters.Add(valueStack.Pop());
                }
            }

            if (!node.LateEvaluation)
            {
                valueStack.Push(Resolver.ResolveFunctionCall(node.FunctionName, parameters));
            }
            else
            {
                var memberInfo =
                    new MemberInfo { Name = node.FunctionName, MemberType = MemberType.Function};
                memberInfo.Arguments.AddRange(parameters);
                valueStack.Push(memberInfo);
            }
        }