MCPcopy Create free account
hub / github.com/dop251/goja / SetLen

Method SetLen

object_dynamic_test.go:371–389  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

369}
370
371func (t *testSharedDynArray) SetLen(i int) bool {
372 t.Lock()
373 defer t.Unlock()
374 if i > len(t.a) {
375 t.expand(i)
376 return true
377 }
378 if i < 0 {
379 return false
380 }
381 if i < len(t.a) {
382 tail := t.a[i:len(t.a)]
383 for j := range tail {
384 tail[j] = nil
385 }
386 t.a = t.a[:i]
387 }
388 return true
389}
390
391func TestSharedDynamicArray(t *testing.T) {
392 dynObj := &testSharedDynArray{a: make([]Value, 10000)}

Callers

nothing calls this directly

Calls 1

expandMethod · 0.95

Tested by

no test coverage detected