@angular/compiler 14.0.0-next.1 → 14.0.0-next.4

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 (39) hide show
  1. package/esm2020/src/compiler_facade_interface.mjs +1 -1
  2. package/esm2020/src/expression_parser/parser.mjs +34 -15
  3. package/esm2020/src/jit_compiler_facade.mjs +4 -1
  4. package/esm2020/src/output/output_ast.mjs +1 -1
  5. package/esm2020/src/render3/partial/api.mjs +1 -1
  6. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  7. package/esm2020/src/render3/partial/directive.mjs +1 -1
  8. package/esm2020/src/render3/partial/factory.mjs +1 -1
  9. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2020/src/render3/partial/injector.mjs +1 -1
  11. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  13. package/esm2020/src/render3/r3_pipe_compiler.mjs +1 -1
  14. package/esm2020/src/render3/r3_template_transform.mjs +4 -4
  15. package/esm2020/src/render3/view/api.mjs +1 -1
  16. package/esm2020/src/render3/view/compiler.mjs +40 -40
  17. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +2 -5
  18. package/esm2020/src/render3/view/i18n/meta.mjs +11 -6
  19. package/esm2020/src/render3/view/template.mjs +78 -122
  20. package/esm2020/src/render3/view/util.mjs +94 -15
  21. package/esm2020/src/template_parser/binding_parser.mjs +11 -11
  22. package/esm2020/src/version.mjs +1 -1
  23. package/fesm2015/compiler.mjs +278 -219
  24. package/fesm2015/compiler.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +1 -1
  26. package/fesm2020/compiler.mjs +276 -217
  27. package/fesm2020/compiler.mjs.map +1 -1
  28. package/fesm2020/testing.mjs +1 -1
  29. package/package.json +1 -1
  30. package/src/compiler_facade_interface.d.ts +4 -0
  31. package/src/expression_parser/parser.d.ts +19 -3
  32. package/src/output/output_ast.d.ts +2 -1
  33. package/src/render3/partial/api.d.ts +10 -0
  34. package/src/render3/r3_pipe_compiler.d.ts +4 -0
  35. package/src/render3/view/api.d.ts +4 -0
  36. package/src/render3/view/i18n/meta.d.ts +1 -1
  37. package/src/render3/view/template.d.ts +0 -3
  38. package/src/render3/view/util.d.ts +19 -2
  39. package/src/template_parser/binding_parser.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.1
2
+ * @license Angular v14.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4876,6 +4876,65 @@ const IMPLICIT_REFERENCE = '$implicit';
4876
4876
  const NON_BINDABLE_ATTR = 'ngNonBindable';
4877
4877
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
4878
4878
  const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
4879
+ /** Instructions that support chaining. */
4880
+ const CHAINABLE_INSTRUCTIONS = new Set([
4881
+ Identifiers.element,
4882
+ Identifiers.elementStart,
4883
+ Identifiers.elementEnd,
4884
+ Identifiers.elementContainer,
4885
+ Identifiers.elementContainerStart,
4886
+ Identifiers.elementContainerEnd,
4887
+ Identifiers.i18nExp,
4888
+ Identifiers.listener,
4889
+ Identifiers.classProp,
4890
+ Identifiers.syntheticHostListener,
4891
+ Identifiers.hostProperty,
4892
+ Identifiers.syntheticHostProperty,
4893
+ Identifiers.property,
4894
+ Identifiers.propertyInterpolate1,
4895
+ Identifiers.propertyInterpolate2,
4896
+ Identifiers.propertyInterpolate3,
4897
+ Identifiers.propertyInterpolate4,
4898
+ Identifiers.propertyInterpolate5,
4899
+ Identifiers.propertyInterpolate6,
4900
+ Identifiers.propertyInterpolate7,
4901
+ Identifiers.propertyInterpolate8,
4902
+ Identifiers.propertyInterpolateV,
4903
+ Identifiers.attribute,
4904
+ Identifiers.attributeInterpolate1,
4905
+ Identifiers.attributeInterpolate2,
4906
+ Identifiers.attributeInterpolate3,
4907
+ Identifiers.attributeInterpolate4,
4908
+ Identifiers.attributeInterpolate5,
4909
+ Identifiers.attributeInterpolate6,
4910
+ Identifiers.attributeInterpolate7,
4911
+ Identifiers.attributeInterpolate8,
4912
+ Identifiers.attributeInterpolateV,
4913
+ Identifiers.styleProp,
4914
+ Identifiers.stylePropInterpolate1,
4915
+ Identifiers.stylePropInterpolate2,
4916
+ Identifiers.stylePropInterpolate3,
4917
+ Identifiers.stylePropInterpolate4,
4918
+ Identifiers.stylePropInterpolate5,
4919
+ Identifiers.stylePropInterpolate6,
4920
+ Identifiers.stylePropInterpolate7,
4921
+ Identifiers.stylePropInterpolate8,
4922
+ Identifiers.stylePropInterpolateV,
4923
+ Identifiers.textInterpolate,
4924
+ Identifiers.textInterpolate1,
4925
+ Identifiers.textInterpolate2,
4926
+ Identifiers.textInterpolate3,
4927
+ Identifiers.textInterpolate4,
4928
+ Identifiers.textInterpolate5,
4929
+ Identifiers.textInterpolate6,
4930
+ Identifiers.textInterpolate7,
4931
+ Identifiers.textInterpolate8,
4932
+ Identifiers.textInterpolateV,
4933
+ ]);
4934
+ /** Generates a call to a single instruction. */
4935
+ function invokeInstruction(span, reference, params) {
4936
+ return importExpr(reference, null, span).callFn(params, span);
4937
+ }
4879
4938
  /**
4880
4939
  * Creates an allocator for a temporary variable.
4881
4940
  *
@@ -5017,20 +5076,6 @@ function getAttrsForDirectiveMatching(elOrTpl) {
5017
5076
  }
5018
5077
  return attributesMap;
5019
5078
  }
5020
- /** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */
5021
- function chainedInstruction(reference, calls, span) {
5022
- let expression = importExpr(reference, null, span);
5023
- if (calls.length > 0) {
5024
- for (let i = 0; i < calls.length; i++) {
5025
- expression = expression.callFn(calls[i], span);
5026
- }
5027
- }
5028
- else {
5029
- // Add a blank invocation, in case the `calls` array is empty.
5030
- expression = expression.callFn([], span);
5031
- }
5032
- return expression;
5033
- }
5034
5079
  /**
5035
5080
  * Gets the number of arguments expected to be passed to a generated instruction in the case of
5036
5081
  * interpolation instructions.
@@ -5048,6 +5093,40 @@ function getInterpolationArgsLength(interpolation) {
5048
5093
  return expressions.length + strings.length;
5049
5094
  }
5050
5095
  }
5096
+ /**
5097
+ * Generates the final instruction call statements based on the passed in configuration.
5098
+ * Will try to chain instructions as much as possible, if chaining is supported.
5099
+ */
5100
+ function getInstructionStatements(instructions) {
5101
+ var _a;
5102
+ const statements = [];
5103
+ let pendingExpression = null;
5104
+ let pendingExpressionType = null;
5105
+ for (const current of instructions) {
5106
+ const resolvedParams = (_a = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn)) !== null && _a !== void 0 ? _a : [];
5107
+ const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
5108
+ // If the current instruction is the same as the previous one
5109
+ // and it can be chained, add another call to the chain.
5110
+ if (pendingExpressionType === current.reference &&
5111
+ CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
5112
+ // We'll always have a pending expression when there's a pending expression type.
5113
+ pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
5114
+ }
5115
+ else {
5116
+ if (pendingExpression !== null) {
5117
+ statements.push(pendingExpression.toStmt());
5118
+ }
5119
+ pendingExpression = invokeInstruction(current.span, current.reference, params);
5120
+ pendingExpressionType = current.reference;
5121
+ }
5122
+ }
5123
+ // Since the current instruction adds the previous one to the statements,
5124
+ // we may be left with the final one at the end that is still pending.
5125
+ if (pendingExpression !== null) {
5126
+ statements.push(pendingExpression.toStmt());
5127
+ }
5128
+ return statements;
5129
+ }
5051
5130
 
5052
5131
  /**
5053
5132
  * @license
@@ -9340,11 +9419,15 @@ class Parser$1 {
9340
9419
  this._lexer = _lexer;
9341
9420
  this.errors = [];
9342
9421
  }
9343
- parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9422
+ parseAction(input, isAssignmentEvent, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9344
9423
  this._checkNoInterpolation(input, location, interpolationConfig);
9345
9424
  const sourceToLex = this._stripComments(input);
9346
9425
  const tokens = this._lexer.tokenize(sourceToLex);
9347
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, true, this.errors, 0).parseChain();
9426
+ let flags = 1 /* Action */;
9427
+ if (isAssignmentEvent) {
9428
+ flags |= 2 /* AssignmentEvent */;
9429
+ }
9430
+ const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
9348
9431
  return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
9349
9432
  }
9350
9433
  parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
@@ -9371,7 +9454,7 @@ class Parser$1 {
9371
9454
  this._checkNoInterpolation(input, location, interpolationConfig);
9372
9455
  const sourceToLex = this._stripComments(input);
9373
9456
  const tokens = this._lexer.tokenize(sourceToLex);
9374
- return new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, 0)
9457
+ return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
9375
9458
  .parseChain();
9376
9459
  }
9377
9460
  /**
@@ -9402,7 +9485,7 @@ class Parser$1 {
9402
9485
  */
9403
9486
  parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
9404
9487
  const tokens = this._lexer.tokenize(templateValue);
9405
- const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, false /* parseAction */, this.errors, 0 /* relative offset */);
9488
+ const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
9406
9489
  return parser.parseTemplateBindings({
9407
9490
  source: templateKey,
9408
9491
  span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
@@ -9417,7 +9500,7 @@ class Parser$1 {
9417
9500
  const expressionText = expressions[i].text;
9418
9501
  const sourceToLex = this._stripComments(expressionText);
9419
9502
  const tokens = this._lexer.tokenize(sourceToLex);
9420
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, offsets[i])
9503
+ const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
9421
9504
  .parseChain();
9422
9505
  expressionNodes.push(ast);
9423
9506
  }
@@ -9431,8 +9514,7 @@ class Parser$1 {
9431
9514
  parseInterpolationExpression(expression, location, absoluteOffset) {
9432
9515
  const sourceToLex = this._stripComments(expression);
9433
9516
  const tokens = this._lexer.tokenize(sourceToLex);
9434
- const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
9435
- /* parseAction */ false, this.errors, 0)
9517
+ const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
9436
9518
  .parseChain();
9437
9519
  const strings = ['', '']; // The prefix and suffix strings are both empty
9438
9520
  return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
@@ -9603,12 +9685,12 @@ var ParseContextFlags;
9603
9685
  ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
9604
9686
  })(ParseContextFlags || (ParseContextFlags = {}));
