fix(arc): assembler label collision (#158)

This commit is contained in:
INeedGames 2023-11-30 17:00:40 -06:00 committed by GitHub
parent 9e2dcf8d36
commit cf8a7566be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,6 +228,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> buffe
auto assembler::assemble_function(function& func) -> void
{
auto labels = std::unordered_map<u32, std::string>();
func.index = script_.pos();
func.size = 0;
func_ = &func;
@ -245,11 +246,12 @@ auto assembler::assemble_function(function& func) -> void
if (itr != func.labels.end())
{
func.labels.insert({ inst->index, itr->second });
func.labels.erase(old_idx);
labels.insert({ inst->index, itr->second });
}
}
func.labels = std::move(labels);
script_.pos(func.index);
for (auto const& inst : func.instructions)