bindingToUpdateStatements function

List<Statement> bindingToUpdateStatements(
  1. Binding binding,
  2. Expression? appViewInstance,
  3. NodeReference? renderNode,
  4. bool isHtmlElement,
  5. Expression currValExpr,
)

Returns statements that update a binding.

Implementation

List<o.Statement> bindingToUpdateStatements(
  ir.Binding binding,
  o.Expression? appViewInstance,
  NodeReference? renderNode,
  bool isHtmlElement,
  o.Expression currValExpr,
) {
  // Wraps current value with sanitization call if necessary.
  var renderValue =
      _sanitizedValue(binding.target.securityContext, currValExpr);
  var visitor = _UpdateStatementsVisitor(
      appViewInstance, renderNode, binding.source, isHtmlElement, currValExpr);
  var updateStatement = binding.target.accept(visitor, renderValue);
  if (binding.source is BoundExpression) {
    updateStatement.sourceReference =
        (binding.source as BoundExpression).sourceReference;
  }
  var devToolsStatement =
      devToolsBindingStatement(binding, appViewInstance, currValExpr);
  return [
    if (devToolsStatement != null) devToolsStatement,
    updateStatement,
  ];
}