authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-03 18:05:44-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-03 18:05:44-04:00
log39d47b2c51d43d98f414ed5d5622c9e582ec9aa6
treef1a9609e9db26c688ced5eae2ae87d5f0a3717c0
parent59ac7b91daed86af1ff03aceb7d9e9b8118e06ba
signaturelock-open Commit is signed but in an unrecognized format.

handle when std lib is unused


1 files changed, 11 insertions(+), 9 deletions(-)

src/dump_analysis.cpp+11-9
...@@ -482,25 +482,27 @@ static void anal_dump_decl_ref(AnalDumpCtx *ctx, Tld *tld) {...@@ -482,25 +482,27 @@ static void anal_dump_decl_ref(AnalDumpCtx *ctx, Tld *tld) {
482482
483static void anal_dump_pkg(AnalDumpCtx *ctx, ZigPackage *pkg) {483static void anal_dump_pkg(AnalDumpCtx *ctx, ZigPackage *pkg) {
484 JsonWriter *jw = &ctx->jw;484 JsonWriter *jw = &ctx->jw;
485 jw_array_elem(jw);
486 jw_begin_object(jw);
487
488 jw_object_field(jw, "name");
489 jw_string(jw, buf_ptr(&pkg->pkg_path));
490485
491 jw_object_field(jw, "file");
492 Buf full_path_buf = BUF_INIT;486 Buf full_path_buf = BUF_INIT;
493 os_path_join(&pkg->root_src_dir, &pkg->root_src_path, &full_path_buf);487 os_path_join(&pkg->root_src_dir, &pkg->root_src_path, &full_path_buf);
494 Buf *resolve_paths[] = { &full_path_buf, };488 Buf *resolve_paths[] = { &full_path_buf, };
495 Buf *resolved_path = buf_alloc();489 Buf *resolved_path = buf_alloc();
496 *resolved_path = os_path_resolve(resolve_paths, 1);490 *resolved_path = os_path_resolve(resolve_paths, 1);
497 anal_dump_file_ref(ctx, resolved_path);
498491
499 auto import_entry = ctx->g->import_table.maybe_get(resolved_path);492 auto import_entry = ctx->g->import_table.maybe_get(resolved_path);
500 if (!import_entry) {493 if (!import_entry) {
501 fprintf(stderr, "due to a race condition or bug, files moved around during analysis\n");494 return;
502 exit(1);
503 }495 }
496
497 jw_array_elem(jw);
498 jw_begin_object(jw);
499
500 jw_object_field(jw, "name");
501 jw_string(jw, buf_ptr(&pkg->pkg_path));
502
503 jw_object_field(jw, "file");
504 anal_dump_file_ref(ctx, resolved_path);
505
504 jw_object_field(jw, "main");506 jw_object_field(jw, "main");
505 anal_dump_type_ref(ctx, import_entry->value);507 anal_dump_type_ref(ctx, import_entry->value);
506508