Return mapping from variables to registers in fate compilation #902

Merged
ghallak merged 13 commits from ghallak/vars-registers-map into master 2022-10-25 15:42:03 +09:00
Showing only changes of commit cb588dc04b - Show all commits

View File

@ -138,7 +138,12 @@ get_variables_registers() ->
add_variables_register(Env = #env{saved_fresh_names = SavedFreshNames}, Name, Register) ->
Olds = get_variables_registers(),
RealName = maps:get(Name, SavedFreshNames, Name),
FunName = binary_to_list(make_function_name(Env#env.current_function)),
FunName =
case Env#env.current_function of
event -> "Chain.event";
{entrypoint, BinName} -> binary_to_list(BinName);
{local_fun, QualName} -> lists:last(QualName)
end,
New = {Env#env.contract, FunName, RealName},
put(variables_registers, Olds#{New => Register}).