1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 08:39:30 +00:00

[internal] fix merge() merging unrelated branches

This commit is contained in:
Étienne Fildadut 2024-04-30 22:53:41 +02:00
parent a8f5cec236
commit 5836eb2a1d
3 changed files with 5 additions and 3 deletions

View file

@ -37,8 +37,8 @@ Branched = ast.abstract.Runtime {
if val and state.source_branch then
self.value[state.source_branch.branch_id] = val
self.value[state.branch_id] = nil
val:merge(state, cache)
end
self:get(state):merge(state, cache)
end,
_format = function(self, state, ...)

View file

@ -57,6 +57,7 @@ local VariableMetadata = ast.abstract.Runtime {
end,
_merge = function(self, state, cache)
self.symbol:merge(state, cache)
if not self.symbol.confined_to_branch then
self.branched:merge(state, cache)
end

View file

@ -288,10 +288,11 @@ Node = class {
if not cache[self] then
cache[self] = true
self:_merge(state, cache)
self:traverse(traverse.merge, state, cache)
end
end,
_merge = function(self, state, cache) end,
_merge = function(self, state, cache)
self:traverse(traverse.merge, state, cache)
end,
-- return string that uniquely represent this node
-- the actual hash is computed in :_hash, don't redefine :hash directly