diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-03-08 18:38:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-08 18:38:39 +0100 |
| commit | 44170a579266501143af63960fda8706df809c09 (patch) | |
| tree | 79fa0b0c1869c550f0980c38b1cd549180aac8fb /src/vm.rs | |
| parent | c61fb2a37fee54b7eb42da074e8c1b42aa6a42f1 (diff) | |
| parent | 16ba42c52bbf57fa78217327bd9759fec9f09fa9 (diff) | |
| download | sylt-44170a579266501143af63960fda8706df809c09.tar.gz | |
Merge pull request #101 from FredTheDino/single-tuples
Single-element tuples
Diffstat (limited to 'src/vm.rs')
| -rw-r--r-- | src/vm.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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() { |
