()
| 274 | } |
| 275 | |
| 276 | override execute(): null { |
| 277 | // `this.inputs` contains only those bindings not matched by any directive. These bindings go to |
| 278 | // the element itself. |
| 279 | let elId: TcbExpr | null = null; |
| 280 | |
| 281 | // TODO(alxhub): this could be more efficient. |
| 282 | for (const binding of this.inputs) { |
| 283 | const isPropertyBinding = |
| 284 | binding.type === BindingType.Property || binding.type === BindingType.TwoWay; |
| 285 | |
| 286 | if (isPropertyBinding && this.claimedInputs?.has(binding.name)) { |
| 287 | // Skip this binding as it was claimed by a directive. |
| 288 | continue; |
| 289 | } |
| 290 | |
| 291 | const expr = widenBinding( |
| 292 | tcbExpression(binding.value, this.tcb, this.scope), |
| 293 | this.tcb, |
| 294 | binding.value, |
| 295 | ); |
| 296 | |
| 297 | if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) { |
| 298 | if (binding.name !== 'style' && binding.name !== 'class') { |
| 299 | if (elId === null) { |
| 300 | elId = this.scope.resolve(this.target); |
| 301 | } |
| 302 | // A direct binding to a property. |
| 303 | const propertyName = REGISTRY.getMappedPropName(binding.name); |
| 304 | const stmt = new TcbExpr( |
| 305 | `${elId.print()}[${TcbExpr.quoteAndEscape(propertyName)}] = ${expr.wrapForTypeChecker().print()}`, |
| 306 | ).addParseSpanInfo(binding.sourceSpan); |
| 307 | this.scope.addStatement(stmt); |
| 308 | } else { |
| 309 | this.scope.addStatement(expr); |
| 310 | } |
| 311 | } else { |
| 312 | // A binding to an animation, attribute, class or style. For now, only validate the right- |
| 313 | // hand side of the expression. |
| 314 | // TODO: properly check class and style bindings. |
| 315 | this.scope.addStatement(expr); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | return null; |
| 320 | } |
| 321 | } |
nothing calls this directly
no test coverage detected