MCPcopy Index your code
hub / github.com/SplootCode/splootcode / insertNode

Method insertNode

packages/core/src/language/childset.ts:82–99  ·  view source on GitHub ↗
(node: SplootNode, index: number)

Source from the content-addressed store, hash-verified

80 }
81
82 insertNode(node: SplootNode, index: number) {
83 if (node.parent && node.enableMutations) {
84 console.warn('Inserting a node with mutations enabled which alredy has a parent!')
85 }
86 this.children.splice(index, 0, node)
87 node.parent = this.childParentRef
88 if (this.enableMutations) {
89 node.afterInsert()
90 node.parent.node.recursivelyValidate()
91 node.recursivelySetMutations(true)
92 const mutation = new ChildSetMutation()
93 mutation.type = ChildSetMutationType.INSERT
94 mutation.childSet = this
95 mutation.nodes = [node]
96 mutation.index = index
97 this.fireMutation(mutation)
98 }
99 }
100
101 allowDelete(): boolean {
102 if (this.type === ChildSetType.Immutable) {

Callers 3

addChildMethod · 0.95
addModuleImportMethod · 0.45

Calls 4

fireMutationMethod · 0.95
afterInsertMethod · 0.80
recursivelyValidateMethod · 0.80

Tested by

no test coverage detected