MCPcopy Index your code
hub / github.com/angular/angular / getChild

Method getChild

packages/forms/signals/src/schema/logic_node.ts:141–161  ·  view source on GitHub ↗
(key: PropertyKey)

Source from the content-addressed store, hash-verified

139 }
140
141 override getChild(key: PropertyKey): LogicNodeBuilder {
142 // Close off the current builder if the key is DYNAMIC and the current builder already has logic
143 // for some non-DYNAMIC key. This guarantees that all of the DYNAMIC logic always comes before
144 // all of the specific-key logic for any given instance of `NonMergeableLogicNodeBuilder`.
145 // We rely on this fact in `getAllChildBuilder` to know that we can return the DYNAMIC logic,
146 // followed by the property-specific logic, in that order.
147 if (key === DYNAMIC) {
148 const children = this.getCurrent().children;
149 // Use the children size to determine if there is logic registered for a property other than
150 // the DYNAMIC property.
151 // - If the children map doesn't have DYNAMIC logic, but the size is still >0 then we know it
152 // has logic for some other property.
153 // - If the children map does have DYNAMIC logic then its size is going to be at least 1,
154 // because it has the DYNAMIC key. However if it is >1, then we again know it contains other
155 // keys.
156 if (children.size > (children.has(DYNAMIC) ? 1 : 0)) {
157 this.current = undefined;
158 }
159 }
160 return this.getCurrent().getChild(key);
161 }
162
163 override hasLogic(builder: AbstractLogicNodeBuilder): boolean {
164 if (this === builder) {

Callers

nothing calls this directly

Calls 3

getCurrentMethod · 0.95
hasMethod · 0.65
getChildMethod · 0.65

Tested by

no test coverage detected