| ... | @@ -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) { |
| 482 | | 482 | |
| 483 | static void anal_dump_pkg(AnalDumpCtx *ctx, ZigPackage *pkg) { | 483 | static 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)); | | |
| 490 | | 485 | |
| 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); | | |
| 498 | | 491 | |
| 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); |
| 506 | | 508 | |