예제 #1
0
        public override bool Translate()
        {
            Visitor.Visit(Exp);
            var type = Visitor.LastType;

            Node = new AbstractTypeNode(this, type);
            return(true);
        }
        public override AbstractFormulaNode Simplify()
        {
            var child = Child.Simplify();

            Child = child;
            if (Child is AbstractTypeNode)
            {
                AbstractTypeNode typeNode = (AbstractTypeNode)Child;
                if (typeNode.Type.OnlyHasType(VarType.TypeError) || typeNode.Type.AllNumeric())
                {
                    return(typeNode);
                }
                return(new AbstractTypeNode(ParentFormula, new Types(VarType.Int)));
            }

            return(this);
        }