Refactor fn arg checking
This commit is contained in:
@@ -62,6 +62,7 @@ typedef struct GroundError {
|
||||
*/
|
||||
typedef struct GroundValue {
|
||||
GroundValueType type;
|
||||
struct GroundStruct* customType;
|
||||
union {
|
||||
int64_t intVal;
|
||||
double doubleVal;
|
||||
@@ -125,6 +126,7 @@ typedef struct GroundProgram {
|
||||
*/
|
||||
typedef struct GroundFunctionArgs {
|
||||
GroundValueType type;
|
||||
struct GroundStruct* customType;
|
||||
char* name;
|
||||
} GroundFunctionArgs;
|
||||
|
||||
@@ -276,6 +278,11 @@ void freeGroundObject(GroundObject* object);
|
||||
// Creates a GroundError.
|
||||
GroundError createGroundError(char* what, char* type, GroundInstruction* where, size_t* line);
|
||||
|
||||
// Compares types of a value and function args.
|
||||
bool checkFnTypes(GroundValue* left, GroundFunctionArgs* arg);
|
||||
|
||||
// Compares types of two values.
|
||||
bool checkTypes(GroundValue* left, GroundValue* right);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user