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); }
protected override bool Visit(ASTPositive node) => EmitUnary <CPositive>(node);
protected abstract bool Visit(ASTPositive node);