Commit 39d47b2c51

Andrew Kelley <andrew@ziglang.org>
2019-10-04 00:05:44
handle when std lib is unused
1 parent 59ac7b9
Changed files (1)
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);