aboutsummaryrefslogtreecommitdiffstats
path: root/src/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm.rs')
-rw-r--r--src/vm.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vm.rs b/src/vm.rs
index 7321deb..e001ebc 100644
--- a/src/vm.rs
+++ b/src/vm.rs
@@ -294,7 +294,7 @@ impl VM {
match (val, slot) {
(Value::Tuple(v), Value::Int(slot)) => {
let slot = slot as usize;
- if v.len() < slot {
+ if v.len() <= slot {
self.stack.push(Value::Nil);
let len = v.len();
error!(self, ErrorKind::IndexOutOfBounds(Value::Tuple(v), len, slot));
@@ -715,6 +715,14 @@ impl VM {
};
}
+ Op::Index => {
+ // We don't have any information about the slot and the indexable might contain
+ // mixed types.
+ self.stack.pop().unwrap();
+ self.stack.pop().unwrap();
+ self.stack.push(Value::Unknown);
+ }
+
Op::Call(num_args) => {
let new_base = self.stack.len() - 1 - num_args;
match self.stack[new_base].clone() {