Fix use-after-move bug in Scope constructor

This commit is contained in:
Tim Wojtulewicz 2023-03-12 14:51:33 -07:00
parent 06bac61607
commit 9eaa2cb45b

View file

@ -22,7 +22,7 @@ Scope::Scope(IDPtr id, std::unique_ptr<std::vector<AttrPtr>> al)
{
return_type = nullptr;
if ( id )
if ( scope_id )
{
const auto& id_type = scope_id->GetType();
@ -31,7 +31,7 @@ Scope::Scope(IDPtr id, std::unique_ptr<std::vector<AttrPtr>> al)
else if ( id_type->Tag() != TYPE_FUNC )
reporter->InternalError("bad scope id");
FuncType* ft = id->GetType()->AsFuncType();
FuncType* ft = scope_id->GetType()->AsFuncType();
return_type = ft->Yield();
}
}