21 lines
420 B
C
21 lines
420 B
C
#include "statement.h"
|
|
|
|
Stmt* CreateStatement(Expr* expression, StatementType type) {
|
|
Stmt* stmt = calloc(1, sizeof(Stmt));
|
|
|
|
if (!stmt) {
|
|
fprintf(stderr, "Failed to calloc space for Statement. %s.\n", strerror(errno));
|
|
return NULL;
|
|
}
|
|
|
|
stmt->expression = expression;
|
|
stmt->type = type;
|
|
|
|
return stmt;
|
|
}
|
|
|
|
void FreeStatement(Stmt* stmt) {
|
|
if (!stmt) return;
|
|
|
|
free(stmt);
|
|
} |