From 848894d3e3b50548df600c6f2e2214afdac8ed41 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Sat, 4 Mar 2017 06:03:38 -0800 Subject: [PATCH] Fix sneaky bug causing declaration leakage Resolves: #211 --- lib/session.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/session.coffee b/lib/session.coffee index 69cba9d..abceb53 100644 --- a/lib/session.coffee +++ b/lib/session.coffee @@ -1077,7 +1077,12 @@ processDeclarations = (sessionContext, allDeclareTimestamps, allDeclareAttribute for path in paths if path.length > currentPath.length fragment = path[currentPath.length] - children[fragment] ?= [] + if not children[fragment] + children[fragment] = [] + if path.length > currentPath.length + 1 + # This is to ensure we don't descend more than one step at a time + p = common.addPathMeta(path.slice(0, currentPath.length + 1)) + children[fragment].push(p) children[fragment].push(path) continue