@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
  */
@@ -4872,6 +4872,65 @@ const IMPLICIT_REFERENCE = '$implicit';
4872
4872
  const NON_BINDABLE_ATTR = 'ngNonBindable';
4873
4873
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
4874
4874
  const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
4875
+ /** Instructions that support chaining. */
4876
+ const CHAINABLE_INSTRUCTIONS = new Set([
4877
+ Identifiers.element,
4878
+ Identifiers.elementStart,
4879
+ Identifiers.elementEnd,
4880
+ Identifiers.elementContainer,
4881
+ Identifiers.elementContainerStart,
4882
+ Identifiers.elementContainerEnd,
4883
+ Identifiers.i18nExp,
4884
+ Identifiers.listener,
4885
+ Identifiers.classProp,
4886
+ Identifiers.syntheticHostListener,
4887
+ Identifiers.hostProperty,
4888
+ Identifiers.syntheticHostProperty,
4889
+ Identifiers.property,
4890
+ Identifiers.propertyInterpolate1,
4891
+ Identifiers.propertyInterpolate2,
4892
+ Identifiers.propertyInterpolate3,
4893
+ Identifiers.propertyInterpolate4,
4894
+ Identifiers.propertyInterpolate5,
4895
+ Identifiers.propertyInterpolate6,
4896
+ Identifiers.propertyInterpolate7,
4897
+ Identifiers.propertyInterpolate8,
4898
+ Identifiers.propertyInterpolateV,
4899
+ Identifiers.attribute,
4900
+ Identifiers.attributeInterpolate1,
4901
+ Identifiers.attributeInterpolate2,
4902
+ Identifiers.attributeInterpolate3,
4903
+ Identifiers.attributeInterpolate4,
4904
+ Identifiers.attributeInterpolate5,
4905
+ Identifiers.attributeInterpolate6,
4906
+ Identifiers.attributeInterpolate7,
4907
+ Identifiers.attributeInterpolate8,
4908
+ Identifiers.attributeInterpolateV,
4909
+ Identifiers.styleProp,
4910
+ Identifiers.stylePropInterpolate1,
4911
+ Identifiers.stylePropInterpolate2,
4912
+ Identifiers.stylePropInterpolate3,
4913
+ Identifiers.stylePropInterpolate4,
4914
+ Identifiers.stylePropInterpolate5,
4915
+ Identifiers.stylePropInterpolate6,
4916
+ Identifiers.stylePropInterpolate7,
4917
+ Identifiers.stylePropInterpolate8,
4918
+ Identifiers.stylePropInterpolateV,
4919
+ Identifiers.textInterpolate,
4920
+ Identifiers.textInterpolate1,
4921
+ Identifiers.textInterpolate2,
4922
+ Identifiers.textInterpolate3,
4923
+ Identifiers.textInterpolate4,
4924
+ Identifiers.textInterpolate5,
4925
+ Identifiers.textInterpolate6,
4926
+ Identifiers.textInterpolate7,
4927
+ Identifiers.textInterpolate8,
4928
+ Identifiers.textInterpolateV,
4929
+ ]);
4930
+ /** Generates a call to a single instruction. */
4931
+ function invokeInstruction(span, reference, params) {
4932
+ return importExpr(reference, null, span).callFn(params, span);
4933
+ }
4875
4934
  /**
4876
4935
  * Creates an allocator for a temporary variable.
4877
4936
  *
@@ -5013,20 +5072,6 @@ function getAttrsForDirectiveMatching(elOrTpl) {
5013
5072
  }
5014
5073
  return attributesMap;
5015
5074
  }
5016
- /** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */
5017
- function chainedInstruction(reference, calls, span) {
5018
- let expression = importExpr(reference, null, span);
5019
- if (calls.length > 0) {
5020
- for (let i = 0; i < calls.length; i++) {
5021
- expression = expression.callFn(calls[i], span);
5022
- }
5023
- }
5024
- else {
5025
- // Add a blank invocation, in case the `calls` array is empty.
5026
- expression = expression.callFn([], span);
5027
- }
5028
- return expression;
5029
- }
5030
5075
  /**
5031
5076
  * Gets the number of arguments expected to be passed to a generated instruction in the case of
5032
5077
  * interpolation instructions.
@@ -5044,6 +5089,40 @@ function getInterpolationArgsLength(interpolation) {
5044
5089
  return expressions.length + strings.length;
5045
5090
  }
5046
5091
  }
5092
+ /**
5093
+ * Generates the final instruction call statements based on the passed in configuration.
5094
+ * Will try to chain instructions as much as possible, if chaining is supported.
5095
+ */
5096
+ function getInstructionStatements(instructions) {
5097
+ const statements = [];
5098
+ let pendingExpression = null;
5099
+ let pendingExpressionType = null;
5100
+ for (const current of instructions) {
5101
+ const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ??
5102
+ [];
5103
+ const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
5104
+ // If the current instruction is the same as the previous one
5105
+ // and it can be chained, add another call to the chain.
5106
+ if (pendingExpressionType === current.reference &&
5107
+ CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
5108
+ // We'll always have a pending expression when there's a pending expression type.
5109
+ pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
5110
+ }
5111
+ else {
5112
+ if (pendingExpression !== null) {
5113
+ statements.push(pendingExpression.toStmt());
5114
+ }
5115
+ pendingExpression = invokeInstruction(current.span, current.reference, params);
5116
+ pendingExpressionType = current.reference;
5117
+ }
5118
+ }
5119
+ // Since the current instruction adds the previous one to the statements,
5120
+ // we may be left with the final one at the end that is still pending.
5121
+ if (pendingExpression !== null) {
5122
+ statements.push(pendingExpression.toStmt());
5123
+ }
5124
+ return statements;
5125
+ }
5047
5126
 
