MCPcopy Create free account
hub / github.com/angular/angular / parseJitTemplate

Function parseJitTemplate

packages/compiler/src/jit_compiler_facade.ts:791–811  ·  view source on GitHub ↗
(
  template: string,
  typeName: string,
  sourceMapUrl: string,
  preserveWhitespaces: boolean,
  deferBlockDependencies: (() => Promise<unknown> | null)[] | undefined,
)

Source from the content-addressed store, hash-verified

789}
790
791function parseJitTemplate(
792 template: string,
793 typeName: string,
794 sourceMapUrl: string,
795 preserveWhitespaces: boolean,
796 deferBlockDependencies: (() => Promise<unknown> | null)[] | undefined,
797) {
798 // Parse the template and check for errors.
799 const parsed = parseTemplate(template, sourceMapUrl, {preserveWhitespaces});
800 if (parsed.errors !== null) {
801 const errors = parsed.errors.map((err) => err.toString()).join(', ');
802 throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
803 }
804 const binder = new R3TargetBinder(null);
805 const boundTarget = binder.bind({template: parsed.nodes});
806
807 return {
808 template: parsed,
809 defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies),
810 };
811}
812
813/**
814 * Convert the expression, if present to an `R3ProviderExpression`.

Callers 2

compileComponentMethod · 0.85

Calls 6

bindMethod · 0.95
parseTemplateFunction · 0.90
mapMethod · 0.80
joinMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected