#ifndef COERCION_H #define COERCION_H #include "types.h" #include "Node.h" #include "SyntaxTree.h" /* Gives the ReturnType that is at least needed for binary operators * based on the return types of the left and right hand sides. */ ReturnType minimumtype(ReturnType lhs, ReturnType rhs); /* Check whether type is of expected type */ void checkType(ReturnType expected, ReturnType actual); void checkType(ReturnType expected, Node *expression); /* Coerces the expression node if necessary. * Returns either a coercion node or expression itself. */ Node *coerce(ReturnType to, Node *expression); /* Checks if the number and type of the arguments to the call are correct * and coerces arguments if necessary. * It gives an error message if it is incorrect. * call_node must be a valid NodeType of either NODE_FUNCTIONCALL or * NODE_PROCCALL */ void check_parameters(Node *call_node); #endif /* COERCION_H */