@@ -352,6 +352,7 @@ struct AnalDumpCtx {
352
352
353
353
ZigList<ZigFn *> fn_list;
354
354
HashMap<const ZigFn *, uint32_t , fn_ptr_hash, fn_ptr_eql> fn_map;
355
+ HashMap<const ZigFn *, uint32_t , fn_ptr_hash, fn_ptr_eql> fn_decl_map;
355
356
356
357
ZigList<AstNode *> node_list;
357
358
HashMap<const AstNode *, uint32_t , node_ptr_hash, node_ptr_eql> node_map;
@@ -491,6 +492,7 @@ static uint32_t anal_dump_get_decl_id(AnalDumpCtx *ctx, Tld *tld) {
491
492
492
493
if (fn != nullptr ) {
493
494
(void )anal_dump_get_type_id (ctx, fn->type_entry );
495
+ ctx->fn_decl_map .put_unique (fn, decl_id);
494
496
}
495
497
break ;
496
498
}
@@ -1065,6 +1067,14 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) {
1065
1067
}
1066
1068
break ;
1067
1069
}
1070
+ case ZigTypeIdFnFrame: {
1071
+ jw_object_field (jw, " fnName" );
1072
+ jw_string (jw, buf_ptr (&ty->data .frame .fn ->symbol_name ));
1073
+
1074
+ jw_object_field (jw, " fn" );
1075
+ anal_dump_fn_ref (ctx, ty->data .frame .fn );
1076
+ break ;
1077
+ }
1068
1078
case ZigTypeIdInvalid:
1069
1079
zig_unreachable ();
1070
1080
default :
@@ -1190,6 +1200,12 @@ static void anal_dump_fn(AnalDumpCtx *ctx, ZigFn *fn) {
1190
1200
jw_object_field (jw, " type" );
1191
1201
anal_dump_type_ref (ctx, fn->type_entry );
1192
1202
1203
+ auto entry = ctx->fn_decl_map .maybe_get (fn);
1204
+ if (entry != nullptr ) {
1205
+ jw_object_field (jw, " decl" );
1206
+ jw_int (jw, entry->value );
1207
+ }
1208
+
1193
1209
jw_end_object (jw);
1194
1210
}
1195
1211
@@ -1204,6 +1220,7 @@ void zig_print_analysis_dump(CodeGen *g, FILE *f, const char *one_indent, const
1204
1220
ctx.decl_map .init (16 );
1205
1221
ctx.node_map .init (16 );
1206
1222
ctx.fn_map .init (16 );
1223
+ ctx.fn_decl_map .init (16 );
1207
1224
ctx.err_map .init (16 );
1208
1225
1209
1226
jw_begin_object (jw);
0 commit comments