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

Method compile

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

* Compiles this schema within the current root compilation context. If the schema was previously * compiled within this context, we reuse the cached FieldPathNode, otherwise we create a new one * and cache it in the compilation context.

()

Source from the content-addressed store, hash-verified

51 * and cache it in the compilation context.
52 */
53 compile(): FieldPathNode {
54 if (compiledSchemas.has(this)) {
55 return compiledSchemas.get(this)!;
56 }
57 const path = FieldPathNode.newRoot();
58 compiledSchemas.set(this, path);
59 let prevCompilingNode = currentCompilingNode;
60 try {
61 currentCompilingNode = path;
62 this.schemaFn(path.fieldPathProxy);
63 } finally {
64 // Use a try/finally to ensure we restore the previous root upon completion,
65 // even if there are errors while compiling the schema.
66 currentCompilingNode = prevCompilingNode;
67 }
68 return path;
69 }
70
71 /**
72 * Creates a SchemaImpl from the given SchemaOrSchemaFn.

Callers 2

mergeInMethod · 0.45
rootCompileMethod · 0.45

Calls 4

hasMethod · 0.65
getMethod · 0.65
newRootMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected