💎💎💎💎💎

This commit is contained in:
Scarlett
2025-05-05 14:28:02 -04:00
parent e51bea728b
commit 76f98b93ab
2 changed files with 29 additions and 17 deletions

View File

@ -306,7 +306,9 @@ function_declaration:
if(getAdInfoType(table_lookup(cur, $4))==TYPE_FUNCTION_TYPE){
//printf("%s\n",$2);
//printf("%s\n",getName(table_lookup(cur, $4)));
CreateEntry(cur,TYPE_FUNCTION_DECLARATION, table_lookup(cur, $4), $2, CreateFunctionDeclarationInfo(-1, false,NULL));
if (CreateEntry(cur,TYPE_FUNCTION_DECLARATION, table_lookup(cur, $4), $2, CreateFunctionDeclarationInfo(-1, false,NULL)) == undefined) {
throw_error(ERROR_TYPE, "Duplicate defination of function in function declaration");
}
}
else{
throw_error(ERROR_TYPE, "Function declatation (%s) is not a valid function type", $2);
@ -318,7 +320,9 @@ function_declaration:
| EXTERNAL FUNCTION ID COLON ID
{
if(getAdInfoType(look_up(cur, $5))==TYPE_FUNCTION_TYPE){
CreateEntry(cur,TYPE_FUNCTION_DECLARATION, look_up(cur, $5), $3, CreateFunctionDeclarationInfo(-1, false,NULL));
if (CreateEntry(cur,TYPE_FUNCTION_DECLARATION, look_up(cur, $5), $3, CreateFunctionDeclarationInfo(-1, false,NULL)) == undefined) {
throw_error(ERROR_TYPE, "Duplicate defination of function in function declaration");
}
}
else{
throw_error(ERROR_TYPE, "Function declatation (%s) is not a valid function type", $3);
@ -1579,7 +1583,7 @@ void throw_error(ErrorType error_type, const char *format, ...) {
}
if (asc_flag) {
/* yyerror(""); */
yyerror("");
int needed = snprintf(NULL, 0, " LINE (%d:%d) ** %s ERROR: ", line, column, error_name);
char *error_message = malloc(needed + 1);
snprintf(error_message, needed + 1, " LINE (%d:%d) ** %s ERROR: ", line, column, error_name);