aboutsummaryrefslogtreecommitdiff
path: root/src/dump_analysis.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-03 18:05:44 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-03 18:05:44 -0400
commit39d47b2c51d43d98f414ed5d5622c9e582ec9aa6 (patch)
treef1a9609e9db26c688ced5eae2ae87d5f0a3717c0 /src/dump_analysis.cpp
parent59ac7b91daed86af1ff03aceb7d9e9b8118e06ba (diff)
downloadzig-39d47b2c51d43d98f414ed5d5622c9e582ec9aa6.tar.gz
zig-39d47b2c51d43d98f414ed5d5622c9e582ec9aa6.zip
handle when std lib is unused
Diffstat (limited to 'src/dump_analysis.cpp')
-rw-r--r--src/dump_analysis.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/dump_analysis.cpp b/src/dump_analysis.cpp
index 9e928ea7f0..9cb0f46c9f 100644
--- a/src/dump_analysis.cpp
+++ b/src/dump_analysis.cpp
@@ -482,25 +482,27 @@ static void anal_dump_decl_ref(AnalDumpCtx *ctx, Tld *tld) {
static void anal_dump_pkg(AnalDumpCtx *ctx, ZigPackage *pkg) {
JsonWriter *jw = &ctx->jw;
- jw_array_elem(jw);
- jw_begin_object(jw);
-
- jw_object_field(jw, "name");
- jw_string(jw, buf_ptr(&pkg->pkg_path));
- jw_object_field(jw, "file");
Buf full_path_buf = BUF_INIT;
os_path_join(&pkg->root_src_dir, &pkg->root_src_path, &full_path_buf);
Buf *resolve_paths[] = { &full_path_buf, };
Buf *resolved_path = buf_alloc();
*resolved_path = os_path_resolve(resolve_paths, 1);
- anal_dump_file_ref(ctx, resolved_path);
auto import_entry = ctx->g->import_table.maybe_get(resolved_path);
if (!import_entry) {
- fprintf(stderr, "due to a race condition or bug, files moved around during analysis\n");
- exit(1);
+ return;
}
+
+ jw_array_elem(jw);
+ jw_begin_object(jw);
+
+ jw_object_field(jw, "name");
+ jw_string(jw, buf_ptr(&pkg->pkg_path));
+
+ jw_object_field(jw, "file");
+ anal_dump_file_ref(ctx, resolved_path);
+
jw_object_field(jw, "main");
anal_dump_type_ref(ctx, import_entry->value);