MCPcopy Create free account
hub / github.com/despiteallobjections/amigo / arrayLen

Method arrayLen

types/builder.go:1711–1725  ·  view source on GitHub ↗

arrayLen returns the length of the array whose composite literal elements are elts.

(elts []Expr)

Source from the content-addressed store, hash-verified

1709
1710// arrayLen returns the length of the array whose composite literal elements are elts.
1711func (b *builder) arrayLen(elts []Expr) int64 {
1712 var max int64 = -1
1713 var i int64 = -1
1714 for _, e := range elts {
1715 if kv, ok := e.(*KeyValueExpr); ok {
1716 i = b.expr(kv.Key).(*SSAConst).Int64()
1717 } else {
1718 i++
1719 }
1720 if i > max {
1721 max = i
1722 }
1723 }
1724 return max + 1
1725}
1726
1727func (w *writer) arrayLen(elts []Expr) int64 {
1728 var i, max int64 = -1, -1

Callers

nothing calls this directly

Calls 2

exprMethod · 0.95
Int64Method · 0.80

Tested by

no test coverage detected