示例#1
0
        public override Type GetResultType(IResolver resolver)
        {
            Type           leftType       = left.GetResultType(resolver);
            IdentifierNode identifierNode = right as IdentifierNode;

            if (identifierNode != null)
            {
                return(resolver.GetMemberType(leftType, identifierNode.Identifier));
            }
            else
            {
                FunctionCallNode functionNode = (FunctionCallNode)right;
                functionNode.DeclaringType = leftType;
                return(functionNode.GetResultType(resolver));
            }
        }
示例#2
0
        public override object Execute(IResolver resolver)
        {
            object leftResult = left.Execute(resolver);

            if (leftResult == null)
            {
                throw new Exception(String.Format("Formula error: Cannot get value of {0}.{1} because {0} is Null.",
                                                  left.ToString(), right.ToString()));
            }
            if (right is IdentifierNode)
            {
                return(resolver.GetMemberValue(leftResult, ((IdentifierNode)right).Identifier));
            }
            else
            {
                FunctionCallNode functionNode = (FunctionCallNode)right;
                functionNode.DeclaringType = leftResult.GetType();
                return(functionNode.Execute(leftResult, resolver));
            }
        }
示例#3
0
        public override void Validate(IResolver resolver)
        {
            left.Validate(resolver);
            Type leftType = left.GetResultType(resolver);

            IdentifierNode identifierNode = right as IdentifierNode;

            if (identifierNode != null)
            {
                resolver.GetMemberType(leftType, identifierNode.Identifier);
                return;
            }

            FunctionCallNode functionNode = right as FunctionCallNode;

            if (functionNode != null)
            {
                functionNode.DeclaringType = left.GetResultType(resolver);
                return;
            }
        }