MCPcopy Create free account
hub / github.com/cogentcore/core / sliceElementValue

Method sliceElementValue

core/list.go:503–514  ·  view source on GitHub ↗

sliceElementValue returns an underlying non-pointer [reflect.Value] of slice element at given index or ElementValue if out of range.

(si int)

Source from the content-addressed store, hash-verified

501// sliceElementValue returns an underlying non-pointer [reflect.Value]
502// of slice element at given index or ElementValue if out of range.
503func (lb *ListBase) sliceElementValue(si int) reflect.Value {
504 var val reflect.Value
505 if si < lb.SliceSize {
506 val = reflectx.Underlying(lb.sliceUnderlying.Index(si)) // deal with pointer lists
507 } else {
508 val = lb.elementValue
509 }
510 if !val.IsValid() {
511 val = lb.elementValue
512 }
513 return val
514}
515
516func (lb *ListBase) MakeGrid(p *tree.Plan, maker func(p *tree.Plan)) {
517 tree.AddAt(p, "grid", func(w *ListGrid) {

Callers 4

UpdateMaxWidthsMethod · 0.95
MakeRowMethod · 0.95
UpdateMaxWidthsMethod · 0.80
MakeRowMethod · 0.80

Calls 3

UnderlyingFunction · 0.92
IndexMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected