diff options
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r-- | tvix/eval/src/vm.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs index d050fa807106..d18cd7977bbe 100644 --- a/tvix/eval/src/vm.rs +++ b/tvix/eval/src/vm.rs @@ -182,12 +182,16 @@ impl VM { OpCode::OpAttrOrNotFound => { let key = self.pop().to_string()?; - let attrs = self.pop().to_attrs()?; + let value = match self.pop() { + Value::Attrs(attrs) => match attrs.select(key.as_str()) { + Some(value) => value.clone(), + None => Value::NotFound, + }, - match attrs.select(key.as_str()) { - Some(value) => self.push(value.clone()), - None => self.push(Value::NotFound), - } + _ => Value::NotFound, + }; + + self.push(value); } OpCode::OpAttrsIsSet => { |