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

Function parseJitTemplate

packages/compiler/src/jit_compiler_facade.ts:789–809  ·  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

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