MCPcopy Index your code
hub / github.com/angular/angular / execute

Method execute

packages/compiler/src/typecheck/ops/inputs.ts:66–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64 }
65
66 override execute(): null {
67 let dirId: TcbExpr | null = null;
68
69 // TODO(joost): report duplicate properties
70 const seenRequiredInputs = new Set<ClassPropertyName>();
71 const boundAttrs = getBoundAttributes(this.dir, this.node);
72
73 if (this.customFormControlType !== null) {
74 checkUnsupportedFieldBindings(this.node, customFormControlBannedInputFields, this.tcb);
75 }
76
77 if (this.customFormControlType !== null || this.isFormControl) {
78 const additionalBindings = expandBoundAttributesForField(
79 this.dir,
80 this.node,
81 this.customFormControlType,
82 );
83
84 if (additionalBindings !== null) {
85 boundAttrs.push(...additionalBindings);
86 }
87 }
88
89 for (const attr of boundAttrs) {
90 // For bound inputs, the property is assigned the binding expression.
91 let assignment = widenBinding(
92 translateInput(attr.value, this.tcb, this.scope),
93 this.tcb,
94 attr.value,
95 );
96 assignment.wrapForTypeChecker();
97
98 for (const {fieldName, required, transformType, isSignal, isTwoWayBinding} of attr.inputs) {
99 let target: TcbExpr;
100
101 if (required) {
102 seenRequiredInputs.add(fieldName);
103 }
104
105 // Note: There is no special logic for transforms/coercion with signal inputs.
106 // For signal inputs, a `transformType` will never be set as we do not capture
107 // the transform in the compiler metadata. Signal inputs incorporate their
108 // transform write type into their member type, and we extract it below when
109 // setting the `WriteT` of such `InputSignalWithTransform<_, WriteT>`.
110
111 if (this.dir.coercedInputFields.has(fieldName)) {
112 let type: TcbExpr;
113
114 if (transformType !== undefined) {
115 type = new TcbExpr(transformType);
116 } else {
117 // The input has a coercion declaration which should be used instead of assigning the
118 // expression into the input field directly. To achieve this, a variable is declared
119 // with a type of `typeof Directive.ngAcceptInputType_fieldName` which is then used as
120 // target of the assignment.
121 const dirTypeRef = this.tcb.env.referenceTcbValue(this.dir.ref);
122 const propName = `ngAcceptInputType_${fieldName}`;
123 const access = isUnsafeObjectKey(fieldName)

Callers

nothing calls this directly

Calls 15

checkRequiredInputsMethod · 0.95
getBoundAttributesFunction · 0.90
widenBindingFunction · 0.90
isUnsafeObjectKeyFunction · 0.90
declareVariableFunction · 0.90
unwrapWritableSignalFunction · 0.90
translateInputFunction · 0.85
wrapForTypeCheckerMethod · 0.80
quoteAndEscapeMethod · 0.80
allocateIdMethod · 0.80

Tested by

no test coverage detected