@angular/core 16.1.2 → 16.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1401,6 +1401,9 @@ var ReadVarExpr = class extends Expression {
1401
1401
  visitExpression(visitor, context) {
1402
1402
  return visitor.visitReadVarExpr(this, context);
1403
1403
  }
1404
+ clone() {
1405
+ return new ReadVarExpr(this.name, this.type, this.sourceSpan);
1406
+ }
1404
1407
  set(value) {
1405
1408
  return new WriteVarExpr(this.name, value, null, this.sourceSpan);
1406
1409
  }
@@ -1419,6 +1422,9 @@ var TypeofExpr = class extends Expression {
1419
1422
  isConstant() {
1420
1423
  return this.expr.isConstant();
1421
1424
  }
1425
+ clone() {
1426
+ return new TypeofExpr(this.expr.clone());
1427
+ }
1422
1428
  };
1423
1429
  var WrappedNodeExpr = class extends Expression {
1424
1430
  constructor(node, type, sourceSpan) {
@@ -1434,6 +1440,9 @@ var WrappedNodeExpr = class extends Expression {
1434
1440
  visitExpression(visitor, context) {
1435
1441
  return visitor.visitWrappedNodeExpr(this, context);
1436
1442
  }
1443
+ clone() {
1444
+ return new WrappedNodeExpr(this.node, this.type, this.sourceSpan);
1445
+ }
1437
1446
  };
1438
1447
  var WriteVarExpr = class extends Expression {
1439
1448
  constructor(name, value, type, sourceSpan) {
@@ -1450,6 +1459,9 @@ var WriteVarExpr = class extends Expression {
1450
1459
  visitExpression(visitor, context) {
1451
1460
  return visitor.visitWriteVarExpr(this, context);
1452
1461
  }
1462
+ clone() {
1463
+ return new WriteVarExpr(this.name, this.value.clone(), this.type, this.sourceSpan);
1464
+ }
1453
1465
  toDeclStmt(type, modifiers) {
1454
1466
  return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
1455
1467
  }
@@ -1473,6 +1485,9 @@ var WriteKeyExpr = class extends Expression {
1473
1485
  visitExpression(visitor, context) {
1474
1486
  return visitor.visitWriteKeyExpr(this, context);
1475
1487
  }
1488
+ clone() {
1489
+ return new WriteKeyExpr(this.receiver.clone(), this.index.clone(), this.value.clone(), this.type, this.sourceSpan);
1490
+ }
1476
1491
  };
1477
1492
  var WritePropExpr = class extends Expression {
1478
1493
  constructor(receiver, name, value, type, sourceSpan) {
@@ -1490,6 +1505,9 @@ var WritePropExpr = class extends Expression {
1490
1505
  visitExpression(visitor, context) {
1491
1506
  return visitor.visitWritePropExpr(this, context);
1492
1507
  }
1508
+ clone() {
1509
+ return new WritePropExpr(this.receiver.clone(), this.name, this.value.clone(), this.type, this.sourceSpan);
1510
+ }
1493
1511
  };
1494
1512
  var InvokeFunctionExpr = class extends Expression {
1495
1513
  constructor(fn2, args, type, sourceSpan, pure = false) {
@@ -1507,6 +1525,9 @@ var InvokeFunctionExpr = class extends Expression {
1507
1525
  visitExpression(visitor, context) {
1508
1526
  return visitor.visitInvokeFunctionExpr(this, context);
1509
1527
  }
1528
+ clone() {
1529
+ return new InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure);
1530
+ }
1510
1531
  };
1511
1532
  var TaggedTemplateExpr = class extends Expression {
1512
1533
  constructor(tag, template2, type, sourceSpan) {
@@ -1523,6 +1544,9 @@ var TaggedTemplateExpr = class extends Expression {
1523
1544
  visitExpression(visitor, context) {
1524
1545
  return visitor.visitTaggedTemplateExpr(this, context);
1525
1546
  }
1547
+ clone() {
1548
+ return new TaggedTemplateExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);
1549
+ }
1526
1550
  };
1527
1551
  var InstantiateExpr = class extends Expression {
1528
1552
  constructor(classExpr, args, type, sourceSpan) {
@@ -1539,6 +1563,9 @@ var InstantiateExpr = class extends Expression {
1539
1563
  visitExpression(visitor, context) {
1540
1564
  return visitor.visitInstantiateExpr(this, context);
1541
1565
  }
1566
+ clone() {
1567
+ return new InstantiateExpr(this.classExpr.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan);
1568
+ }
1542
1569
  };
1543
1570
  var LiteralExpr = class extends Expression {
1544
1571
  constructor(value, type, sourceSpan) {
@@ -1554,12 +1581,18 @@ var LiteralExpr = class extends Expression {
1554
1581
  visitExpression(visitor, context) {
1555
1582
  return visitor.visitLiteralExpr(this, context);
1556
1583
  }
1584
+ clone() {
1585
+ return new LiteralExpr(this.value, this.type, this.sourceSpan);
1586
+ }
1557
1587
  };
1558
1588
  var TemplateLiteral = class {
1559
1589
  constructor(elements, expressions) {
1560
1590
  this.elements = elements;
1561
1591
  this.expressions = expressions;
1562
1592
  }
1593
+ clone() {
1594
+ return new TemplateLiteral(this.elements.map((el) => el.clone()), this.expressions.map((expr) => expr.clone()));
1595
+ }
1563
1596
  };
1564
1597
  var TemplateLiteralElement = class {
1565
1598
  constructor(text2, sourceSpan, rawText) {
@@ -1568,6 +1601,9 @@ var TemplateLiteralElement = class {
1568
1601
  this.sourceSpan = sourceSpan;
1569
1602
  this.rawText = (_a2 = rawText != null ? rawText : sourceSpan == null ? void 0 : sourceSpan.toString()) != null ? _a2 : escapeForTemplateLiteral(escapeSlashes(text2));
1570
1603
  }
1604
+ clone() {
1605
+ return new TemplateLiteralElement(this.text, this.sourceSpan, this.rawText);
1606
+ }
1571
1607
  };
1572
1608
  var LiteralPiece = class {
1573
1609
  constructor(text2, sourceSpan) {
@@ -1602,6 +1638,9 @@ var LocalizedString = class extends Expression {
1602
1638
  visitExpression(visitor, context) {
1603
1639
  return visitor.visitLocalizedString(this, context);
1604
1640
  }
1641
+ clone() {
1642
+ return new LocalizedString(this.metaBlock, this.messageParts, this.placeHolderNames, this.expressions.map((expr) => expr.clone()), this.sourceSpan);
1643
+ }
1605
1644
  serializeI18nHead() {
1606
1645
  let metaBlock = this.metaBlock.description || "";
1607
1646
  if (this.metaBlock.meaning) {
@@ -1670,6 +1709,9 @@ var ExternalExpr = class extends Expression {
1670
1709
  visitExpression(visitor, context) {
1671
1710
  return visitor.visitExternalExpr(this, context);
1672
1711
  }
1712
+ clone() {
1713
+ return new ExternalExpr(this.value, this.type, this.typeParams, this.sourceSpan);
1714
+ }
1673
1715
  };
1674
1716
  var ExternalReference = class {
1675
1717
  constructor(moduleName, name, runtime) {
@@ -1694,6 +1736,10 @@ var ConditionalExpr = class extends Expression {
1694
1736
  visitExpression(visitor, context) {
1695
1737
  return visitor.visitConditionalExpr(this, context);
1696
1738
  }
1739
+ clone() {
1740
+ var _a2;
1741
+ return new ConditionalExpr(this.condition.clone(), this.trueCase.clone(), (_a2 = this.falseCase) == null ? void 0 : _a2.clone(), this.type, this.sourceSpan);
1742
+ }
1697
1743
  };
1698
1744
  var NotExpr = class extends Expression {
1699
1745
  constructor(condition, sourceSpan) {
@@ -1709,6 +1755,9 @@ var NotExpr = class extends Expression {
1709
1755
  visitExpression(visitor, context) {
1710
1756
  return visitor.visitNotExpr(this, context);
1711
1757
  }
1758
+ clone() {
1759
+ return new NotExpr(this.condition.clone(), this.sourceSpan);
1760
+ }
1712
1761
  };
1713
1762
  var FnParam = class {
1714
1763
  constructor(name, type = null) {
@@ -1718,6 +1767,9 @@ var FnParam = class {
1718
1767
  isEquivalent(param) {
1719
1768
  return this.name === param.name;
1720
1769
  }
1770
+ clone() {
1771
+ return new FnParam(this.name, this.type);
1772
+ }
1721
1773
  };
1722
1774
  var FunctionExpr = class extends Expression {
1723
1775
  constructor(params, statements, type, sourceSpan, name) {
@@ -1738,6 +1790,9 @@ var FunctionExpr = class extends Expression {
1738
1790
  toDeclStmt(name, modifiers) {
1739
1791
  return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
1740
1792
  }
1793
+ clone() {
1794
+ return new FunctionExpr(this.params.map((p2) => p2.clone()), this.statements, this.type, this.sourceSpan, this.name);
1795
+ }
1741
1796
  };
1742
1797
  var UnaryOperatorExpr = class extends Expression {
1743
1798
  constructor(operator, expr, type, sourceSpan, parens = true) {
@@ -1755,6 +1810,9 @@ var UnaryOperatorExpr = class extends Expression {
1755
1810
  visitExpression(visitor, context) {
1756
1811
  return visitor.visitUnaryOperatorExpr(this, context);
1757
1812
  }
1813
+ clone() {
1814
+ return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
1815
+ }
1758
1816
  };
1759
1817
  var BinaryOperatorExpr = class extends Expression {
1760
1818
  constructor(operator, lhs, rhs, type, sourceSpan, parens = true) {
@@ -1773,6 +1831,9 @@ var BinaryOperatorExpr = class extends Expression {
1773
1831
  visitExpression(visitor, context) {
1774
1832
  return visitor.visitBinaryOperatorExpr(this, context);
1775
1833
  }
1834
+ clone() {
1835
+ return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan, this.parens);
1836
+ }
1776
1837
  };
1777
1838
  var ReadPropExpr = class extends Expression {
1778
1839
  constructor(receiver, name, type, sourceSpan) {
@@ -1792,6 +1853,9 @@ var ReadPropExpr = class extends Expression {
1792
1853
  set(value) {
1793
1854
  return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
1794
1855
  }
1856
+ clone() {
1857
+ return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
1858
+ }
1795
1859
  };
1796
1860
  var ReadKeyExpr = class extends Expression {
1797
1861
  constructor(receiver, index, type, sourceSpan) {
@@ -1811,6 +1875,9 @@ var ReadKeyExpr = class extends Expression {
1811
1875
  set(value) {
1812
1876
  return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
1813
1877
  }
1878
+ clone() {
1879
+ return new ReadKeyExpr(this.receiver, this.index.clone(), this.type, this.sourceSpan);
1880
+ }
1814
1881
  };
1815
1882
  var LiteralArrayExpr = class extends Expression {
1816
1883
  constructor(entries, type, sourceSpan) {
@@ -1826,6 +1893,9 @@ var LiteralArrayExpr = class extends Expression {
1826
1893
  visitExpression(visitor, context) {
1827
1894
  return visitor.visitLiteralArrayExpr(this, context);
1828
1895
  }
1896
+ clone() {
1897
+ return new LiteralArrayExpr(this.entries.map((e) => e.clone()), this.type, this.sourceSpan);
1898
+ }
1829
1899
  };
1830
1900
  var LiteralMapEntry = class {
1831
1901
  constructor(key, value, quoted) {
@@ -1836,6 +1906,9 @@ var LiteralMapEntry = class {
1836
1906
  isEquivalent(e) {
1837
1907
  return this.key === e.key && this.value.isEquivalent(e.value);
1838
1908
  }
1909
+ clone() {
1910
+ return new LiteralMapEntry(this.key, this.value.clone(), this.quoted);
1911
+ }
1839
1912
  };
1840
1913
  var LiteralMapExpr = class extends Expression {
1841
1914
  constructor(entries, type, sourceSpan) {
@@ -1855,6 +1928,10 @@ var LiteralMapExpr = class extends Expression {
1855
1928
  visitExpression(visitor, context) {
1856
1929
  return visitor.visitLiteralMapExpr(this, context);
1857
1930
  }
1931
+ clone() {
1932
+ const entriesClone = this.entries.map((entry) => entry.clone());
1933
+ return new LiteralMapExpr(entriesClone, this.type, this.sourceSpan);
1934
+ }
1858
1935
  };
1859
1936
  var CommaExpr = class extends Expression {
1860
1937
  constructor(parts, sourceSpan) {
@@ -1870,6 +1947,9 @@ var CommaExpr = class extends Expression {
1870
1947
  visitExpression(visitor, context) {
1871
1948
  return visitor.visitCommaExpr(this, context);
1872
1949
  }
1950
+ clone() {
1951
+ return new CommaExpr(this.parts.map((p2) => p2.clone()));
1952
+ }
1873
1953
  };
1874
1954
  var NULL_EXPR = new LiteralExpr(null, null, null);
1875
1955
  var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
@@ -2251,6 +2331,9 @@ var FixupExpression = class extends Expression {
2251
2331
  isConstant() {
2252
2332
  return true;
2253
2333
  }
2334
+ clone() {
2335
+ throw new Error(`Not supported.`);
2336
+ }
2254
2337
  fixup(expression) {
2255
2338
  this.resolved = expression;
2256
2339
  this.shared = true;
@@ -6831,6 +6914,7 @@ var InterpolationExpression = class extends Expression {
6831
6914
  this.isConstant = unsupported;
6832
6915
  this.isEquivalent = unsupported;
6833
6916
  this.visitExpression = unsupported;
6917
+ this.clone = unsupported;
6834
6918
  }
6835
6919
  };
6836
6920
  var DefaultLocalResolver = class {
@@ -7461,7 +7545,10 @@ var ElementAttributes = class {
7461
7545
  this.known.add(name);
7462
7546
  const array = this.arrayFor(kind);
7463
7547
  array.push(...getAttributeNameLiterals(name));
7464
- if (value !== null) {
7548
+ if (kind === ElementAttributeKind.Attribute || kind === ElementAttributeKind.Style) {
7549
+ if (value === null) {
7550
+ throw Error("Attribute & style element attributes must have a value");
7551
+ }
7465
7552
  array.push(value);
7466
7553
  }
7467
7554
  }
@@ -7510,6 +7597,7 @@ var OpKind;
7510
7597
  OpKind2[OpKind2["InterpolateProperty"] = 14] = "InterpolateProperty";
7511
7598
  OpKind2[OpKind2["Advance"] = 15] = "Advance";
7512
7599
  OpKind2[OpKind2["Pipe"] = 16] = "Pipe";
7600
+ OpKind2[OpKind2["Attribute"] = 17] = "Attribute";
7513
7601
  })(OpKind || (OpKind = {}));
7514
7602
  var ExpressionKind;
7515
7603
  (function(ExpressionKind2) {
@@ -7525,6 +7613,10 @@ var ExpressionKind;
7525
7613
  ExpressionKind2[ExpressionKind2["PureFunctionParameterExpr"] = 9] = "PureFunctionParameterExpr";
7526
7614
  ExpressionKind2[ExpressionKind2["PipeBinding"] = 10] = "PipeBinding";
7527
7615
  ExpressionKind2[ExpressionKind2["PipeBindingVariadic"] = 11] = "PipeBindingVariadic";
7616
+ ExpressionKind2[ExpressionKind2["SafePropertyRead"] = 12] = "SafePropertyRead";
7617
+ ExpressionKind2[ExpressionKind2["SafeKeyedRead"] = 13] = "SafeKeyedRead";
7618
+ ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 14] = "SafeInvokeFunction";
7619
+ ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 15] = "SafeTernaryExpr";
7528
7620
  })(ExpressionKind || (ExpressionKind = {}));
7529
7621
  var SemanticVariableKind;
7530
7622
  (function(SemanticVariableKind2) {
@@ -7608,6 +7700,9 @@ var LexicalReadExpr = class extends ExpressionBase {
7608
7700
  }
7609
7701
  transformInternalExpressions() {
7610
7702
  }
7703
+ clone() {
7704
+ return new LexicalReadExpr(this.name);
7705
+ }
7611
7706
  };
7612
7707
  var _ReferenceExpr = class extends ExpressionBase {
7613
7708
  constructor(target, offset) {
@@ -7628,6 +7723,11 @@ var _ReferenceExpr = class extends ExpressionBase {
7628
7723
  }
7629
7724
  transformInternalExpressions() {
7630
7725
  }
7726
+ clone() {
7727
+ const expr = new _ReferenceExpr(this.target, this.offset);
7728
+ expr.slot = this.slot;
7729
+ return expr;
7730
+ }
7631
7731
  };
7632
7732
  var ReferenceExpr = _ReferenceExpr;
7633
7733
  (() => {
@@ -7649,6 +7749,9 @@ var ContextExpr = class extends ExpressionBase {
7649
7749
  }
7650
7750
  transformInternalExpressions() {
7651
7751
  }
7752
+ clone() {
7753
+ return new ContextExpr(this.view);
7754
+ }
7652
7755
  };
7653
7756
  var NextContextExpr = class extends ExpressionBase {
7654
7757
  constructor() {
@@ -7666,6 +7769,11 @@ var NextContextExpr = class extends ExpressionBase {
7666
7769
  }
7667
7770
  transformInternalExpressions() {
7668
7771
  }
7772
+ clone() {
7773
+ const expr = new NextContextExpr();
7774
+ expr.steps = this.steps;
7775
+ return expr;
7776
+ }
7669
7777
  };
7670
7778
  var GetCurrentViewExpr = class extends ExpressionBase {
7671
7779
  constructor() {
@@ -7682,6 +7790,9 @@ var GetCurrentViewExpr = class extends ExpressionBase {
7682
7790
  }
7683
7791
  transformInternalExpressions() {
7684
7792
  }
7793
+ clone() {
7794
+ return new GetCurrentViewExpr();
7795
+ }
7685
7796
  };
7686
7797
  var RestoreViewExpr = class extends ExpressionBase {
7687
7798
  constructor(view) {
@@ -7712,6 +7823,9 @@ var RestoreViewExpr = class extends ExpressionBase {
7712
7823
  this.view = transformExpressionsInExpression(this.view, transform, flags);
7713
7824
  }
7714
7825
  }
7826
+ clone() {
7827
+ return new RestoreViewExpr(this.view instanceof Expression ? this.view.clone() : this.view);
7828
+ }
7715
7829
  };
7716
7830
  var ResetViewExpr = class extends ExpressionBase {
7717
7831
  constructor(expr) {
@@ -7731,6 +7845,9 @@ var ResetViewExpr = class extends ExpressionBase {
7731
7845
  transformInternalExpressions(transform, flags) {
7732
7846
  this.expr = transformExpressionsInExpression(this.expr, transform, flags);
7733
7847
  }
7848
+ clone() {
7849
+ return new ResetViewExpr(this.expr.clone());
7850
+ }
7734
7851
  };
7735
7852
  var ReadVariableExpr = class extends ExpressionBase {
7736
7853
  constructor(xref) {
@@ -7749,6 +7866,11 @@ var ReadVariableExpr = class extends ExpressionBase {
7749
7866
  }
7750
7867
  transformInternalExpressions() {
7751
7868
  }
7869
+ clone() {
7870
+ const expr = new ReadVariableExpr(this.xref);
7871
+ expr.name = this.name;
7872
+ return expr;
7873
+ }
7752
7874
  };
7753
7875
  var _PureFunctionExpr = class extends ExpressionBase {
7754
7876
  constructor(expression, args) {
@@ -7787,6 +7909,13 @@ var _PureFunctionExpr = class extends ExpressionBase {
7787
7909
  this.args[i] = transformExpressionsInExpression(this.args[i], transform, flags);
7788
7910
  }
7789
7911
  }
7912
+ clone() {
7913
+ var _a2, _b2, _c2, _d2;
7914
+ const expr = new _PureFunctionExpr((_b2 = (_a2 = this.body) == null ? void 0 : _a2.clone()) != null ? _b2 : null, this.args.map((arg) => arg.clone()));
7915
+ expr.fn = (_d2 = (_c2 = this.fn) == null ? void 0 : _c2.clone()) != null ? _d2 : null;
7916
+ expr.varOffset = this.varOffset;
7917
+ return expr;
7918
+ }
7790
7919
  };
7791
7920
  var PureFunctionExpr = _PureFunctionExpr;
7792
7921
  (() => {
@@ -7808,8 +7937,11 @@ var PureFunctionParameterExpr = class extends ExpressionBase {
7808
7937
  }
7809
7938
  transformInternalExpressions() {
7810
7939
  }
7940
+ clone() {
7941
+ return new PureFunctionParameterExpr(this.index);
7942
+ }
7811
7943
  };
7812
- var PipeBindingExpr = class extends ExpressionBase {
7944
+ var _PipeBindingExpr = class extends ExpressionBase {
7813
7945
  constructor(target, name, args) {
7814
7946
  super();
7815
7947
  this.target = target;
@@ -7838,11 +7970,18 @@ var PipeBindingExpr = class extends ExpressionBase {
7838
7970
  this.args[idx] = transformExpressionsInExpression(this.args[idx], transform, flags);
7839
7971
  }
7840
7972
  }
7973
+ clone() {
7974
+ const r = new _PipeBindingExpr(this.target, this.name, this.args.map((a) => a.clone()));
7975
+ r.slot = this.slot;
7976
+ r.varOffset = this.varOffset;
7977
+ return r;
7978
+ }
7841
7979
  };
7980
+ var PipeBindingExpr = _PipeBindingExpr;
7842
7981
  (() => {
7843
7982
  _d = UsesSlotIndex, _e = ConsumesVarsTrait, _f = UsesVarOffset;
7844
7983
  })();
7845
- var PipeBindingVariadicExpr = class extends ExpressionBase {
7984
+ var _PipeBindingVariadicExpr = class extends ExpressionBase {
7846
7985
  constructor(target, name, args, numArgs) {
7847
7986
  super();
7848
7987
  this.target = target;
@@ -7868,10 +8007,110 @@ var PipeBindingVariadicExpr = class extends ExpressionBase {
7868
8007
  transformInternalExpressions(transform, flags) {
7869
8008
  this.args = transformExpressionsInExpression(this.args, transform, flags);
7870
8009
  }
8010
+ clone() {
8011
+ const r = new _PipeBindingVariadicExpr(this.target, this.name, this.args.clone(), this.numArgs);
8012
+ r.slot = this.slot;
8013
+ r.varOffset = this.varOffset;
8014
+ return r;
8015
+ }
7871
8016
  };
8017
+ var PipeBindingVariadicExpr = _PipeBindingVariadicExpr;
7872
8018
  (() => {
7873
8019
  _g = UsesSlotIndex, _h = ConsumesVarsTrait, _j = UsesVarOffset;
7874
8020
  })();
8021
+ var SafePropertyReadExpr = class extends ExpressionBase {
8022
+ constructor(receiver, name) {
8023
+ super();
8024
+ this.receiver = receiver;
8025
+ this.name = name;
8026
+ this.kind = ExpressionKind.SafePropertyRead;
8027
+ }
8028
+ visitExpression(visitor, context) {
8029
+ }
8030
+ isEquivalent() {
8031
+ return false;
8032
+ }
8033
+ isConstant() {
8034
+ return false;
8035
+ }
8036
+ transformInternalExpressions(transform, flags) {
8037
+ this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);
8038
+ }
8039
+ clone() {
8040
+ return new SafePropertyReadExpr(this.receiver.clone(), this.name);
8041
+ }
8042
+ };
8043
+ var SafeKeyedReadExpr = class extends ExpressionBase {
8044
+ constructor(receiver, index) {
8045
+ super();
8046
+ this.receiver = receiver;
8047
+ this.index = index;
8048
+ this.kind = ExpressionKind.SafeKeyedRead;
8049
+ }
8050
+ visitExpression(visitor, context) {
8051
+ }
8052
+ isEquivalent() {
8053
+ return false;
8054
+ }
8055
+ isConstant() {
8056
+ return false;
8057
+ }
8058
+ transformInternalExpressions(transform, flags) {
8059
+ this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);
8060
+ this.index = transformExpressionsInExpression(this.index, transform, flags);
8061
+ }
8062
+ clone() {
8063
+ return new SafeKeyedReadExpr(this.receiver.clone(), this.index.clone());
8064
+ }
8065
+ };
8066
+ var SafeInvokeFunctionExpr = class extends ExpressionBase {
8067
+ constructor(receiver, args) {
8068
+ super();
8069
+ this.receiver = receiver;
8070
+ this.args = args;
8071
+ this.kind = ExpressionKind.SafeInvokeFunction;
8072
+ }
8073
+ visitExpression(visitor, context) {
8074
+ }
8075
+ isEquivalent() {
8076
+ return false;
8077
+ }
8078
+ isConstant() {
8079
+ return false;
8080
+ }
8081
+ transformInternalExpressions(transform, flags) {
8082
+ this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);
8083
+ for (let i = 0; i < this.args.length; i++) {
8084
+ this.args[i] = transformExpressionsInExpression(this.args[i], transform, flags);
8085
+ }
8086
+ }
8087
+ clone() {
8088
+ return new SafeInvokeFunctionExpr(this.receiver.clone(), this.args.map((a) => a.clone()));
8089
+ }
8090
+ };
8091
+ var SafeTernaryExpr = class extends ExpressionBase {
8092
+ constructor(guard, expr) {
8093
+ super();
8094
+ this.guard = guard;
8095
+ this.expr = expr;
8096
+ this.kind = ExpressionKind.SafeTernaryExpr;
8097
+ }
8098
+ visitExpression(visitor, context) {
8099
+ }
8100
+ isEquivalent() {
8101
+ return false;
8102
+ }
8103
+ isConstant() {
8104
+ return false;
8105
+ }
8106
+ transformInternalExpressions(transform, flags) {
8107
+ this.guard = transformExpressionsInExpression(this.guard, transform, flags);
8108
+ this.expr = transformExpressionsInExpression(this.expr, transform, flags);
8109
+ }
8110
+ clone() {
8111
+ return new SafeTernaryExpr(this.guard.clone(), this.expr.clone());
8112
+ }
8113
+ };
7875
8114
  function visitExpressionsInOp(op, visitor) {
7876
8115
  transformExpressionsInOp(op, (expr, flags) => {
7877
8116
  visitor(expr, flags);
@@ -7896,6 +8135,11 @@ function transformExpressionsInOp(op, transform, flags) {
7896
8135
  case OpKind.Statement:
7897
8136
  transformExpressionsInStatement(op.statement, transform, flags);
7898
8137
  break;
8138
+ case OpKind.Attribute:
8139
+ if (op.value) {
8140
+ transformExpressionsInExpression(op.value, transform, flags);
8141
+ }
8142
+ break;
7899
8143
  case OpKind.Variable:
7900
8144
  op.initializer = transformExpressionsInExpression(op.initializer, transform, flags);
7901
8145
  break;
@@ -8165,6 +8409,16 @@ var NEW_OP = {
8165
8409
  };
8166
8410
 
8167
8411
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8412
+ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8413
+ OpKind.Element,
8414
+ OpKind.ElementStart,
8415
+ OpKind.Container,
8416
+ OpKind.ContainerStart,
8417
+ OpKind.Template
8418
+ ]);
8419
+ function isElementOrContainerOp(op) {
8420
+ return elementContainerOpKinds.has(op.kind);
8421
+ }
8168
8422
  function createElementStartOp(tag, xref) {
8169
8423
  return __spreadValues(__spreadValues({
8170
8424
  kind: OpKind.ElementStart,
@@ -8225,18 +8479,29 @@ function createInterpolateTextOp(xref, strings, expressions) {
8225
8479
  expressions
8226
8480
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8227
8481
  }
8228
- function createPropertyOp(xref, name, expression) {
8482
+ function createPropertyOp(xref, bindingKind, name, expression) {
8229
8483
  return __spreadValues(__spreadValues(__spreadValues({
8230
8484
  kind: OpKind.Property,
8231
8485
  target: xref,
8486
+ bindingKind,
8232
8487
  name,
8233
8488
  expression
8234
8489
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
8235
8490
  }
8236
- function createInterpolatePropertyOp(xref, name, strings, expressions) {
8491
+ function createAttributeOp(target, attributeKind, name, value) {
8492
+ return __spreadValues({
8493
+ kind: OpKind.Attribute,
8494
+ target,
8495
+ attributeKind,
8496
+ name,
8497
+ value
8498
+ }, NEW_OP);
8499
+ }
8500
+ function createInterpolatePropertyOp(xref, bindingKind, name, strings, expressions) {
8237
8501
  return __spreadValues(__spreadValues(__spreadValues({
8238
8502
  kind: OpKind.InterpolateProperty,
8239
8503
  target: xref,
8504
+ bindingKind,
8240
8505
  name,
8241
8506
  strings,
8242
8507
  expressions
@@ -8249,6 +8514,181 @@ function createAdvanceOp(delta) {
8249
8514
  }, NEW_OP);
8250
8515
  }
8251
8516
 
8517
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
8518
+ function phaseVarCounting(cpl) {
8519
+ for (const [_, view] of cpl.views) {
8520
+ let varCount = 0;
8521
+ for (const op of view.ops()) {
8522
+ if (hasConsumesVarsTrait(op)) {
8523
+ varCount += varsUsedByOp(op);
8524
+ }
8525
+ visitExpressionsInOp(op, (expr) => {
8526
+ if (!isIrExpression(expr)) {
8527
+ return;
8528
+ }
8529
+ if (hasUsesVarOffsetTrait(expr)) {
8530
+ expr.varOffset = varCount;
8531
+ }
8532
+ if (hasConsumesVarsTrait(expr)) {
8533
+ varCount += varsUsedByIrExpression(expr);
8534
+ }
8535
+ });
8536
+ }
8537
+ view.vars = varCount;
8538
+ }
8539
+ for (const [_, view] of cpl.views) {
8540
+ for (const op of view.create) {
8541
+ if (op.kind !== OpKind.Template) {
8542
+ continue;
8543
+ }
8544
+ const childView = cpl.views.get(op.xref);
8545
+ op.vars = childView.vars;
8546
+ }
8547
+ }
8548
+ }
8549
+ function varsUsedByOp(op) {
8550
+ switch (op.kind) {
8551
+ case OpKind.Property:
8552
+ return 1;
8553
+ case OpKind.InterpolateText:
8554
+ return op.expressions.length;
8555
+ case OpKind.InterpolateProperty:
8556
+ return 1 + op.expressions.length;
8557
+ default:
8558
+ throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
8559
+ }
8560
+ }
8561
+ function varsUsedByIrExpression(expr) {
8562
+ switch (expr.kind) {
8563
+ case ExpressionKind.PureFunctionExpr:
8564
+ return 1 + expr.args.length;
8565
+ case ExpressionKind.PipeBinding:
8566
+ return 1 + expr.args.length;
8567
+ case ExpressionKind.PipeBindingVariadic:
8568
+ return 1 + expr.numArgs;
8569
+ default:
8570
+ throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
8571
+ }
8572
+ }
8573
+
8574
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/align_pipe_variadic_var_offset.mjs
8575
+ function phaseAlignPipeVariadicVarOffset(cpl) {
8576
+ for (const view of cpl.views.values()) {
8577
+ for (const op of view.update) {
8578
+ visitExpressionsInOp(op, (expr) => {
8579
+ if (!(expr instanceof PipeBindingVariadicExpr)) {
8580
+ return expr;
8581
+ }
8582
+ if (!(expr.args instanceof PureFunctionExpr)) {
8583
+ return expr;
8584
+ }
8585
+ if (expr.varOffset === null || expr.args.varOffset === null) {
8586
+ throw new Error(`Must run after variable counting`);
8587
+ }
8588
+ expr.varOffset = expr.args.varOffset;
8589
+ expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
8590
+ });
8591
+ }
8592
+ }
8593
+ }
8594
+
8595
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8596
+ function lookupElement(elements, xref) {
8597
+ const el = elements.get(xref);
8598
+ if (el === void 0) {
8599
+ throw new Error("All attributes should have an element-like target.");
8600
+ }
8601
+ return el;
8602
+ }
8603
+ function phaseAttributeExtraction(cpl, compatibility) {
8604
+ for (const [_, view] of cpl.views) {
8605
+ populateElementAttributes(view, compatibility);
8606
+ }
8607
+ }
8608
+ function populateElementAttributes(view, compatibility) {
8609
+ const elements = /* @__PURE__ */ new Map();
8610
+ for (const op of view.create) {
8611
+ if (!isElementOrContainerOp(op)) {
8612
+ continue;
8613
+ }
8614
+ elements.set(op.xref, op);
8615
+ }
8616
+ for (const op of view.ops()) {
8617
+ let ownerOp;
8618
+ switch (op.kind) {
8619
+ case OpKind.Attribute:
8620
+ ownerOp = lookupElement(elements, op.target);
8621
+ assertIsElementAttributes(ownerOp.attributes);
8622
+ let extractable = compatibility ? op.value instanceof LiteralExpr && typeof op.value.value === "string" : op.value.isConstant();
8623
+ if (extractable) {
8624
+ ownerOp.attributes.add(op.attributeKind, op.name, op.value);
8625
+ OpList.remove(op);
8626
+ }
8627
+ break;
8628
+ case OpKind.Property:
8629
+ case OpKind.InterpolateProperty:
8630
+ ownerOp = lookupElement(elements, op.target);
8631
+ assertIsElementAttributes(ownerOp.attributes);
8632
+ ownerOp.attributes.add(op.bindingKind, op.name, null);
8633
+ break;
8634
+ case OpKind.Listener:
8635
+ ownerOp = lookupElement(elements, op.target);
8636
+ assertIsElementAttributes(ownerOp.attributes);
8637
+ ownerOp.attributes.add(ElementAttributeKind.Binding, op.name, null);
8638
+ if (ownerOp.kind === OpKind.Template) {
8639
+ OpList.remove(op);
8640
+ }
8641
+ break;
8642
+ }
8643
+ }
8644
+ }
8645
+
8646
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
8647
+ var CHAINABLE = /* @__PURE__ */ new Set([
8648
+ Identifiers.elementStart,
8649
+ Identifiers.elementEnd,
8650
+ Identifiers.property,
8651
+ Identifiers.elementContainerStart,
8652
+ Identifiers.elementContainerEnd,
8653
+ Identifiers.elementContainer
8654
+ ]);
8655
+ function phaseChaining(cpl) {
8656
+ for (const [_, view] of cpl.views) {
8657
+ chainOperationsInList(view.create);
8658
+ chainOperationsInList(view.update);
8659
+ }
8660
+ }
8661
+ function chainOperationsInList(opList) {
8662
+ let chain = null;
8663
+ for (const op of opList) {
8664
+ if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
8665
+ chain = null;
8666
+ continue;
8667
+ }
8668
+ if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
8669
+ chain = null;
8670
+ continue;
8671
+ }
8672
+ const instruction = op.statement.expr.fn.value;
8673
+ if (!CHAINABLE.has(instruction)) {
8674
+ chain = null;
8675
+ continue;
8676
+ }
8677
+ if (chain !== null && chain.instruction === instruction) {
8678
+ const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
8679
+ chain.expression = expression;
8680
+ chain.op.statement = expression.toStmt();
8681
+ OpList.remove(op);
8682
+ } else {
8683
+ chain = {
8684
+ op,
8685
+ instruction,
8686
+ expression: op.statement.expr
8687
+ };
8688
+ }
8689
+ }
8690
+ }
8691
+
8252
8692
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
8253
8693
  function phaseConstCollection(cpl) {
8254
8694
  for (const [_, view] of cpl.views) {
@@ -8343,6 +8783,402 @@ function phaseGenerateAdvance(cpl) {
8343
8783
  }
8344
8784
  }
8345
8785
 
8786
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
8787
+ function phaseNullishCoalescing(cpl) {
8788
+ for (const view of cpl.views.values()) {
8789
+ for (const op of view.ops()) {
8790
+ transformExpressionsInOp(op, (expr) => {
8791
+ if (!(expr instanceof BinaryOperatorExpr) || expr.operator !== BinaryOperator.NullishCoalesce) {
8792
+ return expr;
8793
+ }
8794
+ return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, expr.lhs, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, expr.lhs, new LiteralExpr(void 0))), expr.lhs, expr.rhs);
8795
+ }, VisitorContextFlag.None);
8796
+ }
8797
+ }
8798
+ }
8799
+
8800
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
8801
+ function phaseGenerateVariables(cpl) {
8802
+ recursivelyProcessView(cpl.root, null);
8803
+ }
8804
+ function recursivelyProcessView(view, parentScope) {
8805
+ const scope = getScopeForView(view, parentScope);
8806
+ if (view.parent !== null) {
8807
+ }
8808
+ for (const op of view.create) {
8809
+ switch (op.kind) {
8810
+ case OpKind.Template:
8811
+ recursivelyProcessView(view.tpl.views.get(op.xref), scope);
8812
+ break;
8813
+ case OpKind.Listener:
8814
+ op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
8815
+ break;
8816
+ }
8817
+ }
8818
+ const preambleOps = generateVariablesInScopeForView(view, scope);
8819
+ view.update.prepend(preambleOps);
8820
+ }
8821
+ function getScopeForView(view, parent) {
8822
+ const scope = {
8823
+ view: view.xref,
8824
+ viewContextVariable: {
8825
+ kind: SemanticVariableKind.Context,
8826
+ name: null,
8827
+ view: view.xref
8828
+ },
8829
+ contextVariables: /* @__PURE__ */ new Map(),
8830
+ references: [],
8831
+ parent
8832
+ };
8833
+ for (const identifier of view.contextVariables.keys()) {
8834
+ scope.contextVariables.set(identifier, {
8835
+ kind: SemanticVariableKind.Identifier,
8836
+ name: null,
8837
+ identifier
8838
+ });
8839
+ }
8840
+ for (const op of view.create) {
8841
+ switch (op.kind) {
8842
+ case OpKind.Element:
8843
+ case OpKind.ElementStart:
8844
+ case OpKind.Template:
8845
+ if (!Array.isArray(op.localRefs)) {
8846
+ throw new Error(`AssertionError: expected localRefs to be an array`);
8847
+ }
8848
+ for (let offset = 0; offset < op.localRefs.length; offset++) {
8849
+ scope.references.push({
8850
+ name: op.localRefs[offset].name,
8851
+ targetId: op.xref,
8852
+ offset,
8853
+ variable: {
8854
+ kind: SemanticVariableKind.Identifier,
8855
+ name: null,
8856
+ identifier: op.localRefs[offset].name
8857
+ }
8858
+ });
8859
+ }
8860
+ break;
8861
+ }
8862
+ }
8863
+ return scope;
8864
+ }
8865
+ function generateVariablesInScopeForView(view, scope) {
8866
+ const newOps = [];
8867
+ if (scope.view !== view.xref) {
8868
+ newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
8869
+ }
8870
+ for (const [name, value] of view.tpl.views.get(scope.view).contextVariables) {
8871
+ newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.contextVariables.get(name), new ReadPropExpr(new ContextExpr(scope.view), value)));
8872
+ }
8873
+ for (const ref of scope.references) {
8874
+ newOps.push(createVariableOp(view.tpl.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
8875
+ }
8876
+ if (scope.parent !== null) {
8877
+ newOps.push(...generateVariablesInScopeForView(view, scope.parent));
8878
+ }
8879
+ return newOps;
8880
+ }
8881
+
8882
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
8883
+ function phaseLocalRefs(cpl) {
8884
+ for (const view of cpl.views.values()) {
8885
+ for (const op of view.create) {
8886
+ switch (op.kind) {
8887
+ case OpKind.ElementStart:
8888
+ case OpKind.Element:
8889
+ case OpKind.Template:
8890
+ if (!Array.isArray(op.localRefs)) {
8891
+ throw new Error(`AssertionError: expected localRefs to be an array still`);
8892
+ }
8893
+ op.numSlotsUsed += op.localRefs.length;
8894
+ if (op.localRefs.length > 0) {
8895
+ const localRefs = serializeLocalRefs(op.localRefs);
8896
+ op.localRefs = cpl.addConst(localRefs);
8897
+ } else {
8898
+ op.localRefs = null;
8899
+ }
8900
+ break;
8901
+ }
8902
+ }
8903
+ }
8904
+ }
8905
+ function serializeLocalRefs(refs) {
8906
+ const constRefs = [];
8907
+ for (const ref of refs) {
8908
+ constRefs.push(literal(ref.name), literal(ref.target));
8909
+ }
8910
+ return literalArr(constRefs);
8911
+ }
8912
+
8913
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
8914
+ function phaseNaming(cpl) {
8915
+ addNamesToView(cpl.root, cpl.componentName, { index: 0 });
8916
+ }
8917
+ function addNamesToView(view, baseName, state) {
8918
+ if (view.fnName === null) {
8919
+ view.fnName = `${baseName}_Template`;
8920
+ }
8921
+ const varNames = /* @__PURE__ */ new Map();
8922
+ for (const op of view.ops()) {
8923
+ switch (op.kind) {
8924
+ case OpKind.Listener:
8925
+ if (op.handlerFnName === null) {
8926
+ if (op.slot === null) {
8927
+ throw new Error(`Expected a slot to be assigned`);
8928
+ }
8929
+ op.handlerFnName = `${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`;
8930
+ }
8931
+ break;
8932
+ case OpKind.Variable:
8933
+ varNames.set(op.xref, getVariableName(op.variable, state));
8934
+ break;
8935
+ case OpKind.Template:
8936
+ const childView = view.tpl.views.get(op.xref);
8937
+ if (op.slot === null) {
8938
+ throw new Error(`Expected slot to be assigned`);
8939
+ }
8940
+ const safeTagName = op.tag.replace("-", "_");
8941
+ addNamesToView(childView, `${baseName}_${safeTagName}_${op.slot}`, state);
8942
+ break;
8943
+ }
8944
+ }
8945
+ for (const op of view.ops()) {
8946
+ visitExpressionsInOp(op, (expr) => {
8947
+ if (!(expr instanceof ReadVariableExpr) || expr.name !== null) {
8948
+ return;
8949
+ }
8950
+ if (!varNames.has(expr.xref)) {
8951
+ throw new Error(`Variable ${expr.xref} not yet named`);
8952
+ }
8953
+ expr.name = varNames.get(expr.xref);
8954
+ });
8955
+ }
8956
+ }
8957
+ function getVariableName(variable2, state) {
8958
+ if (variable2.name === null) {
8959
+ switch (variable2.kind) {
8960
+ case SemanticVariableKind.Identifier:
8961
+ variable2.name = `${variable2.identifier}_${state.index++}`;
8962
+ break;
8963
+ default:
8964
+ variable2.name = `_r${state.index++}`;
8965
+ break;
8966
+ }
8967
+ }
8968
+ return variable2.name;
8969
+ }
8970
+
8971
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
8972
+ function phaseMergeNextContext(cpl) {
8973
+ for (const view of cpl.views.values()) {
8974
+ for (const op of view.create) {
8975
+ if (op.kind === OpKind.Listener) {
8976
+ mergeNextContextsInOps(op.handlerOps);
8977
+ }
8978
+ }
8979
+ mergeNextContextsInOps(view.update);
8980
+ }
8981
+ }
8982
+ function mergeNextContextsInOps(ops) {
8983
+ for (const op of ops) {
8984
+ if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement) || !(op.statement.expr instanceof NextContextExpr)) {
8985
+ continue;
8986
+ }
8987
+ const mergeSteps = op.statement.expr.steps;
8988
+ let tryToMerge = true;
8989
+ for (let candidate = op.next; candidate.kind !== OpKind.ListEnd && tryToMerge; candidate = candidate.next) {
8990
+ visitExpressionsInOp(candidate, (expr, flags) => {
8991
+ if (!isIrExpression(expr)) {
8992
+ return expr;
8993
+ }
8994
+ if (!tryToMerge) {
8995
+ return;
8996
+ }
8997
+ if (flags & VisitorContextFlag.InChildOperation) {
8998
+ return;
8999
+ }
9000
+ switch (expr.kind) {
9001
+ case ExpressionKind.NextContext:
9002
+ expr.steps += mergeSteps;
9003
+ OpList.remove(op);
9004
+ tryToMerge = false;
9005
+ break;
9006
+ case ExpressionKind.GetCurrentView:
9007
+ case ExpressionKind.Reference:
9008
+ tryToMerge = false;
9009
+ break;
9010
+ }
9011
+ });
9012
+ }
9013
+ }
9014
+ }
9015
+
9016
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
9017
+ var CONTAINER_TAG = "ng-container";
9018
+ function phaseNgContainer(cpl) {
9019
+ for (const [_, view] of cpl.views) {
9020
+ const updatedElementXrefs = /* @__PURE__ */ new Set();
9021
+ for (const op of view.create) {
9022
+ if (op.kind === OpKind.ElementStart && op.tag === CONTAINER_TAG) {
9023
+ op.kind = OpKind.ContainerStart;
9024
+ updatedElementXrefs.add(op.xref);
9025
+ }
9026
+ if (op.kind === OpKind.ElementEnd && updatedElementXrefs.has(op.xref)) {
9027
+ op.kind = OpKind.ContainerEnd;
9028
+ }
9029
+ }
9030
+ }
9031
+ }
9032
+
9033
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
9034
+ function phasePipeCreation(cpl) {
9035
+ for (const view of cpl.views.values()) {
9036
+ processPipeBindingsInView(view);
9037
+ }
9038
+ }
9039
+ function processPipeBindingsInView(view) {
9040
+ for (const updateOp of view.update) {
9041
+ visitExpressionsInOp(updateOp, (expr, flags) => {
9042
+ if (!isIrExpression(expr)) {
9043
+ return;
9044
+ }
9045
+ if (expr.kind !== ExpressionKind.PipeBinding) {
9046
+ return;
9047
+ }
9048
+ if (flags & VisitorContextFlag.InChildOperation) {
9049
+ throw new Error(`AssertionError: pipe bindings should not appear in child expressions`);
9050
+ }
9051
+ if (!hasDependsOnSlotContextTrait(updateOp)) {
9052
+ throw new Error(`AssertionError: pipe binding associated with non-slot operation ${OpKind[updateOp.kind]}`);
9053
+ }
9054
+ addPipeToCreationBlock(view, updateOp.target, expr);
9055
+ });
9056
+ }
9057
+ }
9058
+ function addPipeToCreationBlock(view, afterTargetXref, binding) {
9059
+ for (let op = view.create.head.next; op.kind !== OpKind.ListEnd; op = op.next) {
9060
+ if (!hasConsumesSlotTrait(op)) {
9061
+ continue;
9062
+ }
9063
+ if (op.xref !== afterTargetXref) {
9064
+ continue;
9065
+ }
9066
+ while (op.next.kind === OpKind.Pipe) {
9067
+ op = op.next;
9068
+ }
9069
+ const pipe2 = createPipeOp(binding.target, binding.name);
9070
+ OpList.insertBefore(pipe2, op.next);
9071
+ return;
9072
+ }
9073
+ throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
9074
+ }
9075
+
9076
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
9077
+ function phasePipeVariadic(cpl) {
9078
+ for (const view of cpl.views.values()) {
9079
+ for (const op of view.update) {
9080
+ transformExpressionsInOp(op, (expr) => {
9081
+ if (!(expr instanceof PipeBindingExpr)) {
9082
+ return expr;
9083
+ }
9084
+ if (expr.args.length <= 4) {
9085
+ return expr;
9086
+ }
9087
+ return new PipeBindingVariadicExpr(expr.target, expr.name, literalArr(expr.args), expr.args.length);
9088
+ }, VisitorContextFlag.None);
9089
+ }
9090
+ }
9091
+ }
9092
+
9093
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
9094
+ function phasePureFunctionExtraction(cpl) {
9095
+ for (const view of cpl.views.values()) {
9096
+ for (const op of view.ops()) {
9097
+ visitExpressionsInOp(op, (expr) => {
9098
+ if (!(expr instanceof PureFunctionExpr) || expr.body === null) {
9099
+ return;
9100
+ }
9101
+ const constantDef = new PureFunctionConstant(expr.args.length);
9102
+ expr.fn = cpl.pool.getSharedConstant(constantDef, expr.body);
9103
+ expr.body = null;
9104
+ });
9105
+ }
9106
+ }
9107
+ }
9108
+ var PureFunctionConstant = class extends GenericKeyFn {
9109
+ constructor(numArgs) {
9110
+ super();
9111
+ this.numArgs = numArgs;
9112
+ }
9113
+ keyOf(expr) {
9114
+ if (expr instanceof PureFunctionParameterExpr) {
9115
+ return `param(${expr.index})`;
9116
+ } else {
9117
+ return super.keyOf(expr);
9118
+ }
9119
+ }
9120
+ toSharedConstantDeclaration(declName, keyExpr) {
9121
+ const fnParams = [];
9122
+ for (let idx = 0; idx < this.numArgs; idx++) {
9123
+ fnParams.push(new FnParam("_p" + idx));
9124
+ }
9125
+ const returnExpr = transformExpressionsInExpression(keyExpr, (expr) => {
9126
+ if (!(expr instanceof PureFunctionParameterExpr)) {
9127
+ return expr;
9128
+ }
9129
+ return variable("_p" + expr.index);
9130
+ }, VisitorContextFlag.None);
9131
+ return new DeclareFunctionStmt(declName, fnParams, [new ReturnStatement(returnExpr)]);
9132
+ }
9133
+ };
9134
+
9135
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
9136
+ function phasePureLiteralStructures(cpl) {
9137
+ for (const view of cpl.views.values()) {
9138
+ for (const op of view.update) {
9139
+ transformExpressionsInOp(op, (expr, flags) => {
9140
+ if (flags & VisitorContextFlag.InChildOperation) {
9141
+ return expr;
9142
+ }
9143
+ if (expr instanceof LiteralArrayExpr) {
9144
+ return transformLiteralArray(expr);
9145
+ } else if (expr instanceof LiteralMapExpr) {
9146
+ return transformLiteralMap(expr);
9147
+ }
9148
+ return expr;
9149
+ }, VisitorContextFlag.None);
9150
+ }
9151
+ }
9152
+ }
9153
+ function transformLiteralArray(expr) {
9154
+ const derivedEntries = [];
9155
+ const nonConstantArgs = [];
9156
+ for (const entry of expr.entries) {
9157
+ if (entry.isConstant()) {
9158
+ derivedEntries.push(entry);
9159
+ } else {
9160
+ const idx = nonConstantArgs.length;
9161
+ nonConstantArgs.push(entry);
9162
+ derivedEntries.push(new PureFunctionParameterExpr(idx));
9163
+ }
9164
+ }
9165
+ return new PureFunctionExpr(literalArr(derivedEntries), nonConstantArgs);
9166
+ }
9167
+ function transformLiteralMap(expr) {
9168
+ let derivedEntries = [];
9169
+ const nonConstantArgs = [];
9170
+ for (const entry of expr.entries) {
9171
+ if (entry.value.isConstant()) {
9172
+ derivedEntries.push(entry);
9173
+ } else {
9174
+ const idx = nonConstantArgs.length;
9175
+ nonConstantArgs.push(entry.value);
9176
+ derivedEntries.push(new LiteralMapEntry(entry.key, new PureFunctionParameterExpr(idx), entry.quoted));
9177
+ }
9178
+ }
9179
+ return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
9180
+ }
9181
+
8346
9182
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
8347
9183
  function element(slot, tag, constIndex, localRefIndex) {
8348
9184
  return elementOrContainerBase(Identifiers.element, slot, tag, constIndex, localRefIndex);
@@ -8712,299 +9548,66 @@ function reifyListenerHandler(view, name, handlerOps) {
8712
9548
  if (lookForEvent.seenEventRead) {
8713
9549
  params.push(new FnParam("$event"));
8714
9550
  }
8715
- return fn(params, handlerStmts, void 0, void 0, name);
8716
- }
8717
- var LookForEventVisitor = class extends RecursiveAstVisitor {
8718
- constructor() {
8719
- super(...arguments);
8720
- this.seenEventRead = false;
8721
- }
8722
- visitReadVarExpr(ast, context) {
8723
- if (ast.name === "$event") {
8724
- this.seenEventRead = true;
8725
- }
8726
- }
8727
- };
8728
-
8729
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
8730
- function phaseSlotAllocation(cpl) {
8731
- const slotMap = /* @__PURE__ */ new Map();
8732
- for (const [_, view] of cpl.views) {
8733
- let slotCount = 0;
8734
- for (const op of view.create) {
8735
- if (!hasConsumesSlotTrait(op)) {
8736
- continue;
8737
- }
8738
- op.slot = slotCount;
8739
- slotMap.set(op.xref, op.slot);
8740
- slotCount += op.numSlotsUsed;
8741
- }
8742
- view.decls = slotCount;
8743
- }
8744
- for (const [_, view] of cpl.views) {
8745
- for (const op of view.ops()) {
8746
- if (op.kind === OpKind.Template) {
8747
- const childView = cpl.views.get(op.xref);
8748
- op.decls = childView.decls;
8749
- }
8750
- if (hasUsesSlotIndexTrait(op) && op.slot === null) {
8751
- if (!slotMap.has(op.target)) {
8752
- throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
8753
- }
8754
- op.slot = slotMap.get(op.target);
8755
- }
8756
- visitExpressionsInOp(op, (expr) => {
8757
- if (!isIrExpression(expr)) {
8758
- return;
8759
- }
8760
- if (!hasUsesSlotIndexTrait(expr) || expr.slot !== null) {
8761
- return;
8762
- }
8763
- if (!slotMap.has(expr.target)) {
8764
- throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
8765
- }
8766
- expr.slot = slotMap.get(expr.target);
8767
- });
8768
- }
8769
- }
8770
- }
8771
-
8772
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
8773
- function phaseVarCounting(cpl) {
8774
- for (const [_, view] of cpl.views) {
8775
- let varCount = 0;
8776
- for (const op of view.ops()) {
8777
- if (hasConsumesVarsTrait(op)) {
8778
- varCount += varsUsedByOp(op);
8779
- }
8780
- visitExpressionsInOp(op, (expr) => {
8781
- if (!isIrExpression(expr)) {
8782
- return;
8783
- }
8784
- if (hasUsesVarOffsetTrait(expr)) {
8785
- expr.varOffset = varCount;
8786
- }
8787
- if (hasConsumesVarsTrait(expr)) {
8788
- varCount += varsUsedByIrExpression(expr);
8789
- }
8790
- });
8791
- }
8792
- view.vars = varCount;
8793
- }
8794
- for (const [_, view] of cpl.views) {
8795
- for (const op of view.create) {
8796
- if (op.kind !== OpKind.Template) {
8797
- continue;
8798
- }
8799
- const childView = cpl.views.get(op.xref);
8800
- op.vars = childView.vars;
8801
- }
8802
- }
8803
- }
8804
- function varsUsedByOp(op) {
8805
- switch (op.kind) {
8806
- case OpKind.Property:
8807
- return 1;
8808
- case OpKind.InterpolateText:
8809
- return op.expressions.length;
8810
- case OpKind.InterpolateProperty:
8811
- return 1 + op.expressions.length;
8812
- default:
8813
- throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
8814
- }
8815
- }
8816
- function varsUsedByIrExpression(expr) {
8817
- switch (expr.kind) {
8818
- case ExpressionKind.PureFunctionExpr:
8819
- return 1 + expr.args.length;
8820
- case ExpressionKind.PipeBinding:
8821
- return 1 + expr.args.length;
8822
- case ExpressionKind.PipeBindingVariadic:
8823
- return 1 + expr.numArgs;
8824
- default:
8825
- throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
8826
- }
8827
- }
8828
-
8829
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
8830
- function phaseNaming(cpl) {
8831
- addNamesToView(cpl.root, cpl.componentName, { index: 0 });
8832
- }
8833
- function addNamesToView(view, baseName, state) {
8834
- if (view.fnName === null) {
8835
- view.fnName = `${baseName}_Template`;
8836
- }
8837
- const varNames = /* @__PURE__ */ new Map();
8838
- for (const op of view.ops()) {
8839
- switch (op.kind) {
8840
- case OpKind.Listener:
8841
- if (op.handlerFnName === null) {
8842
- if (op.slot === null) {
8843
- throw new Error(`Expected a slot to be assigned`);
8844
- }
8845
- op.handlerFnName = `${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`;
8846
- }
8847
- break;
8848
- case OpKind.Variable:
8849
- varNames.set(op.xref, getVariableName(op.variable, state));
8850
- break;
8851
- case OpKind.Template:
8852
- const childView = view.tpl.views.get(op.xref);
8853
- if (op.slot === null) {
8854
- throw new Error(`Expected slot to be assigned`);
8855
- }
8856
- const safeTagName = op.tag.replace("-", "_");
8857
- addNamesToView(childView, `${baseName}_${safeTagName}_${op.slot}`, state);
8858
- break;
8859
- }
8860
- }
8861
- for (const op of view.ops()) {
8862
- visitExpressionsInOp(op, (expr) => {
8863
- if (!(expr instanceof ReadVariableExpr) || expr.name !== null) {
8864
- return;
8865
- }
8866
- if (!varNames.has(expr.xref)) {
8867
- throw new Error(`Variable ${expr.xref} not yet named`);
8868
- }
8869
- expr.name = varNames.get(expr.xref);
8870
- });
8871
- }
8872
- }
8873
- function getVariableName(variable2, state) {
8874
- if (variable2.name === null) {
8875
- switch (variable2.kind) {
8876
- case SemanticVariableKind.Identifier:
8877
- variable2.name = `${variable2.identifier}_${state.index++}`;
8878
- break;
8879
- default:
8880
- variable2.name = `_r${state.index++}`;
8881
- break;
8882
- }
8883
- }
8884
- return variable2.name;
8885
- }
8886
-
8887
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
8888
- function phaseLocalRefs(cpl) {
8889
- for (const view of cpl.views.values()) {
8890
- for (const op of view.create) {
8891
- switch (op.kind) {
8892
- case OpKind.ElementStart:
8893
- case OpKind.Element:
8894
- case OpKind.Template:
8895
- if (!Array.isArray(op.localRefs)) {
8896
- throw new Error(`AssertionError: expected localRefs to be an array still`);
8897
- }
8898
- op.numSlotsUsed += op.localRefs.length;
8899
- if (op.localRefs.length > 0) {
8900
- const localRefs = serializeLocalRefs(op.localRefs);
8901
- op.localRefs = cpl.addConst(localRefs);
8902
- } else {
8903
- op.localRefs = null;
8904
- }
8905
- break;
8906
- }
8907
- }
8908
- }
8909
- }
8910
- function serializeLocalRefs(refs) {
8911
- const constRefs = [];
8912
- for (const ref of refs) {
8913
- constRefs.push(literal(ref.name), literal(ref.target));
8914
- }
8915
- return literalArr(constRefs);
8916
- }
8917
-
8918
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
8919
- function phaseGenerateVariables(cpl) {
8920
- recursivelyProcessView(cpl.root, null);
9551
+ return fn(params, handlerStmts, void 0, void 0, name);
8921
9552
  }
8922
- function recursivelyProcessView(view, parentScope) {
8923
- const scope = getScopeForView(view, parentScope);
8924
- if (view.parent !== null) {
9553
+ var LookForEventVisitor = class extends RecursiveAstVisitor {
9554
+ constructor() {
9555
+ super(...arguments);
9556
+ this.seenEventRead = false;
8925
9557
  }
8926
- for (const op of view.create) {
8927
- switch (op.kind) {
8928
- case OpKind.Template:
8929
- recursivelyProcessView(view.tpl.views.get(op.xref), scope);
8930
- break;
8931
- case OpKind.Listener:
8932
- op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
8933
- break;
9558
+ visitReadVarExpr(ast, context) {
9559
+ if (ast.name === "$event") {
9560
+ this.seenEventRead = true;
8934
9561
  }
8935
9562
  }
8936
- const preambleOps = generateVariablesInScopeForView(view, scope);
8937
- view.update.prepend(preambleOps);
8938
- }
8939
- function getScopeForView(view, parent) {
8940
- const scope = {
8941
- view: view.xref,
8942
- viewContextVariable: {
8943
- kind: SemanticVariableKind.Context,
8944
- name: null,
8945
- view: view.xref
8946
- },
8947
- contextVariables: /* @__PURE__ */ new Map(),
8948
- references: [],
8949
- parent
8950
- };
8951
- for (const identifier of view.contextVariables.keys()) {
8952
- scope.contextVariables.set(identifier, {
8953
- kind: SemanticVariableKind.Identifier,
8954
- name: null,
8955
- identifier
8956
- });
9563
+ };
9564
+
9565
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
9566
+ function phaseResolveContexts(cpl) {
9567
+ for (const view of cpl.views.values()) {
9568
+ processLexicalScope(view, view.create);
9569
+ processLexicalScope(view, view.update);
8957
9570
  }
8958
- for (const op of view.create) {
9571
+ }
9572
+ function processLexicalScope(view, ops) {
9573
+ const scope = /* @__PURE__ */ new Map();
9574
+ scope.set(view.xref, variable("ctx"));
9575
+ for (const op of ops) {
8959
9576
  switch (op.kind) {
8960
- case OpKind.Element:
8961
- case OpKind.ElementStart:
8962
- case OpKind.Template:
8963
- if (!Array.isArray(op.localRefs)) {
8964
- throw new Error(`AssertionError: expected localRefs to be an array`);
8965
- }
8966
- for (let offset = 0; offset < op.localRefs.length; offset++) {
8967
- scope.references.push({
8968
- name: op.localRefs[offset].name,
8969
- targetId: op.xref,
8970
- offset,
8971
- variable: {
8972
- kind: SemanticVariableKind.Identifier,
8973
- name: null,
8974
- identifier: op.localRefs[offset].name
8975
- }
8976
- });
9577
+ case OpKind.Variable:
9578
+ switch (op.variable.kind) {
9579
+ case SemanticVariableKind.Context:
9580
+ scope.set(op.variable.view, new ReadVariableExpr(op.xref));
9581
+ break;
8977
9582
  }
8978
9583
  break;
9584
+ case OpKind.Listener:
9585
+ processLexicalScope(view, op.handlerOps);
9586
+ break;
8979
9587
  }
8980
9588
  }
8981
- return scope;
8982
- }
8983
- function generateVariablesInScopeForView(view, scope) {
8984
- const newOps = [];
8985
- if (scope.view !== view.xref) {
8986
- newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
8987
- }
8988
- for (const [name, value] of view.tpl.views.get(scope.view).contextVariables) {
8989
- newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.contextVariables.get(name), new ReadPropExpr(new ContextExpr(scope.view), value)));
8990
- }
8991
- for (const ref of scope.references) {
8992
- newOps.push(createVariableOp(view.tpl.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
8993
- }
8994
- if (scope.parent !== null) {
8995
- newOps.push(...generateVariablesInScopeForView(view, scope.parent));
9589
+ for (const op of ops) {
9590
+ transformExpressionsInOp(op, (expr) => {
9591
+ if (expr instanceof ContextExpr) {
9592
+ if (!scope.has(expr.view)) {
9593
+ throw new Error(`No context found for reference to view ${expr.view} from view ${view.xref}`);
9594
+ }
9595
+ return scope.get(expr.view);
9596
+ } else {
9597
+ return expr;
9598
+ }
9599
+ }, VisitorContextFlag.None);
8996
9600
  }
8997
- return newOps;
8998
9601
  }
8999
9602
 
9000
9603
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
9001
9604
  function phaseResolveNames(cpl) {
9002
9605
  for (const [_, view] of cpl.views) {
9003
- processLexicalScope(view, view.create, null);
9004
- processLexicalScope(view, view.update, null);
9606
+ processLexicalScope2(view, view.create, null);
9607
+ processLexicalScope2(view, view.update, null);
9005
9608
  }
9006
9609
  }
9007
- function processLexicalScope(view, ops, savedView) {
9610
+ function processLexicalScope2(view, ops, savedView) {
9008
9611
  const scope = /* @__PURE__ */ new Map();
9009
9612
  for (const op of ops) {
9010
9613
  switch (op.kind) {
@@ -9025,7 +9628,7 @@ function processLexicalScope(view, ops, savedView) {
9025
9628
  }
9026
9629
  break;
9027
9630
  case OpKind.Listener:
9028
- processLexicalScope(view, op.handlerOps, savedView);
9631
+ processLexicalScope2(view, op.handlerOps, savedView);
9029
9632
  break;
9030
9633
  }
9031
9634
  }
@@ -9050,41 +9653,79 @@ function processLexicalScope(view, ops, savedView) {
9050
9653
  }
9051
9654
  }
9052
9655
 
9053
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
9054
- function phaseResolveContexts(cpl) {
9656
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
9657
+ function phaseSaveRestoreView(cpl) {
9055
9658
  for (const view of cpl.views.values()) {
9056
- processLexicalScope2(view, view.create);
9057
- processLexicalScope2(view, view.update);
9659
+ if (view === cpl.root) {
9660
+ continue;
9661
+ }
9662
+ view.create.prepend([
9663
+ createVariableOp(view.tpl.allocateXrefId(), {
9664
+ kind: SemanticVariableKind.SavedView,
9665
+ name: null,
9666
+ view: view.xref
9667
+ }, new GetCurrentViewExpr())
9668
+ ]);
9669
+ for (const op of view.create) {
9670
+ if (op.kind !== OpKind.Listener) {
9671
+ continue;
9672
+ }
9673
+ op.handlerOps.prepend([
9674
+ createVariableOp(view.tpl.allocateXrefId(), {
9675
+ kind: SemanticVariableKind.Context,
9676
+ name: null,
9677
+ view: view.xref
9678
+ }, new RestoreViewExpr(view.xref))
9679
+ ]);
9680
+ for (const handlerOp of op.handlerOps) {
9681
+ if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
9682
+ handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
9683
+ }
9684
+ }
9685
+ }
9058
9686
  }
9059
9687
  }
9060
- function processLexicalScope2(view, ops) {
9061
- const scope = /* @__PURE__ */ new Map();
9062
- scope.set(view.xref, variable("ctx"));
9063
- for (const op of ops) {
9064
- switch (op.kind) {
9065
- case OpKind.Variable:
9066
- switch (op.variable.kind) {
9067
- case SemanticVariableKind.Context:
9068
- scope.set(op.variable.view, new ReadVariableExpr(op.xref));
9069
- break;
9070
- }
9071
- break;
9072
- case OpKind.Listener:
9073
- processLexicalScope2(view, op.handlerOps);
9074
- break;
9688
+
9689
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
9690
+ function phaseSlotAllocation(cpl) {
9691
+ const slotMap = /* @__PURE__ */ new Map();
9692
+ for (const [_, view] of cpl.views) {
9693
+ let slotCount = 0;
9694
+ for (const op of view.create) {
9695
+ if (!hasConsumesSlotTrait(op)) {
9696
+ continue;
9697
+ }
9698
+ op.slot = slotCount;
9699
+ slotMap.set(op.xref, op.slot);
9700
+ slotCount += op.numSlotsUsed;
9075
9701
  }
9702
+ view.decls = slotCount;
9076
9703
  }
9077
- for (const op of ops) {
9078
- transformExpressionsInOp(op, (expr) => {
9079
- if (expr instanceof ContextExpr) {
9080
- if (!scope.has(expr.view)) {
9081
- throw new Error(`No context found for reference to view ${expr.view} from view ${view.xref}`);
9704
+ for (const [_, view] of cpl.views) {
9705
+ for (const op of view.ops()) {
9706
+ if (op.kind === OpKind.Template) {
9707
+ const childView = cpl.views.get(op.xref);
9708
+ op.decls = childView.decls;
9709
+ }
9710
+ if (hasUsesSlotIndexTrait(op) && op.slot === null) {
9711
+ if (!slotMap.has(op.target)) {
9712
+ throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
9082
9713
  }
9083
- return scope.get(expr.view);
9084
- } else {
9085
- return expr;
9714
+ op.slot = slotMap.get(op.target);
9086
9715
  }
9087
- }, VisitorContextFlag.None);
9716
+ visitExpressionsInOp(op, (expr) => {
9717
+ if (!isIrExpression(expr)) {
9718
+ return;
9719
+ }
9720
+ if (!hasUsesSlotIndexTrait(expr) || expr.slot !== null) {
9721
+ return;
9722
+ }
9723
+ if (!slotMap.has(expr.target)) {
9724
+ throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
9725
+ }
9726
+ expr.slot = slotMap.get(expr.target);
9727
+ });
9728
+ }
9088
9729
  }
9089
9730
  }
9090
9731
 
@@ -9298,319 +9939,79 @@ function allowConservativeInlining(decl, target) {
9298
9939
  }
9299
9940
  }
9300
9941
 
9301
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
9302
- var CHAINABLE = /* @__PURE__ */ new Set([
9303
- Identifiers.elementStart,
9304
- Identifiers.elementEnd,
9305
- Identifiers.property,
9306
- Identifiers.elementContainerStart,
9307
- Identifiers.elementContainerEnd,
9308
- Identifiers.elementContainer
9309
- ]);
9310
- function phaseChaining(cpl) {
9942
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9943
+ function phaseExpandSafeReads(cpl) {
9311
9944
  for (const [_, view] of cpl.views) {
9312
- chainOperationsInList(view.create);
9313
- chainOperationsInList(view.update);
9314
- }
9315
- }
9316
- function chainOperationsInList(opList) {
9317
- let chain = null;
9318
- for (const op of opList) {
9319
- if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
9320
- chain = null;
9321
- continue;
9322
- }
9323
- if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
9324
- chain = null;
9325
- continue;
9326
- }
9327
- const instruction = op.statement.expr.fn.value;
9328
- if (!CHAINABLE.has(instruction)) {
9329
- chain = null;
9330
- continue;
9331
- }
9332
- if (chain !== null && chain.instruction === instruction) {
9333
- const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
9334
- chain.expression = expression;
9335
- chain.op.statement = expression.toStmt();
9336
- OpList.remove(op);
9337
- } else {
9338
- chain = {
9339
- op,
9340
- instruction,
9341
- expression: op.statement.expr
9342
- };
9343
- }
9344
- }
9345
- }
9346
-
9347
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
9348
- function phaseMergeNextContext(cpl) {
9349
- for (const view of cpl.views.values()) {
9350
- for (const op of view.create) {
9351
- if (op.kind === OpKind.Listener) {
9352
- mergeNextContextsInOps(op.handlerOps);
9353
- }
9945
+ for (const op of view.ops()) {
9946
+ transformExpressionsInOp(op, safeTransform, VisitorContextFlag.None);
9947
+ transformExpressionsInOp(op, ternaryTransform, VisitorContextFlag.None);
9354
9948
  }
9355
- mergeNextContextsInOps(view.update);
9356
9949
  }
9357
9950
  }
9358
- function mergeNextContextsInOps(ops) {
9359
- for (const op of ops) {
9360
- if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement) || !(op.statement.expr instanceof NextContextExpr)) {
9361
- continue;
9362
- }
9363
- const mergeSteps = op.statement.expr.steps;
9364
- let tryToMerge = true;
9365
- for (let candidate = op.next; candidate.kind !== OpKind.ListEnd && tryToMerge; candidate = candidate.next) {
9366
- visitExpressionsInOp(candidate, (expr, flags) => {
9367
- if (!isIrExpression(expr)) {
9368
- return expr;
9369
- }
9370
- if (!tryToMerge) {
9371
- return;
9372
- }
9373
- if (flags & VisitorContextFlag.InChildOperation) {
9374
- return;
9375
- }
9376
- switch (expr.kind) {
9377
- case ExpressionKind.NextContext:
9378
- expr.steps += mergeSteps;
9379
- OpList.remove(op);
9380
- tryToMerge = false;
9381
- break;
9382
- case ExpressionKind.GetCurrentView:
9383
- case ExpressionKind.Reference:
9384
- tryToMerge = false;
9385
- break;
9386
- }
9387
- });
9388
- }
9389
- }
9951
+ function isSafeAccessExpression(e) {
9952
+ return e instanceof SafePropertyReadExpr || e instanceof SafeKeyedReadExpr;
9390
9953
  }
9391
-
9392
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
9393
- var CONTAINER_TAG = "ng-container";
9394
- function phaseNgContainer(cpl) {
9395
- for (const [_, view] of cpl.views) {
9396
- const updatedElementXrefs = /* @__PURE__ */ new Set();
9397
- for (const op of view.create) {
9398
- if (op.kind === OpKind.ElementStart && op.tag === CONTAINER_TAG) {
9399
- op.kind = OpKind.ContainerStart;
9400
- updatedElementXrefs.add(op.xref);
9401
- }
9402
- if (op.kind === OpKind.ElementEnd && updatedElementXrefs.has(op.xref)) {
9403
- op.kind = OpKind.ContainerEnd;
9404
- }
9405
- }
9406
- }
9954
+ function isUnsafeAccessExpression(e) {
9955
+ return e instanceof ReadPropExpr || e instanceof ReadKeyExpr;
9407
9956
  }
9408
-
9409
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
9410
- function phaseSaveRestoreView(cpl) {
9411
- for (const view of cpl.views.values()) {
9412
- if (view === cpl.root) {
9413
- continue;
9414
- }
9415
- view.create.prepend([
9416
- createVariableOp(view.tpl.allocateXrefId(), {
9417
- kind: SemanticVariableKind.SavedView,
9418
- name: null,
9419
- view: view.xref
9420
- }, new GetCurrentViewExpr())
9421
- ]);
9422
- for (const op of view.create) {
9423
- if (op.kind !== OpKind.Listener) {
9424
- continue;
9425
- }
9426
- op.handlerOps.prepend([
9427
- createVariableOp(view.tpl.allocateXrefId(), {
9428
- kind: SemanticVariableKind.Context,
9429
- name: null,
9430
- view: view.xref
9431
- }, new RestoreViewExpr(view.xref))
9432
- ]);
9433
- for (const handlerOp of op.handlerOps) {
9434
- if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
9435
- handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
9436
- }
9437
- }
9438
- }
9439
- }
9957
+ function isAccessExpression(e) {
9958
+ return isSafeAccessExpression(e) || isUnsafeAccessExpression(e);
9440
9959
  }
9441
-
9442
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
9443
- function phasePureFunctionExtraction(cpl) {
9444
- for (const view of cpl.views.values()) {
9445
- for (const op of view.ops()) {
9446
- visitExpressionsInOp(op, (expr) => {
9447
- if (!(expr instanceof PureFunctionExpr) || expr.body === null) {
9448
- return;
9449
- }
9450
- const constantDef = new PureFunctionConstant(expr.args.length);
9451
- expr.fn = cpl.pool.getSharedConstant(constantDef, expr.body);
9452
- expr.body = null;
9453
- });
9960
+ function deepestSafeTernary(e) {
9961
+ if (isAccessExpression(e) && e.receiver instanceof SafeTernaryExpr) {
9962
+ let st = e.receiver;
9963
+ while (st.expr instanceof SafeTernaryExpr) {
9964
+ st = st.expr;
9454
9965
  }
9966
+ return st;
9455
9967
  }
9968
+ return null;
9456
9969
  }
9457
- var PureFunctionConstant = class extends GenericKeyFn {
9458
- constructor(numArgs) {
9459
- super();
9460
- this.numArgs = numArgs;
9461
- }
9462
- keyOf(expr) {
9463
- if (expr instanceof PureFunctionParameterExpr) {
9464
- return `param(${expr.index})`;
9465
- } else {
9466
- return super.keyOf(expr);
9467
- }
9468
- }
9469
- toSharedConstantDeclaration(declName, keyExpr) {
9470
- const fnParams = [];
9471
- for (let idx = 0; idx < this.numArgs; idx++) {
9472
- fnParams.push(new FnParam("_p" + idx));
9473
- }
9474
- const returnExpr = transformExpressionsInExpression(keyExpr, (expr) => {
9475
- if (!(expr instanceof PureFunctionParameterExpr)) {
9476
- return expr;
9477
- }
9478
- return variable("_p" + expr.index);
9479
- }, VisitorContextFlag.None);
9480
- return new DeclareFunctionStmt(declName, fnParams, [new ReturnStatement(returnExpr)]);
9481
- }
9482
- };
9483
-
9484
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
9485
- function phasePipeCreation(cpl) {
9486
- for (const view of cpl.views.values()) {
9487
- processPipeBindingsInView(view);
9970
+ function safeTransform(e) {
9971
+ if (e instanceof SafeInvokeFunctionExpr) {
9972
+ return new InvokeFunctionExpr(e.receiver, e.args);
9488
9973
  }
9489
- }
9490
- function processPipeBindingsInView(view) {
9491
- for (const updateOp of view.update) {
9492
- visitExpressionsInOp(updateOp, (expr, flags) => {
9493
- if (!isIrExpression(expr)) {
9494
- return;
9495
- }
9496
- if (expr.kind !== ExpressionKind.PipeBinding) {
9497
- return;
9498
- }
9499
- if (flags & VisitorContextFlag.InChildOperation) {
9500
- throw new Error(`AssertionError: pipe bindings should not appear in child expressions`);
9501
- }
9502
- if (!hasDependsOnSlotContextTrait(updateOp)) {
9503
- throw new Error(`AssertionError: pipe binding associated with non-slot operation ${OpKind[updateOp.kind]}`);
9504
- }
9505
- addPipeToCreationBlock(view, updateOp.target, expr);
9506
- });
9974
+ if (!isAccessExpression(e)) {
9975
+ return e;
9507
9976
  }
9508
- }
9509
- function addPipeToCreationBlock(view, afterTargetXref, binding) {
9510
- for (let op = view.create.head.next; op.kind !== OpKind.ListEnd; op = op.next) {
9511
- if (!hasConsumesSlotTrait(op)) {
9512
- continue;
9513
- }
9514
- if (op.xref !== afterTargetXref) {
9515
- continue;
9977
+ const dst = deepestSafeTernary(e);
9978
+ if (dst) {
9979
+ if (e instanceof ReadPropExpr) {
9980
+ dst.expr = dst.expr.prop(e.name);
9981
+ return e.receiver;
9516
9982
  }
9517
- while (op.next.kind === OpKind.Pipe) {
9518
- op = op.next;
9983
+ if (e instanceof ReadKeyExpr) {
9984
+ dst.expr = dst.expr.key(e.index);
9985
+ return e.receiver;
9519
9986
  }
9520
- const pipe2 = createPipeOp(binding.target, binding.name);
9521
- OpList.insertBefore(pipe2, op.next);
9522
- return;
9523
- }
9524
- throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
9525
- }
9526
-
9527
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
9528
- function phasePipeVariadic(cpl) {
9529
- for (const view of cpl.views.values()) {
9530
- for (const op of view.update) {
9531
- transformExpressionsInOp(op, (expr) => {
9532
- if (!(expr instanceof PipeBindingExpr)) {
9533
- return expr;
9534
- }
9535
- if (expr.args.length <= 4) {
9536
- return expr;
9537
- }
9538
- return new PipeBindingVariadicExpr(expr.target, expr.name, literalArr(expr.args), expr.args.length);
9539
- }, VisitorContextFlag.None);
9987
+ if (e instanceof SafePropertyReadExpr) {
9988
+ dst.expr = new SafeTernaryExpr(dst.expr.clone(), dst.expr.prop(e.name));
9989
+ return e.receiver;
9540
9990
  }
9541
- }
9542
- }
9543
-
9544
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
9545
- function phasePureLiteralStructures(cpl) {
9546
- for (const view of cpl.views.values()) {
9547
- for (const op of view.update) {
9548
- transformExpressionsInOp(op, (expr, flags) => {
9549
- if (flags & VisitorContextFlag.InChildOperation) {
9550
- return expr;
9551
- }
9552
- if (expr instanceof LiteralArrayExpr) {
9553
- return transformLiteralArray(expr);
9554
- } else if (expr instanceof LiteralMapExpr) {
9555
- return transformLiteralMap(expr);
9556
- }
9557
- return expr;
9558
- }, VisitorContextFlag.None);
9991
+ if (e instanceof SafeKeyedReadExpr) {
9992
+ dst.expr = new SafeTernaryExpr(dst.expr.clone(), dst.expr.key(e.index));
9993
+ return e.receiver;
9559
9994
  }
9560
- }
9561
- }
9562
- function transformLiteralArray(expr) {
9563
- const derivedEntries = [];
9564
- const nonConstantArgs = [];
9565
- for (const entry of expr.entries) {
9566
- if (entry.isConstant()) {
9567
- derivedEntries.push(entry);
9568
- } else {
9569
- const idx = nonConstantArgs.length;
9570
- nonConstantArgs.push(entry);
9571
- derivedEntries.push(new PureFunctionParameterExpr(idx));
9995
+ } else {
9996
+ if (e instanceof SafePropertyReadExpr) {
9997
+ return new SafeTernaryExpr(e.receiver.clone(), e.receiver.prop(e.name));
9572
9998
  }
9573
- }
9574
- return new PureFunctionExpr(literalArr(derivedEntries), nonConstantArgs);
9575
- }
9576
- function transformLiteralMap(expr) {
9577
- let derivedEntries = [];
9578
- const nonConstantArgs = [];
9579
- for (const entry of expr.entries) {
9580
- if (entry.value.isConstant()) {
9581
- derivedEntries.push(entry);
9582
- } else {
9583
- const idx = nonConstantArgs.length;
9584
- nonConstantArgs.push(entry.value);
9585
- derivedEntries.push(new LiteralMapEntry(entry.key, new PureFunctionParameterExpr(idx), entry.quoted));
9999
+ if (e instanceof SafeKeyedReadExpr) {
10000
+ return new SafeTernaryExpr(e.receiver.clone(), e.receiver.key(e.index));
9586
10001
  }
9587
10002
  }
9588
- return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
10003
+ return e;
9589
10004
  }
9590
-
9591
- // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/align_pipe_variadic_var_offset.mjs
9592
- function phaseAlignPipeVariadicVarOffset(cpl) {
9593
- for (const view of cpl.views.values()) {
9594
- for (const op of view.update) {
9595
- visitExpressionsInOp(op, (expr) => {
9596
- if (!(expr instanceof PipeBindingVariadicExpr)) {
9597
- return expr;
9598
- }
9599
- if (!(expr.args instanceof PureFunctionExpr)) {
9600
- return expr;
9601
- }
9602
- if (expr.varOffset === null || expr.args.varOffset === null) {
9603
- throw new Error(`Must run after variable counting`);
9604
- }
9605
- expr.varOffset = expr.args.varOffset;
9606
- expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
9607
- });
9608
- }
10005
+ function ternaryTransform(e) {
10006
+ if (!(e instanceof SafeTernaryExpr)) {
10007
+ return e;
9609
10008
  }
10009
+ return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9610
10010
  }
9611
10011
 
9612
10012
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
9613
10013
  function transformTemplate(cpl) {
10014
+ phaseAttributeExtraction(cpl, true);
9614
10015
  phasePipeCreation(cpl);
9615
10016
  phasePipeVariadic(cpl);
9616
10017
  phasePureLiteralStructures(cpl);
@@ -9620,6 +10021,8 @@ function transformTemplate(cpl) {
9620
10021
  phaseResolveContexts(cpl);
9621
10022
  phaseLocalRefs(cpl);
9622
10023
  phaseConstCollection(cpl);
10024
+ phaseNullishCoalescing(cpl);
10025
+ phaseExpandSafeReads(cpl);
9623
10026
  phaseSlotAllocation(cpl);
9624
10027
  phaseVarCounting(cpl);
9625
10028
  phaseGenerateAdvance(cpl);
@@ -9799,7 +10202,6 @@ function ingestElement(view, element2) {
9799
10202
  const id = view.tpl.allocateXrefId();
9800
10203
  const startOp = createElementStartOp(element2.name, id);
9801
10204
  view.create.push(startOp);
9802
- ingestAttributes(startOp, element2);
9803
10205
  ingestBindings(view, startOp, element2);
9804
10206
  ingestReferences(startOp, element2);
9805
10207
  ingestNodes(view, element2.children);
@@ -9810,7 +10212,6 @@ function ingestTemplate(view, tmpl) {
9810
10212
  const childView = view.tpl.allocateView(view.xref);
9811
10213
  const tplOp = createTemplateOp(childView.xref, (_a2 = tmpl.tagName) != null ? _a2 : "ng-template");
9812
10214
  view.create.push(tplOp);
9813
- ingestAttributes(tplOp, tmpl);
9814
10215
  ingestBindings(view, tplOp, tmpl);
9815
10216
  ingestReferences(tplOp, tmpl);
9816
10217
  ingestNodes(childView, tmpl.children);
@@ -9876,78 +10277,84 @@ function convertAst(ast, cpl) {
9876
10277
  return new LiteralArrayExpr(ast.expressions.map((expr) => convertAst(expr, cpl)));
9877
10278
  } else if (ast instanceof Conditional) {
9878
10279
  return new ConditionalExpr(convertAst(ast.condition, cpl), convertAst(ast.trueExp, cpl), convertAst(ast.falseExp, cpl));
10280
+ } else if (ast instanceof NonNullAssert) {
10281
+ return convertAst(ast.expression, cpl);
9879
10282
  } else if (ast instanceof BindingPipe) {
9880
10283
  return new PipeBindingExpr(cpl.allocateXrefId(), ast.name, [
9881
10284
  convertAst(ast.exp, cpl),
9882
10285
  ...ast.args.map((arg) => convertAst(arg, cpl))
9883
10286
  ]);
10287
+ } else if (ast instanceof SafeKeyedRead) {
10288
+ return new SafeKeyedReadExpr(convertAst(ast.receiver, cpl), convertAst(ast.key, cpl));
10289
+ } else if (ast instanceof SafePropertyRead) {
10290
+ return new SafePropertyReadExpr(convertAst(ast.receiver, cpl), ast.name);
10291
+ } else if (ast instanceof SafeCall) {
10292
+ return new SafeInvokeFunctionExpr(convertAst(ast.receiver, cpl), ast.args.map((a) => convertAst(a, cpl)));
9884
10293
  } else {
9885
10294
  throw new Error(`Unhandled expression type: ${ast.constructor.name}`);
9886
10295
  }
9887
10296
  }
9888
- function ingestAttributes(op, element2) {
9889
- assertIsElementAttributes(op.attributes);
10297
+ function ingestBindings(view, op, element2) {
10298
+ if (element2 instanceof Template) {
10299
+ for (const attr of element2.templateAttrs) {
10300
+ if (attr instanceof TextAttribute) {
10301
+ view.update.push(createAttributeOp(op.xref, ElementAttributeKind.Template, attr.name, literal(attr.value)));
10302
+ } else {
10303
+ ingestPropertyBinding(view, op.xref, ElementAttributeKind.Template, attr);
10304
+ }
10305
+ }
10306
+ }
9890
10307
  for (const attr of element2.attributes) {
9891
- op.attributes.add(ElementAttributeKind.Attribute, attr.name, literal(attr.value));
10308
+ view.update.push(createAttributeOp(op.xref, ElementAttributeKind.Attribute, attr.name, literal(attr.value)));
9892
10309
  }
9893
10310
  for (const input of element2.inputs) {
9894
- op.attributes.add(ElementAttributeKind.Binding, input.name, null);
10311
+ ingestPropertyBinding(view, op.xref, ElementAttributeKind.Binding, input);
9895
10312
  }
9896
10313
  for (const output of element2.outputs) {
9897
- op.attributes.add(ElementAttributeKind.Binding, output.name, null);
9898
- }
9899
- if (element2 instanceof Template) {
9900
- for (const attr of element2.templateAttrs) {
9901
- op.attributes.add(ElementAttributeKind.Template, attr.name, null);
10314
+ const listenerOp = createListenerOp(op.xref, output.name, op.tag);
10315
+ let inputExprs;
10316
+ let handler = output.handler;
10317
+ if (handler instanceof ASTWithSource) {
10318
+ handler = handler.ast;
10319
+ }
10320
+ if (handler instanceof Chain) {
10321
+ inputExprs = handler.expressions;
10322
+ } else {
10323
+ inputExprs = [handler];
9902
10324
  }
9903
- }
9904
- }
9905
- function ingestBindings(view, op, element2) {
9906
- if (element2 instanceof Template) {
9907
- for (const attr of [...element2.templateAttrs, ...element2.inputs]) {
9908
- if (!(attr instanceof BoundAttribute)) {
9909
- continue;
9910
- }
9911
- ingestPropertyBinding(view, op.xref, attr.name, attr.value);
10325
+ if (inputExprs.length === 0) {
10326
+ throw new Error("Expected listener to have non-empty expression list.");
9912
10327
  }
9913
- } else {
9914
- for (const input of element2.inputs) {
9915
- ingestPropertyBinding(view, op.xref, input.name, input.value);
9916
- }
9917
- for (const output of element2.outputs) {
9918
- const listenerOp = createListenerOp(op.xref, output.name, op.tag);
9919
- let inputExprs;
9920
- let handler = output.handler;
9921
- if (handler instanceof ASTWithSource) {
9922
- handler = handler.ast;
9923
- }
9924
- if (handler instanceof Chain) {
9925
- inputExprs = handler.expressions;
9926
- } else {
9927
- inputExprs = [handler];
9928
- }
9929
- if (inputExprs.length === 0) {
9930
- throw new Error("Expected listener to have non-empty expression list.");
9931
- }
9932
- const expressions = inputExprs.map((expr) => convertAst(expr, view.tpl));
9933
- const returnExpr = expressions.pop();
9934
- for (const expr of expressions) {
9935
- const stmtOp = createStatementOp(new ExpressionStatement(expr));
9936
- listenerOp.handlerOps.push(stmtOp);
9937
- }
9938
- listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(returnExpr)));
9939
- view.create.push(listenerOp);
10328
+ const expressions = inputExprs.map((expr) => convertAst(expr, view.tpl));
10329
+ const returnExpr = expressions.pop();
10330
+ for (const expr of expressions) {
10331
+ const stmtOp = createStatementOp(new ExpressionStatement(expr));
10332
+ listenerOp.handlerOps.push(stmtOp);
9940
10333
  }
10334
+ listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(returnExpr)));
10335
+ view.create.push(listenerOp);
9941
10336
  }
9942
10337
  }
9943
- function ingestPropertyBinding(view, xref, name, value) {
10338
+ function ingestPropertyBinding(view, xref, bindingKind, { name, value, type }) {
9944
10339
  if (value instanceof ASTWithSource) {
9945
10340
  value = value.ast;
9946
10341
  }
9947
10342
  if (value instanceof Interpolation) {
9948
- view.update.push(createInterpolatePropertyOp(xref, name, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
10343
+ switch (type) {
10344
+ case 0:
10345
+ view.update.push(createInterpolatePropertyOp(xref, bindingKind, name, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
10346
+ break;
10347
+ default:
10348
+ throw Error(`Interpolated property binding type not handled: ${type}`);
10349
+ }
9949
10350
  } else {
9950
- view.update.push(createPropertyOp(xref, name, convertAst(value, view.tpl)));
10351
+ switch (type) {
10352
+ case 0:
10353
+ view.update.push(createPropertyOp(xref, bindingKind, name, convertAst(value, view.tpl)));
10354
+ break;
10355
+ default:
10356
+ throw Error(`Property binding type not handled: ${type}`);
10357
+ }
9951
10358
  }
9952
10359
  }
9953
10360
  function ingestReferences(op, element2) {
@@ -19406,7 +19813,7 @@ function publishFacade(global2) {
19406
19813
  }
19407
19814
 
19408
19815
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
19409
- var VERSION2 = new Version("16.1.2");
19816
+ var VERSION2 = new Version("16.2.0-next.0");
19410
19817
 
19411
19818
  // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
19412
19819
  var _I18N_ATTR = "i18n";
@@ -20725,7 +21132,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
20725
21132
  function compileDeclareClassMetadata(metadata) {
20726
21133
  const definitionMap = new DefinitionMap();
20727
21134
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
20728
- definitionMap.set("version", literal("16.1.2"));
21135
+ definitionMap.set("version", literal("16.2.0-next.0"));
20729
21136
  definitionMap.set("ngImport", importExpr(Identifiers.core));
20730
21137
  definitionMap.set("type", metadata.type);
20731
21138
  definitionMap.set("decorators", metadata.decorators);
@@ -20794,7 +21201,7 @@ function createDirectiveDefinitionMap(meta) {
20794
21201
  var _a2;
20795
21202
  const definitionMap = new DefinitionMap();
20796
21203
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
20797
- definitionMap.set("version", literal("16.1.2"));
21204
+ definitionMap.set("version", literal("16.2.0-next.0"));
20798
21205
  definitionMap.set("type", meta.type.value);
20799
21206
  if (meta.isStandalone) {
20800
21207
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -20979,7 +21386,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
20979
21386
  function compileDeclareFactoryFunction(meta) {
20980
21387
  const definitionMap = new DefinitionMap();
20981
21388
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
20982
- definitionMap.set("version", literal("16.1.2"));
21389
+ definitionMap.set("version", literal("16.2.0-next.0"));
20983
21390
  definitionMap.set("ngImport", importExpr(Identifiers.core));
20984
21391
  definitionMap.set("type", meta.type.value);
20985
21392
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -21002,7 +21409,7 @@ function compileDeclareInjectableFromMetadata(meta) {
21002
21409
  function createInjectableDefinitionMap(meta) {
21003
21410
  const definitionMap = new DefinitionMap();
21004
21411
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
21005
- definitionMap.set("version", literal("16.1.2"));
21412
+ definitionMap.set("version", literal("16.2.0-next.0"));
21006
21413
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21007
21414
  definitionMap.set("type", meta.type.value);
21008
21415
  if (meta.providedIn !== void 0) {
@@ -21040,7 +21447,7 @@ function compileDeclareInjectorFromMetadata(meta) {
21040
21447
  function createInjectorDefinitionMap(meta) {
21041
21448
  const definitionMap = new DefinitionMap();
21042
21449
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
21043
- definitionMap.set("version", literal("16.1.2"));
21450
+ definitionMap.set("version", literal("16.2.0-next.0"));
21044
21451
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21045
21452
  definitionMap.set("type", meta.type.value);
21046
21453
  definitionMap.set("providers", meta.providers);
@@ -21061,7 +21468,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
21061
21468
  function createNgModuleDefinitionMap(meta) {
21062
21469
  const definitionMap = new DefinitionMap();
21063
21470
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
21064
- definitionMap.set("version", literal("16.1.2"));
21471
+ definitionMap.set("version", literal("16.2.0-next.0"));
21065
21472
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21066
21473
  definitionMap.set("type", meta.type.value);
21067
21474
  if (meta.bootstrap.length > 0) {
@@ -21096,7 +21503,7 @@ function compileDeclarePipeFromMetadata(meta) {
21096
21503
  function createPipeDefinitionMap(meta) {
21097
21504
  const definitionMap = new DefinitionMap();
21098
21505
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
21099
- definitionMap.set("version", literal("16.1.2"));
21506
+ definitionMap.set("version", literal("16.2.0-next.0"));
21100
21507
  definitionMap.set("ngImport", importExpr(Identifiers.core));
21101
21508
  definitionMap.set("type", meta.type.value);
21102
21509
  if (meta.isStandalone) {
@@ -21113,7 +21520,7 @@ function createPipeDefinitionMap(meta) {
21113
21520
  publishFacade(_global);
21114
21521
 
21115
21522
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
21116
- var VERSION3 = new Version("16.1.2");
21523
+ var VERSION3 = new Version("16.2.0-next.0");
21117
21524
 
21118
21525
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
21119
21526
  var EmitFlags;
@@ -32747,7 +33154,7 @@ function tsCallMethod(receiver, methodName, args = []) {
32747
33154
  args
32748
33155
  );
32749
33156
  }
32750
- function isAccessExpression(node) {
33157
+ function isAccessExpression2(node) {
32751
33158
  return import_typescript70.default.isPropertyAccessExpression(node) || import_typescript70.default.isElementAccessExpression(node);
32752
33159
  }
32753
33160
 
@@ -35410,7 +35817,7 @@ var SymbolBuilder = class {
35410
35817
  expectedAccess = bindingPropertyNames[0].classPropertyName;
35411
35818
  }
35412
35819
  function filter(n) {
35413
- if (!isAccessExpression(n)) {
35820
+ if (!isAccessExpression2(n)) {
35414
35821
  return false;
35415
35822
  }
35416
35823
  if (import_typescript84.default.isPropertyAccessExpression(n)) {
@@ -35489,7 +35896,7 @@ var SymbolBuilder = class {
35489
35896
  const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: binding.sourceSpan, filter: isAssignment });
35490
35897
  const bindings = [];
35491
35898
  for (const node of nodes) {
35492
- if (!isAccessExpression(node.left)) {
35899
+ if (!isAccessExpression2(node.left)) {
35493
35900
  continue;
35494
35901
  }
35495
35902
  const symbolInfo = this.getSymbolOfTsNode(node.left);