Skip to content

Commit e94ee2f

Browse files
committed
Fix: Reorder includes in main.c and fix uninitialized variable in optimizer.c
1 parent 85fd7a0 commit e94ee2f

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/compiler/optimizer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static Expr* foldBinary(Expr* expr) {
2020
double b = AS_NUMBER(rv);
2121
const char* op = expr->as.binary.operator;
2222

23-
Value res;
23+
Value res = NIL_VAL;
2424
bool folded = true;
2525

2626
if (strcmp(op, "+") == 0) res = NUMBER_VAL(a + b);

src/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <stdio.h>
2323
#include <stdlib.h>
2424
#include <string.h>
25+
#include "type_checker.h"
26+
#include "optimizer.h"
2527

2628
#ifdef _WIN32
2729
#include <process.h>
@@ -151,9 +153,6 @@ static char *readFile(const char *path) {
151153
return buffer;
152154
}
153155

154-
#include "type_checker.h"
155-
#include "optimizer.h"
156-
157156
static void runFile(const char *path) {
158157
char *source = readFile(path);
159158
if (source == NULL) {

0 commit comments

Comments
 (0)