(index int64, t types.VmValue)
| 46 | } |
| 47 | |
| 48 | func (self *ValueStack) Insert(index int64, t types.VmValue) error { |
| 49 | l := int64(len(self.data)) |
| 50 | if l >= self.limit { |
| 51 | return errors.ERR_OVER_LIMIT_STACK |
| 52 | } |
| 53 | if index > l || index < 0 { |
| 54 | return errors.ERR_INDEX_OUT_OF_BOUND |
| 55 | } |
| 56 | index = l - index |
| 57 | self.data = append(self.data, t) |
| 58 | copy(self.data[index+1:], self.data[index:]) |
| 59 | self.data[index] = t |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | func (self *ValueStack) Peek(index int64) (value types.VmValue, err error) { |
| 64 | l := int64(len(self.data)) |