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

Method getDirectiveOp

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

Source from the content-addressed store, hash-verified

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

Callers 2

appendDirectiveInputsMethod · 0.95
appendHostElementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected