Make Environment.scope scope mixins and functions.

This commit is contained in:
Natalie Weizenbaum 2016-08-27 19:01:06 -07:00 committed by Natalie Weizenbaum
parent bbaf8a5a2f
commit 631f0870ac

View File

@ -76,13 +76,21 @@ class Environment {
/*=T*/ scope/*<T>*/(/*=T*/ callback()) {
// TODO: avoid creating a new scope if no variables are declared.
_variables.add({});
_variables.add(normalizedMap());
_functions.add(normalizedMap());
_mixins.add(normalizedMap());
try {
return callback();
} finally {
for (var name in _variables.removeLast().keys) {
_variableIndices.remove(name);
}
for (var name in _functions.removeLast().keys) {
_functionIndices.remove(name);
}
for (var name in _mixins.removeLast().keys) {
_mixinIndices.remove(name);
}
}
}
}