summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorTom Harley2020-01-08 14:14:39 +0000
committerTom Harley2020-01-08 14:14:39 +0000
commit4cdc57ce8041aecabd3175f2dff176b115f17724 (patch)
treeda9a25e2d18ce5f4415d4c61441962e9e06ee727 /scope.c
parentcheckpoint (diff)
downloadsinter-4cdc57ce8041aecabd3175f2dff176b115f17724.tar.gz
sinter-4cdc57ce8041aecabd3175f2dff176b115f17724.zip

I should commit more

Diffstat (limited to 'scope.c')
-rw-r--r--scope.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index 9b65a38..5bb61d8 100644
--- a/scope.c
+++ b/scope.c
@@ -41,7 +41,9 @@ void scope_pop_layer(scope *sc) {
*sc = new_sc;
}
-void scope_add_entry(scope sc, char *id, LLVMValueRef val, LLVMTypeRef type) {
+scope_entry *scope_add_entry(scope sc, char *id, LLVMValueRef val,
+ LLVMTypeRef type) {
+
scope_entry *new_entry = malloc(sizeof (*new_entry));
if (!new_entry) error(GENERAL_ERROR, "cannot malloc?");
@@ -54,6 +56,8 @@ void scope_add_entry(scope sc, char *id, LLVMValueRef val, LLVMTypeRef type) {
scope_layer *layer = sc;
new_entry->prev = layer->head;
layer->head = new_entry;
+
+ return new_entry;
}
scope_entry *scope_find(scope sc, char *id) {