analyze looks for root export decl only in the root source file

This commit is contained in:
Andrew Kelley
2015-11-30 23:06:29 -07:00
parent cd68969115
commit 31cf43de54
3 changed files with 49 additions and 41 deletions

View File

@@ -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");