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

Method execute

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

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 10

widenBindingFunction · 0.90
tcbExpressionFunction · 0.90
addParseSpanInfoMethod · 0.80
quoteAndEscapeMethod · 0.80
wrapForTypeCheckerMethod · 0.80
addStatementMethod · 0.80
hasMethod · 0.65
resolveMethod · 0.65
getMappedPropNameMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected