ext/libsass/src/environment.cpp in sassc-1.8.3 vs ext/libsass/src/environment.cpp in sassc-1.8.4
- old
+ new
@@ -1,16 +1,26 @@
+#include "sass.hpp"
#include "ast.hpp"
#include "environment.hpp"
namespace Sass {
template <typename T>
- Environment<T>::Environment() : local_frame_(std::map<std::string, T>()), parent_(0) { }
+ Environment<T>::Environment(bool is_shadow)
+ : local_frame_(std::map<std::string, T>()),
+ parent_(0), is_shadow_(false)
+ { }
template <typename T>
- Environment<T>::Environment(Environment<T>* env) : local_frame_(std::map<std::string, T>()), parent_(env) { }
+ Environment<T>::Environment(Environment<T>* env, bool is_shadow)
+ : local_frame_(std::map<std::string, T>()),
+ parent_(env), is_shadow_(is_shadow)
+ { }
template <typename T>
- Environment<T>::Environment(Environment<T>& env) : local_frame_(std::map<std::string, T>()), parent_(&env) { }
+ Environment<T>::Environment(Environment<T>& env, bool is_shadow)
+ : local_frame_(std::map<std::string, T>()),
+ parent_(&env), is_shadow_(is_shadow)
+ { }
// link parent to create a stack
template <typename T>
void Environment<T>::link(Environment& env) { parent_ = &env; }
template <typename T>
@@ -116,15 +126,16 @@
// either update already existing lexical value
// or if flag is set, we create one if no lexical found
template <typename T>
void Environment<T>::set_lexical(const std::string& key, T val)
{
- auto cur = this;
- while (cur->is_lexical()) {
+ auto cur = this; bool shadow = false;
+ while (cur->is_lexical() || shadow) {
if (cur->has_local(key)) {
cur->set_local(key, val);
return;
}
+ shadow = cur->is_shadow();
cur = cur->parent_;
}
set_local(key, val);
}