fix: context clear doesn't clear defaults

This commit is contained in:
cha0s 2019-05-22 05:23:59 -05:00
parent 5002d9b107
commit f14493b61b

View File

@ -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;
}