@@ -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
}
@@ -1061,6 +1063,14 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) {
1061
1063
}
1062
1064
break ;
1063
1065
}
1066
+ case ZigTypeIdFnFrame: {
1067
+ jw_object_field (jw, " fn_name" );
1068
+ jw_string (jw, buf_ptr (&ty->data .frame .fn ->symbol_name ));
1069
+
1070
+ jw_object_field (jw, " fn" );
1071
+ anal_dump_fn_ref (ctx, ty->data .frame .fn );
1072
+ break ;
1073
+ }
1064
1074
case ZigTypeIdInvalid:
1065
1075
zig_unreachable ();
1066
1076
default :
@@ -1186,6 +1196,12 @@ static void anal_dump_fn(AnalDumpCtx *ctx, ZigFn *fn) {
1186
1196
jw_object_field (jw, " type" );
1187
1197
anal_dump_type_ref (ctx, fn->type_entry );
1188
1198
1199
+ auto entry = ctx->fn_decl_map .maybe_get (fn);
1200
+ if (entry != nullptr ) {
1201
+ jw_object_field (jw, " decl" );
1202
+ jw_int (jw, entry->value );
1203
+ }
1204
+
1189
1205
jw_end_object (jw);
1190
1206
}
1191
1207
@@ -1200,6 +1216,7 @@ void zig_print_analysis_dump(CodeGen *g, FILE *f, const char *one_indent, const
1200
1216
ctx.decl_map .init (16 );
1201
1217
ctx.node_map .init (16 );
1202
1218
ctx.fn_map .init (16 );
1219
+ ctx.fn_decl_map .init (16 );
1203
1220
ctx.err_map .init (16 );
1204
1221
1205
1222
jw_begin_object (jw);
0 commit comments