9605
9687
  class _ParseAST {
9606
- constructor(input, location, absoluteOffset, tokens, parseAction, errors, offset) {
9688
+ constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {
9607
9689
  this.input = input;
9608
9690
  this.location = location;
9609
9691
  this.absoluteOffset = absoluteOffset;
9610
9692
  this.tokens = tokens;
9611
- this.parseAction = parseAction;
9693
+ this.parseFlags = parseFlags;
9612
9694
  this.errors = errors;
9613
9695
  this.offset = offset;
9614
9696
  this.rparensExpected = 0;
@@ -9785,7 +9867,7 @@ class _ParseAST {
9785
9867
  const expr = this.parsePipe();
9786
9868
  exprs.push(expr);
9787
9869
  if (this.consumeOptionalCharacter($SEMICOLON)) {
9788
- if (!this.parseAction) {
9870
+ if (!(this.parseFlags & 1 /* Action */)) {
9789
9871
  this.error('Binding expression cannot contain chained expression');
9790
9872
  }
9791
9873
  while (this.consumeOptionalCharacter($SEMICOLON)) {
@@ -9809,7 +9891,7 @@ class _ParseAST {
9809
9891
  const start = this.inputIndex;
9810
9892
  let result = this.parseExpression();
9811
9893
  if (this.consumeOptionalOperator('|')) {
9812
- if (this.parseAction) {
9894
+ if (this.parseFlags & 1 /* Action */) {
9813
9895
  this.error('Cannot have a pipe in an action expression');
9814
9896
  }
9815
9897
  do {
@@ -10152,7 +10234,7 @@ class _ParseAST {
10152
10234
  const nameSpan = this.sourceSpan(nameStart);
10153
10235
  let receiver;
10154
10236
  if (isSafe) {
10155
- if (this.consumeOptionalOperator('=')) {
10237
+ if (this.consumeOptionalAssignment()) {
10156
10238
  this.error('The \'?.\' operator cannot be used in the assignment');
10157
10239
  receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
10158
10240
  }
@@ -10161,8 +10243,8 @@ class _ParseAST {
10161
10243
  }
10162
10244
  }
10163
10245
  else {
10164
- if (this.consumeOptionalOperator('=')) {
10165
- if (!this.parseAction) {
10246
+ if (this.consumeOptionalAssignment()) {
10247
+ if (!(this.parseFlags & 1 /* Action */)) {
10166
10248
  this.error('Bindings cannot contain assignments');
10167
10249
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
10168
10250
  }
@@ -10188,6 +10270,22 @@ class _ParseAST {
10188
10270
  return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) :
10189
10271
  new Call(span, sourceSpan, receiver, args, argumentSpan);
10190
10272
  }
10273
+ consumeOptionalAssignment() {
10274
+ // When parsing assignment events (originating from two-way-binding aka banana-in-a-box syntax),
10275
+ // it is valid for the primary expression to be terminated by the non-null operator. This
10276
+ // primary expression is substituted as LHS of the assignment operator to achieve
10277
+ // two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
10278
+ // naturally allow for this syntax, so assignment events are parsed specially.
10279
+ if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
10280
+ this.peek(1).isOperator('=')) {
10281
+ // First skip over the ! operator.
10282
+ this.advance();
10283
+ // Then skip over the = operator, to fully consume the optional assignment operator.
10284
+ this.advance();
10285
+ return true;
10286
+ }
10287
+ return this.consumeOptionalOperator('=');
10288
+ }
10191
10289
  parseCallArguments() {
10192
10290
  if (this.next.isCharacter($RPAREN))
10193
10291
  return [];
@@ -14878,7 +14976,7 @@ class BindingParser {
14878
14976
  // Regardless, neither of these values are used in Ivy but are only here to satisfy the
14879
14977
  // function signature. This should likely be refactored in the future so that `sourceSpan`
14880
14978
  // isn't being used inaccurately.
14881
- this.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
14979
+ this.parseEvent(propName, expression, /* isAssignmentEvent */ false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
14882
14980
  }
14883
14981
  else {
14884
14982
  this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
@@ -15115,7 +15213,7 @@ class BindingParser {
15115
15213
  return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
15116
15214
  }
15117
15215
  // TODO: keySpan should be required but was made optional to avoid changing VE parser.
15118
- parseEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15216
+ parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15119
15217
  if (name.length === 0) {
15120
15218
  this._reportError(`Event name is missing in binding`, sourceSpan);
15121
15219
  }
@@ -15124,21 +15222,21 @@ class BindingParser {
15124
15222
  if (keySpan !== undefined) {
15125
15223
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
15126
15224
  }
15127
- this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
15225
+ this._parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan);
15128
15226
  }
15129
15227
  else {
15130
- this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
15228
+ this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
15131
15229
  }
15132
15230
  }
15133
15231
  calcPossibleSecurityContexts(selector, propName, isAttribute) {
15134
15232
  const prop = this._schemaRegistry.getMappedPropName(propName);
15135
15233
  return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
15136
15234
  }
15137
- _parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
15235
+ _parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan) {
15138
15236
  const matches = splitAtPeriod(name, [name, '']);
15139
15237
  const eventName = matches[0];
15140
15238
  const phase = matches[1].toLowerCase();
15141
- const ast = this._parseAction(expression, handlerSpan);
15239
+ const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
15142
15240
  targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
15143
15241
  if (eventName.length === 0) {
15144
15242
  this._reportError(`Animation event name is missing in binding`, sourceSpan);
@@ -15152,20 +15250,20 @@ class BindingParser {
15152
15250
  this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
15153
15251
  }
15154
15252
  }
15155
- _parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15253
+ _parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15156
15254
  // long format: 'target: eventName'
15157
15255
  const [target, eventName] = splitAtColon(name, [null, name]);
15158
- const ast = this._parseAction(expression, handlerSpan);
15256
+ const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
15159
15257
  targetMatchableAttrs.push([name, ast.source]);
15160
15258
  targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
15161
15259
  // Don't detect directives for event names for now,
15162
15260
  // so don't add the event name to the matchableAttrs
15163
15261
  }
15164
- _parseAction(value, sourceSpan) {
15262
+ _parseAction(value, isAssignmentEvent, sourceSpan) {
15165
15263
  const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
15166
15264
  const absoluteOffset = (sourceSpan && sourceSpan.start) ? sourceSpan.start.offset : 0;
15167
15265
  try {
15168
- const ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
15266
+ const ast = this._exprParser.parseAction(value, isAssignmentEvent, sourceInfo, absoluteOffset, this._interpolationConfig);
15169
15267
  if (ast) {
15170
15268
  this._reportExpressionParserErrors(ast.errors, sourceSpan);
15171
15269
  }
@@ -15627,7 +15725,7 @@ class HtmlAstToIvyAst {
15627
15725
  const events = [];
15628
15726
  const identifier = bindParts[IDENT_KW_IDX];
15629
15727
  const keySpan = createKeySpan(srcSpan, bindParts[KW_ON_IDX], identifier);
15630
- this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15728
+ this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15631
15729
  addEvents(events, boundEvents);
15632
15730
  }
15633
15731
  else if (bindParts[KW_BINDON_IDX]) {
@@ -15671,7 +15769,7 @@ class HtmlAstToIvyAst {
15671
15769
  }
15672
15770
  else {
15673
15771
  const events = [];
15674
- this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15772
+ this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15675
15773
  addEvents(events, boundEvents);
15676
15774
  }
15677
15775
  return true;
@@ -15709,7 +15807,7 @@ class HtmlAstToIvyAst {
15709
15807
  }
15710
15808
  parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan) {
15711
15809
  const events = [];
15712
- this.bindingParser.parseEvent(`${name}Change`, `${expression}=$event`, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
15810
+ this.bindingParser.parseEvent(`${name}Change`, `${expression} =$event`, /* isAssignmentEvent */ true, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
15713
15811
  addEvents(events, boundEvents);
15714
15812
  }
15715
15813
  reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
@@ -16498,7 +16596,8 @@ class I18nMetaVisitor {
16498
16596
  */
16499
16597
  _parseMetadata(meta) {
16500
16598
  return typeof meta === 'string' ? parseI18nMeta(meta) :
16501
- meta instanceof Message ? meta : {};
16599
+ meta instanceof Message ? meta :
16600
+ {};
16502
16601
  }
16503
16602
  /**
16504
16603
  * Generate (or restore) message id if not specified already.
@@ -16523,9 +16622,9 @@ class I18nMetaVisitor {
16523
16622
  // `packages/compiler/src/render3/view/template.ts`).
16524
16623
  // In that case we want to reuse the legacy message generated in the 1st pass (see
16525
16624
  // `setI18nRefs()`).
16526
- const previousMessage = meta instanceof Message ?
16527
- meta :
16528
- meta instanceof IcuPlaceholder ? meta.previousMessage : undefined;
16625
+ const previousMessage = meta instanceof Message ? meta :
16626
+ meta instanceof IcuPlaceholder ? meta.previousMessage :
16627
+ undefined;
16529
16628
  message.legacyIds = previousMessage ? previousMessage.legacyIds : [];
16530
16629
  }
16531
16630
  }
@@ -16570,10 +16669,14 @@ function i18nMetaToJSDoc(meta) {
16570
16669
  if (meta.description) {
16571
16670
  tags.push({ tagName: "desc" /* Desc */, text: meta.description });
16572
16671
  }
16672
+ else {
16673
+ // Suppress the JSCompiler warning that a `@desc` was not given for this message.
16674
+ tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
16675
+ }
16573
16676
  if (meta.meaning) {
16574
16677
  tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
16575
16678
  }
16576
- return tags.length == 0 ? null : jsDocComment(tags);
16679
+ return jsDocComment(tags);
16577
16680
  }
16578
16681
 
16579
16682
  /** Closure uses `goog.getMsg(message)` to lookup translations */
@@ -16591,10 +16694,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
16591
16694
  // const MSG_... = goog.getMsg(..);
16592
16695
  // I18N_X = MSG_...;
16593
16696
  const googGetMsgStmt = closureVar.set(variable(GOOG_GET_MSG).callFn(args)).toConstDecl();
16594
- const metaComment = i18nMetaToJSDoc(message);
16595
- if (metaComment !== null) {
16596
- googGetMsgStmt.addLeadingComment(metaComment);
16597
- }
16697
+ googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
16598
16698
  const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
16599
16699
  return [googGetMsgStmt, i18nAssignmentStmt];
16600
16700
  }
@@ -16925,9 +17025,9 @@ class TemplateDefinitionBuilder {
16925
17025
  this.i18nEnd(null, selfClosingI18nInstruction);
16926
17026
  }
16927
17027
  // Generate all the creation mode instructions (e.g. resolve bindings in listeners)
16928
- const creationStatements = this._creationCodeFns.map((fn) => fn());
17028
+ const creationStatements = getInstructionStatements(this._creationCodeFns);
16929
17029
  // Generate all the update mode instructions (e.g. resolve property or text bindings)
16930
- const updateStatements = this._updateCodeFns.map((fn) => fn());
17030
+ const updateStatements = getInstructionStatements(this._updateCodeFns);
16931
17031
  // Variable declaration must occur after binding resolution so we can generate context
16932
17032
  // instructions that build on each other.
16933
17033
  // e.g. const b = nextContext().$implicit(); const b = nextContext();
@@ -17080,7 +17180,7 @@ class TemplateDefinitionBuilder {
17080
17180
  if (Object.keys(icuMapping).length) {
17081
17181
  args.push(mapLiteral(icuMapping, true));
17082
17182
  }
17083
- return instruction(null, Identifiers.i18nPostprocess, args);
17183
+ return invokeInstruction(null, Identifiers.i18nPostprocess, args);
17084
17184
  };
17085
17185
  }
17086
17186
  this.i18nTranslate(meta, params, context.ref, transformFn);
@@ -17115,14 +17215,12 @@ class TemplateDefinitionBuilder {
17115
17215
  // setup accumulated bindings
17116
17216
  const { index, bindings } = this.i18n;
17117
17217
  if (bindings.size) {
17118
- const chainBindings = [];
17119
- bindings.forEach(binding => {
17120
- chainBindings.push({ sourceSpan: span, value: () => this.convertPropertyBinding(binding) });
17121
- });
17122
- // for i18n block, advance to the most recent element index (by taking the current number of
17123
- // elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
17124
- // necessary lifecycle hooks of components/directives are properly flushed.
17125
- this.updateInstructionChainWithAdvance(this.getConstCount() - 1, Identifiers.i18nExp, chainBindings);
17218
+ for (const binding of bindings) {
17219
+ // for i18n block, advance to the most recent element index (by taking the current number of
17220
+ // elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
17221
+ // necessary lifecycle hooks of components/directives are properly flushed.
17222
+ this.updateInstructionWithAdvance(this.getConstCount() - 1, span, Identifiers.i18nExp, () => this.convertPropertyBinding(binding));
17223
+ }
17126
17224
  this.updateInstruction(span, Identifiers.i18nApply, [literal(index)]);
17127
17225
  }
17128
17226
  if (!selfClosing) {
@@ -17133,7 +17231,6 @@ class TemplateDefinitionBuilder {
17133
17231
  i18nAttributesInstruction(nodeIndex, attrs, sourceSpan) {
17134
17232
  let hasBindings = false;
17135
17233
  const i18nAttrArgs = [];
17136
- const bindings = [];
17137
17234
  attrs.forEach(attr => {
17138
17235
  const message = attr.i18n;
17139
17236
  const converted = attr.value.visit(this._valueConverter);
@@ -17144,16 +17241,10 @@ class TemplateDefinitionBuilder {
17144
17241
  i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
17145
17242
  converted.expressions.forEach(expression => {
17146
17243
  hasBindings = true;
17147
- bindings.push({
17148
- sourceSpan,
17149
- value: () => this.convertPropertyBinding(expression),
17150
- });
17244
+ this.updateInstructionWithAdvance(nodeIndex, sourceSpan, Identifiers.i18nExp, () => this.convertPropertyBinding(expression));
17151
17245
  });
17152
17246
  }
17153
17247
  });
17154
- if (bindings.length > 0) {
17155
- this.updateInstructionChainWithAdvance(nodeIndex, Identifiers.i18nExp, bindings);
17156
- }
17157
17248
  if (i18nAttrArgs.length > 0) {
17158
17249
  const index = literal(this.allocateDataSlot());
17159
17250
  const constIndex = this.addToConsts(literalArr(i18nAttrArgs));
@@ -17282,11 +17373,9 @@ class TemplateDefinitionBuilder {
17282
17373
  }
17283
17374
  // Generate Listeners (outputs)
17284
17375
  if (element.outputs.length > 0) {
17285
- const listeners = element.outputs.map((outputAst) => ({
17286
- sourceSpan: outputAst.sourceSpan,
17287
- params: this.prepareListenerParameter(element.name, outputAst, elementIndex)
17288
- }));
17289
- this.creationInstructionChain(Identifiers.listener, listeners);
17376
+ for (const outputAst of element.outputs) {
17377
+ this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(element.name, outputAst, elementIndex));
17378
+ }
17290
17379
  }
17291
17380
  // Note: it's important to keep i18n/i18nStart instructions after i18nAttributes and
17292
17381
  // listeners, to make sure i18nAttributes instruction targets current element at runtime.
@@ -17327,9 +17416,8 @@ class TemplateDefinitionBuilder {
17327
17416
  const hasValue = value instanceof LiteralPrimitive ? !!value.value : true;
17328
17417
  this.allocateBindingSlots(value);
17329
17418
  propertyBindings.push({
17330
- name: prepareSyntheticPropertyName(input.name),
17331
- sourceSpan: input.sourceSpan,
17332
- value: () => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction
17419
+ span: input.sourceSpan,
17420
+ paramsOrFn: getBindingFunctionParams(() => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction, prepareSyntheticPropertyName(input.name))
17333
17421
  });
17334
17422
  }
17335
17423
  else {
@@ -17366,10 +17454,8 @@ class TemplateDefinitionBuilder {
17366
17454
  // [prop]="value"
17367
17455
  // Collect all the properties so that we can chain into a single function at the end.
17368
17456
  propertyBindings.push({
17369
- name: attrName,
17370
- sourceSpan: input.sourceSpan,
17371
- value: () => this.convertPropertyBinding(value),
17372
- params
17457
+ span: input.sourceSpan,
17458
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), attrName, params)
17373
17459
  });
17374
17460
  }
17375
17461
  }
@@ -17383,10 +17469,8 @@ class TemplateDefinitionBuilder {
17383
17469
  // [attr.name]="value" or attr.name="{{value}}"
17384
17470
  // Collect the attribute bindings so that they can be chained at the end.
17385
17471
  attributeBindings.push({
17386
- name: attrName,
17387
- sourceSpan: input.sourceSpan,
17388
- value: () => this.convertPropertyBinding(boundValue),
17389
- params
17472
+ span: input.sourceSpan,
17473
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(boundValue), attrName, params)
17390
17474
  });
17391
17475
  }
17392
17476
  }
@@ -17402,11 +17486,11 @@ class TemplateDefinitionBuilder {
17402
17486
  }
17403
17487
  }
17404
17488
  });
17405
- if (propertyBindings.length > 0) {
17406
- this.updateInstructionChainWithAdvance(elementIndex, Identifiers.property, propertyBindings);
17489
+ for (const propertyBinding of propertyBindings) {
17490
+ this.updateInstructionWithAdvance(elementIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
17407
17491
  }
17408
- if (attributeBindings.length > 0) {
17409
- this.updateInstructionChainWithAdvance(elementIndex, Identifiers.attribute, attributeBindings);
17492
+ for (const attributeBinding of attributeBindings) {
17493
+ this.updateInstructionWithAdvance(elementIndex, attributeBinding.span, Identifiers.attribute, attributeBinding.paramsOrFn);
17410
17494
  }
17411
17495
  // Traverse element child nodes
17412
17496
  visitAll$1(this, element.children);
@@ -17486,12 +17570,8 @@ class TemplateDefinitionBuilder {
17486
17570
  this.templatePropertyBindings(templateIndex, inputs);
17487
17571
  }
17488
17572
  // Generate listeners for directive output
17489
- if (template.outputs.length > 0) {
17490
- const listeners = template.outputs.map((outputAst) => ({
17491
- sourceSpan: outputAst.sourceSpan,
17492
- params: this.prepareListenerParameter('ng_template', outputAst, templateIndex)
17493
- }));
17494
- this.creationInstructionChain(Identifiers.listener, listeners);
17573
+ for (const outputAst of template.outputs) {
17574
+ this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter('ng_template', outputAst, templateIndex));
17495
17575
  }
17496
17576
  }
17497
17577
  }
@@ -17546,7 +17626,7 @@ class TemplateDefinitionBuilder {
17546
17626
  const transformFn = (raw) => {
17547
17627
  const params = Object.assign(Object.assign({}, vars), placeholders);
17548
17628
  const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
17549
- return instruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17629
+ return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17550
17630
  };
17551
17631
  // in case the whole i18n message is a single ICU - we do not need to
17552
17632
  // create a separate top-level translation, we can use the root ref instead
@@ -17588,32 +17668,33 @@ class TemplateDefinitionBuilder {
17588
17668
  }
17589
17669
  templatePropertyBindings(templateIndex, attrs) {
17590
17670
  const propertyBindings = [];
17591
- attrs.forEach(input => {
17592
- if (input instanceof BoundAttribute) {
17593
- const value = input.value.visit(this._valueConverter);
17594
- if (value !== undefined) {
17595
- this.allocateBindingSlots(value);
17596
- if (value instanceof Interpolation) {
17597
- // Params typically contain attribute namespace and value sanitizer, which is applicable
17598
- // for regular HTML elements, but not applicable for <ng-template> (since props act as
17599
- // inputs to directives), so keep params array empty.
17600
- const params = [];
17601
- // prop="{{value}}" case
17602
- this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
17603
- }
17604
- else {
17605
- // [prop]="value" case
17606
- propertyBindings.push({
17607
- name: input.name,
17608
- sourceSpan: input.sourceSpan,
17609
- value: () => this.convertPropertyBinding(value)
17610
- });
17611
- }
17612
- }
17671
+ for (const input of attrs) {
17672
+ if (!(input instanceof BoundAttribute)) {
17673
+ continue;
17674
+ }
17675
+ const value = input.value.visit(this._valueConverter);
17676
+ if (value === undefined) {
17677
+ continue;
17678
+ }
17679
+ this.allocateBindingSlots(value);
17680
+ if (value instanceof Interpolation) {
17681
+ // Params typically contain attribute namespace and value sanitizer, which is applicable
17682
+ // for regular HTML elements, but not applicable for <ng-template> (since props act as
17683
+ // inputs to directives), so keep params array empty.
17684
+ const params = [];
17685
+ // prop="{{value}}" case
17686
+ this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
17687
+ }
17688
+ else {
17689
+ // [prop]="value" case
17690
+ propertyBindings.push({
17691
+ span: input.sourceSpan,
17692
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), input.name)
17693
+ });
17613
17694
  }
17614
- });
17615
- if (propertyBindings.length > 0) {
17616
- this.updateInstructionChainWithAdvance(templateIndex, Identifiers.property, propertyBindings);
17695
+ }
17696
+ for (const propertyBinding of propertyBindings) {
17697
+ this.updateInstructionWithAdvance(templateIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
17617
17698
  }
17618
17699
  }
17619
17700
  // Bindings must only be resolved after all local refs have been visited, so all
@@ -17621,39 +17702,23 @@ class TemplateDefinitionBuilder {
17621
17702
  // Otherwise, we wouldn't be able to support local refs that are defined after their
17622
17703
  // bindings. e.g. {{ foo }} <div #foo></div>
17623
17704
  instructionFn(fns, span, reference, paramsOrFn, prepend = false) {
17624
- fns[prepend ? 'unshift' : 'push'](() => {
17625
- const params = Array.isArray(paramsOrFn) ? paramsOrFn : paramsOrFn();
17626
- return instruction(span, reference, params).toStmt();
17627
- });
17705
+ fns[prepend ? 'unshift' : 'push']({ span, reference, paramsOrFn });
17628
17706
  }
17629
17707
  processStylingUpdateInstruction(elementIndex, instruction) {
17630
17708
  let allocateBindingSlots = 0;
17631
17709
  if (instruction) {
17632
- const calls = [];
17633
- instruction.calls.forEach(call => {
17710
+ for (const call of instruction.calls) {
17634
17711
  allocateBindingSlots += call.allocateBindingSlots;
17635
- calls.push({
17636
- sourceSpan: call.sourceSpan,
17637
- value: () => {
17638
- return call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
17639
- this.getUpdateInstructionArguments(value) :
17640
- this.convertPropertyBinding(value));
17641
- }
17642
- });
17643
- });
17644
- this.updateInstructionChainWithAdvance(elementIndex, instruction.reference, calls);
17712
+ this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
17713
+ this.getUpdateInstructionArguments(value) :
17714
+ this.convertPropertyBinding(value)));
17715
+ }
17645
17716
  }
17646
17717
  return allocateBindingSlots;
17647
17718
  }
17648
17719
  creationInstruction(span, reference, paramsOrFn, prepend) {
17649
17720
  this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend);
17650
17721
  }
17651
- creationInstructionChain(reference, calls) {
17652
- const span = calls.length ? calls[0].sourceSpan : null;
17653
- this._creationCodeFns.push(() => {
17654
- return chainedInstruction(reference, calls.map(call => call.params()), span).toStmt();
17655
- });
17656
- }
17657
17722
  updateInstructionWithAdvance(nodeIndex, span, reference, paramsOrFn) {
17658
17723
  this.addAdvanceInstructionIfNecessary(nodeIndex, span);
17659
17724
  this.updateInstruction(span, reference, paramsOrFn);
@@ -17661,28 +17726,6 @@ class TemplateDefinitionBuilder {
17661
17726
  updateInstruction(span, reference, paramsOrFn) {
17662
17727
  this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
17663
17728
  }
17664
- updateInstructionChain(reference, bindings) {
17665
- const span = bindings.length ? bindings[0].sourceSpan : null;
17666
- this._updateCodeFns.push(() => {
17667
- const calls = bindings.map(property => {
17668
- const value = property.value();
17669
- const fnParams = Array.isArray(value) ? value : [value];
17670
- if (property.params) {
17671
- fnParams.push(...property.params);
17672
- }
17673
- if (property.name) {
17674
- // We want the property name to always be the first function parameter.
17675
- fnParams.unshift(literal(property.name));
17676
- }
17677
- return fnParams;
17678
- });
17679
- return chainedInstruction(reference, calls, span).toStmt();
17680
- });
17681
- }
17682
- updateInstructionChainWithAdvance(nodeIndex, reference, bindings) {
17683
- this.addAdvanceInstructionIfNecessary(nodeIndex, bindings.length ? bindings[0].sourceSpan : null);
17684
- this.updateInstructionChain(reference, bindings);
17685
- }
17686
17729
  addAdvanceInstructionIfNecessary(nodeIndex, span) {
17687
17730
  if (nodeIndex !== this._currentIndex) {
17688
17731
  const delta = nodeIndex - this._currentIndex;
@@ -17968,9 +18011,6 @@ function pureFunctionCallInfo(args) {
17968
18011
  isVarLength: !identifier,
17969
18012
  };
17970
18013
  }
17971
- function instruction(span, reference, params) {
17972
- return importExpr(reference, null, span).callFn(params, span);
17973
- }
17974
18014
  // e.g. x(2);
17975
18015
  function generateNextContextExpr(relativeLevelDiff) {
17976
18016
  return importExpr(Identifiers.nextContext)
@@ -18175,7 +18215,7 @@ class BindingScope {
18175
18215
  restoreViewStatement() {
18176
18216
  const statements = [];
18177
18217
  if (this.restoreViewVariable) {
18178
- const restoreCall = instruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18218
+ const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18179
18219
  // Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
18180
18220
  // depending on whether it is being used.
18181
18221
  statements.push(this.usesRestoredViewContext ?
@@ -18187,7 +18227,9 @@ class BindingScope {
18187
18227
  viewSnapshotStatements() {
18188
18228
  // const $state$ = getCurrentView();
18189
18229
  return this.restoreViewVariable ?
18190
- [this.restoreViewVariable.set(instruction(null, Identifiers.getCurrentView, [])).toConstDecl()] :
18230
+ [
18231
+ this.restoreViewVariable.set(invokeInstruction(null, Identifiers.getCurrentView, [])).toConstDecl()
18232
+ ] :
18191
18233
  [];
18192
18234
  }
18193
18235
  isListenerScope() {
@@ -18460,6 +18502,20 @@ function isTextNode(node) {
18460
18502
  function hasTextChildrenOnly(children) {
18461
18503
  return children.every(isTextNode);
18462
18504
  }
18505
+ function getBindingFunctionParams(deferredParams, name, eagerParams) {
18506
+ return () => {
18507
+ const value = deferredParams();
18508
+ const fnParams = Array.isArray(value) ? value : [value];
18509
+ if (eagerParams) {
18510
+ fnParams.push(...eagerParams);
18511
+ }
18512
+ if (name) {
18513
+ // We want the property name to always be the first function parameter.
18514
+ fnParams.unshift(literal(name));
18515
+ }
18516
+ return fnParams;
18517
+ };
18518
+ }
18463
18519
  /** Name of the global variable that is used to determine if we use Closure translations or not */
18464
18520
  const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
18465
18521
  /**
@@ -18841,14 +18897,14 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18841
18897
  if (classAttr !== undefined) {
18842
18898
  styleBuilder.registerClassAttr(classAttr);
18843
18899
  }
18844
- const createStatements = [];
18845
- const updateStatements = [];
18900
+ const createInstructions = [];
18901
+ const updateInstructions = [];
18902
+ const updateVariables = [];
18846
18903
  const hostBindingSourceSpan = typeSourceSpan;
18847
18904
  // Calculate host event bindings
18848
18905
  const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
18849
18906
  if (eventBindings && eventBindings.length) {
18850
- const listeners = createHostListeners(eventBindings, name);
18851
- createStatements.push(...listeners);
18907
+ createInstructions.push(...createHostListeners(eventBindings, name));
18852
18908
  }
18853
18909
  // Calculate the host property bindings
18854
18910
  const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
@@ -18884,7 +18940,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18884
18940
  const propertyBindings = [];
18885
18941
  const attributeBindings = [];
18886
18942
  const syntheticHostBindings = [];
18887
- allOtherBindings.forEach((binding) => {
18943
+ for (const binding of allOtherBindings) {
18888
18944
  // resolve literal arrays and literal objects
18889
18945
  const value = binding.expression.visit(getValueConverter());
18890
18946
  const bindingExpr = bindingFn(bindingContext, value);
@@ -18910,7 +18966,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18910
18966
  if (sanitizerFn) {
18911
18967
  instructionParams.push(sanitizerFn);
18912
18968
  }
18913
- updateStatements.push(...bindingExpr.stmts);
18969
+ updateVariables.push(...bindingExpr.stmts);
18914
18970
  if (instruction === Identifiers.hostProperty) {
18915
18971
  propertyBindings.push(instructionParams);
18916
18972
  }
@@ -18921,17 +18977,17 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18921
18977
  syntheticHostBindings.push(instructionParams);
18922
18978
  }
18923
18979
  else {
18924
- updateStatements.push(importExpr(instruction).callFn(instructionParams).toStmt());
18980
+ updateInstructions.push({ reference: instruction, paramsOrFn: instructionParams, span: null });
18925
18981
  }
18926
- });
18927
- if (propertyBindings.length > 0) {
18928
- updateStatements.push(chainedInstruction(Identifiers.hostProperty, propertyBindings).toStmt());
18929
18982
  }
18930
- if (attributeBindings.length > 0) {
18931
- updateStatements.push(chainedInstruction(Identifiers.attribute, attributeBindings).toStmt());
18983
+ for (const bindingParams of propertyBindings) {
18984
+ updateInstructions.push({ reference: Identifiers.hostProperty, paramsOrFn: bindingParams, span: null });
18932
18985
  }
18933
- if (syntheticHostBindings.length > 0) {
18934
- updateStatements.push(chainedInstruction(Identifiers.syntheticHostProperty, syntheticHostBindings).toStmt());
18986
+ for (const bindingParams of attributeBindings) {
18987
+ updateInstructions.push({ reference: Identifiers.attribute, paramsOrFn: bindingParams, span: null });
18988
+ }
18989
+ for (const bindingParams of syntheticHostBindings) {
18990
+ updateInstructions.push({ reference: Identifiers.syntheticHostProperty, paramsOrFn: bindingParams, span: null });
18935
18991
  }
18936
18992
  // since we're dealing with directives/components and both have hostBinding
18937
18993
  // functions, we need to generate a special hostAttrs instruction that deals
@@ -18947,30 +19003,30 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18947
19003
  // the update block of a component/directive templateFn/hostBindingsFn so that the bindings
18948
19004
  // are evaluated and updated for the element.
18949
19005
  styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(instruction => {
18950
- if (instruction.calls.length > 0) {
18951
- const calls = [];
18952
- instruction.calls.forEach(call => {
18953
- // we subtract a value of `1` here because the binding slot was already allocated
18954
- // at the top of this method when all the input bindings were counted.
18955
- totalHostVarsCount +=
18956
- Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
18957
- calls.push(convertStylingCall(call, bindingContext, bindingFn));
19006
+ for (const call of instruction.calls) {
19007
+ // we subtract a value of `1` here because the binding slot was already allocated
19008
+ // at the top of this method when all the input bindings were counted.
19009
+ totalHostVarsCount +=
19010
+ Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
19011
+ updateInstructions.push({
19012
+ reference: instruction.reference,
19013
+ paramsOrFn: convertStylingCall(call, bindingContext, bindingFn),
19014
+ span: null
18958
19015
  });
18959
- updateStatements.push(chainedInstruction(instruction.reference, calls).toStmt());
18960
19016
  }
18961
19017
  });
18962
19018
  }
18963
19019
  if (totalHostVarsCount) {
18964
19020
  definitionMap.set('hostVars', literal(totalHostVarsCount));
18965
19021
  }
18966
- if (createStatements.length > 0 || updateStatements.length > 0) {
19022
+ if (createInstructions.length > 0 || updateInstructions.length > 0) {
18967
19023
  const hostBindingsFnName = name ? `${name}_HostBindings` : null;
18968
19024
  const statements = [];
18969
- if (createStatements.length > 0) {
18970
- statements.push(renderFlagCheckIfStmt(1 /* Create */, createStatements));
19025
+ if (createInstructions.length > 0) {
19026
+ statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
18971
19027
  }
18972
- if (updateStatements.length > 0) {
18973
- statements.push(renderFlagCheckIfStmt(2 /* Update */, updateStatements));
19028
+ if (updateInstructions.length > 0) {
19029
+ statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
18974
19030
  }
18975
19031
  return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
18976
19032
  }
@@ -19006,10 +19062,10 @@ function getBindingNameAndInstruction(binding) {
19006
19062
  return { bindingName, instruction, isAttribute: !!attrMatches };
19007
19063
  }
19008
19064
  function createHostListeners(eventBindings, name) {
19009
- const listeners = [];
19010
- const syntheticListeners = [];
19065
+ const listenerParams = [];
19066
+ const syntheticListenerParams = [];
19011
19067
  const instructions = [];
19012
- eventBindings.forEach(binding => {
19068
+ for (const binding of eventBindings) {
19013
19069
  let bindingName = binding.name && sanitizeIdentifier(binding.name);
19014
19070
  const bindingFnName = binding.type === 1 /* Animation */ ?
19015
19071
  prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
@@ -19017,17 +19073,17 @@ function createHostListeners(eventBindings, name) {
19017
19073
  const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
19018
19074
  const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
19019
19075
  if (binding.type == 1 /* Animation */) {
19020
- syntheticListeners.push(params);
19076
+ syntheticListenerParams.push(params);
19021
19077
  }
19022
19078
  else {
19023
- listeners.push(params);
19079
+ listenerParams.push(params);
19024
19080
  }
19025
- });
19026
- if (syntheticListeners.length > 0) {
19027
- instructions.push(chainedInstruction(Identifiers.syntheticHostListener, syntheticListeners).toStmt());
19028
19081
  }
19029
- if (listeners.length > 0) {
19030
- instructions.push(chainedInstruction(Identifiers.listener, listeners).toStmt());
19082
+ for (const params of syntheticListenerParams) {
19083
+ instructions.push({ reference: Identifiers.syntheticHostListener, paramsOrFn: params, span: null });
19084
+ }
19085
+ for (const params of listenerParams) {
19086
+ instructions.push({ reference: Identifiers.listener, paramsOrFn: params, span: null });
19031
19087
  }
19032
19088
  return instructions;
19033
19089
  }
@@ -19148,6 +19204,7 @@ class CompilerFacadeImpl {
19148
19204
  deps: null,
19149
19205
  pipeName: facade.pipeName,
19150
19206
  pure: facade.pure,
19207
+ isStandalone: facade.isStandalone,
19151
19208
  };
19152
19209
  const res = compilePipeFromMetadata(metadata);
19153
19210
  return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
@@ -19358,7 +19415,7 @@ function convertDirectiveFacadeToMetadata(facade) {
19358
19415
  return Object.assign(Object.assign({}, facade), { typeArgumentCount: 0, typeSourceSpan: facade.typeSourceSpan, type: wrapReference(facade.type), internalType: new WrappedNodeExpr(facade.type), deps: null, host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign(Object.assign({}, inputsFromMetadata), inputsFromType), outputs: Object.assign(Object.assign({}, outputsFromMetadata), outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), fullInheritance: false });
19359
19416
  }
19360
19417
  function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
19361
- var _a, _b, _c, _d, _e, _f, _g, _h;
19418
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19362
19419
  return {
19363
19420
  name: declaration.type.name,
19364
19421
  type: wrapReference(declaration.type),
@@ -19378,6 +19435,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
19378
19435
  deps: null,
19379
19436
  typeArgumentCount: 0,
19380
19437
  fullInheritance: false,
19438
+ isStandalone: (_j = declaration.isStandalone) !== null && _j !== void 0 ? _j : false,
19381
19439
  };
19382
19440
  }
19383
19441
  function convertHostDeclarationToMetadata(host = {}) {
@@ -19541,7 +19599,7 @@ function parseInputOutputs(values) {
19541
19599
  }, {});
19542
19600
  }
19543
19601
  function convertDeclarePipeFacadeToMetadata(declaration) {
19544
- var _a;
19602
+ var _a, _b;
19545
19603
  return {
19546
19604
  name: declaration.type.name,
19547
19605
  type: wrapReference(declaration.type),
@@ -19550,6 +19608,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
19550
19608
  pipeName: declaration.name,
19551
19609
  deps: null,
19552
19610
  pure: (_a = declaration.pure) !== null && _a !== void 0 ? _a : true,
19611
+ isStandalone: (_b = declaration.isStandalone) !== null && _b !== void 0 ? _b : false,
19553
19612
  };
19554
19613
  }
19555
19614
  function convertDeclareInjectorFacadeToMetadata(declaration) {
@@ -19576,7 +19635,7 @@ function publishFacade(global) {
19576
19635
  * Use of this source code is governed by an MIT-style license that can be
19577
19636
  * found in the LICENSE file at https://angular.io/license
19578
19637
  */
19579
- const VERSION = new Version('14.0.0-next.1');
19638
+ const VERSION = new Version('14.0.0-next.4');
19580
19639
 
19581
19640
  /**
19582
19641
  * @license
@@ -21603,7 +21662,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21603
21662
  function compileDeclareClassMetadata(metadata) {
21604
21663
  const definitionMap = new DefinitionMap();
21605
21664
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21606
- definitionMap.set('version', literal('14.0.0-next.1'));
21665
+ definitionMap.set('version', literal('14.0.0-next.4'));
21607
21666
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21608
21667
  definitionMap.set('type', metadata.type);
21609
21668
  definitionMap.set('decorators', metadata.decorators);
@@ -21720,7 +21779,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21720
21779
  function createDirectiveDefinitionMap(meta) {
21721
21780
  const definitionMap = new DefinitionMap();
21722
21781
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21723
- definitionMap.set('version', literal('14.0.0-next.1'));
21782
+ definitionMap.set('version', literal('14.0.0-next.4'));
21724
21783
  // e.g. `type: MyDirective`
21725
21784
  definitionMap.set('type', meta.internalType);
21726
21785
  // e.g. `selector: 'some-dir'`
@@ -21941,7 +22000,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
21941
22000
  function compileDeclareFactoryFunction(meta) {
21942
22001
  const definitionMap = new DefinitionMap();
21943
22002
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
21944
- definitionMap.set('version', literal('14.0.0-next.1'));
22003
+ definitionMap.set('version', literal('14.0.0-next.4'));
21945
22004
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21946
22005
  definitionMap.set('type', meta.internalType);
21947
22006
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -21983,7 +22042,7 @@ function compileDeclareInjectableFromMetadata(meta) {
21983
22042
  function createInjectableDefinitionMap(meta) {
21984
22043
  const definitionMap = new DefinitionMap();
21985
22044
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
21986
- definitionMap.set('version', literal('14.0.0-next.1'));
22045
+ definitionMap.set('version', literal('14.0.0-next.4'));
21987
22046
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21988
22047
  definitionMap.set('type', meta.internalType);
21989
22048
  // Only generate providedIn property if it has a non-null value
@@ -22041,7 +22100,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22041
22100
  function createInjectorDefinitionMap(meta) {
22042
22101
  const definitionMap = new DefinitionMap();
22043
22102
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22044
- definitionMap.set('version', literal('14.0.0-next.1'));
22103
+ definitionMap.set('version', literal('14.0.0-next.4'));
22045
22104
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22046
22105
  definitionMap.set('type', meta.internalType);
22047
22106
  definitionMap.set('providers', meta.providers);
@@ -22078,7 +22137,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22078
22137
  function createNgModuleDefinitionMap(meta) {
22079
22138
  const definitionMap = new DefinitionMap();
22080
22139
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22081
- definitionMap.set('version', literal('14.0.0-next.1'));
22140
+ definitionMap.set('version', literal('14.0.0-next.4'));
22082
22141
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22083
22142
  definitionMap.set('type', meta.internalType);
22084
22143
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22136,7 +22195,7 @@ function compileDeclarePipeFromMetadata(meta) {
22136
22195
  function createPipeDefinitionMap(meta) {
22137
22196
  const definitionMap = new DefinitionMap();
22138
22197
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22139
- definitionMap.set('version', literal('14.0.0-next.1'));
22198
+ definitionMap.set('version', literal('14.0.0-next.4'));
22140
22199
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22141
22200
  // e.g. `type: MyPipe`
22142
22201
  definitionMap.set('type', meta.internalType);