Last change
on this file since 23 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
925 bytes
|
Rev | Line | |
---|
[2] | 1 | #ifndef COERCION_H
|
---|
| 2 | #define COERCION_H
|
---|
| 3 |
|
---|
| 4 | #include "types.h"
|
---|
| 5 | #include "Node.h"
|
---|
| 6 | #include "SyntaxTree.h"
|
---|
| 7 |
|
---|
| 8 | /* Gives the ReturnType that is at least needed for binary operators
|
---|
| 9 | * based on the return types of the left and right hand sides.
|
---|
| 10 | */
|
---|
| 11 | ReturnType minimumtype(ReturnType lhs, ReturnType rhs);
|
---|
| 12 |
|
---|
| 13 | /* Check whether type is of expected type
|
---|
| 14 | */
|
---|
| 15 | void checkType(ReturnType expected, ReturnType actual);
|
---|
| 16 | void checkType(ReturnType expected, Node *expression);
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | /* Coerces the expression node if necessary.
|
---|
| 20 | * Returns either a coercion node or expression itself.
|
---|
| 21 | */
|
---|
| 22 | Node *coerce(ReturnType to, Node *expression);
|
---|
| 23 |
|
---|
| 24 | /* Checks if the number and type of the arguments to the call are correct
|
---|
| 25 | * and coerces arguments if necessary.
|
---|
| 26 | * It gives an error message if it is incorrect.
|
---|
| 27 | * call_node must be a valid NodeType of either NODE_FUNCTIONCALL or
|
---|
| 28 | * NODE_PROCCALL
|
---|
| 29 | */
|
---|
| 30 | void check_parameters(Node *call_node);
|
---|
| 31 |
|
---|
| 32 | #endif /* COERCION_H */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.