mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
[internal] fix merge() merging unrelated branches
This commit is contained in:
parent
a8f5cec236
commit
5836eb2a1d
3 changed files with 5 additions and 3 deletions
|
|
@ -37,8 +37,8 @@ Branched = ast.abstract.Runtime {
|
||||||
if val and state.source_branch then
|
if val and state.source_branch then
|
||||||
self.value[state.source_branch.branch_id] = val
|
self.value[state.source_branch.branch_id] = val
|
||||||
self.value[state.branch_id] = nil
|
self.value[state.branch_id] = nil
|
||||||
val:merge(state, cache)
|
|
||||||
end
|
end
|
||||||
|
self:get(state):merge(state, cache)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
_format = function(self, state, ...)
|
_format = function(self, state, ...)
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ local VariableMetadata = ast.abstract.Runtime {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
_merge = function(self, state, cache)
|
_merge = function(self, state, cache)
|
||||||
|
self.symbol:merge(state, cache)
|
||||||
if not self.symbol.confined_to_branch then
|
if not self.symbol.confined_to_branch then
|
||||||
self.branched:merge(state, cache)
|
self.branched:merge(state, cache)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -288,10 +288,11 @@ Node = class {
|
||||||
if not cache[self] then
|
if not cache[self] then
|
||||||
cache[self] = true
|
cache[self] = true
|
||||||
self:_merge(state, cache)
|
self:_merge(state, cache)
|
||||||
self:traverse(traverse.merge, state, cache)
|
|
||||||
end
|
end
|
||||||
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
|
-- return string that uniquely represent this node
|
||||||
-- the actual hash is computed in :_hash, don't redefine :hash directly
|
-- the actual hash is computed in :_hash, don't redefine :hash directly
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue