diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-01 02:29:21 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-01 02:29:21 -0700 |
| commit | dfb6682089ad758b7ba72733778a9aa8c544c164 (patch) | |
| tree | c86a7a8bff35db1188a4b644a715caff6a5be92c /src/codegen.cpp | |
| parent | 58e375d0a1423c04f4d3faabe4d84bfc11028d56 (diff) | |
| download | zig-dfb6682089ad758b7ba72733778a9aa8c544c164.tar.gz zig-dfb6682089ad758b7ba72733778a9aa8c544c164.zip | |
add test for bad import
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 5ce95023e1..baae91a206 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -669,6 +669,7 @@ static void init(CodeGen *g, Buf *source_path) { } static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *source_path, Buf *source_code) { + int err; Buf full_path = BUF_INIT; os_path_join(g->root_source_dir, source_path, &full_path); @@ -736,7 +737,11 @@ static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *source_path, Buf *sou Buf full_path = BUF_INIT; os_path_join(g->root_source_dir, &top_level_decl->data.use.path, &full_path); Buf *import_code = buf_alloc(); - os_fetch_file_path(&full_path, import_code); + if ((err = os_fetch_file_path(&full_path, import_code))) { + add_node_error(g, top_level_decl, + buf_sprintf("unable to open \"%s\": %s", buf_ptr(&full_path), err_str(err))); + break; + } codegen_add_code(g, &top_level_decl->data.use.path, import_code); } } |
