This repository was archived by the owner on Jul 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,6 +206,20 @@ namespace Sass {
206206 }
207207 };
208208
209+ // use array access for getter and setter functions
210+ template <typename T>
211+ T& Environment<T>::get(const std::string& key)
212+ {
213+ auto cur = this ;
214+ while (cur) {
215+ if (cur->has_local (key)) {
216+ return cur->get_local (key);
217+ }
218+ cur = cur->parent_ ;
219+ }
220+ return get_local (key);
221+ }
222+
209223 // use array access for getter and setter functions
210224 template <typename T>
211225 T& Environment<T>::operator [](const std::string& key)
Original file line number Diff line number Diff line change 77
88namespace Sass {
99
10+ // this defeats the whole purpose of environment being templatable!!
1011 typedef environment_map<std::string, AST_Node_Obj>::iterator EnvIter;
1112
1213 class EnvResult {
@@ -92,6 +93,10 @@ namespace Sass {
9293 // include all scopes available
9394 bool has (const std::string& key) const ;
9495
96+ // look on the full stack for key
97+ // include all scopes available
98+ T& get (const std::string& key);
99+
95100 // look on the full stack for key
96101 // include all scopes available
97102 EnvResult find (const std::string& key);
You can’t perform that action at this time.
0 commit comments