dont mess up silly
This commit is contained in:
17
src/runner.c
17
src/runner.c
@ -157,13 +157,22 @@ int run(FILE *alpha) {
|
||||
|
||||
if (ir_flag != NULL) {
|
||||
printdebug("[-ir] Intermediate code is enabled.");
|
||||
emit_as_file(ir_flag, begin);
|
||||
if (contains_errors) {
|
||||
emit_as_file(ir_flag, begin);
|
||||
} else {
|
||||
remove(ir_name);
|
||||
}
|
||||
fclose(ir_flag);
|
||||
}
|
||||
|
||||
if (cg_flag != NULL) {
|
||||
printdebug("[-cg] Code generation is enabled.");
|
||||
generate();
|
||||
|
||||
if (contains_errors) {
|
||||
generate();
|
||||
} else {
|
||||
remove(cg_name);
|
||||
}
|
||||
fclose(cg_flag);
|
||||
}
|
||||
|
||||
@ -236,8 +245,12 @@ int new_file(char *arg, char *alpha) {
|
||||
} else if (strcmp(arg, "-asc") == 0) {
|
||||
asc_flag = fopen(file_name, "w");
|
||||
} else if (strcmp(arg, "-ir") == 0) {
|
||||
ir_name = malloc(strlen(file_name) + 1);
|
||||
strcpy(ir_name, file_name);
|
||||
ir_flag = fopen(file_name, "w");
|
||||
} else if (strcmp(arg, "-cg") == 0) {
|
||||
cg_name = malloc(strlen(file_name) + 1);
|
||||
strcpy(cg_name, file_name);
|
||||
cg_flag = fopen(file_name, "w");
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user