@angular-eslint/bundled-angular-compiler 21.2.1-alpha.8 → 21.2.1-alpha.9

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.
Files changed (2) hide show
  1. package/dist/index.js +856 -487
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,7 +26,9 @@ __export(index_exports, {
26
26
  ASTWithSource: () => ASTWithSource,
27
27
  AbsoluteSourceSpan: () => AbsoluteSourceSpan,
28
28
  ArrayType: () => ArrayType,
29
- ArrowFunctionExpr: () => ArrowFunctionExpr,
29
+ ArrowFunction: () => ArrowFunction,
30
+ ArrowFunctionExpr: () => ArrowFunctionExpr$1,
31
+ ArrowFunctionIdentifierParameter: () => ArrowFunctionIdentifierParameter,
30
32
  Attribute: () => Attribute,
31
33
  Binary: () => Binary,
32
34
  BinaryOperator: () => BinaryOperator,
@@ -194,6 +196,7 @@ __export(index_exports, {
194
196
  TmplAstSwitchBlock: () => SwitchBlock,
195
197
  TmplAstSwitchBlockCase: () => SwitchBlockCase,
196
198
  TmplAstSwitchBlockCaseGroup: () => SwitchBlockCaseGroup,
199
+ TmplAstSwitchExhaustiveCheck: () => SwitchExhaustiveCheck,
197
200
  TmplAstTemplate: () => Template,
198
201
  TmplAstText: () => Text$3,
199
202
  TmplAstTextAttribute: () => TextAttribute,
@@ -286,7 +289,7 @@ __export(index_exports, {
286
289
  });
287
290
  module.exports = __toCommonJS(index_exports);
288
291
 
289
- // ../../node_modules/.pnpm/@angular+compiler@21.1.4/node_modules/@angular/compiler/fesm2022/compiler.mjs
292
+ // ../../node_modules/.pnpm/@angular+compiler@21.2.0/node_modules/@angular/compiler/fesm2022/compiler.mjs
290
293
  var _SELECTOR_REGEXP = new RegExp(`(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`, "g");
291
294
  var CssSelector = class _CssSelector {
292
295
  static {
@@ -627,6 +630,7 @@ var ChangeDetectionStrategy;
627
630
  (function(ChangeDetectionStrategy2) {
628
631
  ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
629
632
  ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
633
+ ChangeDetectionStrategy2[ChangeDetectionStrategy2["Eager"] = 1] = "Eager";
630
634
  })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
631
635
  var InputFlags;
632
636
  (function(InputFlags2) {
@@ -1124,15 +1128,16 @@ var BinaryOperator;
1124
1128
  BinaryOperator2[BinaryOperator2["NullishCoalesce"] = 18] = "NullishCoalesce";
1125
1129
  BinaryOperator2[BinaryOperator2["Exponentiation"] = 19] = "Exponentiation";
1126
1130
  BinaryOperator2[BinaryOperator2["In"] = 20] = "In";
1127
- BinaryOperator2[BinaryOperator2["AdditionAssignment"] = 21] = "AdditionAssignment";
1128
- BinaryOperator2[BinaryOperator2["SubtractionAssignment"] = 22] = "SubtractionAssignment";
1129
- BinaryOperator2[BinaryOperator2["MultiplicationAssignment"] = 23] = "MultiplicationAssignment";
1130
- BinaryOperator2[BinaryOperator2["DivisionAssignment"] = 24] = "DivisionAssignment";
1131
- BinaryOperator2[BinaryOperator2["RemainderAssignment"] = 25] = "RemainderAssignment";
1132
- BinaryOperator2[BinaryOperator2["ExponentiationAssignment"] = 26] = "ExponentiationAssignment";
1133
- BinaryOperator2[BinaryOperator2["AndAssignment"] = 27] = "AndAssignment";
1134
- BinaryOperator2[BinaryOperator2["OrAssignment"] = 28] = "OrAssignment";
1135
- BinaryOperator2[BinaryOperator2["NullishCoalesceAssignment"] = 29] = "NullishCoalesceAssignment";
1131
+ BinaryOperator2[BinaryOperator2["InstanceOf"] = 21] = "InstanceOf";
1132
+ BinaryOperator2[BinaryOperator2["AdditionAssignment"] = 22] = "AdditionAssignment";
1133
+ BinaryOperator2[BinaryOperator2["SubtractionAssignment"] = 23] = "SubtractionAssignment";
1134
+ BinaryOperator2[BinaryOperator2["MultiplicationAssignment"] = 24] = "MultiplicationAssignment";
1135
+ BinaryOperator2[BinaryOperator2["DivisionAssignment"] = 25] = "DivisionAssignment";
1136
+ BinaryOperator2[BinaryOperator2["RemainderAssignment"] = 26] = "RemainderAssignment";
1137
+ BinaryOperator2[BinaryOperator2["ExponentiationAssignment"] = 27] = "ExponentiationAssignment";
1138
+ BinaryOperator2[BinaryOperator2["AndAssignment"] = 28] = "AndAssignment";
1139
+ BinaryOperator2[BinaryOperator2["OrAssignment"] = 29] = "OrAssignment";
1140
+ BinaryOperator2[BinaryOperator2["NullishCoalesceAssignment"] = 30] = "NullishCoalesceAssignment";
1136
1141
  })(BinaryOperator || (BinaryOperator = {}));
1137
1142
  function nullSafeIsEquivalent(base, other) {
1138
1143
  if (base == null || other == null) {
@@ -1767,7 +1772,7 @@ var FunctionExpr = class _FunctionExpr extends Expression {
1767
1772
  return new _FunctionExpr(this.params.map((p) => p.clone()), this.statements, this.type, this.sourceSpan, this.name);
1768
1773
  }
1769
1774
  };
1770
- var ArrowFunctionExpr = class _ArrowFunctionExpr extends Expression {
1775
+ var ArrowFunctionExpr$1 = class ArrowFunctionExpr extends Expression {
1771
1776
  static {
1772
1777
  __name(this, "ArrowFunctionExpr");
1773
1778
  }
@@ -1779,7 +1784,7 @@ var ArrowFunctionExpr = class _ArrowFunctionExpr extends Expression {
1779
1784
  this.body = body;
1780
1785
  }
1781
1786
  isEquivalent(e) {
1782
- if (!(e instanceof _ArrowFunctionExpr) || !areAllEquivalent(this.params, e.params)) {
1787
+ if (!(e instanceof ArrowFunctionExpr) || !areAllEquivalent(this.params, e.params)) {
1783
1788
  return false;
1784
1789
  }
1785
1790
  if (this.body instanceof Expression && e.body instanceof Expression) {
@@ -1797,7 +1802,7 @@ var ArrowFunctionExpr = class _ArrowFunctionExpr extends Expression {
1797
1802
  return visitor.visitArrowFunctionExpr(this, context);
1798
1803
  }
1799
1804
  clone() {
1800
- return new _ArrowFunctionExpr(this.params.map((p) => p.clone()), Array.isArray(this.body) ? this.body : this.body.clone(), this.type, this.sourceSpan);
1805
+ return new ArrowFunctionExpr(this.params.map((p) => p.clone()), Array.isArray(this.body) ? this.body : this.body.clone(), this.type, this.sourceSpan);
1801
1806
  }
1802
1807
  toDeclStmt(name, modifiers) {
1803
1808
  return new DeclareVarStmt(name, this, INFERRED_TYPE, modifiers, this.sourceSpan);
@@ -2467,7 +2472,7 @@ function fn(params, body, type, sourceSpan, name) {
2467
2472
  }
2468
2473
  __name(fn, "fn");
2469
2474
  function arrowFn(params, body, type, sourceSpan) {
2470
- return new ArrowFunctionExpr(params, body, type, sourceSpan);
2475
+ return new ArrowFunctionExpr$1(params, body, type, sourceSpan);
2471
2476
  }
2472
2477
  __name(arrowFn, "arrowFn");
2473
2478
  function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments) {
@@ -2522,7 +2527,7 @@ __name(serializeTags, "serializeTags");
2522
2527
  var output_ast = /* @__PURE__ */ Object.freeze({
2523
2528
  __proto__: null,
2524
2529
  ArrayType,
2525
- ArrowFunctionExpr,
2530
+ ArrowFunctionExpr: ArrowFunctionExpr$1,
2526
2531
  BOOL_TYPE,
2527
2532
  get BinaryOperator() {
2528
2533
  return BinaryOperator;
@@ -2705,7 +2710,7 @@ var ConstantPool = class {
2705
2710
  return this.sharedConstants.get(key);
2706
2711
  }
2707
2712
  getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
2708
- const isArrow = fn2 instanceof ArrowFunctionExpr;
2713
+ const isArrow = fn2 instanceof ArrowFunctionExpr$1;
2709
2714
  for (const current of this.statements) {
2710
2715
  if (isArrow && current instanceof DeclareVarStmt && current.value?.isEquivalent(fn2)) {
2711
2716
  return variable(current.name);
@@ -3506,6 +3511,10 @@ var Identifiers = class {
3506
3511
  name: "\u0275\u0275readContextLet",
3507
3512
  moduleName: CORE
3508
3513
  };
3514
+ static arrowFunction = {
3515
+ name: "\u0275\u0275arrowFunction",
3516
+ moduleName: CORE
3517
+ };
3509
3518
  static attachSourceLocations = {
3510
3519
  name: "\u0275\u0275attachSourceLocations",
3511
3520
  moduleName: CORE
@@ -3514,6 +3523,10 @@ var Identifiers = class {
3514
3523
  name: "\u0275\u0275NgOnChangesFeature",
3515
3524
  moduleName: CORE
3516
3525
  };
3526
+ static ControlFeature = {
3527
+ name: "\u0275\u0275ControlFeature",
3528
+ moduleName: CORE
3529
+ };
3517
3530
  static InheritDefinitionFeature = {
3518
3531
  name: "\u0275\u0275InheritDefinitionFeature",
3519
3532
  moduleName: CORE
@@ -3873,7 +3886,7 @@ var _EmittedLine = class {
3873
3886
  this.indent = indent;
3874
3887
  }
3875
3888
  };
3876
- var BINARY_OPERATORS$1 = /* @__PURE__ */ new Map([[BinaryOperator.And, "&&"], [BinaryOperator.Bigger, ">"], [BinaryOperator.BiggerEquals, ">="], [BinaryOperator.BitwiseOr, "|"], [BinaryOperator.BitwiseAnd, "&"], [BinaryOperator.Divide, "/"], [BinaryOperator.Assign, "="], [BinaryOperator.Equals, "=="], [BinaryOperator.Identical, "==="], [BinaryOperator.Lower, "<"], [BinaryOperator.LowerEquals, "<="], [BinaryOperator.Minus, "-"], [BinaryOperator.Modulo, "%"], [BinaryOperator.Exponentiation, "**"], [BinaryOperator.Multiply, "*"], [BinaryOperator.NotEquals, "!="], [BinaryOperator.NotIdentical, "!=="], [BinaryOperator.NullishCoalesce, "??"], [BinaryOperator.Or, "||"], [BinaryOperator.Plus, "+"], [BinaryOperator.In, "in"], [BinaryOperator.AdditionAssignment, "+="], [BinaryOperator.SubtractionAssignment, "-="], [BinaryOperator.MultiplicationAssignment, "*="], [BinaryOperator.DivisionAssignment, "/="], [BinaryOperator.RemainderAssignment, "%="], [BinaryOperator.ExponentiationAssignment, "**="], [BinaryOperator.AndAssignment, "&&="], [BinaryOperator.OrAssignment, "||="], [BinaryOperator.NullishCoalesceAssignment, "??="]]);
3889
+ var BINARY_OPERATORS$1 = /* @__PURE__ */ new Map([[BinaryOperator.And, "&&"], [BinaryOperator.Bigger, ">"], [BinaryOperator.BiggerEquals, ">="], [BinaryOperator.BitwiseOr, "|"], [BinaryOperator.BitwiseAnd, "&"], [BinaryOperator.Divide, "/"], [BinaryOperator.Assign, "="], [BinaryOperator.Equals, "=="], [BinaryOperator.Identical, "==="], [BinaryOperator.Lower, "<"], [BinaryOperator.LowerEquals, "<="], [BinaryOperator.Minus, "-"], [BinaryOperator.Modulo, "%"], [BinaryOperator.Exponentiation, "**"], [BinaryOperator.Multiply, "*"], [BinaryOperator.NotEquals, "!="], [BinaryOperator.NotIdentical, "!=="], [BinaryOperator.NullishCoalesce, "??"], [BinaryOperator.Or, "||"], [BinaryOperator.Plus, "+"], [BinaryOperator.In, "in"], [BinaryOperator.InstanceOf, "instanceof"], [BinaryOperator.AdditionAssignment, "+="], [BinaryOperator.SubtractionAssignment, "-="], [BinaryOperator.MultiplicationAssignment, "*="], [BinaryOperator.DivisionAssignment, "/="], [BinaryOperator.RemainderAssignment, "%="], [BinaryOperator.ExponentiationAssignment, "**="], [BinaryOperator.AndAssignment, "&&="], [BinaryOperator.OrAssignment, "||="], [BinaryOperator.NullishCoalesceAssignment, "??="]]);
3877
3890
  var EmitterVisitorContext = class _EmitterVisitorContext {
3878
3891
  static {
3879
3892
  __name(this, "EmitterVisitorContext");
@@ -4063,7 +4076,7 @@ var AbstractEmitterVisitor = class {
4063
4076
  return null;
4064
4077
  }
4065
4078
  visitInvokeFunctionExpr(expr, ctx) {
4066
- const shouldParenthesize = expr.fn instanceof ArrowFunctionExpr;
4079
+ const shouldParenthesize = expr.fn instanceof ArrowFunctionExpr$1;
4067
4080
  if (shouldParenthesize) {
4068
4081
  ctx.print(expr.fn, "(");
4069
4082
  }
@@ -4572,6 +4585,7 @@ var EmptyExpr$1 = class EmptyExpr extends AST {
4572
4585
  __name(this, "EmptyExpr");
4573
4586
  }
4574
4587
  visit(visitor, context = null) {
4588
+ return visitor.visitEmptyExpr?.(this, context);
4575
4589
  }
4576
4590
  };
4577
4591
  var ImplicitReceiver = class extends AST {
@@ -4962,6 +4976,34 @@ var ParenthesizedExpression = class extends AST {
4962
4976
  return visitor.visitParenthesizedExpression(this, context);
4963
4977
  }
4964
4978
  };
4979
+ var ArrowFunctionIdentifierParameter = class {
4980
+ static {
4981
+ __name(this, "ArrowFunctionIdentifierParameter");
4982
+ }
4983
+ name;
4984
+ span;
4985
+ sourceSpan;
4986
+ constructor(name, span, sourceSpan) {
4987
+ this.name = name;
4988
+ this.span = span;
4989
+ this.sourceSpan = sourceSpan;
4990
+ }
4991
+ };
4992
+ var ArrowFunction = class extends AST {
4993
+ static {
4994
+ __name(this, "ArrowFunction");
4995
+ }
4996
+ parameters;
4997
+ body;
4998
+ constructor(span, sourceSpan, parameters, body) {
4999
+ super(span, sourceSpan);
5000
+ this.parameters = parameters;
5001
+ this.body = body;
5002
+ }
5003
+ visit(visitor, context) {
5004
+ return visitor.visitArrowFunction(this, context);
5005
+ }
5006
+ };
4965
5007
  var RegularExpressionLiteral = class extends AST {
4966
5008
  static {
4967
5009
  __name(this, "RegularExpressionLiteral");
@@ -5132,11 +5174,16 @@ var RecursiveAstVisitor2 = class {
5132
5174
  visitParenthesizedExpression(ast, context) {
5133
5175
  this.visit(ast.expression, context);
5134
5176
  }
5177
+ visitArrowFunction(ast, context) {
5178
+ this.visit(ast.body, context);
5179
+ }
5135
5180
  visitRegularExpressionLiteral(ast, context) {
5136
5181
  }
5137
5182
  visitSpreadElement(ast, context) {
5138
5183
  this.visit(ast.expression, context);
5139
5184
  }
5185
+ visitEmptyExpr(ast, context) {
5186
+ }
5140
5187
  visitAll(asts, context) {
5141
5188
  for (const ast of asts) {
5142
5189
  this.visit(ast, context);
@@ -5671,11 +5718,13 @@ var SwitchBlock = class extends BlockNode {
5671
5718
  expression;
5672
5719
  groups;
5673
5720
  unknownBlocks;
5674
- constructor(expression, groups, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
5721
+ exhaustiveCheck;
5722
+ constructor(expression, groups, unknownBlocks, exhaustiveCheck, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
5675
5723
  super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
5676
5724
  this.expression = expression;
5677
5725
  this.groups = groups;
5678
5726
  this.unknownBlocks = unknownBlocks;
5727
+ this.exhaustiveCheck = exhaustiveCheck;
5679
5728
  }
5680
5729
  visit(visitor) {
5681
5730
  return visitor.visitSwitchBlock(this);
@@ -5711,6 +5760,17 @@ var SwitchBlockCaseGroup = class extends BlockNode {
5711
5760
  return visitor.visitSwitchBlockCaseGroup(this);
5712
5761
  }
5713
5762
  };
5763
+ var SwitchExhaustiveCheck = class extends BlockNode {
5764
+ static {
5765
+ __name(this, "SwitchExhaustiveCheck");
5766
+ }
5767
+ constructor(sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
5768
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
5769
+ }
5770
+ visit(visitor) {
5771
+ return visitor.visitSwitchExhaustiveCheck(this);
5772
+ }
5773
+ };
5714
5774
  var ForLoopBlock = class extends BlockNode {
5715
5775
  static {
5716
5776
  __name(this, "ForLoopBlock");
@@ -6075,6 +6135,8 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
6075
6135
  visitAll$1(this, block.cases);
6076
6136
  visitAll$1(this, block.children);
6077
6137
  }
6138
+ visitSwitchExhaustiveCheck(block) {
6139
+ }
6078
6140
  visitForLoopBlock(block) {
6079
6141
  const blockItems = [block.item, ...block.contextVariables, ...block.children];
6080
6142
  block.empty && blockItems.push(block.empty);
@@ -8429,6 +8491,7 @@ var ExpressionKind;
8429
8491
  ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
8430
8492
  ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
8431
8493
  ExpressionKind2[ExpressionKind2["TwoWayBindingSet"] = 25] = "TwoWayBindingSet";
8494
+ ExpressionKind2[ExpressionKind2["ArrowFunction"] = 26] = "ArrowFunction";
8432
8495
  })(ExpressionKind || (ExpressionKind = {}));
8433
8496
  var VariableFlags;
8434
8497
  (function(VariableFlags2) {
@@ -8442,11 +8505,6 @@ var SemanticVariableKind;
8442
8505
  SemanticVariableKind2[SemanticVariableKind2["SavedView"] = 2] = "SavedView";
8443
8506
  SemanticVariableKind2[SemanticVariableKind2["Alias"] = 3] = "Alias";
8444
8507
  })(SemanticVariableKind || (SemanticVariableKind = {}));
8445
- var CompatibilityMode;
8446
- (function(CompatibilityMode2) {
8447
- CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
8448
- CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
8449
- })(CompatibilityMode || (CompatibilityMode = {}));
8450
8508
  var BindingKind;
8451
8509
  (function(BindingKind2) {
8452
8510
  BindingKind2[BindingKind2["Attribute"] = 0] = "Attribute";
@@ -8506,6 +8564,222 @@ var TemplateKind;
8506
8564
  TemplateKind2[TemplateKind2["Structural"] = 1] = "Structural";
8507
8565
  TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
8508
8566
  })(TemplateKind || (TemplateKind = {}));
8567
+ var OpList = class _OpList {
8568
+ static {
8569
+ __name(this, "OpList");
8570
+ }
8571
+ static nextListId = 0;
8572
+ debugListId = _OpList.nextListId++;
8573
+ head = {
8574
+ kind: OpKind.ListEnd,
8575
+ next: null,
8576
+ prev: null,
8577
+ debugListId: this.debugListId
8578
+ };
8579
+ tail = {
8580
+ kind: OpKind.ListEnd,
8581
+ next: null,
8582
+ prev: null,
8583
+ debugListId: this.debugListId
8584
+ };
8585
+ constructor() {
8586
+ this.head.next = this.tail;
8587
+ this.tail.prev = this.head;
8588
+ }
8589
+ push(op) {
8590
+ if (Array.isArray(op)) {
8591
+ for (const o of op) {
8592
+ this.push(o);
8593
+ }
8594
+ return;
8595
+ }
8596
+ _OpList.assertIsNotEnd(op);
8597
+ _OpList.assertIsUnowned(op);
8598
+ op.debugListId = this.debugListId;
8599
+ const oldLast = this.tail.prev;
8600
+ op.prev = oldLast;
8601
+ oldLast.next = op;
8602
+ op.next = this.tail;
8603
+ this.tail.prev = op;
8604
+ }
8605
+ prepend(ops) {
8606
+ if (ops.length === 0) {
8607
+ return;
8608
+ }
8609
+ for (const op of ops) {
8610
+ _OpList.assertIsNotEnd(op);
8611
+ _OpList.assertIsUnowned(op);
8612
+ op.debugListId = this.debugListId;
8613
+ }
8614
+ const first = this.head.next;
8615
+ let prev = this.head;
8616
+ for (const op of ops) {
8617
+ prev.next = op;
8618
+ op.prev = prev;
8619
+ prev = op;
8620
+ }
8621
+ prev.next = first;
8622
+ first.prev = prev;
8623
+ }
8624
+ *[Symbol.iterator]() {
8625
+ let current = this.head.next;
8626
+ while (current !== this.tail) {
8627
+ _OpList.assertIsOwned(current, this.debugListId);
8628
+ const next = current.next;
8629
+ yield current;
8630
+ current = next;
8631
+ }
8632
+ }
8633
+ *reversed() {
8634
+ let current = this.tail.prev;
8635
+ while (current !== this.head) {
8636
+ _OpList.assertIsOwned(current, this.debugListId);
8637
+ const prev = current.prev;
8638
+ yield current;
8639
+ current = prev;
8640
+ }
8641
+ }
8642
+ static replace(oldOp, newOp) {
8643
+ _OpList.assertIsNotEnd(oldOp);
8644
+ _OpList.assertIsNotEnd(newOp);
8645
+ _OpList.assertIsOwned(oldOp);
8646
+ _OpList.assertIsUnowned(newOp);
8647
+ newOp.debugListId = oldOp.debugListId;
8648
+ if (oldOp.prev !== null) {
8649
+ oldOp.prev.next = newOp;
8650
+ newOp.prev = oldOp.prev;
8651
+ }
8652
+ if (oldOp.next !== null) {
8653
+ oldOp.next.prev = newOp;
8654
+ newOp.next = oldOp.next;
8655
+ }
8656
+ oldOp.debugListId = null;
8657
+ oldOp.prev = null;
8658
+ oldOp.next = null;
8659
+ }
8660
+ static replaceWithMany(oldOp, newOps) {
8661
+ if (newOps.length === 0) {
8662
+ _OpList.remove(oldOp);
8663
+ return;
8664
+ }
8665
+ _OpList.assertIsNotEnd(oldOp);
8666
+ _OpList.assertIsOwned(oldOp);
8667
+ const listId = oldOp.debugListId;
8668
+ oldOp.debugListId = null;
8669
+ for (const newOp of newOps) {
8670
+ _OpList.assertIsNotEnd(newOp);
8671
+ _OpList.assertIsUnowned(newOp);
8672
+ }
8673
+ const {
8674
+ prev: oldPrev,
8675
+ next: oldNext
8676
+ } = oldOp;
8677
+ oldOp.prev = null;
8678
+ oldOp.next = null;
8679
+ let prev = oldPrev;
8680
+ for (const newOp of newOps) {
8681
+ _OpList.assertIsUnowned(newOp);
8682
+ newOp.debugListId = listId;
8683
+ prev.next = newOp;
8684
+ newOp.prev = prev;
8685
+ newOp.next = null;
8686
+ prev = newOp;
8687
+ }
8688
+ const first = newOps[0];
8689
+ const last = prev;
8690
+ if (oldPrev !== null) {
8691
+ oldPrev.next = first;
8692
+ first.prev = oldPrev;
8693
+ }
8694
+ if (oldNext !== null) {
8695
+ oldNext.prev = last;
8696
+ last.next = oldNext;
8697
+ }
8698
+ }
8699
+ static remove(op) {
8700
+ _OpList.assertIsNotEnd(op);
8701
+ _OpList.assertIsOwned(op);
8702
+ op.prev.next = op.next;
8703
+ op.next.prev = op.prev;
8704
+ op.debugListId = null;
8705
+ op.prev = null;
8706
+ op.next = null;
8707
+ }
8708
+ static insertBefore(op, target) {
8709
+ if (Array.isArray(op)) {
8710
+ for (const o of op) {
8711
+ _OpList.insertBefore(o, target);
8712
+ }
8713
+ return;
8714
+ }
8715
+ _OpList.assertIsOwned(target);
8716
+ if (target.prev === null) {
8717
+ throw new Error(`AssertionError: illegal operation on list start`);
8718
+ }
8719
+ _OpList.assertIsNotEnd(op);
8720
+ _OpList.assertIsUnowned(op);
8721
+ op.debugListId = target.debugListId;
8722
+ op.prev = null;
8723
+ target.prev.next = op;
8724
+ op.prev = target.prev;
8725
+ op.next = target;
8726
+ target.prev = op;
8727
+ }
8728
+ static insertAfter(op, target) {
8729
+ _OpList.assertIsOwned(target);
8730
+ if (target.next === null) {
8731
+ throw new Error(`AssertionError: illegal operation on list end`);
8732
+ }
8733
+ _OpList.assertIsNotEnd(op);
8734
+ _OpList.assertIsUnowned(op);
8735
+ op.debugListId = target.debugListId;
8736
+ target.next.prev = op;
8737
+ op.next = target.next;
8738
+ op.prev = target;
8739
+ target.next = op;
8740
+ }
8741
+ static assertIsUnowned(op) {
8742
+ if (op.debugListId !== null) {
8743
+ throw new Error(`AssertionError: illegal operation on owned node: ${OpKind[op.kind]}`);
8744
+ }
8745
+ }
8746
+ static assertIsOwned(op, byList) {
8747
+ if (op.debugListId === null) {
8748
+ throw new Error(`AssertionError: illegal operation on unowned node: ${OpKind[op.kind]}`);
8749
+ } else if (byList !== void 0 && op.debugListId !== byList) {
8750
+ throw new Error(`AssertionError: node belongs to the wrong list (expected ${byList}, actual ${op.debugListId})`);
8751
+ }
8752
+ }
8753
+ static assertIsNotEnd(op) {
8754
+ if (op.kind === OpKind.ListEnd) {
8755
+ throw new Error(`AssertionError: illegal operation on list head or tail`);
8756
+ }
8757
+ }
8758
+ };
8759
+ function createStatementOp(statement) {
8760
+ return {
8761
+ kind: OpKind.Statement,
8762
+ statement,
8763
+ ...NEW_OP
8764
+ };
8765
+ }
8766
+ __name(createStatementOp, "createStatementOp");
8767
+ function createVariableOp(xref, variable2, initializer, flags) {
8768
+ return {
8769
+ kind: OpKind.Variable,
8770
+ xref,
8771
+ variable: variable2,
8772
+ initializer,
8773
+ flags,
8774
+ ...NEW_OP
8775
+ };
8776
+ }
8777
+ __name(createVariableOp, "createVariableOp");
8778
+ var NEW_OP = {
8779
+ debugListId: null,
8780
+ prev: null,
8781
+ next: null
8782
+ };
8509
8783
  var ConsumesSlot = Symbol("ConsumesSlot");
8510
8784
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
8511
8785
  var ConsumesVarsTrait = Symbol("ConsumesVars");
@@ -8536,31 +8810,7 @@ function hasUsesVarOffsetTrait(expr) {
8536
8810
  return expr[UsesVarOffset] === true;
8537
8811
  }
8538
8812
  __name(hasUsesVarOffsetTrait, "hasUsesVarOffsetTrait");
8539
- function createStatementOp(statement) {
8540
- return {
8541
- kind: OpKind.Statement,
8542
- statement,
8543
- ...NEW_OP
8544
- };
8545
- }
8546
- __name(createStatementOp, "createStatementOp");
8547
- function createVariableOp(xref, variable2, initializer, flags) {
8548
- return {
8549
- kind: OpKind.Variable,
8550
- xref,
8551
- variable: variable2,
8552
- initializer,
8553
- flags,
8554
- ...NEW_OP
8555
- };
8556
- }
8557
- __name(createVariableOp, "createVariableOp");
8558
- var NEW_OP = {
8559
- debugListId: null,
8560
- prev: null,
8561
- next: null
8562
- };
8563
- function createInterpolateTextOp(xref, interpolation, sourceSpan) {
8813
+ function createInterpolateTextOp(xref, interpolation, sourceSpan) {
8564
8814
  return {
8565
8815
  kind: OpKind.InterpolateText,
8566
8816
  target: xref,
@@ -8826,22 +9076,12 @@ function createStoreLetOp(target, declaredName, value, sourceSpan) {
8826
9076
  };
8827
9077
  }
8828
9078
  __name(createStoreLetOp, "createStoreLetOp");
8829
- function createControlOp(op) {
9079
+ function createControlOp(target, sourceSpan) {
8830
9080
  return {
8831
9081
  kind: OpKind.Control,
8832
- target: op.target,
8833
- name: op.name,
8834
- expression: op.expression,
8835
- bindingKind: op.bindingKind,
8836
- securityContext: op.securityContext,
8837
- sanitizer: null,
8838
- isStructuralTemplateAttribute: op.isStructuralTemplateAttribute,
8839
- templateKind: op.templateKind,
8840
- i18nContext: op.i18nContext,
8841
- i18nMessage: op.i18nMessage,
8842
- sourceSpan: op.sourceSpan,
9082
+ sourceSpan,
9083
+ target,
8843
9084
  ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
8844
- ...TRAIT_CONSUMES_VARS,
8845
9085
  ...NEW_OP
8846
9086
  };
8847
9087
  }
@@ -9021,9 +9261,6 @@ var NextContextExpr = class _NextContextExpr extends ExpressionBase {
9021
9261
  }
9022
9262
  kind = ExpressionKind.NextContext;
9023
9263
  steps = 1;
9024
- constructor() {
9025
- super();
9026
- }
9027
9264
  visitExpression() {
9028
9265
  }
9029
9266
  isEquivalent(e) {
@@ -9625,6 +9862,51 @@ var ConstCollectedExpr = class _ConstCollectedExpr extends ExpressionBase {
9625
9862
  return new _ConstCollectedExpr(this.expr);
9626
9863
  }
9627
9864
  };
9865
+ var ArrowFunctionExpr2 = class _ArrowFunctionExpr extends ExpressionBase {
9866
+ static {
9867
+ __name(this, "ArrowFunctionExpr");
9868
+ }
9869
+ parameters;
9870
+ body;
9871
+ kind = ExpressionKind.ArrowFunction;
9872
+ [ConsumesVarsTrait] = true;
9873
+ [UsesVarOffset] = true;
9874
+ contextName = CONTEXT_NAME;
9875
+ currentViewName = "view";
9876
+ varOffset = null;
9877
+ ops;
9878
+ constructor(parameters, body) {
9879
+ super();
9880
+ this.parameters = parameters;
9881
+ this.body = body;
9882
+ this.ops = new OpList();
9883
+ this.ops.push([createStatementOp(new ReturnStatement(body, body.sourceSpan))]);
9884
+ }
9885
+ visitExpression(visitor, context) {
9886
+ for (const op of this.ops) {
9887
+ visitExpressionsInOp(op, (expr) => {
9888
+ expr.visitExpression(visitor, context);
9889
+ });
9890
+ }
9891
+ }
9892
+ isEquivalent(e) {
9893
+ return e instanceof _ArrowFunctionExpr && e.parameters.length === this.parameters.length && e.parameters.every((param, index) => param.isEquivalent(this.parameters[index])) && e.body.isEquivalent(this.body);
9894
+ }
9895
+ isConstant() {
9896
+ return false;
9897
+ }
9898
+ transformInternalExpressions(transform2, flags) {
9899
+ for (const op of this.ops) {
9900
+ transformExpressionsInOp(op, transform2, flags | (VisitorContextFlag.InChildOperation | VisitorContextFlag.InArrowFunctionOperation));
9901
+ }
9902
+ }
9903
+ clone() {
9904
+ const expr = new _ArrowFunctionExpr(this.parameters, this.body);
9905
+ expr.varOffset = this.varOffset;
9906
+ expr.ops = this.ops;
9907
+ return expr;
9908
+ }
9909
+ };
9628
9910
  function visitExpressionsInOp(op, visitor) {
9629
9911
  transformExpressionsInOp(op, (expr, flags) => {
9630
9912
  visitor(expr, flags);
@@ -9636,6 +9918,7 @@ var VisitorContextFlag;
9636
9918
  (function(VisitorContextFlag2) {
9637
9919
  VisitorContextFlag2[VisitorContextFlag2["None"] = 0] = "None";
9638
9920
  VisitorContextFlag2[VisitorContextFlag2["InChildOperation"] = 1] = "InChildOperation";
9921
+ VisitorContextFlag2[VisitorContextFlag2["InArrowFunctionOperation"] = 2] = "InArrowFunctionOperation";
9639
9922
  })(VisitorContextFlag || (VisitorContextFlag = {}));
9640
9923
  function transformExpressionsInInterpolation(interpolation, transform2, flags) {
9641
9924
  for (let i = 0; i < interpolation.expressions.length; i++) {
@@ -9661,7 +9944,6 @@ function transformExpressionsInOp(op, transform2, flags) {
9661
9944
  case OpKind.Property:
9662
9945
  case OpKind.DomProperty:
9663
9946
  case OpKind.Attribute:
9664
- case OpKind.Control:
9665
9947
  if (op.expression instanceof Interpolation2) {
9666
9948
  transformExpressionsInInterpolation(op.expression, transform2, flags);
9667
9949
  } else {
@@ -9780,6 +10062,7 @@ function transformExpressionsInOp(op, transform2, flags) {
9780
10062
  case OpKind.SourceLocation:
9781
10063
  case OpKind.ConditionalCreate:
9782
10064
  case OpKind.ConditionalBranchCreate:
10065
+ case OpKind.Control:
9783
10066
  case OpKind.ControlCreate:
9784
10067
  break;
9785
10068
  default:
@@ -9836,248 +10119,56 @@ function transformExpressionsInExpression(expr, transform2, flags) {
9836
10119
  } else if (expr instanceof TaggedTemplateLiteralExpr) {
9837
10120
  expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
9838
10121
  expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
9839
- } else if (expr instanceof ArrowFunctionExpr) {
10122
+ } else if (expr instanceof ArrowFunctionExpr$1) {
9840
10123
  if (Array.isArray(expr.body)) {
9841
10124
  for (let i = 0; i < expr.body.length; i++) {
9842
- transformExpressionsInStatement(expr.body[i], transform2, flags);
9843
- }
9844
- } else {
9845
- expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
9846
- }
9847
- } else if (expr instanceof WrappedNodeExpr) ;
9848
- else if (expr instanceof TemplateLiteralExpr) {
9849
- for (let i = 0; i < expr.expressions.length; i++) {
9850
- expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
9851
- }
9852
- } else if (expr instanceof ParenthesizedExpr) {
9853
- expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
9854
- } else if (expr instanceof SpreadElementExpr) {
9855
- expr.expression = transformExpressionsInExpression(expr.expression, transform2, flags);
9856
- } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr || expr instanceof RegularExpressionLiteralExpr) ;
9857
- else {
9858
- throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
9859
- }
9860
- return transform2(expr, flags);
9861
- }
9862
- __name(transformExpressionsInExpression, "transformExpressionsInExpression");
9863
- function transformExpressionsInStatement(stmt, transform2, flags) {
9864
- if (stmt instanceof ExpressionStatement) {
9865
- stmt.expr = transformExpressionsInExpression(stmt.expr, transform2, flags);
9866
- } else if (stmt instanceof ReturnStatement) {
9867
- stmt.value = transformExpressionsInExpression(stmt.value, transform2, flags);
9868
- } else if (stmt instanceof DeclareVarStmt) {
9869
- if (stmt.value !== void 0) {
9870
- stmt.value = transformExpressionsInExpression(stmt.value, transform2, flags);
9871
- }
9872
- } else if (stmt instanceof IfStmt) {
9873
- stmt.condition = transformExpressionsInExpression(stmt.condition, transform2, flags);
9874
- for (const caseStatement of stmt.trueCase) {
9875
- transformExpressionsInStatement(caseStatement, transform2, flags);
9876
- }
9877
- for (const caseStatement of stmt.falseCase) {
9878
- transformExpressionsInStatement(caseStatement, transform2, flags);
9879
- }
9880
- } else {
9881
- throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);
9882
- }
9883
- }
9884
- __name(transformExpressionsInStatement, "transformExpressionsInStatement");
9885
- function isStringLiteral(expr) {
9886
- return expr instanceof LiteralExpr && typeof expr.value === "string";
9887
- }
9888
- __name(isStringLiteral, "isStringLiteral");
9889
- var OpList = class _OpList {
9890
- static {
9891
- __name(this, "OpList");
9892
- }
9893
- static nextListId = 0;
9894
- debugListId = _OpList.nextListId++;
9895
- head = {
9896
- kind: OpKind.ListEnd,
9897
- next: null,
9898
- prev: null,
9899
- debugListId: this.debugListId
9900
- };
9901
- tail = {
9902
- kind: OpKind.ListEnd,
9903
- next: null,
9904
- prev: null,
9905
- debugListId: this.debugListId
9906
- };
9907
- constructor() {
9908
- this.head.next = this.tail;
9909
- this.tail.prev = this.head;
9910
- }
9911
- push(op) {
9912
- if (Array.isArray(op)) {
9913
- for (const o of op) {
9914
- this.push(o);
9915
- }
9916
- return;
9917
- }
9918
- _OpList.assertIsNotEnd(op);
9919
- _OpList.assertIsUnowned(op);
9920
- op.debugListId = this.debugListId;
9921
- const oldLast = this.tail.prev;
9922
- op.prev = oldLast;
9923
- oldLast.next = op;
9924
- op.next = this.tail;
9925
- this.tail.prev = op;
9926
- }
9927
- prepend(ops) {
9928
- if (ops.length === 0) {
9929
- return;
9930
- }
9931
- for (const op of ops) {
9932
- _OpList.assertIsNotEnd(op);
9933
- _OpList.assertIsUnowned(op);
9934
- op.debugListId = this.debugListId;
9935
- }
9936
- const first = this.head.next;
9937
- let prev = this.head;
9938
- for (const op of ops) {
9939
- prev.next = op;
9940
- op.prev = prev;
9941
- prev = op;
9942
- }
9943
- prev.next = first;
9944
- first.prev = prev;
9945
- }
9946
- *[Symbol.iterator]() {
9947
- let current = this.head.next;
9948
- while (current !== this.tail) {
9949
- _OpList.assertIsOwned(current, this.debugListId);
9950
- const next = current.next;
9951
- yield current;
9952
- current = next;
9953
- }
9954
- }
9955
- *reversed() {
9956
- let current = this.tail.prev;
9957
- while (current !== this.head) {
9958
- _OpList.assertIsOwned(current, this.debugListId);
9959
- const prev = current.prev;
9960
- yield current;
9961
- current = prev;
9962
- }
9963
- }
9964
- static replace(oldOp, newOp) {
9965
- _OpList.assertIsNotEnd(oldOp);
9966
- _OpList.assertIsNotEnd(newOp);
9967
- _OpList.assertIsOwned(oldOp);
9968
- _OpList.assertIsUnowned(newOp);
9969
- newOp.debugListId = oldOp.debugListId;
9970
- if (oldOp.prev !== null) {
9971
- oldOp.prev.next = newOp;
9972
- newOp.prev = oldOp.prev;
9973
- }
9974
- if (oldOp.next !== null) {
9975
- oldOp.next.prev = newOp;
9976
- newOp.next = oldOp.next;
9977
- }
9978
- oldOp.debugListId = null;
9979
- oldOp.prev = null;
9980
- oldOp.next = null;
9981
- }
9982
- static replaceWithMany(oldOp, newOps) {
9983
- if (newOps.length === 0) {
9984
- _OpList.remove(oldOp);
9985
- return;
9986
- }
9987
- _OpList.assertIsNotEnd(oldOp);
9988
- _OpList.assertIsOwned(oldOp);
9989
- const listId = oldOp.debugListId;
9990
- oldOp.debugListId = null;
9991
- for (const newOp of newOps) {
9992
- _OpList.assertIsNotEnd(newOp);
9993
- _OpList.assertIsUnowned(newOp);
9994
- }
9995
- const {
9996
- prev: oldPrev,
9997
- next: oldNext
9998
- } = oldOp;
9999
- oldOp.prev = null;
10000
- oldOp.next = null;
10001
- let prev = oldPrev;
10002
- for (const newOp of newOps) {
10003
- _OpList.assertIsUnowned(newOp);
10004
- newOp.debugListId = listId;
10005
- prev.next = newOp;
10006
- newOp.prev = prev;
10007
- newOp.next = null;
10008
- prev = newOp;
10009
- }
10010
- const first = newOps[0];
10011
- const last = prev;
10012
- if (oldPrev !== null) {
10013
- oldPrev.next = first;
10014
- first.prev = oldPrev;
10015
- }
10016
- if (oldNext !== null) {
10017
- oldNext.prev = last;
10018
- last.next = oldNext;
10019
- }
10020
- }
10021
- static remove(op) {
10022
- _OpList.assertIsNotEnd(op);
10023
- _OpList.assertIsOwned(op);
10024
- op.prev.next = op.next;
10025
- op.next.prev = op.prev;
10026
- op.debugListId = null;
10027
- op.prev = null;
10028
- op.next = null;
10029
- }
10030
- static insertBefore(op, target) {
10031
- if (Array.isArray(op)) {
10032
- for (const o of op) {
10033
- _OpList.insertBefore(o, target);
10125
+ transformExpressionsInStatement(expr.body[i], transform2, flags | VisitorContextFlag.InChildOperation);
10034
10126
  }
10035
- return;
10036
- }
10037
- _OpList.assertIsOwned(target);
10038
- if (target.prev === null) {
10039
- throw new Error(`AssertionError: illegal operation on list start`);
10040
- }
10041
- _OpList.assertIsNotEnd(op);
10042
- _OpList.assertIsUnowned(op);
10043
- op.debugListId = target.debugListId;
10044
- op.prev = null;
10045
- target.prev.next = op;
10046
- op.prev = target.prev;
10047
- op.next = target;
10048
- target.prev = op;
10049
- }
10050
- static insertAfter(op, target) {
10051
- _OpList.assertIsOwned(target);
10052
- if (target.next === null) {
10053
- throw new Error(`AssertionError: illegal operation on list end`);
10054
- }
10055
- _OpList.assertIsNotEnd(op);
10056
- _OpList.assertIsUnowned(op);
10057
- op.debugListId = target.debugListId;
10058
- target.next.prev = op;
10059
- op.next = target.next;
10060
- op.prev = target;
10061
- target.next = op;
10062
- }
10063
- static assertIsUnowned(op) {
10064
- if (op.debugListId !== null) {
10065
- throw new Error(`AssertionError: illegal operation on owned node: ${OpKind[op.kind]}`);
10127
+ } else {
10128
+ expr.body = transformExpressionsInExpression(expr.body, transform2, flags | VisitorContextFlag.InChildOperation);
10066
10129
  }
10067
- }
10068
- static assertIsOwned(op, byList) {
10069
- if (op.debugListId === null) {
10070
- throw new Error(`AssertionError: illegal operation on unowned node: ${OpKind[op.kind]}`);
10071
- } else if (byList !== void 0 && op.debugListId !== byList) {
10072
- throw new Error(`AssertionError: node belongs to the wrong list (expected ${byList}, actual ${op.debugListId})`);
10130
+ } else if (expr instanceof WrappedNodeExpr) ;
10131
+ else if (expr instanceof TemplateLiteralExpr) {
10132
+ for (let i = 0; i < expr.expressions.length; i++) {
10133
+ expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
10073
10134
  }
10135
+ } else if (expr instanceof ParenthesizedExpr) {
10136
+ expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
10137
+ } else if (expr instanceof SpreadElementExpr) {
10138
+ expr.expression = transformExpressionsInExpression(expr.expression, transform2, flags);
10139
+ } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr || expr instanceof RegularExpressionLiteralExpr) ;
10140
+ else {
10141
+ throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
10074
10142
  }
10075
- static assertIsNotEnd(op) {
10076
- if (op.kind === OpKind.ListEnd) {
10077
- throw new Error(`AssertionError: illegal operation on list head or tail`);
10143
+ return transform2(expr, flags);
10144
+ }
10145
+ __name(transformExpressionsInExpression, "transformExpressionsInExpression");
10146
+ function transformExpressionsInStatement(stmt, transform2, flags) {
10147
+ if (stmt instanceof ExpressionStatement) {
10148
+ stmt.expr = transformExpressionsInExpression(stmt.expr, transform2, flags);
10149
+ } else if (stmt instanceof ReturnStatement) {
10150
+ stmt.value = transformExpressionsInExpression(stmt.value, transform2, flags);
10151
+ } else if (stmt instanceof DeclareVarStmt) {
10152
+ if (stmt.value !== void 0) {
10153
+ stmt.value = transformExpressionsInExpression(stmt.value, transform2, flags);
10078
10154
  }
10155
+ } else if (stmt instanceof IfStmt) {
10156
+ stmt.condition = transformExpressionsInExpression(stmt.condition, transform2, flags);
10157
+ for (const caseStatement of stmt.trueCase) {
10158
+ transformExpressionsInStatement(caseStatement, transform2, flags);
10159
+ }
10160
+ for (const caseStatement of stmt.falseCase) {
10161
+ transformExpressionsInStatement(caseStatement, transform2, flags);
10162
+ }
10163
+ } else {
10164
+ throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);
10079
10165
  }
10080
- };
10166
+ }
10167
+ __name(transformExpressionsInStatement, "transformExpressionsInStatement");
10168
+ function isStringLiteral(expr) {
10169
+ return expr instanceof LiteralExpr && typeof expr.value === "string";
10170
+ }
10171
+ __name(isStringLiteral, "isStringLiteral");
10081
10172
  var SlotHandle = class {
10082
10173
  static {
10083
10174
  __name(this, "SlotHandle");
@@ -10596,12 +10687,10 @@ var CompilationJob = class {
10596
10687
  }
10597
10688
  componentName;
10598
10689
  pool;
10599
- compatibility;
10600
10690
  mode;
10601
- constructor(componentName, pool, compatibility, mode) {
10691
+ constructor(componentName, pool, mode) {
10602
10692
  this.componentName = componentName;
10603
10693
  this.pool = pool;
10604
- this.compatibility = compatibility;
10605
10694
  this.mode = mode;
10606
10695
  }
10607
10696
  kind = CompilationJobKind.Both;
@@ -10620,8 +10709,8 @@ var ComponentCompilationJob = class extends CompilationJob {
10620
10709
  allDeferrableDepsFn;
10621
10710
  relativeTemplatePath;
10622
10711
  enableDebugLocations;
10623
- constructor(componentName, pool, compatibility, mode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
10624
- super(componentName, pool, compatibility, mode);
10712
+ constructor(componentName, pool, mode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
10713
+ super(componentName, pool, mode);
10625
10714
  this.relativeContextFilePath = relativeContextFilePath;
10626
10715
  this.i18nUseExternalIds = i18nUseExternalIds;
10627
10716
  this.deferMeta = deferMeta;
@@ -10670,9 +10759,15 @@ var CompilationUnit = class {
10670
10759
  }
10671
10760
  create = new OpList();
10672
10761
  update = new OpList();
10762
+ functions = /* @__PURE__ */ new Set();
10673
10763
  fnName = null;
10674
10764
  vars = null;
10675
10765
  *ops() {
10766
+ for (const expr of this.functions) {
10767
+ for (const op of expr.ops) {
10768
+ yield op;
10769
+ }
10770
+ }
10676
10771
  for (const op of this.create) {
10677
10772
  yield op;
10678
10773
  if (op.kind === OpKind.Listener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener || op.kind === OpKind.TwoWayListener) {
@@ -10709,8 +10804,8 @@ var HostBindingCompilationJob = class extends CompilationJob {
10709
10804
  static {
10710
10805
  __name(this, "HostBindingCompilationJob");
10711
10806
  }
10712
- constructor(componentName, pool, compatibility, mode) {
10713
- super(componentName, pool, compatibility, mode);
10807
+ constructor(componentName, pool, mode) {
10808
+ super(componentName, pool, mode);
10714
10809
  this.root = new HostBindingCompilationUnit(this);
10715
10810
  }
10716
10811
  kind = CompilationJobKind.Host;
@@ -10903,15 +10998,12 @@ function extractAttributes(job) {
10903
10998
  OpList.insertBefore(createExtractedAttributeOp(op.target, bindingKind, null, op.name, null, null, null, op.securityContext), lookupElement$3(elements, op.target));
10904
10999
  }
10905
11000
  break;
10906
- case OpKind.Control:
10907
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, null, null, null, op.securityContext), lookupElement$3(elements, op.target));
10908
- break;
10909
11001
  case OpKind.TwoWayProperty:
10910
11002
  OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name, null, null, null, op.securityContext), lookupElement$3(elements, op.target));
10911
11003
  break;
10912
11004
  case OpKind.StyleProp:
10913
11005
  case OpKind.ClassProp:
10914
- if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr2) {
11006
+ if (op.expression instanceof EmptyExpr2) {
10915
11007
  OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, null, null, null, SecurityContext.STYLE), lookupElement$3(elements, op.target));
10916
11008
  }
10917
11009
  break;
@@ -10919,10 +11011,7 @@ function extractAttributes(job) {
10919
11011
  if (!op.isLegacyAnimationListener) {
10920
11012
  const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, null, null, null, SecurityContext.NONE);
10921
11013
  if (job.kind === CompilationJobKind.Host) {
10922
- if (job.compatibility) {
10923
- break;
10924
- }
10925
- unit.create.push(extractedAttributeOp);
11014
+ break;
10926
11015
  } else {
10927
11016
  OpList.insertBefore(extractedAttributeOp, lookupElement$3(elements, op.target));
10928
11017
  }
@@ -10951,11 +11040,7 @@ function extractAttributeOp(unit, op, elements) {
10951
11040
  if (op.expression instanceof Interpolation2) {
10952
11041
  return;
10953
11042
  }
10954
- let extractable = op.isTextAttribute || op.expression.isConstant();
10955
- if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
10956
- extractable &&= op.isTextAttribute;
10957
- }
10958
- if (extractable) {
11043
+ if (op.isTextAttribute) {
10959
11044
  const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
10960
11045
  if (unit.job.kind === CompilationJobKind.Host) {
10961
11046
  unit.create.push(extractedAttributeOp);
@@ -11017,8 +11102,6 @@ function specializeBindings(job) {
11017
11102
  OpList.replace(op, createAttributeOp(op.target, null, op.name, op.expression, op.securityContext, false, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
11018
11103
  } else if (job.kind === CompilationJobKind.Host) {
11019
11104
  OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
11020
- } else if (op.name === "formField") {
11021
- OpList.replace(op, createControlOp(op));
11022
11105
  } else {
11023
11106
  OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
11024
11107
  }
@@ -11128,7 +11211,7 @@ function generateConditionalExpressions(job) {
11128
11211
  }
11129
11212
  }
11130
11213
  __name(generateConditionalExpressions, "generateConditionalExpressions");
11131
- var BINARY_OPERATORS = /* @__PURE__ */ new Map([["&&", BinaryOperator.And], [">", BinaryOperator.Bigger], [">=", BinaryOperator.BiggerEquals], ["|", BinaryOperator.BitwiseOr], ["&", BinaryOperator.BitwiseAnd], ["/", BinaryOperator.Divide], ["=", BinaryOperator.Assign], ["==", BinaryOperator.Equals], ["===", BinaryOperator.Identical], ["<", BinaryOperator.Lower], ["<=", BinaryOperator.LowerEquals], ["-", BinaryOperator.Minus], ["%", BinaryOperator.Modulo], ["**", BinaryOperator.Exponentiation], ["*", BinaryOperator.Multiply], ["!=", BinaryOperator.NotEquals], ["!==", BinaryOperator.NotIdentical], ["??", BinaryOperator.NullishCoalesce], ["||", BinaryOperator.Or], ["+", BinaryOperator.Plus], ["in", BinaryOperator.In], ["+=", BinaryOperator.AdditionAssignment], ["-=", BinaryOperator.SubtractionAssignment], ["*=", BinaryOperator.MultiplicationAssignment], ["/=", BinaryOperator.DivisionAssignment], ["%=", BinaryOperator.RemainderAssignment], ["**=", BinaryOperator.ExponentiationAssignment], ["&&=", BinaryOperator.AndAssignment], ["||=", BinaryOperator.OrAssignment], ["??=", BinaryOperator.NullishCoalesceAssignment]]);
11214
+ var BINARY_OPERATORS = /* @__PURE__ */ new Map([["&&", BinaryOperator.And], [">", BinaryOperator.Bigger], [">=", BinaryOperator.BiggerEquals], ["|", BinaryOperator.BitwiseOr], ["&", BinaryOperator.BitwiseAnd], ["/", BinaryOperator.Divide], ["=", BinaryOperator.Assign], ["==", BinaryOperator.Equals], ["===", BinaryOperator.Identical], ["<", BinaryOperator.Lower], ["<=", BinaryOperator.LowerEquals], ["-", BinaryOperator.Minus], ["%", BinaryOperator.Modulo], ["**", BinaryOperator.Exponentiation], ["*", BinaryOperator.Multiply], ["!=", BinaryOperator.NotEquals], ["!==", BinaryOperator.NotIdentical], ["??", BinaryOperator.NullishCoalesce], ["||", BinaryOperator.Or], ["+", BinaryOperator.Plus], ["in", BinaryOperator.In], ["instanceof", BinaryOperator.InstanceOf], ["+=", BinaryOperator.AdditionAssignment], ["-=", BinaryOperator.SubtractionAssignment], ["*=", BinaryOperator.MultiplicationAssignment], ["/=", BinaryOperator.DivisionAssignment], ["%=", BinaryOperator.RemainderAssignment], ["**=", BinaryOperator.ExponentiationAssignment], ["&&=", BinaryOperator.AndAssignment], ["||=", BinaryOperator.OrAssignment], ["??=", BinaryOperator.NullishCoalesceAssignment]]);
11132
11215
  function namespaceForKey(namespacePrefixKey) {
11133
11216
  const NAMESPACES = /* @__PURE__ */ new Map([["svg", Namespace.SVG], ["math", Namespace.Math]]);
11134
11217
  if (namespacePrefixKey === null) {
@@ -11166,7 +11249,7 @@ function collectElementConsts(job) {
11166
11249
  for (const unit of job.units) {
11167
11250
  for (const op of unit.create) {
11168
11251
  if (op.kind === OpKind.ExtractedAttribute) {
11169
- const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
11252
+ const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
11170
11253
  allElementAttributes.set(op.target, attributes);
11171
11254
  attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
11172
11255
  OpList.remove(op);
@@ -11221,7 +11304,6 @@ var ElementAttributes = class {
11221
11304
  static {
11222
11305
  __name(this, "ElementAttributes");
11223
11306
  }
11224
- compatibility;
11225
11307
  known = /* @__PURE__ */ new Map();
11226
11308
  byKind = /* @__PURE__ */ new Map();
11227
11309
  propertyBindings = null;
@@ -11244,9 +11326,6 @@ var ElementAttributes = class {
11244
11326
  get i18n() {
11245
11327
  return this.byKind.get(BindingKind.I18n) ?? FLYWEIGHT_ARRAY;
11246
11328
  }
11247
- constructor(compatibility) {
11248
- this.compatibility = compatibility;
11249
- }
11250
11329
  isKnown(kind, name) {
11251
11330
  const nameToValue = this.known.get(kind) ?? /* @__PURE__ */ new Set();
11252
11331
  this.known.set(kind, nameToValue);
@@ -11257,7 +11336,7 @@ var ElementAttributes = class {
11257
11336
  return false;
11258
11337
  }
11259
11338
  add(kind, name, value, namespace, trustedValueFn) {
11260
- const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
11339
+ const allowDuplicates = kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty;
11261
11340
  if (!allowDuplicates && this.isKnown(kind, name)) {
11262
11341
  return;
11263
11342
  }
@@ -11500,12 +11579,8 @@ function deduplicateTextBindings(job) {
11500
11579
  for (const op of unit.update.reversed()) {
11501
11580
  if (op.kind === OpKind.Binding && op.isTextAttribute) {
11502
11581
  const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
11503
- if (seenForElement.has(op.name)) {
11504
- if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
11505
- if (op.name === "style" || op.name === "class") {
11506
- OpList.remove(op);
11507
- }
11508
- }
11582
+ if (seenForElement.has(op.name) && (op.name === "style" || op.name === "class")) {
11583
+ OpList.remove(op);
11509
11584
  }
11510
11585
  seenForElement.add(op.name);
11511
11586
  seen.set(op.target, seenForElement);
@@ -11703,7 +11778,7 @@ function eliminateTemporaryAssignments(e, tmps, ctx) {
11703
11778
  transformExpressionsInExpression(e, (e2) => {
11704
11779
  if (e2 instanceof AssignTemporaryExpr && tmps.has(e2.xref)) {
11705
11780
  const read = new ReadTemporaryExpr(e2.xref);
11706
- return ctx.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder ? new AssignTemporaryExpr(read, read.xref) : read;
11781
+ return new AssignTemporaryExpr(read, read.xref);
11707
11782
  }
11708
11783
  return e2;
11709
11784
  }, VisitorContextFlag.None);
@@ -11717,7 +11792,7 @@ function safeTernaryWithTemporary(guard, body, ctx) {
11717
11792
  result = [new AssignTemporaryExpr(guard, xref), new ReadTemporaryExpr(xref)];
11718
11793
  } else {
11719
11794
  result = [guard, guard.clone()];
11720
- eliminateTemporaryAssignments(result[1], temporariesIn(result[0]), ctx);
11795
+ eliminateTemporaryAssignments(result[1], temporariesIn(result[0]));
11721
11796
  }
11722
11797
  return new SafeTernaryExpr(result[0], body(result[1]));
11723
11798
  }
@@ -12004,7 +12079,7 @@ function generateLocalLetReferences(job) {
12004
12079
  }
12005
12080
  __name(generateLocalLetReferences, "generateLocalLetReferences");
12006
12081
  function generateProjectionDefs(job) {
12007
- const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
12082
+ const share = true;
12008
12083
  const selectors = [];
12009
12084
  let projectionSlotIndex = 0;
12010
12085
  for (const unit of job.units) {
@@ -12062,6 +12137,9 @@ function recursivelyProcessView(view, parentScope) {
12062
12137
  }
12063
12138
  }
12064
12139
  view.update.prepend(generateVariablesInScopeForView(view, scope, false));
12140
+ for (const expr of view.functions) {
12141
+ expr.ops.prepend(generateVariablesInScopeForView(view, getScopeForView(view, parentScope), true));
12142
+ }
12065
12143
  }
12066
12144
  __name(recursivelyProcessView, "recursivelyProcessView");
12067
12145
  function getScopeForView(view, parent) {
@@ -14855,6 +14933,13 @@ var _Tokenizer = class {
14855
14933
  this._requireCharCode($AT);
14856
14934
  this._beginToken(24, start);
14857
14935
  const startToken = this._endToken([this._getBlockName()]);
14936
+ if (startToken.parts[0] === "default never" && this._attemptCharCode($SEMICOLON)) {
14937
+ this._beginToken(25);
14938
+ this._endToken([]);
14939
+ this._beginToken(26);
14940
+ this._endToken([]);
14941
+ return;
14942
+ }
14858
14943
  if (this._cursor.peek() === $LPAREN) {
14859
14944
  this._cursor.advance();
14860
14945
  this._consumeBlockParameters();
@@ -16341,8 +16426,15 @@ var _TreeBuilder = class __TreeBuilder {
16341
16426
  this._pushContainer(block, false);
16342
16427
  }
16343
16428
  _consumeBlockClose(token) {
16429
+ const initialStackLength = this._containerStack.length;
16430
+ const topNode = this._containerStack[initialStackLength - 1];
16344
16431
  if (!this._popContainer(null, Block, token.sourceSpan)) {
16345
- this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.`));
16432
+ if (this._containerStack.length < initialStackLength) {
16433
+ const nodeName = topNode instanceof Component2 ? topNode.fullName : topNode.name;
16434
+ this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. Did you forget to close the <${nodeName}> element? If you meant to write the \`}\` character, you should use the "&#125;" HTML entity instead.`));
16435
+ return;
16436
+ }
16437
+ this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. If you meant to write the \`}\` character, you should use the "&#125;" HTML entity instead.`));
16346
16438
  }
16347
16439
  }
16348
16440
  _consumeIncompleteBlock(token) {
@@ -16674,7 +16766,7 @@ var StringTokenKind;
16674
16766
  StringTokenKind2[StringTokenKind2["TemplateLiteralPart"] = 1] = "TemplateLiteralPart";
16675
16767
  StringTokenKind2[StringTokenKind2["TemplateLiteralEnd"] = 2] = "TemplateLiteralEnd";
16676
16768
  })(StringTokenKind || (StringTokenKind = {}));
16677
- var KEYWORDS = ["var", "let", "as", "null", "undefined", "true", "false", "if", "else", "this", "typeof", "void", "in"];
16769
+ var KEYWORDS = ["var", "let", "as", "null", "undefined", "true", "false", "if", "else", "this", "typeof", "void", "in", "instanceof"];
16678
16770
  var Lexer = class {
16679
16771
  static {
16680
16772
  __name(this, "Lexer");
@@ -16750,6 +16842,9 @@ var Token = class {
16750
16842
  isKeywordIn() {
16751
16843
  return this.type === TokenType.Keyword && this.strValue === "in";
16752
16844
  }
16845
+ isKeywordInstanceOf() {
16846
+ return this.type === TokenType.Keyword && this.strValue === "instanceof";
16847
+ }
16753
16848
  isError() {
16754
16849
  return this.type === TokenType.Error;
16755
16850
  }
@@ -16941,8 +17036,9 @@ var _Scanner = class {
16941
17036
  case $GT:
16942
17037
  return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, "=");
16943
17038
  case $BANG:
17039
+ return this.scanComplexOperator(start, "!", $EQ, "=", $EQ, "=");
16944
17040
  case $EQ:
16945
- return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, "=", $EQ, "=");
17041
+ return this.scanEquals(start);
16946
17042
  case $AMPERSAND:
16947
17043
  return this.scanComplexOperator(start, "&", $AMPERSAND, "&", $EQ, "=");
16948
17044
  case $BAR:
@@ -16989,6 +17085,23 @@ var _Scanner = class {
16989
17085
  }
16990
17086
  return newOperatorToken(start, this.index, str);
16991
17087
  }
17088
+ scanEquals(start) {
17089
+ this.advance();
17090
+ let str = "=";
17091
+ if (this.peek === $EQ) {
17092
+ this.advance();
17093
+ str += "=";
17094
+ } else if (this.peek === $GT) {
17095
+ this.advance();
17096
+ str += ">";
17097
+ return newOperatorToken(start, this.index, str);
17098
+ }
17099
+ if (this.peek === $EQ) {
17100
+ this.advance();
17101
+ str += "=";
17102
+ }
17103
+ return newOperatorToken(start, this.index, str);
17104
+ }
16992
17105
  scanIdentifier() {
16993
17106
  const start = this.index;
16994
17107
  this.advance();
@@ -17792,7 +17905,7 @@ var _ParseAST = class {
17792
17905
  parseRelational() {
17793
17906
  const start = this.inputIndex;
17794
17907
  let result = this.parseAdditive();
17795
- while (this.next.type == TokenType.Operator || this.next.isKeywordIn) {
17908
+ while (this.next.type == TokenType.Operator || this.next.isKeywordIn() || this.next.isKeywordInstanceOf()) {
17796
17909
  const operator = this.next.strValue;
17797
17910
  switch (operator) {
17798
17911
  case "<":
@@ -17800,6 +17913,7 @@ var _ParseAST = class {
17800
17913
  case "<=":
17801
17914
  case ">=":
17802
17915
  case "in":
17916
+ case "instanceof":
17803
17917
  this.advance();
17804
17918
  const right = this.parseAdditive();
17805
17919
  result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
@@ -17918,7 +18032,9 @@ var _ParseAST = class {
17918
18032
  }
17919
18033
  parsePrimary() {
17920
18034
  const start = this.inputIndex;
17921
- if (this.consumeOptionalCharacter($LPAREN)) {
18035
+ if (this.isArrowFunction()) {
18036
+ return this.parseArrowFunction(start);
18037
+ } else if (this.consumeOptionalCharacter($LPAREN)) {
17922
18038
  this.rparensExpected++;
17923
18039
  const result = this.parsePipe();
17924
18040
  if (!this.consumeOptionalCharacter($RPAREN)) {
@@ -18293,6 +18409,78 @@ var _ParseAST = class {
18293
18409
  const end = flagsToken ? flagsToken.end : bodyToken.end;
18294
18410
  return new RegularExpressionLiteral(this.span(start, end), this.sourceSpan(start, end), bodyToken.strValue, flagsToken ? flagsToken.strValue : null);
18295
18411
  }
18412
+ parseArrowFunction(start) {
18413
+ let params;
18414
+ if (this.next.isIdentifier()) {
18415
+ const token = this.next;
18416
+ this.advance();
18417
+ params = [this.getArrowFunctionIdentifierArg(token)];
18418
+ } else if (this.next.isCharacter($LPAREN)) {
18419
+ this.rparensExpected++;
18420
+ this.advance();
18421
+ params = this.parseArrowFunctionParameters();
18422
+ this.rparensExpected--;
18423
+ } else {
18424
+ params = [];
18425
+ this.error(`Unexpected token ${this.next}`);
18426
+ }
18427
+ this.expectOperator("=>");
18428
+ let body;
18429
+ if (this.next.isCharacter($LBRACE)) {
18430
+ this.error("Multi-line arrow functions are not supported. If you meant to return an object literal, wrap it with parentheses.");
18431
+ body = new EmptyExpr$1(this.span(start), this.sourceSpan(start));
18432
+ } else {
18433
+ const prevFlags = this.parseFlags;
18434
+ this.parseFlags = 1;
18435
+ body = this.parseExpression();
18436
+ this.parseFlags = prevFlags;
18437
+ }
18438
+ return new ArrowFunction(this.span(start), this.sourceSpan(start), params, body);
18439
+ }
18440
+ parseArrowFunctionParameters() {
18441
+ const params = [];
18442
+ if (!this.consumeOptionalCharacter($RPAREN)) {
18443
+ while (this.next !== EOF) {
18444
+ if (this.next.isIdentifier()) {
18445
+ const token = this.next;
18446
+ this.advance();
18447
+ params.push(this.getArrowFunctionIdentifierArg(token));
18448
+ if (this.consumeOptionalCharacter($RPAREN)) {
18449
+ break;
18450
+ } else {
18451
+ this.expectCharacter($COMMA);
18452
+ }
18453
+ } else {
18454
+ this.error(`Unexpected token ${this.next}`);
18455
+ break;
18456
+ }
18457
+ }
18458
+ }
18459
+ return params;
18460
+ }
18461
+ getArrowFunctionIdentifierArg(token) {
18462
+ return new ArrowFunctionIdentifierParameter(token.strValue, this.span(token.index), this.sourceSpan(token.index));
18463
+ }
18464
+ isArrowFunction() {
18465
+ const start = this.index;
18466
+ const tokens = this.tokens;
18467
+ if (start > tokens.length - 2) {
18468
+ return false;
18469
+ }
18470
+ if (tokens[start].isIdentifier() && tokens[start + 1].isOperator("=>")) {
18471
+ return true;
18472
+ }
18473
+ if (tokens[start].isCharacter($LPAREN)) {
18474
+ let i = start + 1;
18475
+ for (i; i < tokens.length; i++) {
18476
+ if (!tokens[i].isIdentifier() && !tokens[i].isCharacter($COMMA)) {
18477
+ break;
18478
+ }
18479
+ }
18480
+ return i < tokens.length - 1 && tokens[i].isCharacter($RPAREN) && tokens[i + 1].isOperator("=>");
18481
+ }
18482
+ return false;
18483
+ }
18296
18484
  consumeStatementTerminator() {
18297
18485
  this.consumeOptionalCharacter($SEMICOLON) || this.consumeOptionalCharacter($COMMA);
18298
18486
  }
@@ -18455,6 +18643,15 @@ var SerializeExpressionVisitor = class {
18455
18643
  visitRegularExpressionLiteral(ast, context) {
18456
18644
  return `/${ast.body}/${ast.flags || ""}`;
18457
18645
  }
18646
+ visitArrowFunction(ast, context) {
18647
+ let params;
18648
+ if (ast.parameters.length === 1) {
18649
+ params = ast.parameters[0].name;
18650
+ } else {
18651
+ params = `(${ast.parameters.map((e) => e.name).join(", ")})`;
18652
+ }
18653
+ return `${params} => ${ast.body.visit(this, context)}`;
18654
+ }
18458
18655
  visitASTWithSource(ast, context) {
18459
18656
  return ast.ast.visit(this, context);
18460
18657
  }
@@ -20090,10 +20287,10 @@ __name(parseExtractedStyles, "parseExtractedStyles");
20090
20287
  function nameFunctionsAndVariables(job) {
20091
20288
  addNamesToView(job.root, job.componentName, {
20092
20289
  index: 0
20093
- }, job.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
20290
+ });
20094
20291
  }
20095
20292
  __name(nameFunctionsAndVariables, "nameFunctionsAndVariables");
20096
- function addNamesToView(unit, baseName, state, compatibility) {
20293
+ function addNamesToView(unit, baseName, state) {
20097
20294
  if (unit.fnName === null) {
20098
20295
  unit.fnName = unit.job.pool.uniqueName(sanitizeIdentifier(`${baseName}_${unit.job.fnSuffix}`), false);
20099
20296
  }
@@ -20157,7 +20354,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
20157
20354
  op.handlerFnName = sanitizeIdentifier(`${unit.fnName}_${op.tag.replace("-", "_")}_${op.name}_${op.targetSlot.slot}_listener`);
20158
20355
  break;
20159
20356
  case OpKind.Variable:
20160
- varNames.set(op.xref, getVariableName(unit, op.variable, state));
20357
+ varNames.set(op.xref, getVariableName(op.variable, state));
20161
20358
  break;
20162
20359
  case OpKind.RepeaterCreate:
20163
20360
  if (!(unit instanceof ViewCompilationUnit)) {
@@ -20168,9 +20365,9 @@ function addNamesToView(unit, baseName, state, compatibility) {
20168
20365
  }
20169
20366
  if (op.emptyView !== null) {
20170
20367
  const emptyView = unit.job.views.get(op.emptyView);
20171
- addNamesToView(emptyView, `${baseName}_${op.functionNameSuffix}Empty_${op.handle.slot + 2}`, state, compatibility);
20368
+ addNamesToView(emptyView, `${baseName}_${op.functionNameSuffix}Empty_${op.handle.slot + 2}`, state);
20172
20369
  }
20173
- addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
20370
+ addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state);
20174
20371
  break;
20175
20372
  case OpKind.Projection:
20176
20373
  if (!(unit instanceof ViewCompilationUnit)) {
@@ -20181,7 +20378,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
20181
20378
  }
20182
20379
  if (op.fallbackView !== null) {
20183
20380
  const fallbackView = unit.job.views.get(op.fallbackView);
20184
- addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
20381
+ addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state);
20185
20382
  }
20186
20383
  break;
20187
20384
  case OpKind.ConditionalCreate:
@@ -20195,18 +20392,13 @@ function addNamesToView(unit, baseName, state, compatibility) {
20195
20392
  throw new Error(`Expected slot to be assigned`);
20196
20393
  }
20197
20394
  const suffix = op.functionNameSuffix.length === 0 ? "" : `_${op.functionNameSuffix}`;
20198
- addNamesToView(childView, `${baseName}${suffix}_${op.handle.slot}`, state, compatibility);
20395
+ addNamesToView(childView, `${baseName}${suffix}_${op.handle.slot}`, state);
20199
20396
  break;
20200
20397
  case OpKind.StyleProp:
20201
- op.name = normalizeStylePropName(op.name);
20202
- if (compatibility) {
20203
- op.name = stripImportant(op.name);
20204
- }
20398
+ op.name = stripImportant(normalizeStylePropName(op.name));
20205
20399
  break;
20206
20400
  case OpKind.ClassProp:
20207
- if (compatibility) {
20208
- op.name = stripImportant(op.name);
20209
- }
20401
+ op.name = stripImportant(op.name);
20210
20402
  break;
20211
20403
  }
20212
20404
  }
@@ -20223,19 +20415,15 @@ function addNamesToView(unit, baseName, state, compatibility) {
20223
20415
  }
20224
20416
  }
20225
20417
  __name(addNamesToView, "addNamesToView");
20226
- function getVariableName(unit, variable2, state) {
20418
+ function getVariableName(variable2, state) {
20227
20419
  if (variable2.name === null) {
20228
20420
  switch (variable2.kind) {
20229
20421
  case SemanticVariableKind.Context:
20230
20422
  variable2.name = `ctx_r${state.index++}`;
20231
20423
  break;
20232
20424
  case SemanticVariableKind.Identifier:
20233
- if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
20234
- const compatPrefix = variable2.identifier === "ctx" ? "i" : "";
20235
- variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
20236
- } else {
20237
- variable2.name = `${variable2.identifier}_i${state.index++}`;
20238
- }
20425
+ const compatPrefix = variable2.identifier === CONTEXT_NAME ? "i" : "";
20426
+ variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
20239
20427
  break;
20240
20428
  default:
20241
20429
  variable2.name = `_r${++state.index}`;
@@ -20259,6 +20447,9 @@ function stripImportant(name) {
20259
20447
  __name(stripImportant, "stripImportant");
20260
20448
  function mergeNextContextExpressions(job) {
20261
20449
  for (const unit of job.units) {
20450
+ for (const expr of unit.functions) {
20451
+ mergeNextContextsInOps(expr.ops);
20452
+ }
20262
20453
  for (const op of unit.create) {
20263
20454
  if (op.kind === OpKind.Listener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener || op.kind === OpKind.TwoWayListener) {
20264
20455
  mergeNextContextsInOps(op.handlerOps);
@@ -20501,15 +20692,11 @@ function processPipeBindingsInView(unit) {
20501
20692
  if (flags & VisitorContextFlag.InChildOperation) {
20502
20693
  throw new Error(`AssertionError: pipe bindings should not appear in child expressions`);
20503
20694
  }
20504
- if (unit.job.compatibility) {
20505
- const slotHandle = updateOp.target;
20506
- if (slotHandle == void 0) {
20507
- throw new Error(`AssertionError: expected slot handle to be assigned for pipe creation`);
20508
- }
20509
- addPipeToCreationBlock(unit, updateOp.target, expr);
20510
- } else {
20511
- unit.create.push(createPipeOp(expr.target, expr.targetSlot, expr.name));
20695
+ const slotHandle = updateOp.target;
20696
+ if (slotHandle == void 0) {
20697
+ throw new Error(`AssertionError: expected slot handle to be assigned for pipe creation`);
20512
20698
  }
20699
+ addPipeToCreationBlock(unit, updateOp.target, expr);
20513
20700
  });
20514
20701
  }
20515
20702
  }
@@ -20649,7 +20836,7 @@ var PureFunctionConstant = class extends GenericKeyFn {
20649
20836
  }
20650
20837
  return variable("a" + expr.index);
20651
20838
  }, VisitorContextFlag.None);
20652
- return new DeclareVarStmt(declName, new ArrowFunctionExpr(fnParams, returnExpr), void 0, StmtModifier.Final);
20839
+ return new DeclareVarStmt(declName, new ArrowFunctionExpr$1(fnParams, returnExpr), void 0, StmtModifier.Final);
20653
20840
  }
20654
20841
  };
20655
20842
  function generatePureLiteralStructures(job) {
@@ -21045,18 +21232,8 @@ function property(name, expression, sanitizer, sourceSpan) {
21045
21232
  return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
21046
21233
  }
21047
21234
  __name(property, "property");
21048
- function control(name, expression, sanitizer, sourceSpan) {
21049
- const args = [];
21050
- if (expression instanceof Interpolation2) {
21051
- args.push(interpolationToExpression(expression, sourceSpan));
21052
- } else {
21053
- args.push(expression);
21054
- }
21055
- args.push(literal(name));
21056
- if (sanitizer !== null) {
21057
- args.push(sanitizer);
21058
- }
21059
- return call(Identifiers.control, args, sourceSpan);
21235
+ function control(sourceSpan) {
21236
+ return call(Identifiers.control, [], sourceSpan);
21060
21237
  }
21061
21238
  __name(control, "control");
21062
21239
  function controlCreate(sourceSpan) {
@@ -21217,6 +21394,10 @@ function attachSourceLocation(templatePath, locations) {
21217
21394
  return call(Identifiers.attachSourceLocations, [literal(templatePath), locations], null);
21218
21395
  }
21219
21396
  __name(attachSourceLocation, "attachSourceLocation");
21397
+ function arrowFunction(slotOffset, factory, contextRef) {
21398
+ return importExpr(Identifiers.arrowFunction).callFn([literal(slotOffset), factory, contextRef]);
21399
+ }
21400
+ __name(arrowFunction, "arrowFunction");
21220
21401
  function collateInterpolationArgs(strings, expressions) {
21221
21402
  if (strings.length < 1 || expressions.length !== strings.length - 1) {
21222
21403
  throw new Error(`AssertionError: expected specific shape of args for strings/expressions in interpolation`);
@@ -21307,7 +21488,7 @@ function reify(job) {
21307
21488
  __name(reify, "reify");
21308
21489
  function reifyCreateOperations(unit, ops) {
21309
21490
  for (const op of ops) {
21310
- transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
21491
+ transformExpressionsInOp(op, (expr) => reifyIrExpression(unit, expr), VisitorContextFlag.None);
21311
21492
  switch (op.kind) {
21312
21493
  case OpKind.Text:
21313
21494
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
@@ -21555,7 +21736,7 @@ function reifyCreateOperations(unit, ops) {
21555
21736
  __name(reifyCreateOperations, "reifyCreateOperations");
21556
21737
  function reifyUpdateOperations(unit, ops) {
21557
21738
  for (const op of ops) {
21558
- transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
21739
+ transformExpressionsInOp(op, (expr) => reifyIrExpression(unit, expr), VisitorContextFlag.None);
21559
21740
  switch (op.kind) {
21560
21741
  case OpKind.Advance:
21561
21742
  OpList.replace(op, advance(op.delta, op.sourceSpan));
@@ -21641,10 +21822,10 @@ function reifyProperty(op) {
21641
21822
  }
21642
21823
  __name(reifyProperty, "reifyProperty");
21643
21824
  function reifyControl(op) {
21644
- return control(op.name, op.expression, op.sanitizer, op.sourceSpan);
21825
+ return control(op.sourceSpan);
21645
21826
  }
21646
21827
  __name(reifyControl, "reifyControl");
21647
- function reifyIrExpression(expr) {
21828
+ function reifyIrExpression(unit, expr) {
21648
21829
  if (!isIrExpression(expr)) {
21649
21830
  return expr;
21650
21831
  }
@@ -21700,6 +21881,11 @@ function reifyIrExpression(expr) {
21700
21881
  return storeLet(expr.value, expr.sourceSpan);
21701
21882
  case ExpressionKind.TrackContext:
21702
21883
  return variable("this");
21884
+ case ExpressionKind.ArrowFunction:
21885
+ if (expr.varOffset === null) {
21886
+ throw new Error(`AssertionError: variable offset was not assigned to arrow function`);
21887
+ }
21888
+ return arrowFunction(expr.varOffset, unit.job.pool.getSharedFunctionReference(getArrowFunctionFactory(unit, expr), "arrowFn"), variable(CONTEXT_NAME));
21703
21889
  default:
21704
21890
  throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
21705
21891
  }
@@ -21744,6 +21930,19 @@ function reifyTrackBy(unit, op) {
21744
21930
  return op.trackByFn;
21745
21931
  }
21746
21932
  __name(reifyTrackBy, "reifyTrackBy");
21933
+ function getArrowFunctionFactory(unit, expr) {
21934
+ reifyUpdateOperations(unit, expr.ops);
21935
+ const statements = [];
21936
+ for (const op of expr.ops) {
21937
+ if (op.kind !== OpKind.Statement) {
21938
+ throw new Error(`AssertionError: expected reified statements, but found op ${OpKind[op.kind]}`);
21939
+ }
21940
+ statements.push(op.statement);
21941
+ }
21942
+ const body = statements.length === 1 && statements[0] instanceof ReturnStatement ? statements[0].value : statements;
21943
+ return arrowFn([new FnParam(expr.contextName), new FnParam(expr.currentViewName)], arrowFn(expr.parameters, body));
21944
+ }
21945
+ __name(getArrowFunctionFactory, "getArrowFunctionFactory");
21747
21946
  function removeEmptyBindings(job) {
21748
21947
  for (const unit of job.units) {
21749
21948
  for (const op of unit.update) {
@@ -21818,6 +22017,9 @@ function removeUnusedI18nAttributesOps(job) {
21818
22017
  __name(removeUnusedI18nAttributesOps, "removeUnusedI18nAttributesOps");
21819
22018
  function resolveContexts(job) {
21820
22019
  for (const unit of job.units) {
22020
+ for (const expr of unit.functions) {
22021
+ processLexicalScope$1(unit, expr.ops);
22022
+ }
21821
22023
  processLexicalScope$1(unit, unit.create);
21822
22024
  processLexicalScope$1(unit, unit.update);
21823
22025
  }
@@ -21825,7 +22027,7 @@ function resolveContexts(job) {
21825
22027
  __name(resolveContexts, "resolveContexts");
21826
22028
  function processLexicalScope$1(view, ops) {
21827
22029
  const scope = /* @__PURE__ */ new Map();
21828
- scope.set(view.xref, variable("ctx"));
22030
+ scope.set(view.xref, variable(CONTEXT_NAME));
21829
22031
  for (const op of ops) {
21830
22032
  switch (op.kind) {
21831
22033
  case OpKind.Variable:
@@ -21849,7 +22051,7 @@ function processLexicalScope$1(view, ops) {
21849
22051
  }
21850
22052
  }
21851
22053
  if (view === view.job.root) {
21852
- scope.set(view.xref, variable("ctx"));
22054
+ scope.set(view.xref, variable(CONTEXT_NAME));
21853
22055
  }
21854
22056
  for (const op of ops) {
21855
22057
  transformExpressionsInOp(op, (expr) => {
@@ -22184,6 +22386,9 @@ function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
22184
22386
  __name(updatePlaceholder, "updatePlaceholder");
22185
22387
  function resolveNames(job) {
22186
22388
  for (const unit of job.units) {
22389
+ for (const expr of unit.functions) {
22390
+ processLexicalScope(unit, expr.ops, null);
22391
+ }
22187
22392
  processLexicalScope(unit, unit.create, null);
22188
22393
  processLexicalScope(unit, unit.update, null);
22189
22394
  }
@@ -22235,7 +22440,7 @@ function processLexicalScope(unit, ops, savedView) {
22235
22440
  }
22236
22441
  }
22237
22442
  for (const op of ops) {
22238
- if (op.kind == OpKind.Listener || op.kind === OpKind.TwoWayListener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener) {
22443
+ if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener) {
22239
22444
  continue;
22240
22445
  }
22241
22446
  transformExpressionsInOp(op, (expr) => {
@@ -22309,45 +22514,53 @@ function getOnlySecurityContext(securityContext) {
22309
22514
  __name(getOnlySecurityContext, "getOnlySecurityContext");
22310
22515
  function saveAndRestoreView(job) {
22311
22516
  for (const unit of job.units) {
22517
+ for (const expr of unit.functions) {
22518
+ if (needsRestoreView(job, unit, expr.ops)) {
22519
+ addSaveRestoreViewOperation(unit, expr.ops, variable(expr.currentViewName));
22520
+ }
22521
+ }
22312
22522
  unit.create.prepend([createVariableOp(unit.job.allocateXrefId(), {
22313
22523
  kind: SemanticVariableKind.SavedView,
22314
22524
  name: null,
22315
22525
  view: unit.xref
22316
22526
  }, new GetCurrentViewExpr(), VariableFlags.None)]);
22317
22527
  for (const op of unit.create) {
22318
- if (op.kind !== OpKind.Listener && op.kind !== OpKind.TwoWayListener && op.kind !== OpKind.Animation && op.kind !== OpKind.AnimationListener) {
22319
- continue;
22320
- }
22321
- let needsRestoreView = unit !== job.root;
22322
- if (!needsRestoreView) {
22323
- for (const handlerOp of op.handlerOps) {
22324
- visitExpressionsInOp(handlerOp, (expr) => {
22325
- if (expr instanceof ReferenceExpr || expr instanceof ContextLetReferenceExpr) {
22326
- needsRestoreView = true;
22327
- }
22328
- });
22528
+ if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener) {
22529
+ if (needsRestoreView(job, unit, op.handlerOps)) {
22530
+ addSaveRestoreViewOperation(unit, op.handlerOps, unit.xref);
22329
22531
  }
22330
22532
  }
22331
- if (needsRestoreView) {
22332
- addSaveRestoreViewOperationToListener(unit, op);
22333
- }
22334
22533
  }
22335
22534
  }
22336
22535
  }
22337
22536
  __name(saveAndRestoreView, "saveAndRestoreView");
22338
- function addSaveRestoreViewOperationToListener(unit, op) {
22339
- op.handlerOps.prepend([createVariableOp(unit.job.allocateXrefId(), {
22537
+ function needsRestoreView(job, unit, opList) {
22538
+ let result = unit !== job.root;
22539
+ if (!result) {
22540
+ for (const innerOp of opList) {
22541
+ visitExpressionsInOp(innerOp, (expr) => {
22542
+ if (expr instanceof ReferenceExpr || expr instanceof ContextLetReferenceExpr) {
22543
+ result = true;
22544
+ }
22545
+ });
22546
+ }
22547
+ }
22548
+ return result;
22549
+ }
22550
+ __name(needsRestoreView, "needsRestoreView");
22551
+ function addSaveRestoreViewOperation(unit, opList, restoreViewTarget) {
22552
+ opList.prepend([createVariableOp(unit.job.allocateXrefId(), {
22340
22553
  kind: SemanticVariableKind.Context,
22341
22554
  name: null,
22342
22555
  view: unit.xref
22343
- }, new RestoreViewExpr(unit.xref), VariableFlags.None)]);
22344
- for (const handlerOp of op.handlerOps) {
22556
+ }, new RestoreViewExpr(restoreViewTarget), VariableFlags.None)]);
22557
+ for (const handlerOp of opList) {
22345
22558
  if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
22346
22559
  handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
22347
22560
  }
22348
22561
  }
22349
22562
  }
22350
- __name(addSaveRestoreViewOperationToListener, "addSaveRestoreViewOperationToListener");
22563
+ __name(addSaveRestoreViewOperation, "addSaveRestoreViewOperation");
22351
22564
  function allocateSlots(job) {
22352
22565
  const slotMap = /* @__PURE__ */ new Map();
22353
22566
  for (const unit of job.units) {
@@ -22504,6 +22717,9 @@ function generateTemporaryVariables(job) {
22504
22717
  for (const unit of job.units) {
22505
22718
  unit.create.prepend(generateTemporaries(unit.create));
22506
22719
  unit.update.prepend(generateTemporaries(unit.update));
22720
+ for (const expr of unit.functions) {
22721
+ expr.ops.prepend(generateTemporaries(expr.ops));
22722
+ }
22507
22723
  }
22508
22724
  }
22509
22725
  __name(generateTemporaryVariables, "generateTemporaryVariables");
@@ -22669,36 +22885,42 @@ function countVariables(job) {
22669
22885
  varCount += varsUsedByOp(op);
22670
22886
  }
22671
22887
  }
22672
- for (const op of unit.ops()) {
22673
- visitExpressionsInOp(op, (expr) => {
22674
- if (!isIrExpression(expr)) {
22675
- return;
22676
- }
22677
- if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && expr instanceof PureFunctionExpr) {
22678
- return;
22679
- }
22680
- if (hasUsesVarOffsetTrait(expr)) {
22681
- expr.varOffset = varCount;
22682
- }
22683
- if (hasConsumesVarsTrait(expr)) {
22684
- varCount += varsUsedByIrExpression(expr);
22685
- }
22686
- });
22687
- }
22688
- if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
22689
- for (const op of unit.ops()) {
22690
- visitExpressionsInOp(op, (expr) => {
22691
- if (!isIrExpression(expr) || !(expr instanceof PureFunctionExpr)) {
22692
- return;
22693
- }
22694
- if (hasUsesVarOffsetTrait(expr)) {
22695
- expr.varOffset = varCount;
22696
- }
22697
- if (hasConsumesVarsTrait(expr)) {
22698
- varCount += varsUsedByIrExpression(expr);
22699
- }
22700
- });
22888
+ const firstPassCountExpressionVars = /* @__PURE__ */ __name((expr) => {
22889
+ if (!isIrExpression(expr)) {
22890
+ return;
22891
+ }
22892
+ if (expr instanceof PureFunctionExpr) {
22893
+ return;
22894
+ }
22895
+ if (hasUsesVarOffsetTrait(expr)) {
22896
+ expr.varOffset = varCount;
22897
+ }
22898
+ if (hasConsumesVarsTrait(expr)) {
22899
+ varCount += varsUsedByIrExpression(expr);
22701
22900
  }
22901
+ }, "firstPassCountExpressionVars");
22902
+ const secondPassCountExpressionVars = /* @__PURE__ */ __name((expr) => {
22903
+ if (!isIrExpression(expr) || !(expr instanceof PureFunctionExpr)) {
22904
+ return;
22905
+ }
22906
+ if (hasUsesVarOffsetTrait(expr)) {
22907
+ expr.varOffset = varCount;
22908
+ }
22909
+ if (hasConsumesVarsTrait(expr)) {
22910
+ varCount += varsUsedByIrExpression(expr);
22911
+ }
22912
+ }, "secondPassCountExpressionVars");
22913
+ for (const createOp of unit.create) {
22914
+ visitExpressionsInOp(createOp, firstPassCountExpressionVars);
22915
+ }
22916
+ for (const updateOp of unit.update) {
22917
+ visitExpressionsInOp(updateOp, firstPassCountExpressionVars);
22918
+ }
22919
+ for (const createOp of unit.create) {
22920
+ visitExpressionsInOp(createOp, secondPassCountExpressionVars);
22921
+ }
22922
+ for (const updateOp of unit.update) {
22923
+ visitExpressionsInOp(updateOp, secondPassCountExpressionVars);
22702
22924
  }
22703
22925
  unit.vars = varCount;
22704
22926
  }
@@ -22767,6 +22989,7 @@ function varsUsedByIrExpression(expr) {
22767
22989
  case ExpressionKind.PipeBindingVariadic:
22768
22990
  return 1 + expr.numArgs;
22769
22991
  case ExpressionKind.StoreLet:
22992
+ case ExpressionKind.ArrowFunction:
22770
22993
  return 1;
22771
22994
  default:
22772
22995
  throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
@@ -22785,6 +23008,9 @@ function isSingletonInterpolation(expr) {
22785
23008
  __name(isSingletonInterpolation, "isSingletonInterpolation");
22786
23009
  function optimizeVariables(job) {
22787
23010
  for (const unit of job.units) {
23011
+ for (const expr of unit.functions) {
23012
+ inlineAlwaysInlineVariables(expr.ops);
23013
+ }
22788
23014
  inlineAlwaysInlineVariables(unit.create);
22789
23015
  inlineAlwaysInlineVariables(unit.update);
22790
23016
  for (const op of unit.create) {
@@ -22794,15 +23020,20 @@ function optimizeVariables(job) {
22794
23020
  inlineAlwaysInlineVariables(op.trackByOps);
22795
23021
  }
22796
23022
  }
22797
- optimizeVariablesInOpList(unit.create, job.compatibility);
22798
- optimizeVariablesInOpList(unit.update, job.compatibility);
23023
+ for (const expr of unit.functions) {
23024
+ optimizeVariablesInOpList(expr.ops, null);
23025
+ optimizeSaveRestoreView(expr.ops);
23026
+ }
22799
23027
  for (const op of unit.create) {
22800
23028
  if (op.kind === OpKind.Listener || op.kind === OpKind.Animation || op.kind === OpKind.AnimationListener || op.kind === OpKind.TwoWayListener) {
22801
- optimizeVariablesInOpList(op.handlerOps, job.compatibility);
23029
+ optimizeVariablesInOpList(op.handlerOps, skipArrowFunctionOps);
23030
+ optimizeSaveRestoreView(op.handlerOps);
22802
23031
  } else if (op.kind === OpKind.RepeaterCreate && op.trackByOps !== null) {
22803
- optimizeVariablesInOpList(op.trackByOps, job.compatibility);
23032
+ optimizeVariablesInOpList(op.trackByOps, skipArrowFunctionOps);
22804
23033
  }
22805
23034
  }
23035
+ optimizeVariablesInOpList(unit.create, skipArrowFunctionOps);
23036
+ optimizeVariablesInOpList(unit.update, skipArrowFunctionOps);
22806
23037
  }
22807
23038
  }
22808
23039
  __name(optimizeVariables, "optimizeVariables");
@@ -22813,6 +23044,10 @@ var Fence;
22813
23044
  Fence2[Fence2["ViewContextWrite"] = 2] = "ViewContextWrite";
22814
23045
  Fence2[Fence2["SideEffectful"] = 4] = "SideEffectful";
22815
23046
  })(Fence || (Fence = {}));
23047
+ function skipArrowFunctionOps(flags) {
23048
+ return !(flags & VisitorContextFlag.InArrowFunctionOperation);
23049
+ }
23050
+ __name(skipArrowFunctionOps, "skipArrowFunctionOps");
22816
23051
  function inlineAlwaysInlineVariables(ops) {
22817
23052
  const vars = /* @__PURE__ */ new Map();
22818
23053
  for (const op of ops) {
@@ -22837,7 +23072,7 @@ function inlineAlwaysInlineVariables(ops) {
22837
23072
  }
22838
23073
  }
22839
23074
  __name(inlineAlwaysInlineVariables, "inlineAlwaysInlineVariables");
22840
- function optimizeVariablesInOpList(ops, compatibility) {
23075
+ function optimizeVariablesInOpList(ops, predicate) {
22841
23076
  const varDecls = /* @__PURE__ */ new Map();
22842
23077
  const varUsages = /* @__PURE__ */ new Map();
22843
23078
  const varRemoteUsages = /* @__PURE__ */ new Set();
@@ -22850,8 +23085,8 @@ function optimizeVariablesInOpList(ops, compatibility) {
22850
23085
  varDecls.set(op.xref, op);
22851
23086
  varUsages.set(op.xref, 0);
22852
23087
  }
22853
- opMap.set(op, collectOpInfo(op));
22854
- countVariableUsages(op, varUsages, varRemoteUsages);
23088
+ opMap.set(op, collectOpInfo(op, predicate));
23089
+ countVariableUsages(op, varUsages, varRemoteUsages, predicate);
22855
23090
  }
22856
23091
  let contextIsUsed = false;
22857
23092
  for (const op of ops.reversed()) {
@@ -22897,7 +23132,7 @@ function optimizeVariablesInOpList(ops, compatibility) {
22897
23132
  for (let targetOp = decl.next; targetOp.kind !== OpKind.ListEnd; targetOp = targetOp.next) {
22898
23133
  const opInfo = opMap.get(targetOp);
22899
23134
  if (opInfo.variablesUsed.has(candidate)) {
22900
- if (compatibility === CompatibilityMode.TemplateDefinitionBuilder && !allowConservativeInlining(decl, targetOp)) {
23135
+ if (!allowConservativeInlining(decl, targetOp)) {
22901
23136
  break;
22902
23137
  }
22903
23138
  if (tryInlineVariableInitializer(candidate, decl.initializer, targetOp, varInfo.fences)) {
@@ -22936,19 +23171,17 @@ function fencesForIrExpression(expr) {
22936
23171
  }
22937
23172
  }
22938
23173
  __name(fencesForIrExpression, "fencesForIrExpression");
22939
- function collectOpInfo(op) {
23174
+ function collectOpInfo(op, predicate) {
22940
23175
  let fences = Fence.None;
22941
23176
  const variablesUsed = /* @__PURE__ */ new Set();
22942
- visitExpressionsInOp(op, (expr) => {
22943
- if (!isIrExpression(expr)) {
23177
+ visitExpressionsInOp(op, (expr, flags) => {
23178
+ if (!isIrExpression(expr) || predicate !== null && !predicate(flags)) {
22944
23179
  return;
22945
23180
  }
22946
- switch (expr.kind) {
22947
- case ExpressionKind.ReadVariable:
22948
- variablesUsed.add(expr.xref);
22949
- break;
22950
- default:
22951
- fences |= fencesForIrExpression(expr);
23181
+ if (expr.kind === ExpressionKind.ReadVariable) {
23182
+ variablesUsed.add(expr.xref);
23183
+ } else {
23184
+ fences |= fencesForIrExpression(expr);
22952
23185
  }
22953
23186
  });
22954
23187
  return {
@@ -22957,9 +23190,9 @@ function collectOpInfo(op) {
22957
23190
  };
22958
23191
  }
22959
23192
  __name(collectOpInfo, "collectOpInfo");
22960
- function countVariableUsages(op, varUsages, varRemoteUsage) {
23193
+ function countVariableUsages(op, varUsages, varRemoteUsage, predicate) {
22961
23194
  visitExpressionsInOp(op, (expr, flags) => {
22962
- if (!isIrExpression(expr)) {
23195
+ if (!isIrExpression(expr) || predicate !== null && !predicate(flags)) {
22963
23196
  return;
22964
23197
  }
22965
23198
  if (expr.kind !== ExpressionKind.ReadVariable) {
@@ -23039,7 +23272,7 @@ __name(tryInlineVariableInitializer, "tryInlineVariableInitializer");
23039
23272
  function allowConservativeInlining(decl, target) {
23040
23273
  switch (decl.variable.kind) {
23041
23274
  case SemanticVariableKind.Identifier:
23042
- if (decl.initializer instanceof ReadVarExpr && decl.initializer.name === "ctx") {
23275
+ if (decl.initializer instanceof ReadVarExpr && decl.initializer.name === CONTEXT_NAME) {
23043
23276
  return true;
23044
23277
  }
23045
23278
  return false;
@@ -23050,6 +23283,15 @@ function allowConservativeInlining(decl, target) {
23050
23283
  }
23051
23284
  }
23052
23285
  __name(allowConservativeInlining, "allowConservativeInlining");
23286
+ function optimizeSaveRestoreView(ops) {
23287
+ const head = ops.head.next;
23288
+ const tail = ops.tail.prev;
23289
+ if (head !== null && tail !== null && head.next === tail && head.kind === OpKind.Statement && head.statement instanceof ExpressionStatement && head.statement.expr instanceof RestoreViewExpr && tail.kind === OpKind.Statement && tail.statement instanceof ReturnStatement && tail.statement.value instanceof ResetViewExpr) {
23290
+ OpList.remove(head);
23291
+ tail.statement.value = tail.statement.value.expr;
23292
+ }
23293
+ }
23294
+ __name(optimizeSaveRestoreView, "optimizeSaveRestoreView");
23053
23295
  function wrapI18nIcus(job) {
23054
23296
  for (const unit of job.units) {
23055
23297
  let currentI18nOp = null;
@@ -23079,6 +23321,77 @@ function wrapI18nIcus(job) {
23079
23321
  }
23080
23322
  }
23081
23323
  __name(wrapI18nIcus, "wrapI18nIcus");
23324
+ function generateArrowFunctions(job) {
23325
+ for (const unit of job.units) {
23326
+ for (const op of unit.create) {
23327
+ if (op.kind !== OpKind.Animation && op.kind !== OpKind.AnimationListener && op.kind !== OpKind.Listener && op.kind !== OpKind.TwoWayListener) {
23328
+ addArrowFunctions(unit, op);
23329
+ }
23330
+ }
23331
+ for (const op of unit.update) {
23332
+ addArrowFunctions(unit, op);
23333
+ }
23334
+ }
23335
+ }
23336
+ __name(generateArrowFunctions, "generateArrowFunctions");
23337
+ function addArrowFunctions(unit, op) {
23338
+ transformExpressionsInOp(op, (expr, flags) => {
23339
+ if (!(expr instanceof ArrowFunctionExpr$1) || flags & VisitorContextFlag.InChildOperation) {
23340
+ return expr;
23341
+ }
23342
+ if (Array.isArray(expr.body)) {
23343
+ throw new Error("AssertionError: unexpected multi-line arrow function");
23344
+ }
23345
+ const arrowFunction2 = new ArrowFunctionExpr2(expr.params, expr.body);
23346
+ unit.functions.add(arrowFunction2);
23347
+ return arrowFunction2;
23348
+ }, VisitorContextFlag.None);
23349
+ }
23350
+ __name(addArrowFunctions, "addArrowFunctions");
23351
+ var ELIGIBLE_CONTROL_PROPERTIES = /* @__PURE__ */ new Set(["formField"]);
23352
+ function specializeControlProperties(job) {
23353
+ for (const unit of job.units) {
23354
+ processView(unit);
23355
+ }
23356
+ }
23357
+ __name(specializeControlProperties, "specializeControlProperties");
23358
+ function processView(view) {
23359
+ for (const op of view.update) {
23360
+ if (op.kind !== OpKind.Property) {
23361
+ continue;
23362
+ }
23363
+ if (ELIGIBLE_CONTROL_PROPERTIES.has(op.name)) {
23364
+ addControlInstruction(view, op);
23365
+ }
23366
+ }
23367
+ }
23368
+ __name(processView, "processView");
23369
+ var CONTROL_OP_CREATE_KINDS = /* @__PURE__ */ new Set([OpKind.Container, OpKind.ContainerStart, OpKind.ContainerEnd, OpKind.Element, OpKind.ElementStart, OpKind.ElementEnd, OpKind.Template]);
23370
+ function isRelevantCreateOp(createOp) {
23371
+ return CONTROL_OP_CREATE_KINDS.has(createOp.kind);
23372
+ }
23373
+ __name(isRelevantCreateOp, "isRelevantCreateOp");
23374
+ function findCreateInstruction(view, target) {
23375
+ let lastFoundOp = null;
23376
+ for (const createOp of view.create) {
23377
+ if (!isRelevantCreateOp(createOp) || createOp.xref !== target) {
23378
+ continue;
23379
+ }
23380
+ lastFoundOp = createOp;
23381
+ }
23382
+ return lastFoundOp;
23383
+ }
23384
+ __name(findCreateInstruction, "findCreateInstruction");
23385
+ function addControlInstruction(view, propertyOp) {
23386
+ const targetCreateOp = findCreateInstruction(view, propertyOp.target);
23387
+ if (targetCreateOp === null) {
23388
+ throw new Error(`No create instruction found for control target ${propertyOp.target}`);
23389
+ }
23390
+ const controlCreateOp = createControlCreateOp(propertyOp.sourceSpan);
23391
+ OpList.insertAfter(controlCreateOp, targetCreateOp);
23392
+ OpList.insertAfter(createControlOp(propertyOp.target, propertyOp.sourceSpan), propertyOp);
23393
+ }
23394
+ __name(addControlInstruction, "addControlInstruction");
23082
23395
  var phases = [{
23083
23396
  kind: CompilationJobKind.Tmpl,
23084
23397
  fn: removeContentSelectors
@@ -23106,6 +23419,9 @@ var phases = [{
23106
23419
  }, {
23107
23420
  kind: CompilationJobKind.Both,
23108
23421
  fn: specializeBindings
23422
+ }, {
23423
+ kind: CompilationJobKind.Tmpl,
23424
+ fn: specializeControlProperties
23109
23425
  }, {
23110
23426
  kind: CompilationJobKind.Both,
23111
23427
  fn: convertAnimations
@@ -23139,6 +23455,9 @@ var phases = [{
23139
23455
  }, {
23140
23456
  kind: CompilationJobKind.Tmpl,
23141
23457
  fn: createVariadicPipes
23458
+ }, {
23459
+ kind: CompilationJobKind.Both,
23460
+ fn: generateArrowFunctions
23142
23461
  }, {
23143
23462
  kind: CompilationJobKind.Both,
23144
23463
  fn: generatePureLiteralStructures
@@ -23323,14 +23642,14 @@ function emitView(view) {
23323
23642
  }
23324
23643
  const createCond = maybeGenerateRfBlock(1, createStatements);
23325
23644
  const updateCond = maybeGenerateRfBlock(2, updateStatements);
23326
- return fn([new FnParam("rf"), new FnParam("ctx")], [...createCond, ...updateCond], void 0, void 0, view.fnName);
23645
+ return fn([new FnParam(RENDER_FLAGS), new FnParam(CONTEXT_NAME)], [...createCond, ...updateCond], void 0, void 0, view.fnName);
23327
23646
  }
23328
23647
  __name(emitView, "emitView");
23329
23648
  function maybeGenerateRfBlock(flag, statements) {
23330
23649
  if (statements.length === 0) {
23331
23650
  return [];
23332
23651
  }
23333
- return [ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable("rf"), literal(flag)), statements)];
23652
+ return [ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable(RENDER_FLAGS), literal(flag)), statements)];
23334
23653
  }
23335
23654
  __name(maybeGenerateRfBlock, "maybeGenerateRfBlock");
23336
23655
  function emitHostBindingFunction(job) {
@@ -23356,10 +23675,9 @@ function emitHostBindingFunction(job) {
23356
23675
  }
23357
23676
  const createCond = maybeGenerateRfBlock(1, createStatements);
23358
23677
  const updateCond = maybeGenerateRfBlock(2, updateStatements);
23359
- return fn([new FnParam("rf"), new FnParam("ctx")], [...createCond, ...updateCond], void 0, void 0, job.root.fnName);
23678
+ return fn([new FnParam(RENDER_FLAGS), new FnParam(CONTEXT_NAME)], [...createCond, ...updateCond], void 0, void 0, job.root.fnName);
23360
23679
  }
23361
23680
  __name(emitHostBindingFunction, "emitHostBindingFunction");
23362
- var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
23363
23681
  var domSchema = new DomElementSchemaRegistry();
23364
23682
  var NG_TEMPLATE_TAG_NAME = "ng-template";
23365
23683
  var ANIMATE_PREFIX$1 = "animate.";
@@ -23372,13 +23690,13 @@ function isSingleI18nIcu(meta) {
23372
23690
  }
23373
23691
  __name(isSingleI18nIcu, "isSingleI18nIcu");
23374
23692
  function ingestComponent(componentName, template2, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations) {
23375
- const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations);
23693
+ const job = new ComponentCompilationJob(componentName, constantPool, compilationMode, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn, relativeTemplatePath, enableDebugLocations);
23376
23694
  ingestNodes(job.root, template2);
23377
23695
  return job;
23378
23696
  }
23379
23697
  __name(ingestComponent, "ingestComponent");
23380
23698
  function ingestHostBinding(input, bindingParser, constantPool) {
23381
- const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode, TemplateCompilationMode.DomOnly);
23699
+ const job = new HostBindingCompilationJob(input.componentName, constantPool, TemplateCompilationMode.DomOnly);
23382
23700
  for (const property2 of input.properties ?? []) {
23383
23701
  let bindingKind = BindingKind.Property;
23384
23702
  if (property2.name.startsWith("attr.")) {
@@ -23480,10 +23798,6 @@ function ingestElement(unit, element2) {
23480
23798
  ingestNodes(unit, element2.children);
23481
23799
  const endOp = createElementEndOp(id, element2.endSourceSpan ?? element2.startSourceSpan);
23482
23800
  unit.create.push(endOp);
23483
- const fieldInput = element2.inputs.find((input) => input.name === "formField" && input.type === BindingType.Property);
23484
- if (fieldInput) {
23485
- unit.create.push(createControlCreateOp(fieldInput.sourceSpan));
23486
- }
23487
23801
  if (i18nBlockId !== null) {
23488
23802
  OpList.insertBefore(createI18nEndOp(i18nBlockId, element2.endSourceSpan ?? element2.startSourceSpan), endOp);
23489
23803
  }
@@ -23560,8 +23874,7 @@ function ingestBoundText(unit, text2, icuPlaceholder) {
23560
23874
  }
23561
23875
  const textXref = unit.job.allocateXrefId();
23562
23876
  unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
23563
- const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
23564
- unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
23877
+ unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, null)), i18nPlaceholders), text2.sourceSpan));
23565
23878
  }
23566
23879
  __name(ingestBoundText, "ingestBoundText");
23567
23880
  function ingestIfBlock(unit, ifBlock) {
@@ -23930,6 +24243,8 @@ function convertAst(ast, job, baseSourceSpan) {
23930
24243
  return new RegularExpressionLiteralExpr(ast.body, ast.flags, baseSourceSpan);
23931
24244
  } else if (ast instanceof SpreadElement) {
23932
24245
  return new SpreadElementExpr(convertAst(ast.expression, job, baseSourceSpan));
24246
+ } else if (ast instanceof ArrowFunction) {
24247
+ return updateParameterReferences(arrowFn(ast.parameters.map((arg) => new FnParam(arg.name)), convertAst(ast.body, job, baseSourceSpan)));
23933
24248
  } else {
23934
24249
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
23935
24250
  }
@@ -24168,6 +24483,20 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
24168
24483
  return null;
24169
24484
  }
24170
24485
  __name(ingestControlFlowInsertionPoint, "ingestControlFlowInsertionPoint");
24486
+ function updateParameterReferences(root) {
24487
+ const parameterNames = new Set(root.params.map((param) => param.name));
24488
+ return transformExpressionsInExpression(root, (expr) => {
24489
+ if (expr instanceof ArrowFunctionExpr$1) {
24490
+ for (const param of expr.params) {
24491
+ parameterNames.add(param.name);
24492
+ }
24493
+ } else if (expr instanceof LexicalReadExpr && parameterNames.has(expr.name)) {
24494
+ return variable(expr.name);
24495
+ }
24496
+ return expr;
24497
+ }, VisitorContextFlag.None);
24498
+ }
24499
+ __name(updateParameterReferences, "updateParameterReferences");
24171
24500
  var ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
24172
24501
  function setEnableTemplateSourceLocations(value) {
24173
24502
  ENABLE_TEMPLATE_SOURCE_LOCATIONS = value;
@@ -24880,18 +25209,31 @@ function createSwitchBlock(ast, visitor, bindingParser) {
24880
25209
  const unknownBlocks = [];
24881
25210
  let collectedCases = [];
24882
25211
  let firstCaseStart = null;
25212
+ let exhaustiveCheck = null;
24883
25213
  for (const node2 of ast.children) {
24884
25214
  if (!(node2 instanceof Block)) {
24885
25215
  continue;
24886
25216
  }
24887
- if ((node2.name !== "case" || node2.parameters.length === 0) && node2.name !== "default") {
25217
+ if ((node2.name !== "case" || node2.parameters.length === 0) && node2.name !== "default" && node2.name !== "default never") {
24888
25218
  unknownBlocks.push(new UnknownBlock(node2.name, node2.sourceSpan, node2.nameSpan));
24889
25219
  continue;
24890
25220
  }
25221
+ if (exhaustiveCheck !== null) {
25222
+ errors.push(new ParseError(node2.sourceSpan, '@default block with "never" parameter must be the last case in a switch'));
25223
+ }
24891
25224
  const isCase = node2.name === "case";
24892
25225
  let expression = null;
24893
25226
  if (isCase) {
24894
25227
  expression = parseBlockParameterToBinding(node2.parameters[0], bindingParser);
25228
+ } else if (node2.name === "default never") {
25229
+ if (node2.children.length > 0 || node2.endSourceSpan !== null && node2.endSourceSpan.start.offset !== node2.endSourceSpan.end.offset) {
25230
+ errors.push(new ParseError(node2.sourceSpan, '@default block with "never" parameter cannot have a body'));
25231
+ }
25232
+ if (collectedCases.length > 0) {
25233
+ errors.push(new ParseError(node2.sourceSpan, 'A @case block with no body cannot be followed by a @default block with "never" parameter'));
25234
+ }
25235
+ exhaustiveCheck = new SwitchExhaustiveCheck(node2.sourceSpan, node2.startSourceSpan, node2.endSourceSpan, node2.nameSpan);
25236
+ continue;
24895
25237
  }
24896
25238
  const switchCase = new SwitchBlockCase(expression, node2.sourceSpan, node2.startSourceSpan, node2.endSourceSpan, node2.nameSpan);
24897
25239
  collectedCases.push(switchCase);
@@ -24913,7 +25255,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
24913
25255
  groups.push(group);
24914
25256
  collectedCases = [];
24915
25257
  }
24916
- const node = new SwitchBlock(primaryExpression, groups, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan);
25258
+ const node = new SwitchBlock(primaryExpression, groups, unknownBlocks, exhaustiveCheck, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan);
24917
25259
  return {
24918
25260
  node,
24919
25261
  errors
@@ -25045,11 +25387,16 @@ function validateSwitchBlock(ast) {
25045
25387
  if (node instanceof Comment2 || node instanceof Text4 && node.value.trim().length === 0) {
25046
25388
  continue;
25047
25389
  }
25048
- if (!(node instanceof Block) || node.name !== "case" && node.name !== "default") {
25390
+ if (!(node instanceof Block) || node.name !== "case" && node.name !== "default" && node.name !== "default never") {
25049
25391
  errors.push(new ParseError(node.sourceSpan, "@switch block can only contain @case and @default blocks"));
25050
25392
  continue;
25051
25393
  }
25052
- if (node.name === "default") {
25394
+ if (node.name === "default never") {
25395
+ if (hasDefault) {
25396
+ errors.push(new ParseError(node.startSourceSpan, "@switch block can only have one @default block"));
25397
+ }
25398
+ hasDefault = true;
25399
+ } else if (node.name === "default") {
25053
25400
  if (hasDefault) {
25054
25401
  errors.push(new ParseError(node.startSourceSpan, "@switch block can only have one @default block"));
25055
25402
  } else if (node.parameters.length > 0) {
@@ -26467,6 +26814,9 @@ function addFeatures(definitionMap, meta) {
26467
26814
  if (meta.lifecycle.usesOnChanges) {
26468
26815
  features.push(importExpr(Identifiers.NgOnChangesFeature));
26469
26816
  }
26817
+ if (meta.controlCreate !== null) {
26818
+ features.push(importExpr(Identifiers.ControlFeature).callFn([literal(meta.controlCreate.passThroughInput)]));
26819
+ }
26470
26820
  if ("externalStyles" in meta && meta.externalStyles?.length) {
26471
26821
  const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
26472
26822
  features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
@@ -26933,6 +27283,8 @@ var CombinedRecursiveAstVisitor = class extends RecursiveAstVisitor2 {
26933
27283
  this.visitAllTemplateNodes(block.cases);
26934
27284
  this.visitAllTemplateNodes(block.children);
26935
27285
  }
27286
+ visitSwitchExhaustiveCheck(block) {
27287
+ }
26936
27288
  visitForLoopBlock(block) {
26937
27289
  block.item.visit(this);
26938
27290
  this.visitAllTemplateNodes(block.contextVariables);
@@ -27144,6 +27496,8 @@ var Scope2 = class _Scope {
27144
27496
  visitSwitchBlockCaseGroup(block) {
27145
27497
  this.ingestScopedNode(block);
27146
27498
  }
27499
+ visitSwitchExhaustiveCheck(block) {
27500
+ }
27147
27501
  visitForLoopBlock(block) {
27148
27502
  this.ingestScopedNode(block);
27149
27503
  block.empty?.visit(this);
@@ -27276,6 +27630,8 @@ var DirectiveBinder = class _DirectiveBinder {
27276
27630
  visitSwitchBlockCaseGroup(block) {
27277
27631
  block.children.forEach((node) => node.visit(this));
27278
27632
  }
27633
+ visitSwitchExhaustiveCheck(block) {
27634
+ }
27279
27635
  visitForLoopBlock(block) {
27280
27636
  block.item.visit(this);
27281
27637
  block.contextVariables.forEach((v) => v.visit(this));
@@ -27527,6 +27883,8 @@ var TemplateBinder = class _TemplateBinder extends CombinedRecursiveAstVisitor {
27527
27883
  block.cases.forEach((caseNode) => caseNode.visit(this));
27528
27884
  this.ingestScopedNode(block);
27529
27885
  }
27886
+ visitSwitchExhaustiveCheck(block) {
27887
+ }
27530
27888
  visitForLoopBlock(block) {
27531
27889
  block.expression.visit(this);
27532
27890
  this.ingestScopedNode(block);
@@ -28050,6 +28408,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
28050
28408
  providers: declaration.providers !== void 0 ? new WrappedNodeExpr(declaration.providers) : null,
28051
28409
  exportAs: declaration.exportAs ?? null,
28052
28410
  usesInheritance: declaration.usesInheritance ?? false,
28411
+ controlCreate: declaration.controlCreate ?? null,
28053
28412
  lifecycle: {
28054
28413
  usesOnChanges: declaration.usesOnChanges ?? false
28055
28414
  },
@@ -30084,7 +30443,7 @@ var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
30084
30443
  function compileDeclareClassMetadata(metadata) {
30085
30444
  const definitionMap = new DefinitionMap();
30086
30445
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
30087
- definitionMap.set("version", literal("21.1.4"));
30446
+ definitionMap.set("version", literal("21.2.0"));
30088
30447
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30089
30448
  definitionMap.set("type", metadata.type);
30090
30449
  definitionMap.set("decorators", metadata.decorators);
@@ -30103,7 +30462,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
30103
30462
  callbackReturnDefinitionMap.set("ctorParameters", metadata.ctorParameters ?? literal(null));
30104
30463
  callbackReturnDefinitionMap.set("propDecorators", metadata.propDecorators ?? literal(null));
30105
30464
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
30106
- definitionMap.set("version", literal("21.1.4"));
30465
+ definitionMap.set("version", literal("21.2.0"));
30107
30466
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30108
30467
  definitionMap.set("type", metadata.type);
30109
30468
  definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
@@ -30180,7 +30539,7 @@ function createDirectiveDefinitionMap(meta) {
30180
30539
  const definitionMap = new DefinitionMap();
30181
30540
  const minVersion = getMinimumVersionForPartialOutput(meta);
30182
30541
  definitionMap.set("minVersion", literal(minVersion));
30183
- definitionMap.set("version", literal("21.1.4"));
30542
+ definitionMap.set("version", literal("21.2.0"));
30184
30543
  definitionMap.set("type", meta.type.value);
30185
30544
  if (meta.isStandalone !== void 0) {
30186
30545
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -30210,6 +30569,13 @@ function createDirectiveDefinitionMap(meta) {
30210
30569
  if (meta.lifecycle.usesOnChanges) {
30211
30570
  definitionMap.set("usesOnChanges", literal(true));
30212
30571
  }
30572
+ if (meta.controlCreate) {
30573
+ definitionMap.set("controlCreate", literalMap([{
30574
+ key: "passThroughInput",
30575
+ value: literal(meta.controlCreate.passThroughInput),
30576
+ quoted: false
30577
+ }]));
30578
+ }
30213
30579
  if (meta.hostDirectives?.length) {
30214
30580
  definitionMap.set("hostDirectives", createHostDirectives(meta.hostDirectives));
30215
30581
  }
@@ -30529,7 +30895,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION$4 = "12.0.0";
30529
30895
  function compileDeclareFactoryFunction(meta) {
30530
30896
  const definitionMap = new DefinitionMap();
30531
30897
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
30532
- definitionMap.set("version", literal("21.1.4"));
30898
+ definitionMap.set("version", literal("21.2.0"));
30533
30899
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30534
30900
  definitionMap.set("type", meta.type.value);
30535
30901
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -30556,7 +30922,7 @@ __name(compileDeclareInjectableFromMetadata, "compileDeclareInjectableFromMetada
30556
30922
  function createInjectableDefinitionMap(meta) {
30557
30923
  const definitionMap = new DefinitionMap();
30558
30924
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
30559
- definitionMap.set("version", literal("21.1.4"));
30925
+ definitionMap.set("version", literal("21.2.0"));
30560
30926
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30561
30927
  definitionMap.set("type", meta.type.value);
30562
30928
  if (meta.providedIn !== void 0) {
@@ -30598,7 +30964,7 @@ __name(compileDeclareInjectorFromMetadata, "compileDeclareInjectorFromMetadata")
30598
30964
  function createInjectorDefinitionMap(meta) {
30599
30965
  const definitionMap = new DefinitionMap();
30600
30966
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
30601
- definitionMap.set("version", literal("21.1.4"));
30967
+ definitionMap.set("version", literal("21.2.0"));
30602
30968
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30603
30969
  definitionMap.set("type", meta.type.value);
30604
30970
  definitionMap.set("providers", meta.providers);
@@ -30626,7 +30992,7 @@ function createNgModuleDefinitionMap(meta) {
30626
30992
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
30627
30993
  }
30628
30994
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
30629
- definitionMap.set("version", literal("21.1.4"));
30995
+ definitionMap.set("version", literal("21.2.0"));
30630
30996
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30631
30997
  definitionMap.set("type", meta.type.value);
30632
30998
  if (meta.bootstrap.length > 0) {
@@ -30665,7 +31031,7 @@ __name(compileDeclarePipeFromMetadata, "compileDeclarePipeFromMetadata");
30665
31031
  function createPipeDefinitionMap(meta) {
30666
31032
  const definitionMap = new DefinitionMap();
30667
31033
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
30668
- definitionMap.set("version", literal("21.1.4"));
31034
+ definitionMap.set("version", literal("21.2.0"));
30669
31035
  definitionMap.set("ngImport", importExpr(Identifiers.core));
30670
31036
  definitionMap.set("type", meta.type.value);
30671
31037
  if (meta.isStandalone !== void 0) {
@@ -30740,7 +31106,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
30740
31106
  return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
30741
31107
  }
30742
31108
  __name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
30743
- var VERSION = new Version("21.1.4");
31109
+ var VERSION = new Version("21.2.0");
30744
31110
  publishFacade(_global);
30745
31111
  // Annotate the CommonJS export names for ESM import in node:
30746
31112
  0 && (module.exports = {
@@ -30749,7 +31115,9 @@ publishFacade(_global);
30749
31115
  ASTWithSource,
30750
31116
  AbsoluteSourceSpan,
30751
31117
  ArrayType,
31118
+ ArrowFunction,
30752
31119
  ArrowFunctionExpr,
31120
+ ArrowFunctionIdentifierParameter,
30753
31121
  Attribute,
30754
31122
  Binary,
30755
31123
  BinaryOperator,
@@ -30917,6 +31285,7 @@ publishFacade(_global);
30917
31285
  TmplAstSwitchBlock,
30918
31286
  TmplAstSwitchBlockCase,
30919
31287
  TmplAstSwitchBlockCaseGroup,
31288
+ TmplAstSwitchExhaustiveCheck,
30920
31289
  TmplAstTemplate,
30921
31290
  TmplAstText,
30922
31291
  TmplAstTextAttribute,
@@ -31011,7 +31380,7 @@ publishFacade(_global);
31011
31380
 
31012
31381
  @angular/compiler/fesm2022/compiler.mjs:
31013
31382
  (**
31014
- * @license Angular v21.1.4
31383
+ * @license Angular v21.2.0
31015
31384
  * (c) 2010-2026 Google LLC. https://angular.dev/
31016
31385
  * License: MIT
31017
31386
  *)