MCPcopy Create free account
hub / github.com/breck7/scroll / _initAncestorsArrayCache

Method _initAncestorsArrayCache

external/.scrollLibs.js:17936–17948  ·  view source on GitHub ↗
(cannotContainParticles)

Source from the content-addressed store, hash-verified

17934 return this.get(ParticlesConstants.extends)
17935 }
17936 _initAncestorsArrayCache(cannotContainParticles) {
17937 if (this._cache_ancestorsArray) return undefined
17938 if (cannotContainParticles && cannotContainParticles.includes(this)) throw new Error(`Loop detected: '${this.getLine()}' is the ancestor of one of its ancestors.`)
17939 cannotContainParticles = cannotContainParticles || [this]
17940 let ancestors = [this]
17941 const extendedId = this.idThatThisExtends
17942 if (extendedId) {
17943 const parentParticle = this.idToParticleMap[extendedId]
17944 if (!parentParticle) throw new Error(`${extendedId} not found`)
17945 ancestors = ancestors.concat(parentParticle._getAncestorsArray(cannotContainParticles))
17946 }
17947 this._cache_ancestorsArray = ancestors
17948 }
17949}
17950class ExtendibleParticle extends AbstractExtendibleParticle {
17951 get idToParticleMap() {

Callers 1

_getAncestorsArrayMethod · 0.95

Calls 3

concatMethod · 0.80
_getAncestorsArrayMethod · 0.80
getLineMethod · 0.45

Tested by

no test coverage detected