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

Function parseJitTemplate

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

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