aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-11-30 23:06:29 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-11-30 23:06:29 -0700
commit31cf43de54c012c3b6f4fa7a516e2aac0ae18b56 (patch)
treee68740ae147e571c4e0847332f4415f524f8900c /src/codegen.cpp
parentcd68969115f19b09aeb72923426e722725ba9451 (diff)
downloadzig-31cf43de54c012c3b6f4fa7a516e2aac0ae18b56.tar.gz
zig-31cf43de54c012c3b6f4fa7a516e2aac0ae18b56.zip
analyze looks for root export decl only in the root source file
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 598dbd1f15..ee15e2a2e5 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -661,7 +661,7 @@ static void init(CodeGen *g, Buf *source_path) {
}
-static void codegen_add_code(CodeGen *g, Buf *source_path, Buf *source_code) {
+static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *source_path, Buf *source_code) {
Buf full_path = BUF_INIT;
os_path_join(g->root_source_dir, source_path, &full_path);
@@ -715,13 +715,14 @@ static void codegen_add_code(CodeGen *g, Buf *source_path, Buf *source_code) {
codegen_add_code(g, &top_level_decl->data.use.path, &import_code);
}
}
+
+ return import_entry;
}
void codegen_add_root_code(CodeGen *g, Buf *source_path, Buf *source_code) {
init(g, source_path);
- codegen_add_code(g, source_path, source_code);
-
+ g->root_import = codegen_add_code(g, source_path, source_code);
if (g->verbose) {
fprintf(stderr, "\nSemantic Analysis:\n");