From f14493b61b0e578e282fec91771dce2379498c94 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 22 May 2019 05:23:59 -0500 Subject: [PATCH] fix: context clear doesn't clear defaults --- packages/behavior/context/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/behavior/context/index.js b/packages/behavior/context/index.js index 049b801..c70499e 100644 --- a/packages/behavior/context/index.js +++ b/packages/behavior/context/index.js @@ -15,6 +15,12 @@ class Context extends Map { this.set(key, value); } + clear() { + super.clear(); + this.add('context', this); + this.add('global', new Globals()); + } + compile(traversal) { // Compile traversal. if (!compiled.has(traversal.hash)) { @@ -101,7 +107,6 @@ class Context extends Map { export function createContext() { const context = new Context(); - context.add('context', context); - context.add('global', new Globals()); + context.clear(); return context; }