check global scope for variable before local

This commit is contained in:
ConnorSkees 2020-03-24 00:26:55 -04:00
parent c29088b558
commit 27a9578b17

View File

@ -56,9 +56,12 @@ impl Scope {
pub fn get_var(&self, v: &str) -> SassResult<Value> { pub fn get_var(&self, v: &str) -> SassResult<Value> {
let name = &v.replace('_', "-"); let name = &v.replace('_', "-");
match self.vars.get(name) { match get_global_var(name) {
Ok(v) => Ok(v),
Err(e) => match self.vars.get(name) {
Some(v) => Ok(v.clone()), Some(v) => Ok(v.clone()),
None => get_global_var(name), None => Err(e)
}
} }
} }