Collapse a weirdly structured clause in env.cpp

This commit is contained in:
ridiculousfish 2019-04-10 16:32:37 -07:00
parent a597b0e6e1
commit 372291ad02

View file

@ -900,12 +900,9 @@ maybe_t<env_var_t> env_stack_t::get(const wcstring &key, env_mode_flags_t mode)
env = vars_stack().next_scope_to_search(env); env = vars_stack().next_scope_to_search(env);
} }
} }
if (!search_universal) return none();
// Okay, we couldn't find a local or global var given the requirements. If there is a matching // Okay, we couldn't find a local or global var given the requirements. If there is a matching
// universal var return that. // universal var return that.
if (uvars()) { if (search_universal && uvars()) {
auto var = uvars()->get(key); auto var = uvars()->get(key);
if (var && (var->exports() ? search_exported : search_unexported)) { if (var && (var->exports() ? search_exported : search_unexported)) {
return var; return var;