Merge pull request #13032 from jacobly0/br-on-undef-val

stage2: fix branches on undefined values
This commit is contained in:
Andrew Kelley
2022-10-03 22:46:22 -04:00
committed by GitHub
6 changed files with 45 additions and 6 deletions

View File

@@ -2332,10 +2332,13 @@ pub const Object = struct {
// buffer is only used for int_type, `builtin` is a struct.
const builtin_ty = mod.declPtr(builtin_decl).val.toType(undefined);
const builtin_namespace = builtin_ty.getNamespace().?;
const stack_trace_decl = builtin_namespace.decls
const stack_trace_decl_index = builtin_namespace.decls
.getKeyAdapted(stack_trace_str, Module.DeclAdapter{ .mod = mod }).?;
const stack_trace_decl = mod.declPtr(stack_trace_decl_index);
return mod.declPtr(stack_trace_decl).val.toType(undefined);
// Sema should have ensured that StackTrace was analyzed.
assert(stack_trace_decl.has_tv);
return stack_trace_decl.val.toType(undefined);
}
};