Refactor fn arg checking

This commit is contained in:
2026-01-20 19:55:38 +11:00
parent fd6fbbaed5
commit 724162f42e
3 changed files with 51 additions and 2 deletions

View File

@@ -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