5048
5127
  /**
5049
5128
  * @license
@@ -9348,11 +9427,15 @@ class Parser$1 {
9348
9427
  this._lexer = _lexer;
9349
9428
  this.errors = [];
9350
9429
  }
9351
- parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9430
+ parseAction(input, isAssignmentEvent, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9352
9431
  this._checkNoInterpolation(input, location, interpolationConfig);
9353
9432
  const sourceToLex = this._stripComments(input);
9354
9433
  const tokens = this._lexer.tokenize(sourceToLex);
9355
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, true, this.errors, 0).parseChain();
9434
+ let flags = 1 /* Action */;
9435
+ if (isAssignmentEvent) {
9436
+ flags |= 2 /* AssignmentEvent */;
9437
+ }
9438
+ const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
9356
9439
  return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
9357
9440
  }
9358
9441
  parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
@@ -9379,7 +9462,7 @@ class Parser$1 {
9379
9462
  this._checkNoInterpolation(input, location, interpolationConfig);
9380
9463
  const sourceToLex = this._stripComments(input);
9381
9464
  const tokens = this._lexer.tokenize(sourceToLex);
9382
- return new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, 0)
9465
+ return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
9383
9466
  .parseChain();
9384
9467
  }
9385
9468
  /**
@@ -9410,7 +9493,7 @@ class Parser$1 {
9410
9493
  */
9411
9494
  parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
9412
9495
  const tokens = this._lexer.tokenize(templateValue);
9413
- const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, false /* parseAction */, this.errors, 0 /* relative offset */);
9496
+ const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
9414
9497
  return parser.parseTemplateBindings({
9415
9498
  source: templateKey,
9416
9499
  span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
@@ -9425,7 +9508,7 @@ class Parser$1 {
9425
9508
  const expressionText = expressions[i].text;
9426
9509
  const sourceToLex = this._stripComments(expressionText);
9427
9510
  const tokens = this._lexer.tokenize(sourceToLex);
9428
- const ast = new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, offsets[i])
9511
+ const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
9429
9512
  .parseChain();
9430
9513
  expressionNodes.push(ast);
9431
9514
  }
@@ -9439,8 +9522,7 @@ class Parser$1 {
9439
9522
  parseInterpolationExpression(expression, location, absoluteOffset) {
9440
9523
  const sourceToLex = this._stripComments(expression);
9441
9524
  const tokens = this._lexer.tokenize(sourceToLex);
9442
- const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
9443
- /* parseAction */ false, this.errors, 0)
9525
+ const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
9444
9526
  .parseChain();
9445
9527
  const strings = ['', '']; // The prefix and suffix strings are both empty
9446
9528
  return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
@@ -9611,12 +9693,12 @@ var ParseContextFlags;
9611
9693
  ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
9612
9694
  })(ParseContextFlags || (ParseContextFlags = {}));
9613
9695
  class _ParseAST {
9614
- constructor(input, location, absoluteOffset, tokens, parseAction, errors, offset) {
9696
+ constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {
9615
9697
  this.input = input;
9616
9698
  this.location = location;
9617
9699
  this.absoluteOffset = absoluteOffset;
9618
9700
  this.tokens = tokens;
9619
- this.parseAction = parseAction;
9701
+ this.parseFlags = parseFlags;
9620
9702
  this.errors = errors;
9621
9703
  this.offset = offset;
9622
9704
  this.rparensExpected = 0;
@@ -9793,7 +9875,7 @@ class _ParseAST {
9793
9875
  const expr = this.parsePipe();
9794
9876
  exprs.push(expr);
9795
9877
  if (this.consumeOptionalCharacter($SEMICOLON)) {
9796
- if (!this.parseAction) {
9878
+ if (!(this.parseFlags & 1 /* Action */)) {
9797
9879
  this.error('Binding expression cannot contain chained expression');
9798
9880
  }
9799
9881
  while (this.consumeOptionalCharacter($SEMICOLON)) {
@@ -9817,7 +9899,7 @@ class _ParseAST {
9817
9899
  const start = this.inputIndex;
9818
9900
  let result = this.parseExpression();
9819
9901
  if (this.consumeOptionalOperator('|')) {
9820
- if (this.parseAction) {
9902
+ if (this.parseFlags & 1 /* Action */) {
9821
9903
  this.error('Cannot have a pipe in an action expression');
9822
9904
  }
9823
9905
  do {
@@ -10159,7 +10241,7 @@ class _ParseAST {
10159
10241
  const nameSpan = this.sourceSpan(nameStart);
10160
10242
  let receiver;
10161
10243
  if (isSafe) {
10162
- if (this.consumeOptionalOperator('=')) {
10244
+ if (this.consumeOptionalAssignment()) {
10163
10245
  this.error('The \'?.\' operator cannot be used in the assignment');
10164
10246
  receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
10165
10247
  }
@@ -10168,8 +10250,8 @@ class _ParseAST {
10168
10250
  }
10169
10251
  }
10170
10252
  else {
10171
- if (this.consumeOptionalOperator('=')) {
10172
- if (!this.parseAction) {
10253
+ if (this.consumeOptionalAssignment()) {
10254
+ if (!(this.parseFlags & 1 /* Action */)) {
10173
10255
  this.error('Bindings cannot contain assignments');
10174
10256
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
10175
10257
  }
@@ -10195,6 +10277,22 @@ class _ParseAST {
10195
10277
  return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) :
10196
10278
  new Call(span, sourceSpan, receiver, args, argumentSpan);
10197
10279
  }
10280
+ consumeOptionalAssignment() {
10281
+ // When parsing assignment events (originating from two-way-binding aka banana-in-a-box syntax),
10282
+ // it is valid for the primary expression to be terminated by the non-null operator. This
10283
+ // primary expression is substituted as LHS of the assignment operator to achieve
10284
+ // two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
10285
+ // naturally allow for this syntax, so assignment events are parsed specially.
10286
+ if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
10287
+ this.peek(1).isOperator('=')) {
10288
+ // First skip over the ! operator.
10289
+ this.advance();
10290
+ // Then skip over the = operator, to fully consume the optional assignment operator.
10291
+ this.advance();
10292
+ return true;
10293
+ }
10294
+ return this.consumeOptionalOperator('=');
10295
+ }
10198
10296
  parseCallArguments() {
10199
10297
  if (this.next.isCharacter($RPAREN))
10200
10298
  return [];
@@ -14884,7 +14982,7 @@ class BindingParser {
14884
14982
  // Regardless, neither of these values are used in Ivy but are only here to satisfy the
14885
14983
  // function signature. This should likely be refactored in the future so that `sourceSpan`
14886
14984
  // isn't being used inaccurately.
14887
- this.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
14985
+ this.parseEvent(propName, expression, /* isAssignmentEvent */ false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
14888
14986
  }
14889
14987
  else {
14890
14988
  this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
@@ -15121,7 +15219,7 @@ class BindingParser {
15121
15219
  return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
15122
15220
  }
15123
15221
  // TODO: keySpan should be required but was made optional to avoid changing VE parser.
15124
- parseEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15222
+ parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15125
15223
  if (name.length === 0) {
15126
15224
  this._reportError(`Event name is missing in binding`, sourceSpan);
15127
15225
  }
@@ -15130,21 +15228,21 @@ class BindingParser {
15130
15228
  if (keySpan !== undefined) {
15131
15229
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
15132
15230
  }
15133
- this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
15231
+ this._parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan);
15134
15232
  }
15135
15233
  else {
15136
- this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
15234
+ this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
15137
15235
  }
15138
15236
  }
15139
15237
  calcPossibleSecurityContexts(selector, propName, isAttribute) {
15140
15238
  const prop = this._schemaRegistry.getMappedPropName(propName);
15141
15239
  return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
15142
15240
  }
15143
- _parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
15241
+ _parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan) {
15144
15242
  const matches = splitAtPeriod(name, [name, '']);
15145
15243
  const eventName = matches[0];
15146
15244
  const phase = matches[1].toLowerCase();
15147
- const ast = this._parseAction(expression, handlerSpan);
15245
+ const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
15148
15246
  targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
15149
15247
  if (eventName.length === 0) {
15150
15248
  this._reportError(`Animation event name is missing in binding`, sourceSpan);
@@ -15158,20 +15256,20 @@ class BindingParser {
15158
15256
  this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
15159
15257
  }
15160
15258
  }
15161
- _parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15259
+ _parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
15162
15260
  // long format: 'target: eventName'
15163
15261
  const [target, eventName] = splitAtColon(name, [null, name]);
15164
- const ast = this._parseAction(expression, handlerSpan);
15262
+ const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
15165
15263
  targetMatchableAttrs.push([name, ast.source]);
15166
15264
  targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
15167
15265
  // Don't detect directives for event names for now,
15168
15266
  // so don't add the event name to the matchableAttrs
15169
15267
  }
15170
- _parseAction(value, sourceSpan) {
15268
+ _parseAction(value, isAssignmentEvent, sourceSpan) {
15171
15269
  const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
15172
15270
  const absoluteOffset = (sourceSpan && sourceSpan.start) ? sourceSpan.start.offset : 0;
15173
15271
  try {
15174
- const ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
15272
+ const ast = this._exprParser.parseAction(value, isAssignmentEvent, sourceInfo, absoluteOffset, this._interpolationConfig);
15175
15273
  if (ast) {
15176
15274
  this._reportExpressionParserErrors(ast.errors, sourceSpan);
15177
15275
  }
@@ -15633,7 +15731,7 @@ class HtmlAstToIvyAst {
15633
15731
  const events = [];
15634
15732
  const identifier = bindParts[IDENT_KW_IDX];
15635
15733
  const keySpan = createKeySpan(srcSpan, bindParts[KW_ON_IDX], identifier);
15636
- this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15734
+ this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15637
15735
  addEvents(events, boundEvents);
15638
15736
  }
15639
15737
  else if (bindParts[KW_BINDON_IDX]) {
@@ -15677,7 +15775,7 @@ class HtmlAstToIvyAst {
15677
15775
  }
15678
15776
  else {
15679
15777
  const events = [];
15680
- this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15778
+ this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
15681
15779
  addEvents(events, boundEvents);
15682
15780
  }
15683
15781
  return true;
@@ -15715,7 +15813,7 @@ class HtmlAstToIvyAst {
15715
15813
  }
15716
15814
  parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan) {
15717
15815
  const events = [];
15718
- this.bindingParser.parseEvent(`${name}Change`, `${expression}=$event`, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
15816
+ this.bindingParser.parseEvent(`${name}Change`, `${expression} =$event`, /* isAssignmentEvent */ true, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
15719
15817
  addEvents(events, boundEvents);
15720
15818
  }
15721
15819
  reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
@@ -16503,7 +16601,8 @@ class I18nMetaVisitor {
16503
16601
  */
16504
16602
  _parseMetadata(meta) {
16505
16603
  return typeof meta === 'string' ? parseI18nMeta(meta) :
16506
- meta instanceof Message ? meta : {};
16604
+ meta instanceof Message ? meta :
16605
+ {};
16507
16606
  }
16508
16607
  /**
16509
16608
  * Generate (or restore) message id if not specified already.
@@ -16528,9 +16627,9 @@ class I18nMetaVisitor {
16528
16627
  // `packages/compiler/src/render3/view/template.ts`).
16529
16628
  // In that case we want to reuse the legacy message generated in the 1st pass (see
16530
16629
  // `setI18nRefs()`).
16531
- const previousMessage = meta instanceof Message ?
16532
- meta :
16533
- meta instanceof IcuPlaceholder ? meta.previousMessage : undefined;
16630
+ const previousMessage = meta instanceof Message ? meta :
16631
+ meta instanceof IcuPlaceholder ? meta.previousMessage :
16632
+ undefined;
16534
16633
  message.legacyIds = previousMessage ? previousMessage.legacyIds : [];
16535
16634
  }
16536
16635
  }
@@ -16575,10 +16674,14 @@ function i18nMetaToJSDoc(meta) {
16575
16674
  if (meta.description) {
16576
16675
  tags.push({ tagName: "desc" /* Desc */, text: meta.description });
16577
16676
  }
16677
+ else {
16678
+ // Suppress the JSCompiler warning that a `@desc` was not given for this message.
16679
+ tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
16680
+ }
16578
16681
  if (meta.meaning) {
16579
16682
  tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
16580
16683
  }
16581
- return tags.length == 0 ? null : jsDocComment(tags);
16684
+ return jsDocComment(tags);
16582
16685
  }
16583
16686
 
16584
16687
  /** Closure uses `goog.getMsg(message)` to lookup translations */
@@ -16596,10 +16699,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
16596
16699
  // const MSG_... = goog.getMsg(..);
16597
16700
  // I18N_X = MSG_...;
16598
16701
  const googGetMsgStmt = closureVar.set(variable(GOOG_GET_MSG).callFn(args)).toConstDecl();
16599
- const metaComment = i18nMetaToJSDoc(message);
16600
- if (metaComment !== null) {
16601
- googGetMsgStmt.addLeadingComment(metaComment);
16602
- }
16702
+ googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
16603
16703
  const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
16604
16704
  return [googGetMsgStmt, i18nAssignmentStmt];
16605
16705
  }
@@ -16929,9 +17029,9 @@ class TemplateDefinitionBuilder {
16929
17029
  this.i18nEnd(null, selfClosingI18nInstruction);
16930
17030
  }
16931
17031
  // Generate all the creation mode instructions (e.g. resolve bindings in listeners)
16932
- const creationStatements = this._creationCodeFns.map((fn) => fn());
17032
+ const creationStatements = getInstructionStatements(this._creationCodeFns);
16933
17033
  // Generate all the update mode instructions (e.g. resolve property or text bindings)
16934
- const updateStatements = this._updateCodeFns.map((fn) => fn());
17034
+ const updateStatements = getInstructionStatements(this._updateCodeFns);
16935
17035
  // Variable declaration must occur after binding resolution so we can generate context
16936
17036
  // instructions that build on each other.
16937
17037
  // e.g. const b = nextContext().$implicit(); const b = nextContext();
@@ -17084,7 +17184,7 @@ class TemplateDefinitionBuilder {
17084
17184
  if (Object.keys(icuMapping).length) {
17085
17185
  args.push(mapLiteral(icuMapping, true));
17086
17186
  }
17087
- return instruction(null, Identifiers.i18nPostprocess, args);
17187
+ return invokeInstruction(null, Identifiers.i18nPostprocess, args);
17088
17188
  };
17089
17189
  }
17090
17190
  this.i18nTranslate(meta, params, context.ref, transformFn);
@@ -17119,14 +17219,12 @@ class TemplateDefinitionBuilder {
17119
17219
  // setup accumulated bindings
17120
17220
  const { index, bindings } = this.i18n;
17121
17221
  if (bindings.size) {
17122
- const chainBindings = [];
17123
- bindings.forEach(binding => {
17124
- chainBindings.push({ sourceSpan: span, value: () => this.convertPropertyBinding(binding) });
17125
- });
17126
- // for i18n block, advance to the most recent element index (by taking the current number of
17127
- // elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
17128
- // necessary lifecycle hooks of components/directives are properly flushed.
17129
- this.updateInstructionChainWithAdvance(this.getConstCount() - 1, Identifiers.i18nExp, chainBindings);
17222
+ for (const binding of bindings) {
17223
+ // for i18n block, advance to the most recent element index (by taking the current number of
17224
+ // elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
17225
+ // necessary lifecycle hooks of components/directives are properly flushed.
17226
+ this.updateInstructionWithAdvance(this.getConstCount() - 1, span, Identifiers.i18nExp, () => this.convertPropertyBinding(binding));
17227
+ }
17130
17228
  this.updateInstruction(span, Identifiers.i18nApply, [literal(index)]);
17131
17229
  }
17132
17230
  if (!selfClosing) {
@@ -17137,7 +17235,6 @@ class TemplateDefinitionBuilder {
17137
17235
  i18nAttributesInstruction(nodeIndex, attrs, sourceSpan) {
17138
17236
  let hasBindings = false;
17139
17237
  const i18nAttrArgs = [];
17140
- const bindings = [];
17141
17238
  attrs.forEach(attr => {
17142
17239
  const message = attr.i18n;
17143
17240
  const converted = attr.value.visit(this._valueConverter);
@@ -17148,16 +17245,10 @@ class TemplateDefinitionBuilder {
17148
17245
  i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
17149
17246
  converted.expressions.forEach(expression => {
17150
17247
  hasBindings = true;
17151
- bindings.push({
17152
- sourceSpan,
17153
- value: () => this.convertPropertyBinding(expression),
17154
- });
17248
+ this.updateInstructionWithAdvance(nodeIndex, sourceSpan, Identifiers.i18nExp, () => this.convertPropertyBinding(expression));
17155
17249
  });
17156
17250
  }
17157
17251
  });
17158
- if (bindings.length > 0) {
17159
- this.updateInstructionChainWithAdvance(nodeIndex, Identifiers.i18nExp, bindings);
17160
- }
17161
17252
  if (i18nAttrArgs.length > 0) {
17162
17253
  const index = literal(this.allocateDataSlot());
17163
17254
  const constIndex = this.addToConsts(literalArr(i18nAttrArgs));
@@ -17285,11 +17376,9 @@ class TemplateDefinitionBuilder {
17285
17376
  }
17286
17377
  // Generate Listeners (outputs)
17287
17378
  if (element.outputs.length > 0) {
17288
- const listeners = element.outputs.map((outputAst) => ({
17289
- sourceSpan: outputAst.sourceSpan,
17290
- params: this.prepareListenerParameter(element.name, outputAst, elementIndex)
17291
- }));
17292
- this.creationInstructionChain(Identifiers.listener, listeners);
17379
+ for (const outputAst of element.outputs) {
17380
+ this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(element.name, outputAst, elementIndex));
17381
+ }
17293
17382
  }
17294
17383
  // Note: it's important to keep i18n/i18nStart instructions after i18nAttributes and
17295
17384
  // listeners, to make sure i18nAttributes instruction targets current element at runtime.
@@ -17330,9 +17419,8 @@ class TemplateDefinitionBuilder {
17330
17419
  const hasValue = value instanceof LiteralPrimitive ? !!value.value : true;
17331
17420
  this.allocateBindingSlots(value);
17332
17421
  propertyBindings.push({
17333
- name: prepareSyntheticPropertyName(input.name),
17334
- sourceSpan: input.sourceSpan,
17335
- value: () => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction
17422
+ span: input.sourceSpan,
17423
+ paramsOrFn: getBindingFunctionParams(() => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction, prepareSyntheticPropertyName(input.name))
17336
17424
  });
17337
17425
  }
17338
17426
  else {
@@ -17369,10 +17457,8 @@ class TemplateDefinitionBuilder {
17369
17457
  // [prop]="value"
17370
17458
  // Collect all the properties so that we can chain into a single function at the end.
17371
17459
  propertyBindings.push({
17372
- name: attrName,
17373
- sourceSpan: input.sourceSpan,
17374
- value: () => this.convertPropertyBinding(value),
17375
- params
17460
+ span: input.sourceSpan,
17461
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), attrName, params)
17376
17462
  });
17377
17463
  }
17378
17464
  }
@@ -17386,10 +17472,8 @@ class TemplateDefinitionBuilder {
17386
17472
  // [attr.name]="value" or attr.name="{{value}}"
17387
17473
  // Collect the attribute bindings so that they can be chained at the end.
17388
17474
  attributeBindings.push({
17389
- name: attrName,
17390
- sourceSpan: input.sourceSpan,
17391
- value: () => this.convertPropertyBinding(boundValue),
17392
- params
17475
+ span: input.sourceSpan,
17476
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(boundValue), attrName, params)
17393
17477
  });
17394
17478
  }
17395
17479
  }
@@ -17405,11 +17489,11 @@ class TemplateDefinitionBuilder {
17405
17489
  }
17406
17490
  }
17407
17491
  });
17408
- if (propertyBindings.length > 0) {
17409
- this.updateInstructionChainWithAdvance(elementIndex, Identifiers.property, propertyBindings);
17492
+ for (const propertyBinding of propertyBindings) {
17493
+ this.updateInstructionWithAdvance(elementIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
17410
17494
  }
17411
- if (attributeBindings.length > 0) {
17412
- this.updateInstructionChainWithAdvance(elementIndex, Identifiers.attribute, attributeBindings);
17495
+ for (const attributeBinding of attributeBindings) {
17496
+ this.updateInstructionWithAdvance(elementIndex, attributeBinding.span, Identifiers.attribute, attributeBinding.paramsOrFn);
17413
17497
  }
17414
17498
  // Traverse element child nodes
17415
17499
  visitAll$1(this, element.children);
@@ -17488,12 +17572,8 @@ class TemplateDefinitionBuilder {
17488
17572
  this.templatePropertyBindings(templateIndex, inputs);
17489
17573
  }
17490
17574
  // Generate listeners for directive output
17491
- if (template.outputs.length > 0) {
17492
- const listeners = template.outputs.map((outputAst) => ({
17493
- sourceSpan: outputAst.sourceSpan,
17494
- params: this.prepareListenerParameter('ng_template', outputAst, templateIndex)
17495
- }));
17496
- this.creationInstructionChain(Identifiers.listener, listeners);
17575
+ for (const outputAst of template.outputs) {
17576
+ this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter('ng_template', outputAst, templateIndex));
17497
17577
  }
17498
17578
  }
17499
17579
  }
@@ -17548,7 +17628,7 @@ class TemplateDefinitionBuilder {
17548
17628
  const transformFn = (raw) => {
17549
17629
  const params = { ...vars, ...placeholders };
17550
17630
  const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
17551
- return instruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17631
+ return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17552
17632
  };
17553
17633
  // in case the whole i18n message is a single ICU - we do not need to
17554
17634
  // create a separate top-level translation, we can use the root ref instead
@@ -17590,32 +17670,33 @@ class TemplateDefinitionBuilder {
17590
17670
  }
17591
17671
  templatePropertyBindings(templateIndex, attrs) {
17592
17672
  const propertyBindings = [];
17593
- attrs.forEach(input => {
17594
- if (input instanceof BoundAttribute) {
17595
- const value = input.value.visit(this._valueConverter);
17596
- if (value !== undefined) {
17597
- this.allocateBindingSlots(value);
17598
- if (value instanceof Interpolation) {
17599
- // Params typically contain attribute namespace and value sanitizer, which is applicable
17600
- // for regular HTML elements, but not applicable for <ng-template> (since props act as
17601
- // inputs to directives), so keep params array empty.
17602
- const params = [];
17603
- // prop="{{value}}" case
17604
- this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
17605
- }
17606
- else {
17607
- // [prop]="value" case
17608
- propertyBindings.push({
17609
- name: input.name,
17610
- sourceSpan: input.sourceSpan,
17611
- value: () => this.convertPropertyBinding(value)
17612
- });
17613
- }
17614
- }
17673
+ for (const input of attrs) {
17674
+ if (!(input instanceof BoundAttribute)) {
17675
+ continue;
17615
17676
  }
17616
- });
17617
- if (propertyBindings.length > 0) {
17618
- this.updateInstructionChainWithAdvance(templateIndex, Identifiers.property, propertyBindings);
17677
+ const value = input.value.visit(this._valueConverter);
17678
+ if (value === undefined) {
17679
+ continue;
17680
+ }
17681
+ this.allocateBindingSlots(value);
17682
+ if (value instanceof Interpolation) {
17683
+ // Params typically contain attribute namespace and value sanitizer, which is applicable
17684
+ // for regular HTML elements, but not applicable for <ng-template> (since props act as
17685
+ // inputs to directives), so keep params array empty.
17686
+ const params = [];
17687
+ // prop="{{value}}" case
17688
+ this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
17689
+ }
17690
+ else {
17691
+ // [prop]="value" case
17692
+ propertyBindings.push({
17693
+ span: input.sourceSpan,
17694
+ paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), input.name)
17695
+ });
17696
+ }
17697
+ }
17698
+ for (const propertyBinding of propertyBindings) {
17699
+ this.updateInstructionWithAdvance(templateIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
17619
17700
  }
17620
17701
  }
17621
17702
  // Bindings must only be resolved after all local refs have been visited, so all
@@ -17623,39 +17704,23 @@ class TemplateDefinitionBuilder {
17623
17704
  // Otherwise, we wouldn't be able to support local refs that are defined after their
17624
17705
  // bindings. e.g. {{ foo }} <div #foo></div>
17625
17706
  instructionFn(fns, span, reference, paramsOrFn, prepend = false) {
17626
- fns[prepend ? 'unshift' : 'push'](() => {
17627
- const params = Array.isArray(paramsOrFn) ? paramsOrFn : paramsOrFn();
17628
- return instruction(span, reference, params).toStmt();
17629
- });
17707
+ fns[prepend ? 'unshift' : 'push']({ span, reference, paramsOrFn });
17630
17708
  }
17631
17709
  processStylingUpdateInstruction(elementIndex, instruction) {
17632
17710
  let allocateBindingSlots = 0;
17633
17711
  if (instruction) {
17634
- const calls = [];
17635
- instruction.calls.forEach(call => {
17712
+ for (const call of instruction.calls) {
17636
17713
  allocateBindingSlots += call.allocateBindingSlots;
17637
- calls.push({
17638
- sourceSpan: call.sourceSpan,
17639
- value: () => {
17640
- return call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
17641
- this.getUpdateInstructionArguments(value) :
17642
- this.convertPropertyBinding(value));
17643
- }
17644
- });
17645
- });
17646
- this.updateInstructionChainWithAdvance(elementIndex, instruction.reference, calls);
17714
+ this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
17715
+ this.getUpdateInstructionArguments(value) :
17716
+ this.convertPropertyBinding(value)));
17717
+ }
17647
17718
  }
17648
17719
  return allocateBindingSlots;
17649
17720
  }
17650
17721
  creationInstruction(span, reference, paramsOrFn, prepend) {
17651
17722
  this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend);
17652
17723
  }
17653
- creationInstructionChain(reference, calls) {
17654
- const span = calls.length ? calls[0].sourceSpan : null;
17655
- this._creationCodeFns.push(() => {
17656
- return chainedInstruction(reference, calls.map(call => call.params()), span).toStmt();
17657
- });
17658
- }
17659
17724
  updateInstructionWithAdvance(nodeIndex, span, reference, paramsOrFn) {
17660
17725
  this.addAdvanceInstructionIfNecessary(nodeIndex, span);
17661
17726
  this.updateInstruction(span, reference, paramsOrFn);
@@ -17663,28 +17728,6 @@ class TemplateDefinitionBuilder {
17663
17728
  updateInstruction(span, reference, paramsOrFn) {
17664
17729
  this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
17665
17730
  }
17666
- updateInstructionChain(reference, bindings) {
17667
- const span = bindings.length ? bindings[0].sourceSpan : null;
17668
- this._updateCodeFns.push(() => {
17669
- const calls = bindings.map(property => {
17670
- const value = property.value();
17671
- const fnParams = Array.isArray(value) ? value : [value];
17672
- if (property.params) {
17673
- fnParams.push(...property.params);
17674
- }
17675
- if (property.name) {
17676
- // We want the property name to always be the first function parameter.
17677
- fnParams.unshift(literal(property.name));
17678
- }
17679
- return fnParams;
17680
- });
17681
- return chainedInstruction(reference, calls, span).toStmt();
17682
- });
17683
- }
17684
- updateInstructionChainWithAdvance(nodeIndex, reference, bindings) {
17685
- this.addAdvanceInstructionIfNecessary(nodeIndex, bindings.length ? bindings[0].sourceSpan : null);
17686
- this.updateInstructionChain(reference, bindings);
17687
- }
17688
17731
  addAdvanceInstructionIfNecessary(nodeIndex, span) {
17689
17732
  if (nodeIndex !== this._currentIndex) {
17690
17733
  const delta = nodeIndex - this._currentIndex;
@@ -17970,9 +18013,6 @@ function pureFunctionCallInfo(args) {
17970
18013
  isVarLength: !identifier,
17971
18014
  };
17972
18015
  }
17973
- function instruction(span, reference, params) {
17974
- return importExpr(reference, null, span).callFn(params, span);
17975
- }
17976
18016
  // e.g. x(2);
17977
18017
  function generateNextContextExpr(relativeLevelDiff) {
17978
18018
  return importExpr(Identifiers.nextContext)
@@ -18177,7 +18217,7 @@ class BindingScope {
18177
18217
  restoreViewStatement() {
18178
18218
  const statements = [];
18179
18219
  if (this.restoreViewVariable) {
18180
- const restoreCall = instruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18220
+ const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18181
18221
  // Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
18182
18222
  // depending on whether it is being used.
18183
18223
  statements.push(this.usesRestoredViewContext ?
@@ -18189,7 +18229,9 @@ class BindingScope {
18189
18229
  viewSnapshotStatements() {
18190
18230
  // const $state$ = getCurrentView();
18191
18231
  return this.restoreViewVariable ?
18192
- [this.restoreViewVariable.set(instruction(null, Identifiers.getCurrentView, [])).toConstDecl()] :
18232
+ [
18233
+ this.restoreViewVariable.set(invokeInstruction(null, Identifiers.getCurrentView, [])).toConstDecl()
18234
+ ] :
18193
18235
  [];
18194
18236
  }
18195
18237
  isListenerScope() {
@@ -18462,6 +18504,20 @@ function isTextNode(node) {
18462
18504
  function hasTextChildrenOnly(children) {
18463
18505
  return children.every(isTextNode);
18464
18506
  }
18507
+ function getBindingFunctionParams(deferredParams, name, eagerParams) {
18508
+ return () => {
18509
+ const value = deferredParams();
18510
+ const fnParams = Array.isArray(value) ? value : [value];
18511
+ if (eagerParams) {
18512
+ fnParams.push(...eagerParams);
18513
+ }
18514
+ if (name) {
18515
+ // We want the property name to always be the first function parameter.
18516
+ fnParams.unshift(literal(name));
18517
+ }
18518
+ return fnParams;
18519
+ };
18520
+ }
18465
18521
  /** Name of the global variable that is used to determine if we use Closure translations or not */
18466
18522
  const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
18467
18523
  /**
@@ -18843,14 +18899,14 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18843
18899
  if (classAttr !== undefined) {
18844
18900
  styleBuilder.registerClassAttr(classAttr);
18845
18901
  }
18846
- const createStatements = [];
18847
- const updateStatements = [];
18902
+ const createInstructions = [];
18903
+ const updateInstructions = [];
18904
+ const updateVariables = [];
18848
18905
  const hostBindingSourceSpan = typeSourceSpan;
18849
18906
  // Calculate host event bindings
18850
18907
  const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
18851
18908
  if (eventBindings && eventBindings.length) {
18852
- const listeners = createHostListeners(eventBindings, name);
18853
- createStatements.push(...listeners);
18909
+ createInstructions.push(...createHostListeners(eventBindings, name));
18854
18910
  }
18855
18911
  // Calculate the host property bindings
18856
18912
  const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
@@ -18886,7 +18942,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18886
18942
  const propertyBindings = [];
18887
18943
  const attributeBindings = [];
18888
18944
  const syntheticHostBindings = [];
18889
- allOtherBindings.forEach((binding) => {
18945
+ for (const binding of allOtherBindings) {
18890
18946
  // resolve literal arrays and literal objects
18891
18947
  const value = binding.expression.visit(getValueConverter());
18892
18948
  const bindingExpr = bindingFn(bindingContext, value);
@@ -18912,7 +18968,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18912
18968
  if (sanitizerFn) {
18913
18969
  instructionParams.push(sanitizerFn);
18914
18970
  }
18915
- updateStatements.push(...bindingExpr.stmts);
18971
+ updateVariables.push(...bindingExpr.stmts);
18916
18972
  if (instruction === Identifiers.hostProperty) {
18917
18973
  propertyBindings.push(instructionParams);
18918
18974
  }
@@ -18923,17 +18979,17 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18923
18979
  syntheticHostBindings.push(instructionParams);
18924
18980
  }
18925
18981
  else {
18926
- updateStatements.push(importExpr(instruction).callFn(instructionParams).toStmt());
18982
+ updateInstructions.push({ reference: instruction, paramsOrFn: instructionParams, span: null });
18927
18983
  }
18928
- });
18929
- if (propertyBindings.length > 0) {
18930
- updateStatements.push(chainedInstruction(Identifiers.hostProperty, propertyBindings).toStmt());
18931
18984
  }
18932
- if (attributeBindings.length > 0) {
18933
- updateStatements.push(chainedInstruction(Identifiers.attribute, attributeBindings).toStmt());
18985
+ for (const bindingParams of propertyBindings) {
18986
+ updateInstructions.push({ reference: Identifiers.hostProperty, paramsOrFn: bindingParams, span: null });
18987
+ }
18988
+ for (const bindingParams of attributeBindings) {
18989
+ updateInstructions.push({ reference: Identifiers.attribute, paramsOrFn: bindingParams, span: null });
18934
18990
  }
18935
- if (syntheticHostBindings.length > 0) {
18936
- updateStatements.push(chainedInstruction(Identifiers.syntheticHostProperty, syntheticHostBindings).toStmt());
18991
+ for (const bindingParams of syntheticHostBindings) {
18992
+ updateInstructions.push({ reference: Identifiers.syntheticHostProperty, paramsOrFn: bindingParams, span: null });
18937
18993
  }
18938
18994
  // since we're dealing with directives/components and both have hostBinding
18939
18995
  // functions, we need to generate a special hostAttrs instruction that deals
@@ -18949,30 +19005,30 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
18949
19005
  // the update block of a component/directive templateFn/hostBindingsFn so that the bindings
18950
19006
  // are evaluated and updated for the element.
18951
19007
  styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(instruction => {
18952
- if (instruction.calls.length > 0) {
18953
- const calls = [];
18954
- instruction.calls.forEach(call => {
18955
- // we subtract a value of `1` here because the binding slot was already allocated
18956
- // at the top of this method when all the input bindings were counted.
18957
- totalHostVarsCount +=
18958
- Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
18959
- calls.push(convertStylingCall(call, bindingContext, bindingFn));
19008
+ for (const call of instruction.calls) {
19009
+ // we subtract a value of `1` here because the binding slot was already allocated
19010
+ // at the top of this method when all the input bindings were counted.
19011
+ totalHostVarsCount +=
19012
+ Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
19013
+ updateInstructions.push({
19014
+ reference: instruction.reference,
19015
+ paramsOrFn: convertStylingCall(call, bindingContext, bindingFn),
19016
+ span: null
18960
19017
  });
18961
- updateStatements.push(chainedInstruction(instruction.reference, calls).toStmt());
18962
19018
  }
18963
19019
  });
18964
19020
  }
18965
19021
  if (totalHostVarsCount) {
18966
19022
  definitionMap.set('hostVars', literal(totalHostVarsCount));
18967
19023
  }
18968
- if (createStatements.length > 0 || updateStatements.length > 0) {
19024
+ if (createInstructions.length > 0 || updateInstructions.length > 0) {
18969
19025
  const hostBindingsFnName = name ? `${name}_HostBindings` : null;
18970
19026
  const statements = [];
18971
- if (createStatements.length > 0) {
18972
- statements.push(renderFlagCheckIfStmt(1 /* Create */, createStatements));
19027
+ if (createInstructions.length > 0) {
19028
+ statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
18973
19029
  }
18974
- if (updateStatements.length > 0) {
18975
- statements.push(renderFlagCheckIfStmt(2 /* Update */, updateStatements));
19030
+ if (updateInstructions.length > 0) {
19031
+ statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
18976
19032
  }
18977
19033
  return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
18978
19034
  }
@@ -19008,10 +19064,10 @@ function getBindingNameAndInstruction(binding) {
19008
19064
  return { bindingName, instruction, isAttribute: !!attrMatches };
19009
19065
  }
19010
19066
  function createHostListeners(eventBindings, name) {
19011
- const listeners = [];
19012
- const syntheticListeners = [];
19067
+ const listenerParams = [];
19068
+ const syntheticListenerParams = [];
19013
19069
  const instructions = [];
19014
- eventBindings.forEach(binding => {
19070
+ for (const binding of eventBindings) {
19015
19071
  let bindingName = binding.name && sanitizeIdentifier(binding.name);
19016
19072
  const bindingFnName = binding.type === 1 /* Animation */ ?
19017
19073
  prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
@@ -19019,17 +19075,17 @@ function createHostListeners(eventBindings, name) {
19019
19075
  const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
19020
19076
  const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
19021
19077
  if (binding.type == 1 /* Animation */) {
19022
- syntheticListeners.push(params);
19078
+ syntheticListenerParams.push(params);
19023
19079
  }
19024
19080
  else {
19025
- listeners.push(params);
19081
+ listenerParams.push(params);
19026
19082
  }
19027
- });
19028
- if (syntheticListeners.length > 0) {
19029
- instructions.push(chainedInstruction(Identifiers.syntheticHostListener, syntheticListeners).toStmt());
19030
19083
  }
19031
- if (listeners.length > 0) {
19032
- instructions.push(chainedInstruction(Identifiers.listener, listeners).toStmt());
19084
+ for (const params of syntheticListenerParams) {
19085
+ instructions.push({ reference: Identifiers.syntheticHostListener, paramsOrFn: params, span: null });
19086
+ }
19087
+ for (const params of listenerParams) {
19088
+ instructions.push({ reference: Identifiers.listener, paramsOrFn: params, span: null });
19033
19089
  }
19034
19090
  return instructions;
19035
19091
  }
@@ -19150,6 +19206,7 @@ class CompilerFacadeImpl {
19150
19206
  deps: null,
19151
19207
  pipeName: facade.pipeName,
19152
19208
  pure: facade.pure,
19209
+ isStandalone: facade.isStandalone,
19153
19210
  };
19154
19211
  const res = compilePipeFromMetadata(metadata);
19155
19212
  return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
@@ -19410,6 +19467,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
19410
19467
  deps: null,
19411
19468
  typeArgumentCount: 0,
19412
19469
  fullInheritance: false,
19470
+ isStandalone: declaration.isStandalone ?? false,
19413
19471
  };
19414
19472
  }
19415
19473
  function convertHostDeclarationToMetadata(host = {}) {
@@ -19591,6 +19649,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
19591
19649
  pipeName: declaration.name,
19592
19650
  deps: null,
19593
19651
  pure: declaration.pure ?? true,
19652
+ isStandalone: declaration.isStandalone ?? false,
19594
19653
  };
19595
19654
  }
19596
19655
  function convertDeclareInjectorFacadeToMetadata(declaration) {
@@ -19617,7 +19676,7 @@ function publishFacade(global) {
19617
19676
  * Use of this source code is governed by an MIT-style license that can be
19618
19677
  * found in the LICENSE file at https://angular.io/license
19619
19678
  */
19620
- const VERSION = new Version('14.0.0-next.1');
19679
+ const VERSION = new Version('14.0.0-next.4');
19621
19680
 
19622
19681
  /**
19623
19682
  * @license
@@ -21658,7 +21717,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21658
21717
  function compileDeclareClassMetadata(metadata) {
21659
21718
  const definitionMap = new DefinitionMap();
21660
21719
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21661
- definitionMap.set('version', literal('14.0.0-next.1'));
21720
+ definitionMap.set('version', literal('14.0.0-next.4'));
21662
21721
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21663
21722
  definitionMap.set('type', metadata.type);
21664
21723
  definitionMap.set('decorators', metadata.decorators);
@@ -21775,7 +21834,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21775
21834
  function createDirectiveDefinitionMap(meta) {
21776
21835
  const definitionMap = new DefinitionMap();
21777
21836
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21778
- definitionMap.set('version', literal('14.0.0-next.1'));
21837
+ definitionMap.set('version', literal('14.0.0-next.4'));
21779
21838
  // e.g. `type: MyDirective`
21780
21839
  definitionMap.set('type', meta.internalType);
21781
21840
  // e.g. `selector: 'some-dir'`
@@ -21996,7 +22055,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
21996
22055
  function compileDeclareFactoryFunction(meta) {
21997
22056
  const definitionMap = new DefinitionMap();
21998
22057
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
21999
- definitionMap.set('version', literal('14.0.0-next.1'));
22058
+ definitionMap.set('version', literal('14.0.0-next.4'));
22000
22059
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22001
22060
  definitionMap.set('type', meta.internalType);
22002
22061
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22038,7 +22097,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22038
22097
  function createInjectableDefinitionMap(meta) {
22039
22098
  const definitionMap = new DefinitionMap();
22040
22099
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22041
- definitionMap.set('version', literal('14.0.0-next.1'));
22100
+ definitionMap.set('version', literal('14.0.0-next.4'));
22042
22101
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22043
22102
  definitionMap.set('type', meta.internalType);
22044
22103
  // Only generate providedIn property if it has a non-null value
@@ -22096,7 +22155,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22096
22155
  function createInjectorDefinitionMap(meta) {
22097
22156
  const definitionMap = new DefinitionMap();
22098
22157
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22099
- definitionMap.set('version', literal('14.0.0-next.1'));
22158
+ definitionMap.set('version', literal('14.0.0-next.4'));
22100
22159
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22101
22160
  definitionMap.set('type', meta.internalType);
22102
22161
  definitionMap.set('providers', meta.providers);
@@ -22133,7 +22192,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22133
22192
  function createNgModuleDefinitionMap(meta) {
22134
22193
  const definitionMap = new DefinitionMap();
22135
22194
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22136
- definitionMap.set('version', literal('14.0.0-next.1'));
22195
+ definitionMap.set('version', literal('14.0.0-next.4'));
22137
22196
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22138
22197
  definitionMap.set('type', meta.internalType);
22139
22198
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22191,7 +22250,7 @@ function compileDeclarePipeFromMetadata(meta) {
22191
22250
  function createPipeDefinitionMap(meta) {
22192
22251
  const definitionMap = new DefinitionMap();
22193
22252
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22194
- definitionMap.set('version', literal('14.0.0-next.1'));
22253
+ definitionMap.set('version', literal('14.0.0-next.4'));
22195
22254
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22196
22255
  // e.g. `type: MyPipe`
22197
22256
  definitionMap.set('type', meta.internalType);