示例#1
0
        protected override bool Visit(ASTPositive node)
        {
            if (!Visit(node.Child))
            {
                return(false);
            }

            var childType = node.Child.TypeInfo;

            if (childType is FloatType f)
            {
                node.TypeInfo = f;
                return(true);
            }

            if (childType is IntegerType i)
            {
                node.TypeInfo = i;
                return(true);
            }

            Error(node.Position, $"Cannot do unary positive on {childType}");
            return(false);
        }
示例#2
0
 protected override bool Visit(ASTPositive node) => EmitUnary <CPositive>(node);
示例#3
0
 protected abstract bool Visit(ASTPositive node);