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

Method getDirectiveOp

packages/compiler/src/typecheck/ops/scope.ts:773–793  ·  view source on GitHub ↗
(
    dir: TcbDirectiveMetadata,
    node: DirectiveOwner,
    customFieldType: CustomFormControlType | null,
    directiveIndex?: number,
  )

Source from the content-addressed store, hash-verified

771 }
772
773 private getDirectiveOp(
774 dir: TcbDirectiveMetadata,
775 node: DirectiveOwner,
776 customFieldType: CustomFormControlType | null,
777 directiveIndex?: number,
778 ): TcbOp {
779 if (!dir.isGeneric) {
780 // The most common case is that when a directive is not generic, we use the normal
781 // `TcbNonDirectiveTypeOp`.
782 return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir, directiveIndex);
783 } else if (!dir.requiresInlineTypeCtor || this.tcb.env.config.useInlineTypeConstructors) {
784 // For generic directives, we use a type constructor to infer types. If a directive requires
785 // an inline type constructor, then inlining must be available to use the
786 // `TcbDirectiveCtorOp`. If not we, we fallback to using `any` – see below.
787 return new TcbDirectiveCtorOp(this.tcb, this, node, dir, customFieldType, directiveIndex);
788 }
789
790 // If inlining is not available, then we give up on inferring the generic params, and use
791 // `any` type for the directive's generic parameters.
792 return new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir, directiveIndex);
793 }
794
795 private appendDeepSchemaChecks(nodes: Node[]): void {
796 for (const node of nodes) {

Callers 2

appendDirectiveInputsMethod · 0.95
appendHostElementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected