MCPcopy
hub / github.com/angular/angular / rootCompile

Method rootCompile

packages/forms/signals/src/schema/schema.ts:85–100  ·  view source on GitHub ↗

* Compiles the given schema in a fresh compilation context. This clears the cached results of any * previous compilations.

(schema: SchemaImpl | SchemaOrSchemaFn<any> | undefined)

Source from the content-addressed store, hash-verified

83 * previous compilations.
84 */
85 static rootCompile(schema: SchemaImpl | SchemaOrSchemaFn<any> | undefined): FieldPathNode {
86 try {
87 compiledSchemas.clear();
88 if (schema === undefined) {
89 return FieldPathNode.newRoot();
90 }
91 if (schema instanceof SchemaImpl) {
92 return schema.compile();
93 }
94 return new SchemaImpl(schema as SchemaFn<unknown>).compile();
95 } finally {
96 // Use a try/finally to ensure we properly reset the compilation context upon completion,
97 // even if there are errors while compiling the schema.
98 compiledSchemas.clear();
99 }
100 }
101}
102
103/** Checks if the given value is a schema or schema function. */

Callers 2

field_node.spec.tsFile · 0.80
formFunction · 0.80

Calls 3

newRootMethod · 0.65
clearMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected