@angular/language-service 9.0.3 → 9.0.7

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.0.3
2
+ * @license Angular v9.0.7
3
3
  * Copyright Google Inc. All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -7263,120 +7263,98 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7263
7263
  return ASTWithSource;
7264
7264
  }(AST));
7265
7265
  var TemplateBinding = /** @class */ (function () {
7266
- function TemplateBinding(span, sourceSpan, key, keyIsVar, name, expression) {
7266
+ function TemplateBinding(span, sourceSpan, key, keyIsVar, name, value) {
7267
7267
  this.span = span;
7268
7268
  this.key = key;
7269
7269
  this.keyIsVar = keyIsVar;
7270
7270
  this.name = name;
7271
- this.expression = expression;
7271
+ this.value = value;
7272
7272
  }
7273
7273
  return TemplateBinding;
7274
7274
  }());
7275
- var NullAstVisitor = /** @class */ (function () {
7276
- function NullAstVisitor() {
7277
- }
7278
- NullAstVisitor.prototype.visitBinary = function (ast, context) { };
7279
- NullAstVisitor.prototype.visitChain = function (ast, context) { };
7280
- NullAstVisitor.prototype.visitConditional = function (ast, context) { };
7281
- NullAstVisitor.prototype.visitFunctionCall = function (ast, context) { };
7282
- NullAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { };
7283
- NullAstVisitor.prototype.visitInterpolation = function (ast, context) { };
7284
- NullAstVisitor.prototype.visitKeyedRead = function (ast, context) { };
7285
- NullAstVisitor.prototype.visitKeyedWrite = function (ast, context) { };
7286
- NullAstVisitor.prototype.visitLiteralArray = function (ast, context) { };
7287
- NullAstVisitor.prototype.visitLiteralMap = function (ast, context) { };
7288
- NullAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { };
7289
- NullAstVisitor.prototype.visitMethodCall = function (ast, context) { };
7290
- NullAstVisitor.prototype.visitPipe = function (ast, context) { };
7291
- NullAstVisitor.prototype.visitPrefixNot = function (ast, context) { };
7292
- NullAstVisitor.prototype.visitNonNullAssert = function (ast, context) { };
7293
- NullAstVisitor.prototype.visitPropertyRead = function (ast, context) { };
7294
- NullAstVisitor.prototype.visitPropertyWrite = function (ast, context) { };
7295
- NullAstVisitor.prototype.visitQuote = function (ast, context) { };
7296
- NullAstVisitor.prototype.visitSafeMethodCall = function (ast, context) { };
7297
- NullAstVisitor.prototype.visitSafePropertyRead = function (ast, context) { };
7298
- return NullAstVisitor;
7299
- }());
7300
7275
  var RecursiveAstVisitor$1 = /** @class */ (function () {
7301
7276
  function RecursiveAstVisitor() {
7302
7277
  }
7278
+ RecursiveAstVisitor.prototype.visit = function (ast, context) {
7279
+ // The default implementation just visits every node.
7280
+ // Classes that extend RecursiveAstVisitor should override this function
7281
+ // to selectively visit the specified node.
7282
+ ast.visit(this, context);
7283
+ };
7303
7284
  RecursiveAstVisitor.prototype.visitBinary = function (ast, context) {
7304
- ast.left.visit(this, context);
7305
- ast.right.visit(this, context);
7306
- return null;
7285
+ this.visit(ast.left, context);
7286
+ this.visit(ast.right, context);
7307
7287
  };
7308
- RecursiveAstVisitor.prototype.visitChain = function (ast, context) { return this.visitAll(ast.expressions, context); };
7288
+ RecursiveAstVisitor.prototype.visitChain = function (ast, context) { this.visitAll(ast.expressions, context); };
7309
7289
  RecursiveAstVisitor.prototype.visitConditional = function (ast, context) {
7310
- ast.condition.visit(this, context);
7311
- ast.trueExp.visit(this, context);
7312
- ast.falseExp.visit(this, context);
7313
- return null;
7290
+ this.visit(ast.condition, context);
7291
+ this.visit(ast.trueExp, context);
7292
+ this.visit(ast.falseExp, context);
7314
7293
  };
7315
7294
  RecursiveAstVisitor.prototype.visitPipe = function (ast, context) {
7316
- ast.exp.visit(this, context);
7295
+ this.visit(ast.exp, context);
7317
7296
  this.visitAll(ast.args, context);
7318
- return null;
7319
7297
  };
7320
7298
  RecursiveAstVisitor.prototype.visitFunctionCall = function (ast, context) {
7321
- ast.target.visit(this, context);
7299
+ if (ast.target) {
7300
+ this.visit(ast.target, context);
7301
+ }
7322
7302
  this.visitAll(ast.args, context);
7323
- return null;
7324
7303
  };
7325
- RecursiveAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { return null; };
7304
+ RecursiveAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { };
7326
7305
  RecursiveAstVisitor.prototype.visitInterpolation = function (ast, context) {
7327
- return this.visitAll(ast.expressions, context);
7306
+ this.visitAll(ast.expressions, context);
7328
7307
  };
7329
7308
  RecursiveAstVisitor.prototype.visitKeyedRead = function (ast, context) {
7330
- ast.obj.visit(this, context);
7331
- ast.key.visit(this, context);
7332
- return null;
7309
+ this.visit(ast.obj, context);
7310
+ this.visit(ast.key, context);
7333
7311
  };
7334
7312
  RecursiveAstVisitor.prototype.visitKeyedWrite = function (ast, context) {
7335
- ast.obj.visit(this, context);
7336
- ast.key.visit(this, context);
7337
- ast.value.visit(this, context);
7338
- return null;
7313
+ this.visit(ast.obj, context);
7314
+ this.visit(ast.key, context);
7315
+ this.visit(ast.value, context);
7339
7316
  };
7340
7317
  RecursiveAstVisitor.prototype.visitLiteralArray = function (ast, context) {
7341
- return this.visitAll(ast.expressions, context);
7318
+ this.visitAll(ast.expressions, context);
7342
7319
  };
7343
- RecursiveAstVisitor.prototype.visitLiteralMap = function (ast, context) { return this.visitAll(ast.values, context); };
7344
- RecursiveAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { return null; };
7320
+ RecursiveAstVisitor.prototype.visitLiteralMap = function (ast, context) { this.visitAll(ast.values, context); };
7321
+ RecursiveAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { };
7345
7322
  RecursiveAstVisitor.prototype.visitMethodCall = function (ast, context) {
7346
- ast.receiver.visit(this, context);
7347
- return this.visitAll(ast.args, context);
7348
- };
7349
- RecursiveAstVisitor.prototype.visitPrefixNot = function (ast, context) {
7350
- ast.expression.visit(this, context);
7351
- return null;
7352
- };
7353
- RecursiveAstVisitor.prototype.visitNonNullAssert = function (ast, context) {
7354
- ast.expression.visit(this, context);
7355
- return null;
7356
- };
7357
- RecursiveAstVisitor.prototype.visitPropertyRead = function (ast, context) {
7358
- ast.receiver.visit(this, context);
7359
- return null;
7323
+ this.visit(ast.receiver, context);
7324
+ this.visitAll(ast.args, context);
7360
7325
  };
7326
+ RecursiveAstVisitor.prototype.visitPrefixNot = function (ast, context) { this.visit(ast.expression, context); };
7327
+ RecursiveAstVisitor.prototype.visitNonNullAssert = function (ast, context) { this.visit(ast.expression, context); };
7328
+ RecursiveAstVisitor.prototype.visitPropertyRead = function (ast, context) { this.visit(ast.receiver, context); };
7361
7329
  RecursiveAstVisitor.prototype.visitPropertyWrite = function (ast, context) {
7362
- ast.receiver.visit(this, context);
7363
- ast.value.visit(this, context);
7364
- return null;
7330
+ this.visit(ast.receiver, context);
7331
+ this.visit(ast.value, context);
7365
7332
  };
7366
7333
  RecursiveAstVisitor.prototype.visitSafePropertyRead = function (ast, context) {
7367
- ast.receiver.visit(this, context);
7368
- return null;
7334
+ this.visit(ast.receiver, context);
7369
7335
  };
7370
7336
  RecursiveAstVisitor.prototype.visitSafeMethodCall = function (ast, context) {
7371
- ast.receiver.visit(this, context);
7372
- return this.visitAll(ast.args, context);
7337
+ this.visit(ast.receiver, context);
7338
+ this.visitAll(ast.args, context);
7373
7339
  };
7340
+ RecursiveAstVisitor.prototype.visitQuote = function (ast, context) { };
7341
+ // This is not part of the AstVisitor interface, just a helper method
7374
7342
  RecursiveAstVisitor.prototype.visitAll = function (asts, context) {
7375
- var _this = this;
7376
- asts.forEach(function (ast) { return ast.visit(_this, context); });
7377
- return null;
7343
+ var e_1, _a;
7344
+ try {
7345
+ for (var asts_1 = __values(asts), asts_1_1 = asts_1.next(); !asts_1_1.done; asts_1_1 = asts_1.next()) {
7346
+ var ast = asts_1_1.value;
7347
+ this.visit(ast, context);
7348
+ }
7349
+ }
7350
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
7351
+ finally {
7352
+ try {
7353
+ if (asts_1_1 && !asts_1_1.done && (_a = asts_1.return)) _a.call(asts_1);
7354
+ }
7355
+ finally { if (e_1) throw e_1.error; }
7356
+ }
7378
7357
  };
7379
- RecursiveAstVisitor.prototype.visitQuote = function (ast, context) { return null; };
7380
7358
  return RecursiveAstVisitor;
7381
7359
  }());
7382
7360
  var AstTransformer$1 = /** @class */ (function () {
@@ -7599,65 +7577,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7599
7577
  AstMemoryEfficientTransformer.prototype.visitQuote = function (ast, context) { return ast; };
7600
7578
  return AstMemoryEfficientTransformer;
7601
7579
  }());
7602
- function visitAstChildren(ast, visitor, context) {
7603
- function visit(ast) {
7604
- visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
7605
- }
7606
- function visitAll(asts) { asts.forEach(visit); }
7607
- ast.visit({
7608
- visitBinary: function (ast) {
7609
- visit(ast.left);
7610
- visit(ast.right);
7611
- },
7612
- visitChain: function (ast) { visitAll(ast.expressions); },
7613
- visitConditional: function (ast) {
7614
- visit(ast.condition);
7615
- visit(ast.trueExp);
7616
- visit(ast.falseExp);
7617
- },
7618
- visitFunctionCall: function (ast) {
7619
- if (ast.target) {
7620
- visit(ast.target);
7621
- }
7622
- visitAll(ast.args);
7623
- },
7624
- visitImplicitReceiver: function (ast) { },
7625
- visitInterpolation: function (ast) { visitAll(ast.expressions); },
7626
- visitKeyedRead: function (ast) {
7627
- visit(ast.obj);
7628
- visit(ast.key);
7629
- },
7630
- visitKeyedWrite: function (ast) {
7631
- visit(ast.obj);
7632
- visit(ast.key);
7633
- visit(ast.obj);
7634
- },
7635
- visitLiteralArray: function (ast) { visitAll(ast.expressions); },
7636
- visitLiteralMap: function (ast) { },
7637
- visitLiteralPrimitive: function (ast) { },
7638
- visitMethodCall: function (ast) {
7639
- visit(ast.receiver);
7640
- visitAll(ast.args);
7641
- },
7642
- visitPipe: function (ast) {
7643
- visit(ast.exp);
7644
- visitAll(ast.args);
7645
- },
7646
- visitPrefixNot: function (ast) { visit(ast.expression); },
7647
- visitNonNullAssert: function (ast) { visit(ast.expression); },
7648
- visitPropertyRead: function (ast) { visit(ast.receiver); },
7649
- visitPropertyWrite: function (ast) {
7650
- visit(ast.receiver);
7651
- visit(ast.value);
7652
- },
7653
- visitQuote: function (ast) { },
7654
- visitSafeMethodCall: function (ast) {
7655
- visit(ast.receiver);
7656
- visitAll(ast.args);
7657
- },
7658
- visitSafePropertyRead: function (ast) { visit(ast.receiver); },
7659
- });
7660
- }
7661
7580
  // Bindings
7662
7581
  var ParsedProperty = /** @class */ (function () {
7663
7582
  function ParsedProperty(name, expression, type, sourceSpan, valueSpan) {
@@ -11560,8 +11479,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11560
11479
  if (binding.keyIsVar) {
11561
11480
  targetVars.push(new ParsedVariable(binding.key, binding.name, sourceSpan));
11562
11481
  }
11563
- else if (binding.expression) {
11564
- this._parsePropertyAst(binding.key, binding.expression, sourceSpan, undefined, targetMatchableAttrs, targetProps);
11482
+ else if (binding.value) {
11483
+ this._parsePropertyAst(binding.key, binding.value, sourceSpan, undefined, targetMatchableAttrs, targetProps);
11565
11484
  }
11566
11485
  else {
11567
11486
  targetMatchableAttrs.push([binding.key, '']);
@@ -11584,8 +11503,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11584
11503
  var bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo, absoluteValueOffset);
11585
11504
  this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
11586
11505
  bindingsResult.templateBindings.forEach(function (binding) {
11587
- if (binding.expression) {
11588
- _this._checkPipes(binding.expression, sourceSpan);
11506
+ if (binding.value) {
11507
+ _this._checkPipes(binding.value, sourceSpan);
11589
11508
  }
11590
11509
  });
11591
11510
  bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
@@ -12902,8 +12821,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12902
12821
  var binding = null;
12903
12822
  var prefix = name.substring(0, 6);
12904
12823
  var isStyle = name === 'style' || prefix === 'style.' || prefix === 'style!';
12905
- var isClass = !isStyle &&
12906
- (name === 'class' || name === 'className' || prefix === 'class.' || prefix === 'class!');
12824
+ var isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
12907
12825
  if (isStyle || isClass) {
12908
12826
  var isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
12909
12827
  var property = name.substr(isMapBased ? 5 : 6); // the dot explains why there's a +1
@@ -13744,10 +13662,34 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13744
13662
  var span = new ParseSpan(0, input.length);
13745
13663
  return new Quote(span, span.toAbsolute(absoluteOffset), prefix, uninterpretedExpression, location);
13746
13664
  };
13747
- Parser.prototype.parseTemplateBindings = function (tplKey, tplValue, location, absoluteOffset) {
13748
- var tokens = this._lexer.tokenize(tplValue);
13749
- return new _ParseAST(tplValue, location, absoluteOffset, tokens, tplValue.length, false, this.errors, 0)
13750
- .parseTemplateBindings(tplKey);
13665
+ /**
13666
+ * Parse microsyntax template expression and return a list of bindings or
13667
+ * parsing errors in case the given expression is invalid.
13668
+ *
13669
+ * For example,
13670
+ * ```
13671
+ * <div *ngFor="let item of items">
13672
+ * ^ `absoluteOffset` for `tplValue`
13673
+ * ```
13674
+ * contains three bindings:
13675
+ * 1. ngFor -> null
13676
+ * 2. item -> NgForOfContext.$implicit
13677
+ * 3. ngForOf -> items
13678
+ *
13679
+ * This is apparent from the de-sugared template:
13680
+ * ```
13681
+ * <ng-template ngFor let-item [ngForOf]="items">
13682
+ * ```
13683
+ *
13684
+ * @param templateKey name of directive, without the * prefix. For example: ngIf, ngFor
13685
+ * @param templateValue RHS of the microsyntax attribute
13686
+ * @param templateUrl template filename if it's external, component filename if it's inline
13687
+ * @param absoluteOffset absolute offset of the `tplValue`
13688
+ */
13689
+ Parser.prototype.parseTemplateBindings = function (templateKey, templateValue, templateUrl, absoluteOffset) {
13690
+ var tokens = this._lexer.tokenize(templateValue);
13691
+ return new _ParseAST(templateValue, templateUrl, absoluteOffset, tokens, templateValue.length, false /* parseAction */, this.errors, 0 /* relative offset */)
13692
+ .parseTemplateBindings(templateKey);
13751
13693
  };
13752
13694
  Parser.prototype.parseInterpolation = function (input, location, absoluteOffset, interpolationConfig) {
13753
13695
  if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
@@ -13895,7 +13837,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13895
13837
  return this.sourceSpanCache.get(serial);
13896
13838
  };
13897
13839
  _ParseAST.prototype.advance = function () { this.index++; };
13898
- _ParseAST.prototype.optionalCharacter = function (code) {
13840
+ _ParseAST.prototype.consumeOptionalCharacter = function (code) {
13899
13841
  if (this.next.isCharacter(code)) {
13900
13842
  this.advance();
13901
13843
  return true;
@@ -13907,11 +13849,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13907
13849
  _ParseAST.prototype.peekKeywordLet = function () { return this.next.isKeywordLet(); };
13908
13850
  _ParseAST.prototype.peekKeywordAs = function () { return this.next.isKeywordAs(); };
13909
13851
  _ParseAST.prototype.expectCharacter = function (code) {
13910
- if (this.optionalCharacter(code))
13852
+ if (this.consumeOptionalCharacter(code))
13911
13853
  return;
13912
13854
  this.error("Missing expected " + String.fromCharCode(code));
13913
13855
  };
13914
- _ParseAST.prototype.optionalOperator = function (op) {
13856
+ _ParseAST.prototype.consumeOptionalOperator = function (op) {
13915
13857
  if (this.next.isOperator(op)) {
13916
13858
  this.advance();
13917
13859
  return true;
@@ -13921,7 +13863,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13921
13863
  }
13922
13864
  };
13923
13865
  _ParseAST.prototype.expectOperator = function (operator) {
13924
- if (this.optionalOperator(operator))
13866
+ if (this.consumeOptionalOperator(operator))
13925
13867
  return;
13926
13868
  this.error("Missing expected operator " + operator);
13927
13869
  };
@@ -13949,11 +13891,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13949
13891
  while (this.index < this.tokens.length) {
13950
13892
  var expr = this.parsePipe();
13951
13893
  exprs.push(expr);
13952
- if (this.optionalCharacter($SEMICOLON)) {
13894
+ if (this.consumeOptionalCharacter($SEMICOLON)) {
13953
13895
  if (!this.parseAction) {
13954
13896
  this.error('Binding expression cannot contain chained expression');
13955
13897
  }
13956
- while (this.optionalCharacter($SEMICOLON)) {
13898
+ while (this.consumeOptionalCharacter($SEMICOLON)) {
13957
13899
  } // read all semicolons
13958
13900
  }
13959
13901
  else if (this.index < this.tokens.length) {
@@ -13968,7 +13910,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13968
13910
  };
13969
13911
  _ParseAST.prototype.parsePipe = function () {
13970
13912
  var result = this.parseExpression();
13971
- if (this.optionalOperator('|')) {
13913
+ if (this.consumeOptionalOperator('|')) {
13972
13914
  if (this.parseAction) {
13973
13915
  this.error('Cannot have a pipe in an action expression');
13974
13916
  }
@@ -13977,13 +13919,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13977
13919
  var name_1 = this.expectIdentifierOrKeyword();
13978
13920
  var nameSpan = this.sourceSpan(nameStart);
13979
13921
  var args = [];
13980
- while (this.optionalCharacter($COLON)) {
13922
+ while (this.consumeOptionalCharacter($COLON)) {
13981
13923
  args.push(this.parseExpression());
13982
13924
  }
13983
13925
  var start = result.span.start;
13984
13926
  result =
13985
13927
  new BindingPipe(this.span(start), this.sourceSpan(start), result, name_1, args, nameSpan);
13986
- } while (this.optionalOperator('|'));
13928
+ } while (this.consumeOptionalOperator('|'));
13987
13929
  }
13988
13930
  return result;
13989
13931
  };
@@ -13991,10 +13933,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13991
13933
  _ParseAST.prototype.parseConditional = function () {
13992
13934
  var start = this.inputIndex;
13993
13935
  var result = this.parseLogicalOr();
13994
- if (this.optionalOperator('?')) {
13936
+ if (this.consumeOptionalOperator('?')) {
13995
13937
  var yes = this.parsePipe();
13996
13938
  var no = void 0;
13997
- if (!this.optionalCharacter($COLON)) {
13939
+ if (!this.consumeOptionalCharacter($COLON)) {
13998
13940
  var end = this.inputIndex;
13999
13941
  var expression = this.input.substring(start, end);
14000
13942
  this.error("Conditional expression " + expression + " requires all 3 expressions");
@@ -14012,7 +13954,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14012
13954
  _ParseAST.prototype.parseLogicalOr = function () {
14013
13955
  // '||'
14014
13956
  var result = this.parseLogicalAnd();
14015
- while (this.optionalOperator('||')) {
13957
+ while (this.consumeOptionalOperator('||')) {
14016
13958
  var right = this.parseLogicalAnd();
14017
13959
  var start = result.span.start;
14018
13960
  result = new Binary(this.span(start), this.sourceSpan(start), '||', result, right);
@@ -14022,7 +13964,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14022
13964
  _ParseAST.prototype.parseLogicalAnd = function () {
14023
13965
  // '&&'
14024
13966
  var result = this.parseEquality();
14025
- while (this.optionalOperator('&&')) {
13967
+ while (this.consumeOptionalOperator('&&')) {
14026
13968
  var right = this.parseEquality();
14027
13969
  var start = result.span.start;
14028
13970
  result = new Binary(this.span(start), this.sourceSpan(start), '&&', result, right);
@@ -14134,18 +14076,18 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14134
14076
  var result = this.parsePrimary();
14135
14077
  var resultStart = result.span.start;
14136
14078
  while (true) {
14137
- if (this.optionalCharacter($PERIOD)) {
14079
+ if (this.consumeOptionalCharacter($PERIOD)) {
14138
14080
  result = this.parseAccessMemberOrMethodCall(result, false);
14139
14081
  }
14140
- else if (this.optionalOperator('?.')) {
14082
+ else if (this.consumeOptionalOperator('?.')) {
14141
14083
  result = this.parseAccessMemberOrMethodCall(result, true);
14142
14084
  }
14143
- else if (this.optionalCharacter($LBRACKET)) {
14085
+ else if (this.consumeOptionalCharacter($LBRACKET)) {
14144
14086
  this.rbracketsExpected++;
14145
14087
  var key = this.parsePipe();
14146
14088
  this.rbracketsExpected--;
14147
14089
  this.expectCharacter($RBRACKET);
14148
- if (this.optionalOperator('=')) {
14090
+ if (this.consumeOptionalOperator('=')) {
14149
14091
  var value = this.parseConditional();
14150
14092
  result = new KeyedWrite(this.span(resultStart), this.sourceSpan(resultStart), result, key, value);
14151
14093
  }
@@ -14153,7 +14095,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14153
14095
  result = new KeyedRead(this.span(resultStart), this.sourceSpan(resultStart), result, key);
14154
14096
  }
14155
14097
  }
14156
- else if (this.optionalCharacter($LPAREN)) {
14098
+ else if (this.consumeOptionalCharacter($LPAREN)) {
14157
14099
  this.rparensExpected++;
14158
14100
  var args = this.parseCallArguments();
14159
14101
  this.rparensExpected--;
@@ -14161,7 +14103,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14161
14103
  result =
14162
14104
  new FunctionCall(this.span(resultStart), this.sourceSpan(resultStart), result, args);
14163
14105
  }
14164
- else if (this.optionalOperator('!')) {
14106
+ else if (this.consumeOptionalOperator('!')) {
14165
14107
  result = new NonNullAssert(this.span(resultStart), this.sourceSpan(resultStart), result);
14166
14108
  }
14167
14109
  else {
@@ -14171,7 +14113,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14171
14113
  };
14172
14114
  _ParseAST.prototype.parsePrimary = function () {
14173
14115
  var start = this.inputIndex;
14174
- if (this.optionalCharacter($LPAREN)) {
14116
+ if (this.consumeOptionalCharacter($LPAREN)) {
14175
14117
  this.rparensExpected++;
14176
14118
  var result = this.parsePipe();
14177
14119
  this.rparensExpected--;
@@ -14198,7 +14140,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14198
14140
  this.advance();
14199
14141
  return new ImplicitReceiver(this.span(start), this.sourceSpan(start));
14200
14142
  }
14201
- else if (this.optionalCharacter($LBRACKET)) {
14143
+ else if (this.consumeOptionalCharacter($LBRACKET)) {
14202
14144
  this.rbracketsExpected++;
14203
14145
  var elements = this.parseExpressionList($RBRACKET);
14204
14146
  this.rbracketsExpected--;
@@ -14235,7 +14177,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14235
14177
  if (!this.next.isCharacter(terminator)) {
14236
14178
  do {
14237
14179
  result.push(this.parsePipe());
14238
- } while (this.optionalCharacter($COMMA));
14180
+ } while (this.consumeOptionalCharacter($COMMA));
14239
14181
  }
14240
14182
  return result;
14241
14183
  };
@@ -14244,7 +14186,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14244
14186
  var values = [];
14245
14187
  var start = this.inputIndex;
14246
14188
  this.expectCharacter($LBRACE);
14247
- if (!this.optionalCharacter($RBRACE)) {
14189
+ if (!this.consumeOptionalCharacter($RBRACE)) {
14248
14190
  this.rbracesExpected++;
14249
14191
  do {
14250
14192
  var quoted = this.next.isString();
@@ -14252,7 +14194,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14252
14194
  keys.push({ key: key, quoted: quoted });
14253
14195
  this.expectCharacter($COLON);
14254
14196
  values.push(this.parsePipe());
14255
- } while (this.optionalCharacter($COMMA));
14197
+ } while (this.consumeOptionalCharacter($COMMA));
14256
14198
  this.rbracesExpected--;
14257
14199
  this.expectCharacter($RBRACE);
14258
14200
  }
@@ -14262,7 +14204,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14262
14204
  if (isSafe === void 0) { isSafe = false; }
14263
14205
  var start = receiver.span.start;
14264
14206
  var id = this.expectIdentifierOrKeyword();
14265
- if (this.optionalCharacter($LPAREN)) {
14207
+ if (this.consumeOptionalCharacter($LPAREN)) {
14266
14208
  this.rparensExpected++;
14267
14209
  var args = this.parseCallArguments();
14268
14210
  this.expectCharacter($RPAREN);
@@ -14274,7 +14216,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14274
14216
  }
14275
14217
  else {
14276
14218
  if (isSafe) {
14277
- if (this.optionalOperator('=')) {
14219
+ if (this.consumeOptionalOperator('=')) {
14278
14220
  this.error('The \'?.\' operator cannot be used in the assignment');
14279
14221
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
14280
14222
  }
@@ -14283,7 +14225,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14283
14225
  }
14284
14226
  }
14285
14227
  else {
14286
- if (this.optionalOperator('=')) {
14228
+ if (this.consumeOptionalOperator('=')) {
14287
14229
  if (!this.parseAction) {
14288
14230
  this.error('Bindings cannot contain assignments');
14289
14231
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
@@ -14304,81 +14246,193 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14304
14246
  var positionals = [];
14305
14247
  do {
14306
14248
  positionals.push(this.parsePipe());
14307
- } while (this.optionalCharacter($COMMA));
14249
+ } while (this.consumeOptionalCharacter($COMMA));
14308
14250
  return positionals;
14309
14251
  };
14310
14252
  /**
14311
- * An identifier, a keyword, a string with an optional `-` in between.
14253
+ * Parses an identifier, a keyword, a string with an optional `-` in between.
14312
14254
  */
14313
14255
  _ParseAST.prototype.expectTemplateBindingKey = function () {
14314
14256
  var result = '';
14315
14257
  var operatorFound = false;
14258
+ var start = this.inputIndex;
14316
14259
  do {
14317
14260
  result += this.expectIdentifierOrKeywordOrString();
14318
- operatorFound = this.optionalOperator('-');
14261
+ operatorFound = this.consumeOptionalOperator('-');
14319
14262
  if (operatorFound) {
14320
14263
  result += '-';
14321
14264
  }
14322
14265
  } while (operatorFound);
14323
- return result.toString();
14266
+ return {
14267
+ key: result,
14268
+ keySpan: new ParseSpan(start, start + result.length),
14269
+ };
14324
14270
  };
14325
- // Parses the AST for `<some-tag *tplKey=AST>`
14326
- _ParseAST.prototype.parseTemplateBindings = function (tplKey) {
14327
- var firstBinding = true;
14271
+ /**
14272
+ * Parse microsyntax template expression and return a list of bindings or
14273
+ * parsing errors in case the given expression is invalid.
14274
+ *
14275
+ * For example,
14276
+ * ```
14277
+ * <div *ngFor="let item of items; index as i; trackBy: func">
14278
+ * ```
14279
+ * contains five bindings:
14280
+ * 1. ngFor -> null
14281
+ * 2. item -> NgForOfContext.$implicit
14282
+ * 3. ngForOf -> items
14283
+ * 4. i -> NgForOfContext.index
14284
+ * 5. ngForTrackBy -> func
14285
+ *
14286
+ * For a full description of the microsyntax grammar, see
14287
+ * https://gist.github.com/mhevery/d3530294cff2e4a1b3fe15ff75d08855
14288
+ *
14289
+ * @param templateKey name of the microsyntax directive, like ngIf, ngFor, without the *
14290
+ */
14291
+ _ParseAST.prototype.parseTemplateBindings = function (templateKey) {
14328
14292
  var bindings = [];
14329
- var warnings = [];
14330
- do {
14331
- var start = this.inputIndex;
14332
- var rawKey = void 0;
14333
- var key = void 0;
14334
- var isVar = false;
14335
- if (firstBinding) {
14336
- rawKey = key = tplKey;
14337
- firstBinding = false;
14293
+ // The first binding is for the template key itself
14294
+ // In *ngFor="let item of items", key = "ngFor", value = null
14295
+ // In *ngIf="cond | pipe", key = "ngIf", value = "cond | pipe"
14296
+ bindings.push.apply(bindings, __spread(this.parseDirectiveKeywordBindings(templateKey, new ParseSpan(0, templateKey.length), this.absoluteOffset)));
14297
+ while (this.index < this.tokens.length) {
14298
+ // If it starts with 'let', then this must be variable declaration
14299
+ var letBinding = this.parseLetBinding();
14300
+ if (letBinding) {
14301
+ bindings.push(letBinding);
14338
14302
  }
14339
14303
  else {
14340
- isVar = this.peekKeywordLet();
14341
- if (isVar)
14342
- this.advance();
14343
- rawKey = this.expectTemplateBindingKey();
14344
- key = isVar ? rawKey : tplKey + rawKey[0].toUpperCase() + rawKey.substring(1);
14345
- this.optionalCharacter($COLON);
14346
- }
14347
- var name_2 = null;
14348
- var expression = null;
14349
- if (isVar) {
14350
- if (this.optionalOperator('=')) {
14351
- name_2 = this.expectTemplateBindingKey();
14304
+ // Two possible cases here, either `value "as" key` or
14305
+ // "directive-keyword expression". We don't know which case, but both
14306
+ // "value" and "directive-keyword" are template binding key, so consume
14307
+ // the key first.
14308
+ var _a = this.expectTemplateBindingKey(), key = _a.key, keySpan = _a.keySpan;
14309
+ // Peek at the next token, if it is "as" then this must be variable
14310
+ // declaration.
14311
+ var binding = this.parseAsBinding(key, keySpan, this.absoluteOffset);
14312
+ if (binding) {
14313
+ bindings.push(binding);
14352
14314
  }
14353
14315
  else {
14354
- name_2 = '\$implicit';
14316
+ // Otherwise the key must be a directive keyword, like "of". Transform
14317
+ // the key to actual key. Eg. of -> ngForOf, trackBy -> ngForTrackBy
14318
+ var actualKey = templateKey + key[0].toUpperCase() + key.substring(1);
14319
+ bindings.push.apply(bindings, __spread(this.parseDirectiveKeywordBindings(actualKey, keySpan, this.absoluteOffset)));
14355
14320
  }
14356
14321
  }
14357
- else if (this.peekKeywordAs()) {
14358
- this.advance(); // consume `as`
14359
- name_2 = rawKey;
14360
- key = this.expectTemplateBindingKey(); // read local var name
14361
- isVar = true;
14362
- }
14363
- else if (this.next !== EOF && !this.peekKeywordLet()) {
14364
- var start_1 = this.inputIndex;
14365
- var ast = this.parsePipe();
14366
- var source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
14367
- expression =
14368
- new ASTWithSource(ast, source, this.location, this.absoluteOffset + start_1, this.errors);
14369
- }
14370
- bindings.push(new TemplateBinding(this.span(start), this.sourceSpan(start), key, isVar, name_2, expression));
14371
- if (this.peekKeywordAs() && !isVar) {
14372
- var letStart = this.inputIndex;
14373
- this.advance(); // consume `as`
14374
- var letName = this.expectTemplateBindingKey(); // read local var name
14375
- bindings.push(new TemplateBinding(this.span(letStart), this.sourceSpan(letStart), letName, true, key, null));
14376
- }
14377
- if (!this.optionalCharacter($SEMICOLON)) {
14378
- this.optionalCharacter($COMMA);
14379
- }
14380
- } while (this.index < this.tokens.length);
14381
- return new TemplateBindingParseResult(bindings, warnings, this.errors);
14322
+ this.consumeStatementTerminator();
14323
+ }
14324
+ return new TemplateBindingParseResult(bindings, [] /* warnings */, this.errors);
14325
+ };
14326
+ /**
14327
+ * Parse a directive keyword, followed by a mandatory expression.
14328
+ * For example, "of items", "trackBy: func".
14329
+ * The bindings are: ngForOf -> items, ngForTrackBy -> func
14330
+ * There could be an optional "as" binding that follows the expression.
14331
+ * For example,
14332
+ * ```
14333
+ * *ngFor="let item of items | slice:0:1 as collection".`
14334
+ * ^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
14335
+ * keyword bound target optional 'as' binding
14336
+ * ```
14337
+ *
14338
+ * @param key binding key, for example, ngFor, ngIf, ngForOf
14339
+ * @param keySpan span of the key in the expression. keySpan might be different
14340
+ * from `key.length`. For example, the span for key "ngForOf" is "of".
14341
+ * @param absoluteOffset absolute offset of the attribute value
14342
+ */
14343
+ _ParseAST.prototype.parseDirectiveKeywordBindings = function (key, keySpan, absoluteOffset) {
14344
+ var _a;
14345
+ var bindings = [];
14346
+ this.consumeOptionalCharacter($COLON); // trackBy: trackByFunction
14347
+ var valueExpr = this.getDirectiveBoundTarget();
14348
+ var span = new ParseSpan(keySpan.start, this.inputIndex);
14349
+ bindings.push(new TemplateBinding(span, span.toAbsolute(absoluteOffset), key, false /* keyIsVar */, ((_a = valueExpr) === null || _a === void 0 ? void 0 : _a.source) || '', valueExpr));
14350
+ // The binding could optionally be followed by "as". For example,
14351
+ // *ngIf="cond | pipe as x". In this case, the key in the "as" binding
14352
+ // is "x" and the value is the template key itself ("ngIf"). Note that the
14353
+ // 'key' in the current context now becomes the "value" in the next binding.
14354
+ var asBinding = this.parseAsBinding(key, keySpan, absoluteOffset);
14355
+ if (asBinding) {
14356
+ bindings.push(asBinding);
14357
+ }
14358
+ this.consumeStatementTerminator();
14359
+ return bindings;
14360
+ };
14361
+ /**
14362
+ * Return the expression AST for the bound target of a directive keyword
14363
+ * binding. For example,
14364
+ * ```
14365
+ * *ngIf="condition | pipe".
14366
+ * ^^^^^^^^^^^^^^^^ bound target for "ngIf"
14367
+ * *ngFor="let item of items"
14368
+ * ^^^^^ bound target for "ngForOf"
14369
+ * ```
14370
+ */
14371
+ _ParseAST.prototype.getDirectiveBoundTarget = function () {
14372
+ if (this.next === EOF || this.peekKeywordAs() || this.peekKeywordLet()) {
14373
+ return null;
14374
+ }
14375
+ var ast = this.parsePipe(); // example: "condition | async"
14376
+ var _a = ast.span, start = _a.start, end = _a.end;
14377
+ var value = this.input.substring(start, end);
14378
+ return new ASTWithSource(ast, value, this.location, this.absoluteOffset + start, this.errors);
14379
+ };
14380
+ /**
14381
+ * Return the binding for a variable declared using `as`. Note that the order
14382
+ * of the key-value pair in this declaration is reversed. For example,
14383
+ * ```
14384
+ * *ngFor="let item of items; index as i"
14385
+ * ^^^^^ ^
14386
+ * value key
14387
+ * ```
14388
+ *
14389
+ * @param value name of the value in the declaration, "ngIf" in the example above
14390
+ * @param valueSpan span of the value in the declaration
14391
+ * @param absoluteOffset absolute offset of `value`
14392
+ */
14393
+ _ParseAST.prototype.parseAsBinding = function (value, valueSpan, absoluteOffset) {
14394
+ if (!this.peekKeywordAs()) {
14395
+ return null;
14396
+ }
14397
+ this.advance(); // consume the 'as' keyword
14398
+ var key = this.expectTemplateBindingKey().key;
14399
+ var valueAst = new AST(valueSpan, valueSpan.toAbsolute(absoluteOffset));
14400
+ var valueExpr = new ASTWithSource(valueAst, value, this.location, absoluteOffset + valueSpan.start, this.errors);
14401
+ var span = new ParseSpan(valueSpan.start, this.inputIndex);
14402
+ return new TemplateBinding(span, span.toAbsolute(absoluteOffset), key, true /* keyIsVar */, value, valueExpr);
14403
+ };
14404
+ /**
14405
+ * Return the binding for a variable declared using `let`. For example,
14406
+ * ```
14407
+ * *ngFor="let item of items; let i=index;"
14408
+ * ^^^^^^^^ ^^^^^^^^^^^
14409
+ * ```
14410
+ * In the first binding, `item` is bound to `NgForOfContext.$implicit`.
14411
+ * In the second binding, `i` is bound to `NgForOfContext.index`.
14412
+ */
14413
+ _ParseAST.prototype.parseLetBinding = function () {
14414
+ var _a;
14415
+ if (!this.peekKeywordLet()) {
14416
+ return null;
14417
+ }
14418
+ var spanStart = this.inputIndex;
14419
+ this.advance(); // consume the 'let' keyword
14420
+ var key = this.expectTemplateBindingKey().key;
14421
+ var valueExpr = null;
14422
+ if (this.consumeOptionalOperator('=')) {
14423
+ var _b = this.expectTemplateBindingKey(), value = _b.key, valueSpan = _b.keySpan;
14424
+ var ast = new AST(valueSpan, valueSpan.toAbsolute(this.absoluteOffset));
14425
+ valueExpr = new ASTWithSource(ast, value, this.location, this.absoluteOffset + valueSpan.start, this.errors);
14426
+ }
14427
+ var spanEnd = this.inputIndex;
14428
+ var span = new ParseSpan(spanStart, spanEnd);
14429
+ return new TemplateBinding(span, span.toAbsolute(this.absoluteOffset), key, true /* keyIsVar */, ((_a = valueExpr) === null || _a === void 0 ? void 0 : _a.source) || '$implicit', valueExpr);
14430
+ };
14431
+ /**
14432
+ * Consume the optional statement terminator: semicolon or comma.
14433
+ */
14434
+ _ParseAST.prototype.consumeStatementTerminator = function () {
14435
+ this.consumeOptionalCharacter($SEMICOLON) || this.consumeOptionalCharacter($COMMA);
14382
14436
  };
14383
14437
  _ParseAST.prototype.error = function (message, index) {
14384
14438
  if (index === void 0) { index = null; }
@@ -16611,6 +16665,45 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16611
16665
  }
16612
16666
  this.i18n = null; // reset local i18n context
16613
16667
  };
16668
+ TemplateDefinitionBuilder.prototype.i18nAttributesInstruction = function (nodeIndex, attrs, sourceSpan) {
16669
+ var _this = this;
16670
+ var hasBindings = false;
16671
+ var i18nAttrArgs = [];
16672
+ var bindings = [];
16673
+ attrs.forEach(function (attr) {
16674
+ var message = attr.i18n;
16675
+ if (attr instanceof TextAttribute) {
16676
+ i18nAttrArgs.push(literal(attr.name), _this.i18nTranslate(message));
16677
+ }
16678
+ else {
16679
+ var converted = attr.value.visit(_this._valueConverter);
16680
+ _this.allocateBindingSlots(converted);
16681
+ if (converted instanceof Interpolation) {
16682
+ var placeholders = assembleBoundTextPlaceholders(message);
16683
+ var params = placeholdersToParams(placeholders);
16684
+ i18nAttrArgs.push(literal(attr.name), _this.i18nTranslate(message, params));
16685
+ converted.expressions.forEach(function (expression) {
16686
+ hasBindings = true;
16687
+ bindings.push({
16688
+ sourceSpan: sourceSpan,
16689
+ value: function () { return _this.convertPropertyBinding(expression); },
16690
+ });
16691
+ });
16692
+ }
16693
+ }
16694
+ });
16695
+ if (bindings.length > 0) {
16696
+ this.updateInstructionChainWithAdvance(nodeIndex, Identifiers$1.i18nExp, bindings);
16697
+ }
16698
+ if (i18nAttrArgs.length > 0) {
16699
+ var index = literal(this.allocateDataSlot());
16700
+ var args = this.constantPool.getConstLiteral(literalArr(i18nAttrArgs), true);
16701
+ this.creationInstruction(sourceSpan, Identifiers$1.i18nAttributes, [index, args]);
16702
+ if (hasBindings) {
16703
+ this.updateInstruction(sourceSpan, Identifiers$1.i18nApply, [index]);
16704
+ }
16705
+ }
16706
+ };
16614
16707
  TemplateDefinitionBuilder.prototype.getNamespaceInstruction = function (namespaceKey) {
16615
16708
  switch (namespaceKey) {
16616
16709
  case 'math':
@@ -16677,16 +16770,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16677
16770
  stylingBuilder.registerClassAttr(value);
16678
16771
  }
16679
16772
  else {
16680
- if (attr.i18n) {
16681
- // Place attributes into a separate array for i18n processing, but also keep such
16682
- // attributes in the main list to make them available for directive matching at runtime.
16683
- // TODO(FW-1248): prevent attributes duplication in `i18nAttributes` and `elementStart`
16684
- // arguments
16685
- i18nAttrs.push(attr);
16686
- }
16687
- else {
16688
- outputAttrs.push(attr);
16689
- }
16773
+ (attr.i18n ? i18nAttrs : outputAttrs).push(attr);
16690
16774
  }
16691
16775
  }
16692
16776
  }
@@ -16710,10 +16794,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16710
16794
  var stylingInputWasSet = stylingBuilder.registerBoundInput(input);
16711
16795
  if (!stylingInputWasSet) {
16712
16796
  if (input.type === 0 /* Property */ && input.i18n) {
16713
- // Place attributes into a separate array for i18n processing, but also keep such
16714
- // attributes in the main list to make them available for directive matching at runtime.
16715
- // TODO(FW-1248): prevent attributes duplication in `i18nAttributes` and `elementStart`
16716
- // arguments
16717
16797
  i18nAttrs.push(input);
16718
16798
  }
16719
16799
  else {
@@ -16752,44 +16832,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16752
16832
  if (isNonBindableMode) {
16753
16833
  this.creationInstruction(element.sourceSpan, Identifiers$1.disableBindings);
16754
16834
  }
16755
- // process i18n element attributes
16756
- if (i18nAttrs.length) {
16757
- var hasBindings_1 = false;
16758
- var i18nAttrArgs_1 = [];
16759
- var bindings_1 = [];
16760
- i18nAttrs.forEach(function (attr) {
16761
- var message = attr.i18n;
16762
- if (attr instanceof TextAttribute) {
16763
- i18nAttrArgs_1.push(literal(attr.name), _this.i18nTranslate(message));
16764
- }
16765
- else {
16766
- var converted = attr.value.visit(_this._valueConverter);
16767
- _this.allocateBindingSlots(converted);
16768
- if (converted instanceof Interpolation) {
16769
- var placeholders = assembleBoundTextPlaceholders(message);
16770
- var params = placeholdersToParams(placeholders);
16771
- i18nAttrArgs_1.push(literal(attr.name), _this.i18nTranslate(message, params));
16772
- converted.expressions.forEach(function (expression) {
16773
- hasBindings_1 = true;
16774
- bindings_1.push({
16775
- sourceSpan: element.sourceSpan,
16776
- value: function () { return _this.convertPropertyBinding(expression); }
16777
- });
16778
- });
16779
- }
16780
- }
16781
- });
16782
- if (bindings_1.length) {
16783
- this.updateInstructionChainWithAdvance(elementIndex, Identifiers$1.i18nExp, bindings_1);
16784
- }
16785
- if (i18nAttrArgs_1.length) {
16786
- var index = literal(this.allocateDataSlot());
16787
- var args = this.constantPool.getConstLiteral(literalArr(i18nAttrArgs_1), true);
16788
- this.creationInstruction(element.sourceSpan, Identifiers$1.i18nAttributes, [index, args]);
16789
- if (hasBindings_1) {
16790
- this.updateInstruction(element.sourceSpan, Identifiers$1.i18nApply, [index]);
16791
- }
16792
- }
16835
+ if (i18nAttrs.length > 0) {
16836
+ this.i18nAttributesInstruction(elementIndex, i18nAttrs, element.sourceSpan);
16793
16837
  }
16794
16838
  // Generate Listeners (outputs)
16795
16839
  if (element.outputs.length > 0) {
@@ -16953,6 +16997,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16953
16997
  // find directives matching on a given <ng-template> node
16954
16998
  this.matchDirectives(NG_TEMPLATE_TAG_NAME, template);
16955
16999
  // prepare attributes parameter (including attributes used for directive matching)
17000
+ // TODO (FW-1942): exclude i18n attributes from the main attribute list and pass them
17001
+ // as an `i18nAttrs` argument of the `getAttributeExpressions` function below.
16956
17002
  var attrsExprs = this.getAttributeExpressions(template.attributes, template.inputs, template.outputs, undefined, template.templateAttrs, undefined);
16957
17003
  parameters.push(this.addAttrsToConsts(attrsExprs));
16958
17004
  // local refs (ex.: <ng-template #foo>)
@@ -16982,10 +17028,22 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16982
17028
  });
16983
17029
  // handle property bindings e.g. ɵɵproperty('ngForOf', ctx.items), et al;
16984
17030
  this.templatePropertyBindings(templateIndex, template.templateAttrs);
16985
- // Only add normal input/output binding instructions on explicit ng-template elements.
17031
+ // Only add normal input/output binding instructions on explicit <ng-template> elements.
16986
17032
  if (template.tagName === NG_TEMPLATE_TAG_NAME) {
17033
+ var inputs_1 = [];
17034
+ var i18nAttrs_1 = template.attributes.filter(function (attr) { return !!attr.i18n; });
17035
+ template.inputs.forEach(function (input) { return (input.i18n ? i18nAttrs_1 : inputs_1).push(input); });
17036
+ // Add i18n attributes that may act as inputs to directives. If such attributes are present,
17037
+ // generate `i18nAttributes` instruction. Note: we generate it only for explicit <ng-template>
17038
+ // elements, in case of inline templates, corresponding instructions will be generated in the
17039
+ // nested template function.
17040
+ if (i18nAttrs_1.length > 0) {
17041
+ this.i18nAttributesInstruction(templateIndex, i18nAttrs_1, template.sourceSpan);
17042
+ }
16987
17043
  // Add the input bindings
16988
- this.templatePropertyBindings(templateIndex, template.inputs);
17044
+ if (inputs_1.length > 0) {
17045
+ this.templatePropertyBindings(templateIndex, inputs_1);
17046
+ }
16989
17047
  // Generate listeners for directive output
16990
17048
  if (template.outputs.length > 0) {
16991
17049
  var listeners = template.outputs.map(function (outputAst) { return ({
@@ -17086,11 +17144,22 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17086
17144
  var value_4 = input.value.visit(_this._valueConverter);
17087
17145
  if (value_4 !== undefined) {
17088
17146
  _this.allocateBindingSlots(value_4);
17089
- propertyBindings.push({
17090
- name: input.name,
17091
- sourceSpan: input.sourceSpan,
17092
- value: function () { return _this.convertPropertyBinding(value_4); }
17093
- });
17147
+ if (value_4 instanceof Interpolation) {
17148
+ // Params typically contain attribute namespace and value sanitizer, which is applicable
17149
+ // for regular HTML elements, but not applicable for <ng-template> (since props act as
17150
+ // inputs to directives), so keep params array empty.
17151
+ var params = [];
17152
+ // prop="{{value}}" case
17153
+ _this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value_4), templateIndex, input.name, input, value_4, params);
17154
+ }
17155
+ else {
17156
+ // [prop]="value" case
17157
+ propertyBindings.push({
17158
+ name: input.name,
17159
+ sourceSpan: input.sourceSpan,
17160
+ value: function () { return _this.convertPropertyBinding(value_4); }
17161
+ });
17162
+ }
17094
17163
  }
17095
17164
  }
17096
17165
  });
@@ -17940,7 +18009,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17940
18009
  * Use of this source code is governed by an MIT-style license that can be
17941
18010
  * found in the LICENSE file at https://angular.io/license
17942
18011
  */
17943
- var EMPTY_ARRAY = [];
17944
18012
  // This regex matches any binding names that contain the "attr." prefix, e.g. "attr.required"
17945
18013
  // If there is a match, the first matching group will contain the attribute name to bind.
17946
18014
  var ATTR_REGEX = /attr\.([^\]]+)/;
@@ -17975,7 +18043,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17975
18043
  * Add features to the definition map.
17976
18044
  */
17977
18045
  function addFeatures(definitionMap, meta) {
17978
- // e.g. `features: [NgOnChangesFeature()]`
18046
+ // e.g. `features: [NgOnChangesFeature]`
17979
18047
  var features = [];
17980
18048
  var providers = meta.providers;
17981
18049
  var viewProviders = meta.viewProviders;
@@ -17993,7 +18061,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17993
18061
  features.push(importExpr(Identifiers$1.CopyDefinitionFeature));
17994
18062
  }
17995
18063
  if (meta.lifecycle.usesOnChanges) {
17996
- features.push(importExpr(Identifiers$1.NgOnChangesFeature).callFn(EMPTY_ARRAY));
18064
+ features.push(importExpr(Identifiers$1.NgOnChangesFeature));
17997
18065
  }
17998
18066
  if (features.length) {
17999
18067
  definitionMap.set('features', literalArr(features));
@@ -18828,7 +18896,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18828
18896
  * Use of this source code is governed by an MIT-style license that can be
18829
18897
  * found in the LICENSE file at https://angular.io/license
18830
18898
  */
18831
- var VERSION$1 = new Version('9.0.3');
18899
+ var VERSION$1 = new Version('9.0.7');
18832
18900
 
18833
18901
  /**
18834
18902
  * @license
@@ -22394,9 +22462,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
22394
22462
  });
22395
22463
  }
22396
22464
  else {
22397
- // handle the symbols via export * directives.
22465
+ // Handle the symbols loaded by 'export *' directives.
22398
22466
  var resolvedModule = this_1.resolveModule(moduleExport.from, filePath);
22399
- if (resolvedModule) {
22467
+ if (resolvedModule && resolvedModule !== filePath) {
22400
22468
  var nestedExports = this_1.getSymbolsOf(resolvedModule);
22401
22469
  nestedExports.forEach(function (targetSymbol) {
22402
22470
  var sourceSymbol = _this.getStaticSymbol(filePath, targetSymbol.name);
@@ -24528,6 +24596,17 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24528
24596
  _this.visitNode = function (node) { return node.visit(_this); };
24529
24597
  return _this;
24530
24598
  }
24599
+ // This method is defined to reconcile the type of TemplateBinder since both
24600
+ // RecursiveAstVisitor and Visitor define the visit() method in their
24601
+ // interfaces.
24602
+ TemplateBinder.prototype.visit = function (node, context) {
24603
+ if (node instanceof AST) {
24604
+ node.visit(this, context);
24605
+ }
24606
+ else {
24607
+ node.visit(this);
24608
+ }
24609
+ };
24531
24610
  /**
24532
24611
  * Process a template and extract metadata about expressions and symbols within.
24533
24612
  *
@@ -24657,6 +24736,126 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24657
24736
  // the late binding of the Compiler to the @angular/core for jit compilation.
24658
24737
  publishFacade(_global);
24659
24738
 
24739
+ /**
24740
+ * @license
24741
+ * Copyright Google Inc. All Rights Reserved.
24742
+ *
24743
+ * Use of this source code is governed by an MIT-style license that can be
24744
+ * found in the LICENSE file at https://angular.io/license
24745
+ */
24746
+ var Diagnostic = {
24747
+ directive_not_in_module: {
24748
+ message: "%1 '%2' is not included in a module and will not be available inside a template. Consider adding it to a NgModule declaration.",
24749
+ kind: 'Suggestion',
24750
+ },
24751
+ missing_template_and_templateurl: {
24752
+ message: "Component '%1' must have a template or templateUrl",
24753
+ kind: 'Error',
24754
+ },
24755
+ both_template_and_templateurl: {
24756
+ message: "Component '%1' must not have both template and templateUrl",
24757
+ kind: 'Error',
24758
+ },
24759
+ invalid_templateurl: {
24760
+ message: "URL does not point to a valid file",
24761
+ kind: 'Error',
24762
+ },
24763
+ template_context_missing_member: {
24764
+ message: "The template context of '%1' does not define %2.\n" +
24765
+ "If the context type is a base type or 'any', consider refining it to a more specific type.",
24766
+ kind: 'Suggestion',
24767
+ },
24768
+ callable_expression_expected_method_call: {
24769
+ message: 'Unexpected callable expression. Expected a method call',
24770
+ kind: 'Warning',
24771
+ },
24772
+ call_target_not_callable: {
24773
+ message: 'Call target is not callable',
24774
+ kind: 'Error',
24775
+ },
24776
+ expression_might_be_null: {
24777
+ message: 'The expression might be null',
24778
+ kind: 'Error',
24779
+ },
24780
+ expected_a_number_type: {
24781
+ message: 'Expected a number type',
24782
+ kind: 'Error',
24783
+ },
24784
+ expected_a_string_or_number_type: {
24785
+ message: 'Expected operands to be a string or number type',
24786
+ kind: 'Error',
24787
+ },
24788
+ expected_operands_of_similar_type_or_any: {
24789
+ message: 'Expected operands to be of similar type or any',
24790
+ kind: 'Error',
24791
+ },
24792
+ unrecognized_operator: {
24793
+ message: 'Unrecognized operator %1',
24794
+ kind: 'Error',
24795
+ },
24796
+ unrecognized_primitive: {
24797
+ message: 'Unrecognized primitive %1',
24798
+ kind: 'Error',
24799
+ },
24800
+ no_pipe_found: {
24801
+ message: 'No pipe of name %1 found',
24802
+ kind: 'Error',
24803
+ },
24804
+ // TODO: Consider a better error message here.
24805
+ unable_to_resolve_compatible_call_signature: {
24806
+ message: 'Unable to resolve compatible call signature',
24807
+ kind: 'Error',
24808
+ },
24809
+ unable_to_resolve_signature: {
24810
+ message: 'Unable to resolve signature for call of %1',
24811
+ kind: 'Error',
24812
+ },
24813
+ could_not_resolve_type: {
24814
+ message: "Could not resolve the type of '%1'",
24815
+ kind: 'Error',
24816
+ },
24817
+ identifier_not_callable: {
24818
+ message: "'%1' is not callable",
24819
+ kind: 'Error',
24820
+ },
24821
+ identifier_possibly_undefined: {
24822
+ message: "'%1' is possibly undefined. Consider using the safe navigation operator (%2) or non-null assertion operator (%3).",
24823
+ kind: 'Suggestion',
24824
+ },
24825
+ identifier_not_defined_in_app_context: {
24826
+ message: "Identifier '%1' is not defined. The component declaration, template variable declarations, and element references do not contain such a member",
24827
+ kind: 'Error',
24828
+ },
24829
+ identifier_not_defined_on_receiver: {
24830
+ message: "Identifier '%1' is not defined. '%2' does not contain such a member",
24831
+ kind: 'Error',
24832
+ },
24833
+ identifier_is_private: {
24834
+ message: "Identifier '%1' refers to a private member of %2",
24835
+ kind: 'Warning',
24836
+ },
24837
+ };
24838
+ /**
24839
+ * Creates a language service diagnostic.
24840
+ * @param span location the diagnostic for
24841
+ * @param dm diagnostic message
24842
+ * @param formatArgs run-time arguments to format the diagnostic message with (see the messages in
24843
+ * the `Diagnostic` object for an example).
24844
+ * @returns a created diagnostic
24845
+ */
24846
+ function createDiagnostic(span, dm) {
24847
+ var formatArgs = [];
24848
+ for (var _i = 2; _i < arguments.length; _i++) {
24849
+ formatArgs[_i - 2] = arguments[_i];
24850
+ }
24851
+ // Formats "%1 %2" with formatArgs ['a', 'b'] as "a b"
24852
+ var formattedMessage = dm.message.replace(/%(\d+)/g, function (_, index) { return formatArgs[+index - 1]; });
24853
+ return {
24854
+ kind: ts.DiagnosticCategory[dm.kind],
24855
+ message: formattedMessage, span: span,
24856
+ };
24857
+ }
24858
+
24660
24859
  /**
24661
24860
  * @license
24662
24861
  * Copyright Google Inc. All Rights Reserved.
@@ -24724,7 +24923,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24724
24923
  AstType.prototype.getDiagnostics = function (ast) {
24725
24924
  var type = ast.visit(this);
24726
24925
  if (this.context.event && type.callable) {
24727
- this.reportDiagnostic('Unexpected callable expression. Expected a method call', ast, ts.DiagnosticCategory.Warning);
24926
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.callable_expression_expected_method_call));
24728
24927
  }
24729
24928
  return this.diagnostics;
24730
24929
  };
@@ -24752,7 +24951,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24752
24951
  // Nullable allowed.
24753
24952
  break;
24754
24953
  default:
24755
- _this_1.reportDiagnostic("The expression might be null", ast);
24954
+ _this_1.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expression_might_be_null));
24756
24955
  break;
24757
24956
  }
24758
24957
  return _this_1.query.getNonNullableType(type);
@@ -24794,7 +24993,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24794
24993
  errorAst = ast.right;
24795
24994
  break;
24796
24995
  }
24797
- this.reportDiagnostic('Expected a numeric type', errorAst);
24996
+ this.diagnostics.push(createDiagnostic(errorAst.span, Diagnostic.expected_a_number_type));
24798
24997
  return this.anyType;
24799
24998
  }
24800
24999
  case '+':
@@ -24821,14 +25020,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24821
25020
  return this.query.getBuiltinType(BuiltinType$1.Number);
24822
25021
  case BuiltinType$1.Boolean << 8 | BuiltinType$1.Number:
24823
25022
  case BuiltinType$1.Other << 8 | BuiltinType$1.Number:
24824
- this.reportDiagnostic('Expected a number type', ast.left);
25023
+ this.diagnostics.push(createDiagnostic(ast.left.span, Diagnostic.expected_a_number_type));
24825
25024
  return this.anyType;
24826
25025
  case BuiltinType$1.Number << 8 | BuiltinType$1.Boolean:
24827
25026
  case BuiltinType$1.Number << 8 | BuiltinType$1.Other:
24828
- this.reportDiagnostic('Expected a number type', ast.right);
25027
+ this.diagnostics.push(createDiagnostic(ast.right.span, Diagnostic.expected_a_number_type));
24829
25028
  return this.anyType;
24830
25029
  default:
24831
- this.reportDiagnostic('Expected operands to be a string or number type', ast);
25030
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expected_a_string_or_number_type));
24832
25031
  return this.anyType;
24833
25032
  }
24834
25033
  case '>':
@@ -24855,7 +25054,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24855
25054
  case BuiltinType$1.Other << 8 | BuiltinType$1.Other:
24856
25055
  return this.query.getBuiltinType(BuiltinType$1.Boolean);
24857
25056
  default:
24858
- this.reportDiagnostic('Expected the operants to be of similar type or any', ast);
25057
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expected_operands_of_similar_type_or_any));
24859
25058
  return this.anyType;
24860
25059
  }
24861
25060
  case '&&':
@@ -24863,18 +25062,33 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24863
25062
  case '||':
24864
25063
  return this.query.getTypeUnion(leftType, rightType);
24865
25064
  }
24866
- this.reportDiagnostic("Unrecognized operator " + ast.operation, ast);
25065
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unrecognized_operator, ast.operation));
24867
25066
  return this.anyType;
24868
25067
  };
24869
25068
  AstType.prototype.visitChain = function (ast) {
24870
- // If we are producing diagnostics, visit the children
24871
- visitAstChildren(ast, this);
25069
+ var e_1, _a;
25070
+ try {
25071
+ // If we are producing diagnostics, visit the children
25072
+ for (var _b = __values(ast.expressions), _c = _b.next(); !_c.done; _c = _b.next()) {
25073
+ var expr = _c.value;
25074
+ expr.visit(this);
25075
+ }
25076
+ }
25077
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
25078
+ finally {
25079
+ try {
25080
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
25081
+ }
25082
+ finally { if (e_1) throw e_1.error; }
25083
+ }
24872
25084
  // The type of a chain is always undefined.
24873
25085
  return this.query.getBuiltinType(BuiltinType$1.Undefined);
24874
25086
  };
24875
25087
  AstType.prototype.visitConditional = function (ast) {
24876
25088
  // The type of a conditional is the union of the true and false conditions.
24877
- visitAstChildren(ast, this);
25089
+ ast.condition.visit(this);
25090
+ ast.trueExp.visit(this);
25091
+ ast.falseExp.visit(this);
24878
25092
  return this.query.getTypeUnion(this.getType(ast.trueExp), this.getType(ast.falseExp));
24879
25093
  };
24880
25094
  AstType.prototype.visitFunctionCall = function (ast) {
@@ -24886,7 +25100,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24886
25100
  var args = ast.args.map(function (arg) { return _this_1.getType(arg); });
24887
25101
  var target = this.getType(ast.target);
24888
25102
  if (!target || !target.callable) {
24889
- this.reportDiagnostic('Call target is not callable', ast);
25103
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.call_target_not_callable));
24890
25104
  return this.anyType;
24891
25105
  }
24892
25106
  var signature = target.selectSignature(args);
@@ -24894,7 +25108,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24894
25108
  return signature.result;
24895
25109
  }
24896
25110
  // TODO: Consider a better error message here.
24897
- this.reportDiagnostic('Unable no compatible signature found for call', ast);
25111
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_compatible_call_signature));
24898
25112
  return this.anyType;
24899
25113
  };
24900
25114
  AstType.prototype.visitImplicitReceiver = function (ast) {
@@ -24921,8 +25135,21 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24921
25135
  };
24922
25136
  };
24923
25137
  AstType.prototype.visitInterpolation = function (ast) {
24924
- // If we are producing diagnostics, visit the children.
24925
- visitAstChildren(ast, this);
25138
+ var e_2, _a;
25139
+ try {
25140
+ // If we are producing diagnostics, visit the children.
25141
+ for (var _b = __values(ast.expressions), _c = _b.next(); !_c.done; _c = _b.next()) {
25142
+ var expr = _c.value;
25143
+ expr.visit(this);
25144
+ }
25145
+ }
25146
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
25147
+ finally {
25148
+ try {
25149
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
25150
+ }
25151
+ finally { if (e_2) throw e_2.error; }
25152
+ }
24926
25153
  return this.undefinedType;
24927
25154
  };
24928
25155
  AstType.prototype.visitKeyedRead = function (ast) {
@@ -24942,8 +25169,21 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24942
25169
  return this.query.getArrayType((_a = this.query).getTypeUnion.apply(_a, __spread(ast.expressions.map(function (element) { return _this_1.getType(element); }))));
24943
25170
  };
24944
25171
  AstType.prototype.visitLiteralMap = function (ast) {
24945
- // If we are producing diagnostics, visit the children
24946
- visitAstChildren(ast, this);
25172
+ var e_3, _a;
25173
+ try {
25174
+ // If we are producing diagnostics, visit the children
25175
+ for (var _b = __values(ast.values), _c = _b.next(); !_c.done; _c = _b.next()) {
25176
+ var value = _c.value;
25177
+ value.visit(this);
25178
+ }
25179
+ }
25180
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
25181
+ finally {
25182
+ try {
25183
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
25184
+ }
25185
+ finally { if (e_3) throw e_3.error; }
25186
+ }
24947
25187
  // TODO: Return a composite type.
24948
25188
  return this.anyType;
24949
25189
  };
@@ -24964,7 +25204,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24964
25204
  case 'number':
24965
25205
  return this.query.getBuiltinType(BuiltinType$1.Number);
24966
25206
  default:
24967
- this.reportDiagnostic('Unrecognized primitive', ast);
25207
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unrecognized_primitive, typeof ast.value));
24968
25208
  return this.anyType;
24969
25209
  }
24970
25210
  }
@@ -24978,20 +25218,20 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
24978
25218
  // by getPipes() is expected to contain symbols with the corresponding transform method type.
24979
25219
  var pipe = this.query.getPipes().get(ast.name);
24980
25220
  if (!pipe) {
24981
- this.reportDiagnostic("No pipe by the name " + ast.name + " found", ast);
25221
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.no_pipe_found, ast.name));
24982
25222
  return this.anyType;
24983
25223
  }
24984
25224
  var expType = this.getType(ast.exp);
24985
25225
  var signature = pipe.selectSignature([expType].concat(ast.args.map(function (arg) { return _this_1.getType(arg); })));
24986
25226
  if (!signature) {
24987
- this.reportDiagnostic('Unable to resolve signature for pipe invocation', ast);
25227
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_signature, ast.name));
24988
25228
  return this.anyType;
24989
25229
  }
24990
25230
  return signature.result;
24991
25231
  };
24992
25232
  AstType.prototype.visitPrefixNot = function (ast) {
24993
25233
  // If we are producing diagnostics, visit the children
24994
- visitAstChildren(ast, this);
25234
+ ast.expression.visit(this);
24995
25235
  // The type of a prefix ! is always boolean.
24996
25236
  return this.query.getBuiltinType(BuiltinType$1.Boolean);
24997
25237
  };
@@ -25045,19 +25285,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25045
25285
  }
25046
25286
  var methodType = this.resolvePropertyRead(receiverType, ast);
25047
25287
  if (!methodType) {
25048
- this.reportDiagnostic("Could not find a type for '" + ast.name + "'", ast);
25288
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.could_not_resolve_type, ast.name));
25049
25289
  return this.anyType;
25050
25290
  }
25051
25291
  if (this.isAny(methodType)) {
25052
25292
  return this.anyType;
25053
25293
  }
25054
25294
  if (!methodType.callable) {
25055
- this.reportDiagnostic("Member '" + ast.name + "' is not callable", ast);
25295
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_callable, ast.name));
25056
25296
  return this.anyType;
25057
25297
  }
25058
25298
  var signature = methodType.selectSignature(ast.args.map(function (arg) { return _this_1.getType(arg); }));
25059
25299
  if (!signature) {
25060
- this.reportDiagnostic("Unable to resolve signature for call of method " + ast.name, ast);
25300
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_signature, ast.name));
25061
25301
  return this.anyType;
25062
25302
  }
25063
25303
  return signature.result;
@@ -25070,28 +25310,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25070
25310
  var member = receiverType.members().get(ast.name);
25071
25311
  if (!member) {
25072
25312
  if (receiverType.name === '$implicit') {
25073
- this.reportDiagnostic("Identifier '" + ast.name + "' is not defined. " +
25074
- "The component declaration, template variable declarations, and element references do not contain such a member", ast);
25313
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_defined_in_app_context, ast.name));
25075
25314
  }
25076
25315
  else if (receiverType.nullable && ast.receiver instanceof PropertyRead) {
25077
25316
  var receiver = ast.receiver.name;
25078
- this.reportDiagnostic("'" + receiver + "' is possibly undefined. Consider using the safe navigation operator (" + receiver + "?." + ast.name + ") " +
25079
- ("or non-null assertion operator (" + receiver + "!." + ast.name + ")."), ast, ts.DiagnosticCategory.Suggestion);
25317
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_possibly_undefined, receiver, receiver + "?." + ast.name, receiver + "!." + ast.name));
25080
25318
  }
25081
25319
  else {
25082
- this.reportDiagnostic("Identifier '" + ast.name + "' is not defined. '" + receiverType.name + "' does not contain such a member", ast);
25320
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_defined_on_receiver, ast.name, receiverType.name));
25083
25321
  }
25084
25322
  return this.anyType;
25085
25323
  }
25086
25324
  if (!member.public) {
25087
- this.reportDiagnostic("Identifier '" + ast.name + "' refers to a private member of " + (receiverType.name === '$implicit' ? 'the component' : "\n '" + receiverType.name + "'\n "), ast, ts.DiagnosticCategory.Warning);
25325
+ var container = receiverType.name === '$implicit' ? 'the component' : "'" + receiverType.name + "'";
25326
+ this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_is_private, ast.name, container));
25088
25327
  }
25089
25328
  return member.type;
25090
25329
  };
25091
- AstType.prototype.reportDiagnostic = function (message, ast, kind) {
25092
- if (kind === void 0) { kind = ts.DiagnosticCategory.Error; }
25093
- this.diagnostics.push({ kind: kind, span: ast.span, message: message });
25094
- };
25095
25330
  AstType.prototype.isAny = function (symbol) {
25096
25331
  return !symbol || this.query.getTypeKind(symbol) === BuiltinType$1.Any ||
25097
25332
  (!!symbol.type && this.isAny(symbol.type));
@@ -25497,10 +25732,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25497
25732
  continue;
25498
25733
  }
25499
25734
  var _loop_2 = function (variable) {
25500
- var symbol = info.members.get(variable.value);
25501
- if (!symbol) {
25502
- symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current);
25503
- }
25735
+ var symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current);
25504
25736
  var kind = info.query.getTypeKind(symbol);
25505
25737
  if (kind === BuiltinType$1.Any || kind === BuiltinType$1.Unbound) {
25506
25738
  // For special cases such as ngFor and ngIf, the any type is not very useful.
@@ -25576,7 +25808,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25576
25808
  */
25577
25809
  function refinedVariableType(value, mergedTable, query, templateElement) {
25578
25810
  if (value === '$implicit') {
25579
- // Special case the ngFor directive
25811
+ // Special case: ngFor directive
25580
25812
  var ngForDirective = templateElement.directives.find(function (d) {
25581
25813
  var name = identifierName(d.directive.type);
25582
25814
  return name == 'NgFor' || name == 'NgForOf';
@@ -25595,12 +25827,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25595
25827
  }
25596
25828
  }
25597
25829
  }
25598
- // Special case the ngIf directive ( *ngIf="data$ | async as variable" )
25599
- if (value === 'ngIf') {
25830
+ if (value === 'ngIf' || value === '$implicit') {
25600
25831
  var ngIfDirective = templateElement.directives.find(function (d) { return identifierName(d.directive.type) === 'NgIf'; });
25601
25832
  if (ngIfDirective) {
25833
+ // Special case: ngIf directive. The NgIf structural directive owns a template context with
25834
+ // "$implicit" and "ngIf" members. These properties are typed as generics. Until the language
25835
+ // service uses an Ivy and TypecheckBlock backend, we cannot bind these values to a concrete
25836
+ // type without manual inference. To get the concrete type, look up the type of the "ngIf"
25837
+ // import on the NgIf directive bound to the template.
25838
+ //
25839
+ // See @angular/common/ng_if.ts for more information.
25602
25840
  var ngIfBinding = ngIfDirective.inputs.find(function (i) { return i.directiveName === 'ngIf'; });
25603
25841
  if (ngIfBinding) {
25842
+ // Check if there is a known type bound to the ngIf input.
25604
25843
  var bindingType = new AstType(mergedTable, query, {}).getType(ngIfBinding.value);
25605
25844
  if (bindingType) {
25606
25845
  return bindingType;
@@ -25696,8 +25935,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25696
25935
  var context = this.info.query.getTemplateContext(directive.type.reference);
25697
25936
  if (context && !context.has(ast.value)) {
25698
25937
  var missingMember = ast.value === '$implicit' ? 'an implicit value' : "a member called '" + ast.value + "'";
25699
- this.reportDiagnostic("The template context of '" + directive.type.reference.name + "' does not define " + missingMember + ".\n" +
25700
- "If the context type is a base type or 'any', consider refining it to a more specific type.", spanOf$1(ast.sourceSpan), ts.DiagnosticCategory.Suggestion);
25938
+ var span = this.absSpan(spanOf$1(ast.sourceSpan));
25939
+ this.diagnostics.push(createDiagnostic(span, Diagnostic.template_context_missing_member, directive.type.reference.name, missingMember));
25701
25940
  }
25702
25941
  }
25703
25942
  };
@@ -25731,10 +25970,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25731
25970
  var analyzer = new AstType(scope, this.info.query, { event: event });
25732
25971
  try {
25733
25972
  for (var _b = __values(analyzer.getDiagnostics(ast)), _c = _b.next(); !_c.done; _c = _b.next()) {
25734
- var _d = _c.value, message = _d.message, span = _d.span, kind = _d.kind;
25735
- span.start += offset;
25736
- span.end += offset;
25737
- this.reportDiagnostic(message, span, kind);
25973
+ var diagnostic = _c.value;
25974
+ diagnostic.span = this.absSpan(diagnostic.span, offset);
25975
+ this.diagnostics.push(diagnostic);
25738
25976
  }
25739
25977
  }
25740
25978
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
@@ -25747,11 +25985,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25747
25985
  };
25748
25986
  ExpressionDiagnosticsVisitor.prototype.push = function (ast) { this.path.push(ast); };
25749
25987
  ExpressionDiagnosticsVisitor.prototype.pop = function () { this.path.pop(); };
25750
- ExpressionDiagnosticsVisitor.prototype.reportDiagnostic = function (message, span, kind) {
25751
- if (kind === void 0) { kind = ts.DiagnosticCategory.Error; }
25752
- span.start += this.info.offset;
25753
- span.end += this.info.offset;
25754
- this.diagnostics.push({ kind: kind, span: span, message: message });
25988
+ ExpressionDiagnosticsVisitor.prototype.absSpan = function (span, additionalOffset) {
25989
+ if (additionalOffset === void 0) { additionalOffset = 0; }
25990
+ return {
25991
+ start: span.start + this.info.offset + additionalOffset,
25992
+ end: span.end + this.info.offset + additionalOffset,
25993
+ };
25755
25994
  };
25756
25995
  return ExpressionDiagnosticsVisitor;
25757
25996
  }(RecursiveTemplateAstVisitor));
@@ -25836,11 +26075,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25836
26075
  if ((!excludeEmpty || ast.sourceSpan.start < ast.sourceSpan.end) &&
25837
26076
  inSpan(position, ast.sourceSpan)) {
25838
26077
  path.push(ast);
25839
- visitAstChildren(ast, this);
26078
+ ast.visit(this);
25840
26079
  }
25841
26080
  };
25842
26081
  return class_1;
25843
- }(NullAstVisitor));
26082
+ }(RecursiveAstVisitor$1));
25844
26083
  // We never care about the ASTWithSource node and its visit() method calls its ast's visit so
25845
26084
  // the visit() method above would never see it.
25846
26085
  if (ast instanceof ASTWithSource) {
@@ -28135,8 +28374,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28135
28374
  }
28136
28375
  }
28137
28376
  }
28138
- if (binding.expression && inSpan(valueRelativePosition, binding.expression.ast.span)) {
28139
- this.processExpressionCompletions(binding.expression.ast);
28377
+ if (binding.value && inSpan(valueRelativePosition, binding.value.ast.span)) {
28378
+ this.processExpressionCompletions(binding.value.ast);
28140
28379
  return;
28141
28380
  }
28142
28381
  // If the expression is incomplete, for example *ngFor="let x of |"
@@ -28439,10 +28678,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28439
28678
  // Find the symbol that contains the position.
28440
28679
  templateBindings.filter(function (tb) { return !tb.keyIsVar; }).forEach(function (tb) {
28441
28680
  var _a;
28442
- if (inSpan(valueRelativePosition, (_a = tb.expression) === null || _a === void 0 ? void 0 : _a.ast.span)) {
28681
+ if (inSpan(valueRelativePosition, (_a = tb.value) === null || _a === void 0 ? void 0 : _a.ast.span)) {
28443
28682
  var dinfo = diagnosticInfoFromTemplateInfo(info);
28444
28683
  var scope = getExpressionScope(dinfo, path);
28445
- result = getExpressionSymbol(scope, tb.expression, path.position, info.template.query);
28684
+ result = getExpressionSymbol(scope, tb.value, path.position, info.template.query);
28446
28685
  }
28447
28686
  else if (inSpan(valueRelativePosition, tb.span)) {
28448
28687
  var template = path.first(EmbeddedTemplateAst);
@@ -28772,17 +29011,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28772
29011
  members: template.members,
28773
29012
  });
28774
29013
  }
28775
- /**
28776
- * Generate an error message that indicates a directive is not part of any
28777
- * NgModule.
28778
- * @param name class name
28779
- * @param isComponent true if directive is an Angular Component
28780
- */
28781
- function missingDirective(name, isComponent) {
28782
- var type = isComponent ? 'Component' : 'Directive';
28783
- return type + " '" + name + "' is not included in a module and will not be " +
28784
- 'available inside a template. Consider adding it to a NgModule declaration.';
28785
- }
28786
29014
  /**
28787
29015
  * Performs a variety diagnostics on directive declarations.
28788
29016
  *
@@ -28853,29 +29081,17 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28853
29081
  }
28854
29082
  finally { if (e_4) throw e_4.error; }
28855
29083
  }
29084
+ if (!modules.ngModuleByPipeOrDirective.has(declaration.type)) {
29085
+ results.push(createDiagnostic(declarationSpan, Diagnostic.directive_not_in_module, metadata.isComponent ? 'Component' : 'Directive', type.name));
29086
+ }
28856
29087
  if (metadata.isComponent) {
28857
- if (!modules.ngModuleByPipeOrDirective.has(declaration.type)) {
28858
- results.push({
28859
- kind: ts.DiagnosticCategory.Suggestion,
28860
- message: missingDirective(type.name, metadata.isComponent),
28861
- span: declarationSpan,
28862
- });
28863
- }
28864
29088
  var _j = metadata.template, template = _j.template, templateUrl = _j.templateUrl, styleUrls = _j.styleUrls;
28865
29089
  if (template === null && !templateUrl) {
28866
- results.push({
28867
- kind: ts.DiagnosticCategory.Error,
28868
- message: "Component '" + type.name + "' must have a template or templateUrl",
28869
- span: declarationSpan,
28870
- });
29090
+ results.push(createDiagnostic(declarationSpan, Diagnostic.missing_template_and_templateurl, type.name));
28871
29091
  }
28872
29092
  else if (templateUrl) {
28873
29093
  if (template) {
28874
- results.push({
28875
- kind: ts.DiagnosticCategory.Error,
28876
- message: "Component '" + type.name + "' must not have both template and templateUrl",
28877
- span: declarationSpan,
28878
- });
29094
+ results.push(createDiagnostic(declarationSpan, Diagnostic.both_template_and_templateurl, type.name));
28879
29095
  }
28880
29096
  // Find templateUrl value from the directive call expression, which is the parent of the
28881
29097
  // directive identifier.
@@ -28900,13 +29116,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28900
29116
  results.push.apply(results, __spread(validateUrls(styleUrlsNode.elements, host.tsLsHost)));
28901
29117
  }
28902
29118
  }
28903
- else if (!directives.has(declaration.type)) {
28904
- results.push({
28905
- kind: ts.DiagnosticCategory.Suggestion,
28906
- message: missingDirective(type.name, metadata.isComponent),
28907
- span: declarationSpan,
28908
- });
28909
- }
28910
29119
  }
28911
29120
  }
28912
29121
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -28945,12 +29154,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28945
29154
  var url = path.join(path.dirname(curPath), urlNode.text);
28946
29155
  if (tsLsHost.fileExists(url))
28947
29156
  continue;
28948
- allErrors.push({
28949
- kind: ts.DiagnosticCategory.Error,
28950
- message: "URL does not point to a valid file",
28951
- // Exclude opening and closing quotes in the url span.
28952
- span: { start: urlNode.getStart() + 1, end: urlNode.end - 1 },
28953
- });
29157
+ // Exclude opening and closing quotes in the url span.
29158
+ var urlSpan = { start: urlNode.getStart() + 1, end: urlNode.end - 1 };
29159
+ allErrors.push(createDiagnostic(urlSpan, Diagnostic.invalid_templateurl));
28954
29160
  }
28955
29161
  return allErrors;
28956
29162
  }
@@ -29183,6 +29389,26 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29183
29389
  return LanguageServiceImpl;
29184
29390
  }());
29185
29391
 
29392
+ /**
29393
+ * @license
29394
+ * Copyright Google Inc. All Rights Reserved.
29395
+ *
29396
+ * Use of this source code is governed by an MIT-style license that can be
29397
+ * found in the LICENSE file at https://angular.io/license
29398
+ */
29399
+ /**
29400
+ * Convince closure compiler that the wrapped function has no side-effects.
29401
+ *
29402
+ * Closure compiler always assumes that `toString` has no side-effects. We use this quirk to
29403
+ * allow us to execute a function but have closure compiler mark the call as no-side-effects.
29404
+ * It is important that the return value for the `noSideEffects` function be assigned
29405
+ * to something which is retained otherwise the call to `noSideEffects` will be removed by closure
29406
+ * compiler.
29407
+ */
29408
+ function noSideEffects(fn) {
29409
+ return { toString: fn }.toString();
29410
+ }
29411
+
29186
29412
  /**
29187
29413
  * @license
29188
29414
  * Copyright Google Inc. All Rights Reserved.
@@ -29197,38 +29423,40 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29197
29423
  * @suppress {globalThis}
29198
29424
  */
29199
29425
  function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {
29200
- var metaCtor = makeMetadataCtor(props);
29201
- function DecoratorFactory() {
29202
- var _a;
29203
- var args = [];
29204
- for (var _i = 0; _i < arguments.length; _i++) {
29205
- args[_i] = arguments[_i];
29426
+ return noSideEffects(function () {
29427
+ var metaCtor = makeMetadataCtor(props);
29428
+ function DecoratorFactory() {
29429
+ var _a;
29430
+ var args = [];
29431
+ for (var _i = 0; _i < arguments.length; _i++) {
29432
+ args[_i] = arguments[_i];
29433
+ }
29434
+ if (this instanceof DecoratorFactory) {
29435
+ metaCtor.call.apply(metaCtor, __spread([this], args));
29436
+ return this;
29437
+ }
29438
+ var annotationInstance = new ((_a = DecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29439
+ return function TypeDecorator(cls) {
29440
+ if (typeFn)
29441
+ typeFn.apply(void 0, __spread([cls], args));
29442
+ // Use of Object.defineProperty is important since it creates non-enumerable property which
29443
+ // prevents the property is copied during subclassing.
29444
+ var annotations = cls.hasOwnProperty(ANNOTATIONS) ?
29445
+ cls[ANNOTATIONS] :
29446
+ Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
29447
+ annotations.push(annotationInstance);
29448
+ if (additionalProcessing)
29449
+ additionalProcessing(cls);
29450
+ return cls;
29451
+ };
29206
29452
  }
29207
- if (this instanceof DecoratorFactory) {
29208
- metaCtor.call.apply(metaCtor, __spread([this], args));
29209
- return this;
29453
+ if (parentClass) {
29454
+ DecoratorFactory.prototype = Object.create(parentClass.prototype);
29210
29455
  }
29211
- var annotationInstance = new ((_a = DecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29212
- return function TypeDecorator(cls) {
29213
- if (typeFn)
29214
- typeFn.apply(void 0, __spread([cls], args));
29215
- // Use of Object.defineProperty is important since it creates non-enumerable property which
29216
- // prevents the property is copied during subclassing.
29217
- var annotations = cls.hasOwnProperty(ANNOTATIONS) ?
29218
- cls[ANNOTATIONS] :
29219
- Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
29220
- annotations.push(annotationInstance);
29221
- if (additionalProcessing)
29222
- additionalProcessing(cls);
29223
- return cls;
29224
- };
29225
- }
29226
- if (parentClass) {
29227
- DecoratorFactory.prototype = Object.create(parentClass.prototype);
29228
- }
29229
- DecoratorFactory.prototype.ngMetadataName = name;
29230
- DecoratorFactory.annotationCls = DecoratorFactory;
29231
- return DecoratorFactory;
29456
+ DecoratorFactory.prototype.ngMetadataName = name;
29457
+ DecoratorFactory.annotationCls = DecoratorFactory;
29458
+ return DecoratorFactory;
29459
+ });
29232
29460
  }
29233
29461
  function makeMetadataCtor(props) {
29234
29462
  return function ctor() {
@@ -29245,75 +29473,79 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29245
29473
  };
29246
29474
  }
29247
29475
  function makeParamDecorator(name, props, parentClass) {
29248
- var metaCtor = makeMetadataCtor(props);
29249
- function ParamDecoratorFactory() {
29250
- var _a;
29251
- var args = [];
29252
- for (var _i = 0; _i < arguments.length; _i++) {
29253
- args[_i] = arguments[_i];
29254
- }
29255
- if (this instanceof ParamDecoratorFactory) {
29256
- metaCtor.apply(this, args);
29257
- return this;
29258
- }
29259
- var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29260
- ParamDecorator.annotation = annotationInstance;
29261
- return ParamDecorator;
29262
- function ParamDecorator(cls, unusedKey, index) {
29263
- // Use of Object.defineProperty is important since it creates non-enumerable property which
29264
- // prevents the property is copied during subclassing.
29265
- var parameters = cls.hasOwnProperty(PARAMETERS) ?
29266
- cls[PARAMETERS] :
29267
- Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
29268
- // there might be gaps if some in between parameters do not have annotations.
29269
- // we pad with nulls.
29270
- while (parameters.length <= index) {
29271
- parameters.push(null);
29476
+ return noSideEffects(function () {
29477
+ var metaCtor = makeMetadataCtor(props);
29478
+ function ParamDecoratorFactory() {
29479
+ var _a;
29480
+ var args = [];
29481
+ for (var _i = 0; _i < arguments.length; _i++) {
29482
+ args[_i] = arguments[_i];
29272
29483
  }
29273
- (parameters[index] = parameters[index] || []).push(annotationInstance);
29274
- return cls;
29275
- }
29276
- }
29277
- if (parentClass) {
29278
- ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
29279
- }
29280
- ParamDecoratorFactory.prototype.ngMetadataName = name;
29281
- ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
29282
- return ParamDecoratorFactory;
29484
+ if (this instanceof ParamDecoratorFactory) {
29485
+ metaCtor.apply(this, args);
29486
+ return this;
29487
+ }
29488
+ var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29489
+ ParamDecorator.annotation = annotationInstance;
29490
+ return ParamDecorator;
29491
+ function ParamDecorator(cls, unusedKey, index) {
29492
+ // Use of Object.defineProperty is important since it creates non-enumerable property which
29493
+ // prevents the property is copied during subclassing.
29494
+ var parameters = cls.hasOwnProperty(PARAMETERS) ?
29495
+ cls[PARAMETERS] :
29496
+ Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
29497
+ // there might be gaps if some in between parameters do not have annotations.
29498
+ // we pad with nulls.
29499
+ while (parameters.length <= index) {
29500
+ parameters.push(null);
29501
+ }
29502
+ (parameters[index] = parameters[index] || []).push(annotationInstance);
29503
+ return cls;
29504
+ }
29505
+ }
29506
+ if (parentClass) {
29507
+ ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
29508
+ }
29509
+ ParamDecoratorFactory.prototype.ngMetadataName = name;
29510
+ ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
29511
+ return ParamDecoratorFactory;
29512
+ });
29283
29513
  }
29284
29514
  function makePropDecorator(name, props, parentClass, additionalProcessing) {
29285
- var metaCtor = makeMetadataCtor(props);
29286
- function PropDecoratorFactory() {
29287
- var _a;
29288
- var args = [];
29289
- for (var _i = 0; _i < arguments.length; _i++) {
29290
- args[_i] = arguments[_i];
29291
- }
29292
- if (this instanceof PropDecoratorFactory) {
29293
- metaCtor.apply(this, args);
29294
- return this;
29295
- }
29296
- var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29297
- function PropDecorator(target, name) {
29298
- var constructor = target.constructor;
29299
- // Use of Object.defineProperty is important since it creates non-enumerable property which
29300
- // prevents the property is copied during subclassing.
29301
- var meta = constructor.hasOwnProperty(PROP_METADATA) ?
29302
- constructor[PROP_METADATA] :
29303
- Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
29304
- meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
29305
- meta[name].unshift(decoratorInstance);
29306
- if (additionalProcessing)
29307
- additionalProcessing.apply(void 0, __spread([target, name], args));
29308
- }
29309
- return PropDecorator;
29310
- }
29311
- if (parentClass) {
29312
- PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
29313
- }
29314
- PropDecoratorFactory.prototype.ngMetadataName = name;
29315
- PropDecoratorFactory.annotationCls = PropDecoratorFactory;
29316
- return PropDecoratorFactory;
29515
+ return noSideEffects(function () {
29516
+ var metaCtor = makeMetadataCtor(props);
29517
+ function PropDecoratorFactory() {
29518
+ var _a;
29519
+ var args = [];
29520
+ for (var _i = 0; _i < arguments.length; _i++) {
29521
+ args[_i] = arguments[_i];
29522
+ }
29523
+ if (this instanceof PropDecoratorFactory) {
29524
+ metaCtor.apply(this, args);
29525
+ return this;
29526
+ }
29527
+ var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
29528
+ function PropDecorator(target, name) {
29529
+ var constructor = target.constructor;
29530
+ // Use of Object.defineProperty is important since it creates non-enumerable property which
29531
+ // prevents the property is copied during subclassing.
29532
+ var meta = constructor.hasOwnProperty(PROP_METADATA) ?
29533
+ constructor[PROP_METADATA] :
29534
+ Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
29535
+ meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
29536
+ meta[name].unshift(decoratorInstance);
29537
+ if (additionalProcessing)
29538
+ additionalProcessing.apply(void 0, __spread([target, name], args));
29539
+ }
29540
+ return PropDecorator;
29541
+ }
29542
+ if (parentClass) {
29543
+ PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
29544
+ }
29545
+ PropDecoratorFactory.prototype.ngMetadataName = name;
29546
+ PropDecoratorFactory.annotationCls = PropDecoratorFactory;
29547
+ return PropDecoratorFactory;
29548
+ });
29317
29549
  }
29318
29550
 
29319
29551
  /**
@@ -30109,8 +30341,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30109
30341
  }
30110
30342
  }
30111
30343
  function throwError(msg, actual, expected, comparison) {
30112
- // tslint:disable-next-line
30113
- debugger; // Left intentionally for better debugger experience.
30114
30344
  throw new Error("ASSERTION ERROR: " + msg +
30115
30345
  (comparison == null ? '' : " [Expected=> " + expected + " " + comparison + " " + actual + " <=Actual]"));
30116
30346
  }
@@ -30317,7 +30547,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30317
30547
  * code.
30318
30548
  */
30319
30549
  var EMPTY_OBJ = {};
30320
- var EMPTY_ARRAY$1 = [];
30550
+ var EMPTY_ARRAY = [];
30321
30551
  // freezing the values prevents any code from accidentally inserting new values in
30322
30552
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
30323
30553
  // These property accesses can be ignored because ngDevMode will be set to false
@@ -30325,7 +30555,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30325
30555
  // tslint:disable-next-line:no-toplevel-property-access
30326
30556
  Object.freeze(EMPTY_OBJ);
30327
30557
  // tslint:disable-next-line:no-toplevel-property-access
30328
- Object.freeze(EMPTY_ARRAY$1);
30558
+ Object.freeze(EMPTY_ARRAY);
30329
30559
  }
30330
30560
 
30331
30561
  /**
@@ -30464,6 +30694,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30464
30694
  * Use of this source code is governed by an MIT-style license that can be
30465
30695
  * found in the LICENSE file at https://angular.io/license
30466
30696
  */
30697
+ // [Assert functions do not constraint type when they are guarded by a truthy
30698
+ // expression.](https://github.com/microsoft/TypeScript/issues/37295)
30467
30699
  function assertTNodeForLView(tNode, lView) {
30468
30700
  tNode.hasOwnProperty('tView_') && assertEqual(tNode.tView_, lView[TVIEW], 'This TNode does not belong to this LView.');
30469
30701
  }
@@ -30507,6 +30739,202 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30507
30739
  var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
30508
30740
  var MATH_ML_NAMESPACE = 'http://www.w3.org/1998/MathML/';
30509
30741
 
30742
+ /**
30743
+ * @license
30744
+ * Copyright Google Inc. All Rights Reserved.
30745
+ *
30746
+ * Use of this source code is governed by an MIT-style license that can be
30747
+ * found in the LICENSE file at https://angular.io/license
30748
+ */
30749
+ /**
30750
+ * This property will be monkey-patched on elements, components and directives
30751
+ */
30752
+ var MONKEY_PATCH_KEY_NAME = '__ngContext__';
30753
+
30754
+ /**
30755
+ * @license
30756
+ * Copyright Google Inc. All Rights Reserved.
30757
+ *
30758
+ * Use of this source code is governed by an MIT-style license that can be
30759
+ * found in the LICENSE file at https://angular.io/license
30760
+ */
30761
+ /**
30762
+ * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
30763
+ * inject the `DOCUMENT` token and are done.
30764
+ *
30765
+ * Ivy is special because it does not rely upon the DI and must get hold of the document some other
30766
+ * way.
30767
+ *
30768
+ * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
30769
+ * Wherever ivy needs the global document, it calls `getDocument()` instead.
30770
+ *
30771
+ * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
30772
+ * tell ivy what the global `document` is.
30773
+ *
30774
+ * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
30775
+ * by calling `setDocument()` when providing the `DOCUMENT` token.
30776
+ */
30777
+ var DOCUMENT = undefined;
30778
+ /**
30779
+ * Access the object that represents the `document` for this platform.
30780
+ *
30781
+ * Ivy calls this whenever it needs to access the `document` object.
30782
+ * For example to create the renderer or to do sanitization.
30783
+ */
30784
+ function getDocument() {
30785
+ if (DOCUMENT !== undefined) {
30786
+ return DOCUMENT;
30787
+ }
30788
+ else if (typeof document !== 'undefined') {
30789
+ return document;
30790
+ }
30791
+ // No "document" can be found. This should only happen if we are running ivy outside Angular and
30792
+ // the current platform is not a browser. Since this is not a supported scenario at the moment
30793
+ // this should not happen in Angular apps.
30794
+ // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
30795
+ // public API. Meanwhile we just return `undefined` and let the application fail.
30796
+ return undefined;
30797
+ }
30798
+
30799
+ /**
30800
+ * @license
30801
+ * Copyright Google Inc. All Rights Reserved.
30802
+ *
30803
+ * Use of this source code is governed by an MIT-style license that can be
30804
+ * found in the LICENSE file at https://angular.io/license
30805
+ */
30806
+ // TODO: cleanup once the code is merged in angular/angular
30807
+ var RendererStyleFlags3;
30808
+ (function (RendererStyleFlags3) {
30809
+ RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
30810
+ RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
30811
+ })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
30812
+ /** Returns whether the `renderer` is a `ProceduralRenderer3` */
30813
+ function isProceduralRenderer(renderer) {
30814
+ return !!(renderer.listen);
30815
+ }
30816
+ var ɵ0$2 = function (hostElement, rendererType) { return getDocument(); };
30817
+ var domRendererFactory3 = {
30818
+ createRenderer: ɵ0$2
30819
+ };
30820
+
30821
+ /**
30822
+ * @license
30823
+ * Copyright Google Inc. All Rights Reserved.
30824
+ *
30825
+ * Use of this source code is governed by an MIT-style license that can be
30826
+ * found in the LICENSE file at https://angular.io/license
30827
+ */
30828
+ /**
30829
+ * For efficiency reasons we often put several different data types (`RNode`, `LView`, `LContainer`)
30830
+ * in same location in `LView`. This is because we don't want to pre-allocate space for it
30831
+ * because the storage is sparse. This file contains utilities for dealing with such data types.
30832
+ *
30833
+ * How do we know what is stored at a given location in `LView`.
30834
+ * - `Array.isArray(value) === false` => `RNode` (The normal storage value)
30835
+ * - `Array.isArray(value) === true` => then the `value[0]` represents the wrapped value.
30836
+ * - `typeof value[TYPE] === 'object'` => `LView`
30837
+ * - This happens when we have a component at a given location
30838
+ * - `typeof value[TYPE] === true` => `LContainer`
30839
+ * - This happens when we have `LContainer` binding at a given location.
30840
+ *
30841
+ *
30842
+ * NOTE: it is assumed that `Array.isArray` and `typeof` operations are very efficient.
30843
+ */
30844
+ /**
30845
+ * Returns `RNode`.
30846
+ * @param value wrapped value of `RNode`, `LView`, `LContainer`
30847
+ */
30848
+ function unwrapRNode(value) {
30849
+ while (Array.isArray(value)) {
30850
+ value = value[HOST];
30851
+ }
30852
+ return value;
30853
+ }
30854
+ /**
30855
+ * Retrieve an `RNode` for a given `TNode` and `LView`.
30856
+ *
30857
+ * This function guarantees in dev mode to retrieve a non-null `RNode`.
30858
+ *
30859
+ * @param tNode
30860
+ * @param lView
30861
+ */
30862
+ function getNativeByTNode(tNode, lView) {
30863
+ ngDevMode && assertTNodeForLView(tNode, lView);
30864
+ ngDevMode && assertDataInRange(lView, tNode.index);
30865
+ var node = unwrapRNode(lView[tNode.index]);
30866
+ ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
30867
+ return node;
30868
+ }
30869
+ /**
30870
+ * Retrieve an `RNode` or `null` for a given `TNode` and `LView`.
30871
+ *
30872
+ * Some `TNode`s don't have associated `RNode`s. For example `Projection`
30873
+ *
30874
+ * @param tNode
30875
+ * @param lView
30876
+ */
30877
+ function getNativeByTNodeOrNull(tNode, lView) {
30878
+ var index = tNode.index;
30879
+ if (index !== -1) {
30880
+ ngDevMode && assertTNodeForLView(tNode, lView);
30881
+ var node = unwrapRNode(lView[index]);
30882
+ ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
30883
+ return node;
30884
+ }
30885
+ return null;
30886
+ }
30887
+ function getTNode(tView, index) {
30888
+ ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
30889
+ ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');
30890
+ return tView.data[index + HEADER_OFFSET];
30891
+ }
30892
+ function getComponentLViewByIndex(nodeIndex, hostView) {
30893
+ // Could be an LView or an LContainer. If LContainer, unwrap to find LView.
30894
+ ngDevMode && assertDataInRange(hostView, nodeIndex);
30895
+ var slotValue = hostView[nodeIndex];
30896
+ var lView = isLView(slotValue) ? slotValue : slotValue[HOST];
30897
+ return lView;
30898
+ }
30899
+ /**
30900
+ * Returns the monkey-patch value data present on the target (which could be
30901
+ * a component, directive or a DOM node).
30902
+ */
30903
+ function readPatchedData(target) {
30904
+ ngDevMode && assertDefined(target, 'Target expected');
30905
+ return target[MONKEY_PATCH_KEY_NAME] || null;
30906
+ }
30907
+ function readPatchedLView(target) {
30908
+ var value = readPatchedData(target);
30909
+ if (value) {
30910
+ return Array.isArray(value) ? value : value.lView;
30911
+ }
30912
+ return null;
30913
+ }
30914
+ /** Checks whether a given view is in creation mode */
30915
+ function isCreationMode(view) {
30916
+ return (view[FLAGS] & 4 /* CreationMode */) === 4 /* CreationMode */;
30917
+ }
30918
+ /**
30919
+ * Returns a boolean for whether the view is attached to the change detection tree.
30920
+ *
30921
+ * Note: This determines whether a view should be checked, not whether it's inserted
30922
+ * into a container. For that, you'll want `viewAttachedToContainer` below.
30923
+ */
30924
+ function viewAttachedToChangeDetector(view) {
30925
+ return (view[FLAGS] & 128 /* Attached */) === 128 /* Attached */;
30926
+ }
30927
+ /**
30928
+ * Resets the pre-order hook flags of the view.
30929
+ * @param lView the LView on which the flags are reset
30930
+ */
30931
+ function resetPreOrderHookFlags(lView) {
30932
+ lView[PREORDER_HOOK_FLAGS] = 0;
30933
+ }
30934
+ function getLContainerActiveIndex(lContainer) {
30935
+ return lContainer[ACTIVE_INDEX] >> 1 /* SHIFT */;
30936
+ }
30937
+
30510
30938
  /**
30511
30939
  * @license
30512
30940
  * Copyright Google Inc. All Rights Reserved.
@@ -31088,73 +31516,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31088
31516
  return '<unknown>';
31089
31517
  }
31090
31518
 
31091
- /**
31092
- * @license
31093
- * Copyright Google Inc. All Rights Reserved.
31094
- *
31095
- * Use of this source code is governed by an MIT-style license that can be
31096
- * found in the LICENSE file at https://angular.io/license
31097
- */
31098
- /**
31099
- * Most of the use of `document` in Angular is from within the DI system so it is possible to simply
31100
- * inject the `DOCUMENT` token and are done.
31101
- *
31102
- * Ivy is special because it does not rely upon the DI and must get hold of the document some other
31103
- * way.
31104
- *
31105
- * The solution is to define `getDocument()` and `setDocument()` top-level functions for ivy.
31106
- * Wherever ivy needs the global document, it calls `getDocument()` instead.
31107
- *
31108
- * When running ivy outside of a browser environment, it is necessary to call `setDocument()` to
31109
- * tell ivy what the global `document` is.
31110
- *
31111
- * Angular does this for us in each of the standard platforms (`Browser`, `Server`, and `WebWorker`)
31112
- * by calling `setDocument()` when providing the `DOCUMENT` token.
31113
- */
31114
- var DOCUMENT = undefined;
31115
- /**
31116
- * Access the object that represents the `document` for this platform.
31117
- *
31118
- * Ivy calls this whenever it needs to access the `document` object.
31119
- * For example to create the renderer or to do sanitization.
31120
- */
31121
- function getDocument() {
31122
- if (DOCUMENT !== undefined) {
31123
- return DOCUMENT;
31124
- }
31125
- else if (typeof document !== 'undefined') {
31126
- return document;
31127
- }
31128
- // No "document" can be found. This should only happen if we are running ivy outside Angular and
31129
- // the current platform is not a browser. Since this is not a supported scenario at the moment
31130
- // this should not happen in Angular apps.
31131
- // Once we support running ivy outside of Angular we will need to publish `setDocument()` as a
31132
- // public API. Meanwhile we just return `undefined` and let the application fail.
31133
- return undefined;
31134
- }
31135
-
31136
- /**
31137
- * @license
31138
- * Copyright Google Inc. All Rights Reserved.
31139
- *
31140
- * Use of this source code is governed by an MIT-style license that can be
31141
- * found in the LICENSE file at https://angular.io/license
31142
- */
31143
- // TODO: cleanup once the code is merged in angular/angular
31144
- var RendererStyleFlags3;
31145
- (function (RendererStyleFlags3) {
31146
- RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
31147
- RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
31148
- })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
31149
- /** Returns whether the `renderer` is a `ProceduralRenderer3` */
31150
- function isProceduralRenderer(renderer) {
31151
- return !!(renderer.listen);
31152
- }
31153
- var ɵ0$2 = function (hostElement, rendererType) { return getDocument(); };
31154
- var domRendererFactory3 = {
31155
- createRenderer: ɵ0$2
31156
- };
31157
-
31158
31519
  /**
31159
31520
  * Assigns all attribute values to the provided element via the inferred renderer.
31160
31521
  *
@@ -32217,135 +32578,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32217
32578
  }
32218
32579
  }
32219
32580
 
32220
- /**
32221
- * @license
32222
- * Copyright Google Inc. All Rights Reserved.
32223
- *
32224
- * Use of this source code is governed by an MIT-style license that can be
32225
- * found in the LICENSE file at https://angular.io/license
32226
- */
32227
- /**
32228
- * This property will be monkey-patched on elements, components and directives
32229
- */
32230
- var MONKEY_PATCH_KEY_NAME = '__ngContext__';
32231
-
32232
- /**
32233
- * @license
32234
- * Copyright Google Inc. All Rights Reserved.
32235
- *
32236
- * Use of this source code is governed by an MIT-style license that can be
32237
- * found in the LICENSE file at https://angular.io/license
32238
- */
32239
- /**
32240
- * For efficiency reasons we often put several different data types (`RNode`, `LView`, `LContainer`)
32241
- * in same location in `LView`. This is because we don't want to pre-allocate space for it
32242
- * because the storage is sparse. This file contains utilities for dealing with such data types.
32243
- *
32244
- * How do we know what is stored at a given location in `LView`.
32245
- * - `Array.isArray(value) === false` => `RNode` (The normal storage value)
32246
- * - `Array.isArray(value) === true` => then the `value[0]` represents the wrapped value.
32247
- * - `typeof value[TYPE] === 'object'` => `LView`
32248
- * - This happens when we have a component at a given location
32249
- * - `typeof value[TYPE] === true` => `LContainer`
32250
- * - This happens when we have `LContainer` binding at a given location.
32251
- *
32252
- *
32253
- * NOTE: it is assumed that `Array.isArray` and `typeof` operations are very efficient.
32254
- */
32255
- /**
32256
- * Returns `RNode`.
32257
- * @param value wrapped value of `RNode`, `LView`, `LContainer`
32258
- */
32259
- function unwrapRNode(value) {
32260
- while (Array.isArray(value)) {
32261
- value = value[HOST];
32262
- }
32263
- return value;
32264
- }
32265
- /**
32266
- * Retrieve an `RNode` for a given `TNode` and `LView`.
32267
- *
32268
- * This function guarantees in dev mode to retrieve a non-null `RNode`.
32269
- *
32270
- * @param tNode
32271
- * @param lView
32272
- */
32273
- function getNativeByTNode(tNode, lView) {
32274
- ngDevMode && assertTNodeForLView(tNode, lView);
32275
- ngDevMode && assertDataInRange(lView, tNode.index);
32276
- var node = unwrapRNode(lView[tNode.index]);
32277
- ngDevMode && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
32278
- return node;
32279
- }
32280
- /**
32281
- * Retrieve an `RNode` or `null` for a given `TNode` and `LView`.
32282
- *
32283
- * Some `TNode`s don't have associated `RNode`s. For example `Projection`
32284
- *
32285
- * @param tNode
32286
- * @param lView
32287
- */
32288
- function getNativeByTNodeOrNull(tNode, lView) {
32289
- var index = tNode.index;
32290
- if (index !== -1) {
32291
- ngDevMode && assertTNodeForLView(tNode, lView);
32292
- var node = unwrapRNode(lView[index]);
32293
- ngDevMode && node !== null && !isProceduralRenderer(lView[RENDERER]) && assertDomNode(node);
32294
- return node;
32295
- }
32296
- return null;
32297
- }
32298
- function getTNode(tView, index) {
32299
- ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
32300
- ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');
32301
- return tView.data[index + HEADER_OFFSET];
32302
- }
32303
- function getComponentLViewByIndex(nodeIndex, hostView) {
32304
- // Could be an LView or an LContainer. If LContainer, unwrap to find LView.
32305
- ngDevMode && assertDataInRange(hostView, nodeIndex);
32306
- var slotValue = hostView[nodeIndex];
32307
- var lView = isLView(slotValue) ? slotValue : slotValue[HOST];
32308
- return lView;
32309
- }
32310
- /**
32311
- * Returns the monkey-patch value data present on the target (which could be
32312
- * a component, directive or a DOM node).
32313
- */
32314
- function readPatchedData(target) {
32315
- ngDevMode && assertDefined(target, 'Target expected');
32316
- return target[MONKEY_PATCH_KEY_NAME] || null;
32317
- }
32318
- function readPatchedLView(target) {
32319
- var value = readPatchedData(target);
32320
- if (value) {
32321
- return Array.isArray(value) ? value : value.lView;
32322
- }
32323
- return null;
32324
- }
32325
- /** Checks whether a given view is in creation mode */
32326
- function isCreationMode(view) {
32327
- return (view[FLAGS] & 4 /* CreationMode */) === 4 /* CreationMode */;
32328
- }
32329
- /**
32330
- * Returns a boolean for whether the view is attached to the change detection tree.
32331
- *
32332
- * Note: This determines whether a view should be checked, not whether it's inserted
32333
- * into a container. For that, you'll want `viewAttachedToContainer` below.
32334
- */
32335
- function viewAttachedToChangeDetector(view) {
32336
- return (view[FLAGS] & 128 /* Attached */) === 128 /* Attached */;
32337
- }
32338
- /**
32339
- * Resets the pre-order hook flags of the view.
32340
- * @param lView the LView on which the flags are reset
32341
- */
32342
- function resetPreOrderHookFlags(lView) {
32343
- lView[PREORDER_HOOK_FLAGS] = 0;
32344
- }
32345
- function getLContainerActiveIndex(lContainer) {
32346
- return lContainer[ACTIVE_INDEX] >> 1 /* SHIFT */;
32347
- }
32348
-
32349
32581
  /**
32350
32582
  * @license
32351
32583
  * Copyright Google Inc. All Rights Reserved.
@@ -32580,7 +32812,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32580
32812
  var tNode = lView[TVIEW].data[nodeIndex];
32581
32813
  var directiveStartIndex = tNode.directiveStart;
32582
32814
  if (directiveStartIndex == 0)
32583
- return EMPTY_ARRAY$1;
32815
+ return EMPTY_ARRAY;
32584
32816
  var directiveEndIndex = tNode.directiveEnd;
32585
32817
  if (!includeComponents && tNode.flags & 2 /* isComponentHost */)
32586
32818
  directiveStartIndex++;
@@ -35894,7 +36126,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35894
36126
  */
35895
36127
  var ɵ0$6 = getClosureSafeProperty;
35896
36128
  var USE_VALUE$4 = getClosureSafeProperty({ provide: String, useValue: ɵ0$6 });
35897
- var EMPTY_ARRAY$2 = [];
36129
+ var EMPTY_ARRAY$1 = [];
35898
36130
  function convertInjectableProviderToFactory(type, provider) {
35899
36131
  if (!provider) {
35900
36132
  var reflectionCapabilities = new ReflectionCapabilities();
@@ -35912,7 +36144,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35912
36144
  }
35913
36145
  else if (provider.useFactory) {
35914
36146
  var factoryProvider_1 = provider;
35915
- return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, __spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY$2))); };
36147
+ return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, __spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY$1))); };
35916
36148
  }
35917
36149
  else if (provider.useClass) {
35918
36150
  var classProvider_1 = provider;
@@ -35999,7 +36231,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35999
36231
  * a circular dependency among the providers.
36000
36232
  */
36001
36233
  var CIRCULAR = {};
36002
- var EMPTY_ARRAY$3 = [];
36234
+ var EMPTY_ARRAY$2 = [];
36003
36235
  /**
36004
36236
  * A lazily initialized NullInjector.
36005
36237
  */
@@ -36011,15 +36243,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36011
36243
  return NULL_INJECTOR;
36012
36244
  }
36013
36245
  /**
36014
- * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
36015
- *
36016
- * @publicApi
36246
+ * Creates a new injector without eagerly resolving its injector types. Can be used in places
36247
+ * where resolving the injector types immediately can lead to an infinite loop. The injector types
36248
+ * should be resolved at a later point by calling `_resolveInjectorDefTypes`.
36017
36249
  */
36018
- function createInjector(defType, parent, additionalProviders, name) {
36250
+ function createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name) {
36019
36251
  if (parent === void 0) { parent = null; }
36020
36252
  if (additionalProviders === void 0) { additionalProviders = null; }
36021
- parent = parent || getNullInjector();
36022
- return new R3Injector(defType, additionalProviders, parent, name);
36253
+ return new R3Injector(defType, additionalProviders, parent || getNullInjector(), name);
36023
36254
  }
36024
36255
  var R3Injector = /** @class */ (function () {
36025
36256
  function R3Injector(def, additionalProviders, parent, source) {
@@ -36053,8 +36284,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36053
36284
  // any injectable scoped to APP_ROOT_SCOPE.
36054
36285
  var record = this.records.get(INJECTOR_SCOPE);
36055
36286
  this.scope = record != null ? record.value : null;
36056
- // Eagerly instantiate the InjectorType classes themselves.
36057
- this.injectorDefTypes.forEach(function (defType) { return _this.get(defType); });
36058
36287
  // Source name, used for debugging
36059
36288
  this.source = source || (typeof def === 'object' ? null : stringify$1(def));
36060
36289
  }
@@ -36149,6 +36378,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36149
36378
  setCurrentInjector(previousInjector);
36150
36379
  }
36151
36380
  };
36381
+ /** @internal */
36382
+ R3Injector.prototype._resolveInjectorDefTypes = function () {
36383
+ var _this = this;
36384
+ this.injectorDefTypes.forEach(function (defType) { return _this.get(defType); });
36385
+ };
36152
36386
  R3Injector.prototype.toString = function () {
36153
36387
  var tokens = [], records = this.records;
36154
36388
  records.forEach(function (v, token) { return tokens.push(stringify$1(token)); });
@@ -36230,7 +36464,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36230
36464
  if (importTypesWithProviders_1 !== undefined) {
36231
36465
  var _loop_1 = function (i) {
36232
36466
  var _a = importTypesWithProviders_1[i], ngModule_1 = _a.ngModule, providers = _a.providers;
36233
- deepForEach(providers, function (provider) { return _this.processProvider(provider, ngModule_1, providers || EMPTY_ARRAY$3); });
36467
+ deepForEach(providers, function (provider) { return _this.processProvider(provider, ngModule_1, providers || EMPTY_ARRAY$2); });
36234
36468
  };
36235
36469
  for (var i = 0; i < importTypesWithProviders_1.length; i++) {
36236
36470
  _loop_1(i);
@@ -37934,7 +38168,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
37934
38168
  * code.
37935
38169
  */
37936
38170
  var EMPTY_OBJ$1 = {};
37937
- var EMPTY_ARRAY$4 = [];
38171
+ var EMPTY_ARRAY$3 = [];
37938
38172
  // freezing the values prevents any code from accidentally inserting new values in
37939
38173
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
37940
38174
  // These property accesses can be ignored because ngDevMode will be set to false
@@ -37942,7 +38176,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
37942
38176
  // tslint:disable-next-line:no-toplevel-property-access
37943
38177
  Object.freeze(EMPTY_OBJ$1);
37944
38178
  // tslint:disable-next-line:no-toplevel-property-access
37945
- Object.freeze(EMPTY_ARRAY$4);
38179
+ Object.freeze(EMPTY_ARRAY$3);
37946
38180
  }
37947
38181
 
37948
38182
  /**
@@ -38571,7 +38805,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
38571
38805
  /**
38572
38806
  * @publicApi
38573
38807
  */
38574
- var VERSION$2 = new Version$1('9.0.3');
38808
+ var VERSION$2 = new Version$1('9.0.7');
38575
38809
 
38576
38810
  /**
38577
38811
  * @license
@@ -40716,7 +40950,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
40716
40950
  });
40717
40951
  return TemplateRef_;
40718
40952
  }(TemplateRef));
40719
- function createInjector$1(view, elDef) {
40953
+ function createInjector(view, elDef) {
40720
40954
  return new Injector_(view, elDef);
40721
40955
  }
40722
40956
  var Injector_ = /** @class */ (function () {
@@ -41025,7 +41259,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
41025
41259
  }
41026
41260
  case InjectorRefTokenKey$1:
41027
41261
  case INJECTORRefTokenKey$1:
41028
- return createInjector$1(searchView, elDef);
41262
+ return createInjector(searchView, elDef);
41029
41263
  default:
41030
41264
  var providerDef_1 = (allowPrivateServices ? elDef.element.allProviders :
41031
41265
  elDef.element.publicProviders)[tokenKey];
@@ -41580,10 +41814,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
41580
41814
  var ngLocaleIdDef = getNgLocaleIdDef(ngModuleType);
41581
41815
  ngLocaleIdDef && setLocaleId(ngLocaleIdDef);
41582
41816
  _this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
41583
- _this._r3Injector = createInjector(ngModuleType, _parent, [
41817
+ _this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
41584
41818
  { provide: NgModuleRef, useValue: _this },
41585
41819
  { provide: ComponentFactoryResolver, useValue: _this.componentFactoryResolver }
41586
41820
  ], stringify$1(ngModuleType));
41821
+ // We need to resolve the injector types separately from the injector creation, because
41822
+ // the module might be trying to use this ref in its contructor for DI which will cause a
41823
+ // circular error that will eventually error out, because the injector isn't created yet.
41824
+ _this._r3Injector._resolveInjectorDefTypes();
41587
41825
  _this.instance = _this.get(ngModuleType);
41588
41826
  return _this;
41589
41827
  }
@@ -47608,7 +47846,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
47608
47846
  configurable: true
47609
47847
  });
47610
47848
  Object.defineProperty(DebugContext_.prototype, "injector", {
47611
- get: function () { return createInjector$1(this.elView, this.elDef); },
47849
+ get: function () { return createInjector(this.elView, this.elDef); },
47612
47850
  enumerable: true,
47613
47851
  configurable: true
47614
47852
  });
@@ -50577,7 +50815,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
50577
50815
  * Use of this source code is governed by an MIT-style license that can be
50578
50816
  * found in the LICENSE file at https://angular.io/license
50579
50817
  */
50580
- var VERSION$3 = new Version$1('9.0.3');
50818
+ var VERSION$3 = new Version$1('9.0.7');
50581
50819
 
50582
50820
  exports.TypeScriptServiceHost = TypeScriptServiceHost;
50583
50821
  exports.VERSION = VERSION$3;