MCPcopy Create free account
hub / github.com/akyoto/q / compileStoreArray

Method compileStoreArray

src/core/compileStoreArray.go:9–31  ·  view source on GitHub ↗

compileStoreArray compiles an assignment to an element in an array.

(node *ast.Assign)

Source from the content-addressed store, hash-verified

7
8// compileStoreArray compiles an assignment to an element in an array.
9func (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}

Callers 1

compileAssignMethod · 0.95

Calls 3

evaluateRightMethod · 0.95
evaluateArrayMethod · 0.95
storeMethod · 0.95

Tested by

no test coverage detected