compileStoreArray compiles an assignment to an element in an array.
(node *ast.Assign)
| 7 | |
| 8 | // compileStoreArray compiles an assignment to an element in an array. |
| 9 | func (f *Function) compileStoreArray(node *ast.Assign) error { |
| 10 | right := node.Expression.Children[1] |
| 11 | rightValue, err := f.evaluateRight(right) |
| 12 | |
| 13 | if err != nil { |
| 14 | return err |
| 15 | } |
| 16 | |
| 17 | left := node.Expression.Children[0] |
| 18 | leftValue, err := f.evaluateArray(left) |
| 19 | |
| 20 | if err != nil { |
| 21 | return err |
| 22 | } |
| 23 | |
| 24 | memory, isMemory := leftValue.(*ssa.Memory) |
| 25 | |
| 26 | if !isMemory { |
| 27 | panic("not a memory address") |
| 28 | } |
| 29 | |
| 30 | return f.store(memory, rightValue) |
| 31 | } |
no test coverage detected