()
| 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) |
nothing calls this directly
no test coverage detected