MCPcopy Create free account
hub / github.com/egonelbre/exp / specializeCounterAccess

Method specializeCounterAccess

vector/generate/naive.go:214–231  ·  view source on GitHub ↗
(body string, prim It, primOffset int, ranges []It)

Source from the content-addressed store, hash-verified

212}
213
214func (ctx *NaiveFile) specializeCounterAccess(body string, prim It, primOffset int, ranges []It) string {
215 return rxVariable.ReplaceAllStringFunc(body, func(ref string) string {
216 ref = ref[1:]
217
218 for _, it := range ranges {
219 if it.Name == ref {
220 at := it.Name + "[i" + it.Name
221 if primOffset > 0 {
222 at += "+" + mul(Const(primOffset), it.Inc).String()
223 }
224 at += "]"
225 return at
226 }
227 }
228
229 panic("did not find " + ref)
230 })
231}
232
233func (ctx *NaiveFile) specializePointerAccess(body string, prim It, primOffset int, ranges []It) string {
234 return rxVariable.ReplaceAllStringFunc(body, func(ref string) string {

Callers 1

specializeBodyMethod · 0.95

Calls 3

mulFunction · 0.85
ConstFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected