fix(arc): assembler label collision (#158)
This commit is contained in:
parent
9e2dcf8d36
commit
cf8a7566be
@ -228,6 +228,7 @@ auto assembler::assemble(assembly const& data, std::string const& name) -> buffe
|
|||||||
|
|
||||||
auto assembler::assemble_function(function& func) -> void
|
auto assembler::assemble_function(function& func) -> void
|
||||||
{
|
{
|
||||||
|
auto labels = std::unordered_map<u32, std::string>();
|
||||||
func.index = script_.pos();
|
func.index = script_.pos();
|
||||||
func.size = 0;
|
func.size = 0;
|
||||||
func_ = &func;
|
func_ = &func;
|
||||||
@ -245,11 +246,12 @@ auto assembler::assemble_function(function& func) -> void
|
|||||||
|
|
||||||
if (itr != func.labels.end())
|
if (itr != func.labels.end())
|
||||||
{
|
{
|
||||||
func.labels.insert({ inst->index, itr->second });
|
labels.insert({ inst->index, itr->second });
|
||||||
func.labels.erase(old_idx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func.labels = std::move(labels);
|
||||||
|
|
||||||
script_.pos(func.index);
|
script_.pos(func.index);
|
||||||
|
|
||||||
for (auto const& inst : func.instructions)
|
for (auto const& inst : func.instructions)
|
||||||
|
Loading…
Reference in New Issue
Block a user