@angular/language-service 9.1.3 → 9.1.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.1.3
2
+ * @license Angular v9.1.7
3
3
  * Copyright Google Inc. All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -3691,7 +3691,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
3691
3691
  Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleName: CORE$1 };
3692
3692
  Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE$1 };
3693
3693
  Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE$1 };
3694
- Identifiers.containerCreate = { name: 'ɵɵcontainer', moduleName: CORE$1 };
3695
3694
  Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE$1 };
3696
3695
  Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE$1 };
3697
3696
  Identifiers.text = { name: 'ɵɵtext', moduleName: CORE$1 };
@@ -7196,6 +7195,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7196
7195
  };
7197
7196
  return AST;
7198
7197
  }());
7198
+ var ASTWithName = /** @class */ (function (_super) {
7199
+ __extends(ASTWithName, _super);
7200
+ function ASTWithName(span, sourceSpan, nameSpan) {
7201
+ var _this = _super.call(this, span, sourceSpan) || this;
7202
+ _this.nameSpan = nameSpan;
7203
+ return _this;
7204
+ }
7205
+ return ASTWithName;
7206
+ }(AST));
7199
7207
  /**
7200
7208
  * Represents a quoted expression of the form:
7201
7209
  *
@@ -7281,8 +7289,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7281
7289
  }(AST));
7282
7290
  var PropertyRead = /** @class */ (function (_super) {
7283
7291
  __extends(PropertyRead, _super);
7284
- function PropertyRead(span, sourceSpan, receiver, name) {
7285
- var _this = _super.call(this, span, sourceSpan) || this;
7292
+ function PropertyRead(span, sourceSpan, nameSpan, receiver, name) {
7293
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7286
7294
  _this.receiver = receiver;
7287
7295
  _this.name = name;
7288
7296
  return _this;
@@ -7292,11 +7300,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7292
7300
  return visitor.visitPropertyRead(this, context);
7293
7301
  };
7294
7302
  return PropertyRead;
7295
- }(AST));
7303
+ }(ASTWithName));
7296
7304
  var PropertyWrite = /** @class */ (function (_super) {
7297
7305
  __extends(PropertyWrite, _super);
7298
- function PropertyWrite(span, sourceSpan, receiver, name, value) {
7299
- var _this = _super.call(this, span, sourceSpan) || this;
7306
+ function PropertyWrite(span, sourceSpan, nameSpan, receiver, name, value) {
7307
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7300
7308
  _this.receiver = receiver;
7301
7309
  _this.name = name;
7302
7310
  _this.value = value;
@@ -7307,11 +7315,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7307
7315
  return visitor.visitPropertyWrite(this, context);
7308
7316
  };
7309
7317
  return PropertyWrite;
7310
- }(AST));
7318
+ }(ASTWithName));
7311
7319
  var SafePropertyRead = /** @class */ (function (_super) {
7312
7320
  __extends(SafePropertyRead, _super);
7313
- function SafePropertyRead(span, sourceSpan, receiver, name) {
7314
- var _this = _super.call(this, span, sourceSpan) || this;
7321
+ function SafePropertyRead(span, sourceSpan, nameSpan, receiver, name) {
7322
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7315
7323
  _this.receiver = receiver;
7316
7324
  _this.name = name;
7317
7325
  return _this;
@@ -7321,7 +7329,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7321
7329
  return visitor.visitSafePropertyRead(this, context);
7322
7330
  };
7323
7331
  return SafePropertyRead;
7324
- }(AST));
7332
+ }(ASTWithName));
7325
7333
  var KeyedRead = /** @class */ (function (_super) {
7326
7334
  __extends(KeyedRead, _super);
7327
7335
  function KeyedRead(span, sourceSpan, obj, key) {
@@ -7354,11 +7362,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7354
7362
  var BindingPipe = /** @class */ (function (_super) {
7355
7363
  __extends(BindingPipe, _super);
7356
7364
  function BindingPipe(span, sourceSpan, exp, name, args, nameSpan) {
7357
- var _this = _super.call(this, span, sourceSpan) || this;
7365
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7358
7366
  _this.exp = exp;
7359
7367
  _this.name = name;
7360
7368
  _this.args = args;
7361
- _this.nameSpan = nameSpan;
7362
7369
  return _this;
7363
7370
  }
7364
7371
  BindingPipe.prototype.visit = function (visitor, context) {
@@ -7366,7 +7373,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7366
7373
  return visitor.visitPipe(this, context);
7367
7374
  };
7368
7375
  return BindingPipe;
7369
- }(AST));
7376
+ }(ASTWithName));
7370
7377
  var LiteralPrimitive = /** @class */ (function (_super) {
7371
7378
  __extends(LiteralPrimitive, _super);
7372
7379
  function LiteralPrimitive(span, sourceSpan, value) {
@@ -7464,8 +7471,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7464
7471
  }(AST));
7465
7472
  var MethodCall = /** @class */ (function (_super) {
7466
7473
  __extends(MethodCall, _super);
7467
- function MethodCall(span, sourceSpan, receiver, name, args) {
7468
- var _this = _super.call(this, span, sourceSpan) || this;
7474
+ function MethodCall(span, sourceSpan, nameSpan, receiver, name, args) {
7475
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7469
7476
  _this.receiver = receiver;
7470
7477
  _this.name = name;
7471
7478
  _this.args = args;
@@ -7476,11 +7483,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7476
7483
  return visitor.visitMethodCall(this, context);
7477
7484
  };
7478
7485
  return MethodCall;
7479
- }(AST));
7486
+ }(ASTWithName));
7480
7487
  var SafeMethodCall = /** @class */ (function (_super) {
7481
7488
  __extends(SafeMethodCall, _super);
7482
- function SafeMethodCall(span, sourceSpan, receiver, name, args) {
7483
- var _this = _super.call(this, span, sourceSpan) || this;
7489
+ function SafeMethodCall(span, sourceSpan, nameSpan, receiver, name, args) {
7490
+ var _this = _super.call(this, span, sourceSpan, nameSpan) || this;
7484
7491
  _this.receiver = receiver;
7485
7492
  _this.name = name;
7486
7493
  _this.args = args;
@@ -7491,7 +7498,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7491
7498
  return visitor.visitSafeMethodCall(this, context);
7492
7499
  };
7493
7500
  return SafeMethodCall;
7494
- }(AST));
7501
+ }(ASTWithName));
7495
7502
  var FunctionCall = /** @class */ (function (_super) {
7496
7503
  __extends(FunctionCall, _super);
7497
7504
  function FunctionCall(span, sourceSpan, target, args) {
@@ -7678,19 +7685,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7678
7685
  return new LiteralPrimitive(ast.span, ast.sourceSpan, ast.value);
7679
7686
  };
7680
7687
  AstTransformer.prototype.visitPropertyRead = function (ast, context) {
7681
- return new PropertyRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.name);
7688
+ return new PropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name);
7682
7689
  };
7683
7690
  AstTransformer.prototype.visitPropertyWrite = function (ast, context) {
7684
- return new PropertyWrite(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.name, ast.value.visit(this));
7691
+ return new PropertyWrite(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, ast.value.visit(this));
7685
7692
  };
7686
7693
  AstTransformer.prototype.visitSafePropertyRead = function (ast, context) {
7687
- return new SafePropertyRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.name);
7694
+ return new SafePropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name);
7688
7695
  };
7689
7696
  AstTransformer.prototype.visitMethodCall = function (ast, context) {
7690
- return new MethodCall(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
7697
+ return new MethodCall(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
7691
7698
  };
7692
7699
  AstTransformer.prototype.visitSafeMethodCall = function (ast, context) {
7693
- return new SafeMethodCall(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
7700
+ return new SafeMethodCall(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
7694
7701
  };
7695
7702
  AstTransformer.prototype.visitFunctionCall = function (ast, context) {
7696
7703
  return new FunctionCall(ast.span, ast.sourceSpan, ast.target.visit(this), this.visitAll(ast.args));
@@ -7757,7 +7764,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7757
7764
  AstMemoryEfficientTransformer.prototype.visitPropertyRead = function (ast, context) {
7758
7765
  var receiver = ast.receiver.visit(this);
7759
7766
  if (receiver !== ast.receiver) {
7760
- return new PropertyRead(ast.span, ast.sourceSpan, receiver, ast.name);
7767
+ return new PropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name);
7761
7768
  }
7762
7769
  return ast;
7763
7770
  };
@@ -7765,14 +7772,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7765
7772
  var receiver = ast.receiver.visit(this);
7766
7773
  var value = ast.value.visit(this);
7767
7774
  if (receiver !== ast.receiver || value !== ast.value) {
7768
- return new PropertyWrite(ast.span, ast.sourceSpan, receiver, ast.name, value);
7775
+ return new PropertyWrite(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, value);
7769
7776
  }
7770
7777
  return ast;
7771
7778
  };
7772
7779
  AstMemoryEfficientTransformer.prototype.visitSafePropertyRead = function (ast, context) {
7773
7780
  var receiver = ast.receiver.visit(this);
7774
7781
  if (receiver !== ast.receiver) {
7775
- return new SafePropertyRead(ast.span, ast.sourceSpan, receiver, ast.name);
7782
+ return new SafePropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name);
7776
7783
  }
7777
7784
  return ast;
7778
7785
  };
@@ -7780,7 +7787,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7780
7787
  var receiver = ast.receiver.visit(this);
7781
7788
  var args = this.visitAll(ast.args);
7782
7789
  if (receiver !== ast.receiver || args !== ast.args) {
7783
- return new MethodCall(ast.span, ast.sourceSpan, receiver, ast.name, args);
7790
+ return new MethodCall(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, args);
7784
7791
  }
7785
7792
  return ast;
7786
7793
  };
@@ -7788,7 +7795,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7788
7795
  var receiver = ast.receiver.visit(this);
7789
7796
  var args = this.visitAll(ast.args);
7790
7797
  if (receiver !== ast.receiver || args !== ast.args) {
7791
- return new SafeMethodCall(ast.span, ast.sourceSpan, receiver, ast.name, args);
7798
+ return new SafeMethodCall(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, args);
7792
7799
  }
7793
7800
  return ast;
7794
7801
  };
@@ -8515,10 +8522,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8515
8522
  // Convert the ast to an unguarded access to the receiver's member. The map will substitute
8516
8523
  // leftMostNode with its unguarded version in the call to `this.visit()`.
8517
8524
  if (leftMostSafe instanceof SafeMethodCall) {
8518
- this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
8525
+ this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.nameSpan, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
8519
8526
  }
8520
8527
  else {
8521
- this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.receiver, leftMostSafe.name));
8528
+ this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.nameSpan, leftMostSafe.receiver, leftMostSafe.name));
8522
8529
  }
8523
8530
  // Recursively convert the node now without the guarded member access.
8524
8531
  var access = this._visit(ast, _Mode.Expression);
@@ -14380,10 +14387,41 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14380
14387
  enumerable: true,
14381
14388
  configurable: true
14382
14389
  });
14390
+ Object.defineProperty(_ParseAST.prototype, "atEOF", {
14391
+ /** Whether all the parser input has been processed. */
14392
+ get: function () {
14393
+ return this.index >= this.tokens.length;
14394
+ },
14395
+ enumerable: true,
14396
+ configurable: true
14397
+ });
14383
14398
  Object.defineProperty(_ParseAST.prototype, "inputIndex", {
14399
+ /**
14400
+ * Index of the next token to be processed, or the end of the last token if all have been
14401
+ * processed.
14402
+ */
14384
14403
  get: function () {
14385
- return (this.index < this.tokens.length) ? this.next.index + this.offset :
14386
- this.inputLength + this.offset;
14404
+ return this.atEOF ? this.currentEndIndex : this.next.index + this.offset;
14405
+ },
14406
+ enumerable: true,
14407
+ configurable: true
14408
+ });
14409
+ Object.defineProperty(_ParseAST.prototype, "currentEndIndex", {
14410
+ /**
14411
+ * End index of the last processed token, or the start of the first token if none have been
14412
+ * processed.
14413
+ */
14414
+ get: function () {
14415
+ if (this.index > 0) {
14416
+ var curToken = this.peek(-1);
14417
+ return curToken.end + this.offset;
14418
+ }
14419
+ // No tokens have been processed yet; return the next token's start or the length of the input
14420
+ // if there is no token.
14421
+ if (this.tokens.length === 0) {
14422
+ return this.inputLength + this.offset;
14423
+ }
14424
+ return this.next.index + this.offset;
14387
14425
  },
14388
14426
  enumerable: true,
14389
14427
  configurable: true
@@ -14399,12 +14437,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14399
14437
  configurable: true
14400
14438
  });
14401
14439
  _ParseAST.prototype.span = function (start) {
14402
- // `end` is either the
14403
- // - end index of the current token
14404
- // - start of the first token (this can happen e.g. when creating an implicit receiver)
14405
- var curToken = this.peek(-1);
14406
- var end = this.index > 0 ? curToken.end + this.offset : this.inputIndex;
14407
- return new ParseSpan(start, end);
14440
+ return new ParseSpan(start, this.currentEndIndex);
14408
14441
  };
14409
14442
  _ParseAST.prototype.sourceSpan = function (start) {
14410
14443
  var serial = start + "@" + this.inputIndex;
@@ -14788,7 +14821,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14788
14821
  _ParseAST.prototype.parseAccessMemberOrMethodCall = function (receiver, isSafe) {
14789
14822
  if (isSafe === void 0) { isSafe = false; }
14790
14823
  var start = receiver.span.start;
14824
+ var nameStart = this.inputIndex;
14791
14825
  var id = this.expectIdentifierOrKeyword();
14826
+ var nameSpan = this.sourceSpan(nameStart);
14792
14827
  if (this.consumeOptionalCharacter($LPAREN)) {
14793
14828
  this.rparensExpected++;
14794
14829
  var args = this.parseCallArguments();
@@ -14796,8 +14831,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14796
14831
  this.rparensExpected--;
14797
14832
  var span = this.span(start);
14798
14833
  var sourceSpan = this.sourceSpan(start);
14799
- return isSafe ? new SafeMethodCall(span, sourceSpan, receiver, id, args) :
14800
- new MethodCall(span, sourceSpan, receiver, id, args);
14834
+ return isSafe ? new SafeMethodCall(span, sourceSpan, nameSpan, receiver, id, args) :
14835
+ new MethodCall(span, sourceSpan, nameSpan, receiver, id, args);
14801
14836
  }
14802
14837
  else {
14803
14838
  if (isSafe) {
@@ -14806,7 +14841,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14806
14841
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
14807
14842
  }
14808
14843
  else {
14809
- return new SafePropertyRead(this.span(start), this.sourceSpan(start), receiver, id);
14844
+ return new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, receiver, id);
14810
14845
  }
14811
14846
  }
14812
14847
  else {
@@ -14816,10 +14851,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
14816
14851
  return new EmptyExpr(this.span(start), this.sourceSpan(start));
14817
14852
  }
14818
14853
  var value = this.parseConditional();
14819
- return new PropertyWrite(this.span(start), this.sourceSpan(start), receiver, id, value);
14854
+ return new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, receiver, id, value);
14820
14855
  }
14821
14856
  else {
14822
- return new PropertyRead(this.span(start), this.sourceSpan(start), receiver, id);
14857
+ return new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, receiver, id);
14823
14858
  }
14824
14859
  }
14825
14860
  }
@@ -18114,7 +18149,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18114
18149
  var slotPseudoLocal = "PIPE:" + slot;
18115
18150
  // Allocate one slot for the result plus one slot per pipe argument
18116
18151
  var pureFunctionSlot = this.allocatePureFunctionSlots(2 + pipe.args.length);
18117
- var target = new PropertyRead(pipe.span, pipe.sourceSpan, new ImplicitReceiver(pipe.span, pipe.sourceSpan), slotPseudoLocal);
18152
+ var target = new PropertyRead(pipe.span, pipe.sourceSpan, pipe.nameSpan, new ImplicitReceiver(pipe.span, pipe.sourceSpan), slotPseudoLocal);
18118
18153
  var _a = pipeBindingCallInfo(pipe.args), identifier = _a.identifier, isVarLength = _a.isVarLength;
18119
18154
  this.definePipe(pipe.name, slotPseudoLocal, slot, importExpr(identifier));
18120
18155
  var args = __spread([pipe.exp], pipe.args);
@@ -19566,7 +19601,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
19566
19601
  * Use of this source code is governed by an MIT-style license that can be
19567
19602
  * found in the LICENSE file at https://angular.io/license
19568
19603
  */
19569
- var VERSION$1 = new Version('9.1.3');
19604
+ var VERSION$1 = new Version('9.1.7');
19570
19605
 
19571
19606
  /**
19572
19607
  * @license
@@ -25729,6 +25764,250 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25729
25764
  BuiltinType[BuiltinType["Object"] = 128] = "Object";
25730
25765
  })(BuiltinType$1 || (BuiltinType$1 = {}));
25731
25766
 
25767
+ /**
25768
+ * @license
25769
+ * Copyright Google Inc. All Rights Reserved.
25770
+ *
25771
+ * Use of this source code is governed by an MIT-style license that can be
25772
+ * found in the LICENSE file at https://angular.io/license
25773
+ */
25774
+ function isParseSourceSpan(value) {
25775
+ return value && !!value.start;
25776
+ }
25777
+ function spanOf(span) {
25778
+ if (!span)
25779
+ return undefined;
25780
+ if (isParseSourceSpan(span)) {
25781
+ return { start: span.start.offset, end: span.end.offset };
25782
+ }
25783
+ else {
25784
+ if (span.endSourceSpan) {
25785
+ return { start: span.sourceSpan.start.offset, end: span.endSourceSpan.end.offset };
25786
+ }
25787
+ else if (span.children && span.children.length) {
25788
+ return {
25789
+ start: span.sourceSpan.start.offset,
25790
+ end: spanOf(span.children[span.children.length - 1]).end
25791
+ };
25792
+ }
25793
+ return { start: span.sourceSpan.start.offset, end: span.sourceSpan.end.offset };
25794
+ }
25795
+ }
25796
+ function inSpan(position, span, exclusive) {
25797
+ return span != null &&
25798
+ (exclusive ? position >= span.start && position < span.end :
25799
+ position >= span.start && position <= span.end);
25800
+ }
25801
+ function offsetSpan(span, amount) {
25802
+ return { start: span.start + amount, end: span.end + amount };
25803
+ }
25804
+ function isNarrower(spanA, spanB) {
25805
+ return spanA.start >= spanB.start && spanA.end <= spanB.end;
25806
+ }
25807
+ function isStructuralDirective(type) {
25808
+ var e_1, _a;
25809
+ var _b;
25810
+ try {
25811
+ for (var _c = __values(type.diDeps), _d = _c.next(); !_d.done; _d = _c.next()) {
25812
+ var diDep = _d.value;
25813
+ var diDepName = identifierName((_b = diDep.token) === null || _b === void 0 ? void 0 : _b.identifier);
25814
+ if (diDepName === Identifiers.TemplateRef.name ||
25815
+ diDepName === Identifiers.ViewContainerRef.name) {
25816
+ return true;
25817
+ }
25818
+ }
25819
+ }
25820
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
25821
+ finally {
25822
+ try {
25823
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
25824
+ }
25825
+ finally { if (e_1) throw e_1.error; }
25826
+ }
25827
+ return false;
25828
+ }
25829
+ function getSelectors(info) {
25830
+ var e_2, _a, e_3, _b;
25831
+ var map = new Map();
25832
+ var results = [];
25833
+ try {
25834
+ for (var _c = __values(info.directives), _d = _c.next(); !_d.done; _d = _c.next()) {
25835
+ var directive = _d.value;
25836
+ var selectors = CssSelector.parse(directive.selector);
25837
+ try {
25838
+ for (var selectors_1 = (e_3 = void 0, __values(selectors)), selectors_1_1 = selectors_1.next(); !selectors_1_1.done; selectors_1_1 = selectors_1.next()) {
25839
+ var selector = selectors_1_1.value;
25840
+ results.push(selector);
25841
+ map.set(selector, directive);
25842
+ }
25843
+ }
25844
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
25845
+ finally {
25846
+ try {
25847
+ if (selectors_1_1 && !selectors_1_1.done && (_b = selectors_1.return)) _b.call(selectors_1);
25848
+ }
25849
+ finally { if (e_3) throw e_3.error; }
25850
+ }
25851
+ }
25852
+ }
25853
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
25854
+ finally {
25855
+ try {
25856
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
25857
+ }
25858
+ finally { if (e_2) throw e_2.error; }
25859
+ }
25860
+ return { selectors: results, map: map };
25861
+ }
25862
+ function diagnosticInfoFromTemplateInfo(info) {
25863
+ return {
25864
+ fileName: info.template.fileName,
25865
+ offset: info.template.span.start,
25866
+ query: info.template.query,
25867
+ members: info.template.members,
25868
+ htmlAst: info.htmlAst,
25869
+ templateAst: info.templateAst,
25870
+ source: info.template.source,
25871
+ };
25872
+ }
25873
+ function findTemplateAstAt(ast, position) {
25874
+ var path = [];
25875
+ var visitor = new /** @class */ (function (_super) {
25876
+ __extends(class_1, _super);
25877
+ function class_1() {
25878
+ return _super !== null && _super.apply(this, arguments) || this;
25879
+ }
25880
+ class_1.prototype.visit = function (ast) {
25881
+ var span = spanOf(ast);
25882
+ if (inSpan(position, span)) {
25883
+ var len = path.length;
25884
+ if (!len || isNarrower(span, spanOf(path[len - 1]))) {
25885
+ path.push(ast);
25886
+ }
25887
+ }
25888
+ else {
25889
+ // Returning a value here will result in the children being skipped.
25890
+ return true;
25891
+ }
25892
+ };
25893
+ class_1.prototype.visitEmbeddedTemplate = function (ast, context) {
25894
+ return this.visitChildren(context, function (visit) {
25895
+ // Ignore reference, variable and providers
25896
+ visit(ast.attrs);
25897
+ visit(ast.directives);
25898
+ visit(ast.children);
25899
+ });
25900
+ };
25901
+ class_1.prototype.visitElement = function (ast, context) {
25902
+ return this.visitChildren(context, function (visit) {
25903
+ // Ingnore providers
25904
+ visit(ast.attrs);
25905
+ visit(ast.inputs);
25906
+ visit(ast.outputs);
25907
+ visit(ast.references);
25908
+ visit(ast.directives);
25909
+ visit(ast.children);
25910
+ });
25911
+ };
25912
+ class_1.prototype.visitDirective = function (ast, context) {
25913
+ // Ignore the host properties of a directive
25914
+ var result = this.visitChildren(context, function (visit) {
25915
+ visit(ast.inputs);
25916
+ });
25917
+ // We never care about the diretive itself, just its inputs.
25918
+ if (path[path.length - 1] === ast) {
25919
+ path.pop();
25920
+ }
25921
+ return result;
25922
+ };
25923
+ return class_1;
25924
+ }(RecursiveTemplateAstVisitor));
25925
+ templateVisitAll(visitor, ast);
25926
+ return new AstPath(path, position);
25927
+ }
25928
+ /**
25929
+ * Find the tightest node at the specified `position` from the AST `nodes`, and
25930
+ * return the path to the node.
25931
+ * @param nodes HTML AST nodes
25932
+ * @param position
25933
+ */
25934
+ function getPathToNodeAtPosition(nodes, position) {
25935
+ var path = [];
25936
+ var visitor = new /** @class */ (function (_super) {
25937
+ __extends(class_2, _super);
25938
+ function class_2() {
25939
+ return _super !== null && _super.apply(this, arguments) || this;
25940
+ }
25941
+ class_2.prototype.visit = function (ast) {
25942
+ var span = spanOf(ast);
25943
+ if (inSpan(position, span)) {
25944
+ path.push(ast);
25945
+ }
25946
+ else {
25947
+ // Returning a truthy value here will skip all children and terminate
25948
+ // the visit.
25949
+ return true;
25950
+ }
25951
+ };
25952
+ return class_2;
25953
+ }(RecursiveVisitor));
25954
+ visitAll$1(visitor, nodes);
25955
+ return new AstPath(path, position);
25956
+ }
25957
+ /**
25958
+ * Inverts an object's key-value pairs.
25959
+ */
25960
+ function invertMap(obj) {
25961
+ var e_4, _a;
25962
+ var result = {};
25963
+ try {
25964
+ for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
25965
+ var name_1 = _c.value;
25966
+ var v = obj[name_1];
25967
+ result[v] = name_1;
25968
+ }
25969
+ }
25970
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
25971
+ finally {
25972
+ try {
25973
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
25974
+ }
25975
+ finally { if (e_4) throw e_4.error; }
25976
+ }
25977
+ return result;
25978
+ }
25979
+ /**
25980
+ * Finds the directive member providing a template output binding, if one exists.
25981
+ * @param info aggregate template AST information
25982
+ * @param path narrowing
25983
+ */
25984
+ function findOutputBinding(binding, path, query) {
25985
+ var e_5, _a;
25986
+ var element = path.first(ElementAst);
25987
+ if (element) {
25988
+ try {
25989
+ for (var _b = __values(element.directives), _c = _b.next(); !_c.done; _c = _b.next()) {
25990
+ var directive = _c.value;
25991
+ var invertedOutputs = invertMap(directive.directive.outputs);
25992
+ var fieldName = invertedOutputs[binding.name];
25993
+ if (fieldName) {
25994
+ var classSymbol = query.getTypeSymbol(directive.directive.type.reference);
25995
+ if (classSymbol) {
25996
+ return classSymbol.members().get(fieldName);
25997
+ }
25998
+ }
25999
+ }
26000
+ }
26001
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
26002
+ finally {
26003
+ try {
26004
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
26005
+ }
26006
+ finally { if (e_5) throw e_5.error; }
26007
+ }
26008
+ }
26009
+ }
26010
+
25732
26011
  /**
25733
26012
  * @license
25734
26013
  * Copyright Google Inc. All Rights Reserved.
@@ -25751,7 +26030,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25751
26030
  AstType.prototype.getDiagnostics = function (ast) {
25752
26031
  var type = ast.visit(this);
25753
26032
  if (this.context.inEvent && type.callable) {
25754
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.callable_expression_expected_method_call));
26033
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.callable_expression_expected_method_call));
25755
26034
  }
25756
26035
  return this.diagnostics;
25757
26036
  };
@@ -25770,7 +26049,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25770
26049
  // Nullable allowed.
25771
26050
  break;
25772
26051
  default:
25773
- _this_1.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expression_might_be_null));
26052
+ _this_1.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.expression_might_be_null));
25774
26053
  break;
25775
26054
  }
25776
26055
  }
@@ -25843,7 +26122,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25843
26122
  this.diagnostics.push(createDiagnostic(ast.right.span, Diagnostic.expected_a_number_type));
25844
26123
  return this.anyType;
25845
26124
  default:
25846
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expected_a_string_or_number_type));
26125
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.expected_a_string_or_number_type));
25847
26126
  return this.anyType;
25848
26127
  }
25849
26128
  case '>':
@@ -25859,7 +26138,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25859
26138
  // Two values are comparable only if
25860
26139
  // - they have some type overlap, or
25861
26140
  // - at least one is not defined
25862
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.expected_operands_of_comparable_types_or_any));
26141
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.expected_operands_of_comparable_types_or_any));
25863
26142
  }
25864
26143
  return this.query.getBuiltinType(BuiltinType$1.Boolean);
25865
26144
  case '&&':
@@ -25867,7 +26146,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25867
26146
  case '||':
25868
26147
  return this.query.getTypeUnion(leftType, rightType);
25869
26148
  }
25870
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unrecognized_operator, ast.operation));
26149
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unrecognized_operator, ast.operation));
25871
26150
  return this.anyType;
25872
26151
  };
25873
26152
  AstType.prototype.visitChain = function (ast) {
@@ -25905,7 +26184,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25905
26184
  var args = ast.args.map(function (arg) { return _this_1.getType(arg); });
25906
26185
  var target = this.getType(ast.target);
25907
26186
  if (!target || !target.callable) {
25908
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.call_target_not_callable, this.sourceOf(ast.target), target.name));
26187
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.call_target_not_callable, this.sourceOf(ast.target), target.name));
25909
26188
  return this.anyType;
25910
26189
  }
25911
26190
  var signature = target.selectSignature(args);
@@ -25914,7 +26193,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25914
26193
  }
25915
26194
  // TODO: Consider a better error message here. See `typescript_symbols#selectSignature` for more
25916
26195
  // details.
25917
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_compatible_call_signature));
26196
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_compatible_call_signature));
25918
26197
  return this.anyType;
25919
26198
  };
25920
26199
  AstType.prototype.visitImplicitReceiver = function (_ast) {
@@ -26020,7 +26299,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26020
26299
  case 'number':
26021
26300
  return this.query.getBuiltinType(BuiltinType$1.Number);
26022
26301
  default:
26023
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unrecognized_primitive, typeof ast.value));
26302
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unrecognized_primitive, typeof ast.value));
26024
26303
  return this.anyType;
26025
26304
  }
26026
26305
  }
@@ -26034,13 +26313,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26034
26313
  // by getPipes() is expected to contain symbols with the corresponding transform method type.
26035
26314
  var pipe = this.query.getPipes().get(ast.name);
26036
26315
  if (!pipe) {
26037
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.no_pipe_found, ast.name));
26316
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.no_pipe_found, ast.name));
26038
26317
  return this.anyType;
26039
26318
  }
26040
26319
  var expType = this.getType(ast.exp);
26041
26320
  var signature = pipe.selectSignature([expType].concat(ast.args.map(function (arg) { return _this_1.getType(arg); })));
26042
26321
  if (!signature) {
26043
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_signature, ast.name));
26322
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_signature, ast.name));
26044
26323
  return this.anyType;
26045
26324
  }
26046
26325
  return signature.result;
@@ -26109,19 +26388,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26109
26388
  }
26110
26389
  var methodType = this.resolvePropertyRead(receiverType, ast);
26111
26390
  if (!methodType) {
26112
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.could_not_resolve_type, ast.name));
26391
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.could_not_resolve_type, ast.name));
26113
26392
  return this.anyType;
26114
26393
  }
26115
26394
  if (this.isAny(methodType)) {
26116
26395
  return this.anyType;
26117
26396
  }
26118
26397
  if (!methodType.callable) {
26119
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_callable, ast.name));
26398
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_not_callable, ast.name));
26120
26399
  return this.anyType;
26121
26400
  }
26122
26401
  var signature = methodType.selectSignature(ast.args.map(function (arg) { return _this_1.getType(arg); }));
26123
26402
  if (!signature) {
26124
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.unable_to_resolve_signature, ast.name));
26403
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_signature, ast.name));
26125
26404
  return this.anyType;
26126
26405
  }
26127
26406
  return signature.result;
@@ -26134,20 +26413,20 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26134
26413
  var member = receiverType.members().get(ast.name);
26135
26414
  if (!member) {
26136
26415
  if (receiverType.name === '$implicit') {
26137
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_defined_in_app_context, ast.name));
26416
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_not_defined_in_app_context, ast.name));
26138
26417
  }
26139
26418
  else if (receiverType.nullable && ast.receiver instanceof PropertyRead) {
26140
26419
  var receiver = ast.receiver.name;
26141
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_possibly_undefined, receiver, receiver + "?." + ast.name, receiver + "!." + ast.name));
26420
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_possibly_undefined, receiver, receiver + "?." + ast.name, receiver + "!." + ast.name));
26142
26421
  }
26143
26422
  else {
26144
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_not_defined_on_receiver, ast.name, receiverType.name));
26423
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_not_defined_on_receiver, ast.name, receiverType.name));
26145
26424
  }
26146
26425
  return this.anyType;
26147
26426
  }
26148
26427
  if (!member.public) {
26149
26428
  var container = receiverType.name === '$implicit' ? 'the component' : "'" + receiverType.name + "'";
26150
- this.diagnostics.push(createDiagnostic(ast.span, Diagnostic.identifier_is_private, ast.name, container));
26429
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_is_private, ast.name, container));
26151
26430
  }
26152
26431
  return member.type;
26153
26432
  };
@@ -26157,379 +26436,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26157
26436
  };
26158
26437
  return AstType;
26159
26438
  }());
26160
-
26161
- /**
26162
- * @license
26163
- * Copyright Google Inc. All Rights Reserved.
26164
- *
26165
- * Use of this source code is governed by an MIT-style license that can be
26166
- * found in the LICENSE file at https://angular.io/license
26167
- */
26168
- function isParseSourceSpan(value) {
26169
- return value && !!value.start;
26170
- }
26171
- function spanOf(span) {
26172
- if (!span)
26173
- return undefined;
26174
- if (isParseSourceSpan(span)) {
26175
- return { start: span.start.offset, end: span.end.offset };
26176
- }
26177
- else {
26178
- if (span.endSourceSpan) {
26179
- return { start: span.sourceSpan.start.offset, end: span.endSourceSpan.end.offset };
26180
- }
26181
- else if (span.children && span.children.length) {
26182
- return {
26183
- start: span.sourceSpan.start.offset,
26184
- end: spanOf(span.children[span.children.length - 1]).end
26185
- };
26186
- }
26187
- return { start: span.sourceSpan.start.offset, end: span.sourceSpan.end.offset };
26188
- }
26189
- }
26190
- function inSpan(position, span, exclusive) {
26191
- return span != null &&
26192
- (exclusive ? position >= span.start && position < span.end :
26193
- position >= span.start && position <= span.end);
26194
- }
26195
- function offsetSpan(span, amount) {
26196
- return { start: span.start + amount, end: span.end + amount };
26197
- }
26198
- function isNarrower(spanA, spanB) {
26199
- return spanA.start >= spanB.start && spanA.end <= spanB.end;
26200
- }
26201
- function isStructuralDirective(type) {
26202
- var e_1, _a;
26203
- var _b;
26204
- try {
26205
- for (var _c = __values(type.diDeps), _d = _c.next(); !_d.done; _d = _c.next()) {
26206
- var diDep = _d.value;
26207
- var diDepName = identifierName((_b = diDep.token) === null || _b === void 0 ? void 0 : _b.identifier);
26208
- if (diDepName === Identifiers.TemplateRef.name ||
26209
- diDepName === Identifiers.ViewContainerRef.name) {
26210
- return true;
26211
- }
26212
- }
26213
- }
26214
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
26215
- finally {
26216
- try {
26217
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
26218
- }
26219
- finally { if (e_1) throw e_1.error; }
26220
- }
26221
- return false;
26222
- }
26223
- function getSelectors(info) {
26224
- var e_2, _a, e_3, _b;
26225
- var map = new Map();
26226
- var results = [];
26227
- try {
26228
- for (var _c = __values(info.directives), _d = _c.next(); !_d.done; _d = _c.next()) {
26229
- var directive = _d.value;
26230
- var selectors = CssSelector.parse(directive.selector);
26231
- try {
26232
- for (var selectors_1 = (e_3 = void 0, __values(selectors)), selectors_1_1 = selectors_1.next(); !selectors_1_1.done; selectors_1_1 = selectors_1.next()) {
26233
- var selector = selectors_1_1.value;
26234
- results.push(selector);
26235
- map.set(selector, directive);
26236
- }
26237
- }
26238
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
26239
- finally {
26240
- try {
26241
- if (selectors_1_1 && !selectors_1_1.done && (_b = selectors_1.return)) _b.call(selectors_1);
26242
- }
26243
- finally { if (e_3) throw e_3.error; }
26244
- }
26245
- }
26246
- }
26247
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
26248
- finally {
26249
- try {
26250
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
26251
- }
26252
- finally { if (e_2) throw e_2.error; }
26253
- }
26254
- return { selectors: results, map: map };
26255
- }
26256
- function diagnosticInfoFromTemplateInfo(info) {
26257
- return {
26258
- fileName: info.template.fileName,
26259
- offset: info.template.span.start,
26260
- query: info.template.query,
26261
- members: info.template.members,
26262
- htmlAst: info.htmlAst,
26263
- templateAst: info.templateAst,
26264
- source: info.template.source,
26265
- };
26266
- }
26267
- function findTemplateAstAt(ast, position) {
26268
- var path = [];
26269
- var visitor = new /** @class */ (function (_super) {
26270
- __extends(class_1, _super);
26271
- function class_1() {
26272
- return _super !== null && _super.apply(this, arguments) || this;
26273
- }
26274
- class_1.prototype.visit = function (ast) {
26275
- var span = spanOf(ast);
26276
- if (inSpan(position, span)) {
26277
- var len = path.length;
26278
- if (!len || isNarrower(span, spanOf(path[len - 1]))) {
26279
- path.push(ast);
26280
- }
26281
- }
26282
- else {
26283
- // Returning a value here will result in the children being skipped.
26284
- return true;
26285
- }
26286
- };
26287
- class_1.prototype.visitEmbeddedTemplate = function (ast, context) {
26288
- return this.visitChildren(context, function (visit) {
26289
- // Ignore reference, variable and providers
26290
- visit(ast.attrs);
26291
- visit(ast.directives);
26292
- visit(ast.children);
26293
- });
26294
- };
26295
- class_1.prototype.visitElement = function (ast, context) {
26296
- return this.visitChildren(context, function (visit) {
26297
- // Ingnore providers
26298
- visit(ast.attrs);
26299
- visit(ast.inputs);
26300
- visit(ast.outputs);
26301
- visit(ast.references);
26302
- visit(ast.directives);
26303
- visit(ast.children);
26304
- });
26305
- };
26306
- class_1.prototype.visitDirective = function (ast, context) {
26307
- // Ignore the host properties of a directive
26308
- var result = this.visitChildren(context, function (visit) {
26309
- visit(ast.inputs);
26310
- });
26311
- // We never care about the diretive itself, just its inputs.
26312
- if (path[path.length - 1] === ast) {
26313
- path.pop();
26314
- }
26315
- return result;
26316
- };
26317
- return class_1;
26318
- }(RecursiveTemplateAstVisitor));
26319
- templateVisitAll(visitor, ast);
26320
- return new AstPath(path, position);
26321
- }
26322
- /**
26323
- * Return the node that most tightly encompass the specified `position`.
26324
- * @param node
26325
- * @param position
26326
- */
26327
- function findTightestNode(node, position) {
26328
- if (node.getStart() <= position && position < node.getEnd()) {
26329
- return node.forEachChild(function (c) { return findTightestNode(c, position); }) || node;
26330
- }
26331
- }
26332
- /**
26333
- * Return metadata about `node` if it looks like an Angular directive class.
26334
- * In this case, potential matches are `@NgModule`, `@Component`, `@Directive`,
26335
- * `@Pipe`, etc.
26336
- * These class declarations all share some common attributes, namely their
26337
- * decorator takes exactly one parameter and the parameter must be an object
26338
- * literal.
26339
- *
26340
- * For example,
26341
- * v---------- `decoratorId`
26342
- * @NgModule({ <
26343
- * declarations: [], < classDecl
26344
- * }) <
26345
- * class AppModule {} <
26346
- * ^----- `classId`
26347
- *
26348
- * @param node Potential node that represents an Angular directive.
26349
- */
26350
- function getDirectiveClassLike(node) {
26351
- var e_4, _a;
26352
- if (!ts.isClassDeclaration(node) || !node.name || !node.decorators) {
26353
- return;
26354
- }
26355
- try {
26356
- for (var _b = __values(node.decorators), _c = _b.next(); !_c.done; _c = _b.next()) {
26357
- var d = _c.value;
26358
- var expr = d.expression;
26359
- if (!ts.isCallExpression(expr) || expr.arguments.length !== 1 ||
26360
- !ts.isIdentifier(expr.expression)) {
26361
- continue;
26362
- }
26363
- var arg = expr.arguments[0];
26364
- if (ts.isObjectLiteralExpression(arg)) {
26365
- return {
26366
- decoratorId: expr.expression,
26367
- classId: node.name,
26368
- };
26369
- }
26370
- }
26371
- }
26372
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
26373
- finally {
26374
- try {
26375
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
26376
- }
26377
- finally { if (e_4) throw e_4.error; }
26378
- }
26379
- }
26380
- /**
26381
- * Finds the value of a property assignment that is nested in a TypeScript node and is of a certain
26382
- * type T.
26383
- *
26384
- * @param startNode node to start searching for nested property assignment from
26385
- * @param propName property assignment name
26386
- * @param predicate function to verify that a node is of type T.
26387
- * @return node property assignment value of type T, or undefined if none is found
26388
- */
26389
- function findPropertyValueOfType(startNode, propName, predicate) {
26390
- if (ts.isPropertyAssignment(startNode) && startNode.name.getText() === propName) {
26391
- var initializer = startNode.initializer;
26392
- if (predicate(initializer))
26393
- return initializer;
26394
- }
26395
- return startNode.forEachChild(function (c) { return findPropertyValueOfType(c, propName, predicate); });
26396
- }
26397
- /**
26398
- * Find the tightest node at the specified `position` from the AST `nodes`, and
26399
- * return the path to the node.
26400
- * @param nodes HTML AST nodes
26401
- * @param position
26402
- */
26403
- function getPathToNodeAtPosition(nodes, position) {
26404
- var path = [];
26405
- var visitor = new /** @class */ (function (_super) {
26406
- __extends(class_2, _super);
26407
- function class_2() {
26408
- return _super !== null && _super.apply(this, arguments) || this;
26409
- }
26410
- class_2.prototype.visit = function (ast) {
26411
- var span = spanOf(ast);
26412
- if (inSpan(position, span)) {
26413
- path.push(ast);
26414
- }
26415
- else {
26416
- // Returning a truthy value here will skip all children and terminate
26417
- // the visit.
26418
- return true;
26419
- }
26420
- };
26421
- return class_2;
26422
- }(RecursiveVisitor));
26423
- visitAll$1(visitor, nodes);
26424
- return new AstPath(path, position);
26425
- }
26426
- /**
26427
- * Inverts an object's key-value pairs.
26428
- */
26429
- function invertMap(obj) {
26430
- var e_5, _a;
26431
- var result = {};
26432
- try {
26433
- for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
26434
- var name_1 = _c.value;
26435
- var v = obj[name_1];
26436
- result[v] = name_1;
26437
- }
26438
- }
26439
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
26440
- finally {
26441
- try {
26442
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
26443
- }
26444
- finally { if (e_5) throw e_5.error; }
26445
- }
26446
- return result;
26447
- }
26448
- /**
26449
- * Finds the directive member providing a template output binding, if one exists.
26450
- * @param info aggregate template AST information
26451
- * @param path narrowing
26452
- */
26453
- function findOutputBinding(binding, path, query) {
26454
- var e_6, _a;
26455
- var element = path.first(ElementAst);
26456
- if (element) {
26457
- try {
26458
- for (var _b = __values(element.directives), _c = _b.next(); !_c.done; _c = _b.next()) {
26459
- var directive = _c.value;
26460
- var invertedOutputs = invertMap(directive.directive.outputs);
26461
- var fieldName = invertedOutputs[binding.name];
26462
- if (fieldName) {
26463
- var classSymbol = query.getTypeSymbol(directive.directive.type.reference);
26464
- if (classSymbol) {
26465
- return classSymbol.members().get(fieldName);
26466
- }
26467
- }
26468
- }
26469
- }
26470
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
26471
- finally {
26472
- try {
26473
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
26474
- }
26475
- finally { if (e_6) throw e_6.error; }
26476
- }
26477
- }
26478
- }
26479
- /**
26480
- * Returns a property assignment from the assignment value, or `undefined` if there is no
26481
- * assignment.
26482
- */
26483
- function getPropertyAssignmentFromValue(value) {
26484
- if (!value.parent || !ts.isPropertyAssignment(value.parent)) {
26485
- return;
26486
- }
26487
- return value.parent;
26488
- }
26489
- /**
26490
- * Given a decorator property assignment, return the ClassDeclaration node that corresponds to the
26491
- * directive class the property applies to.
26492
- * If the property assignment is not on a class decorator, no declaration is returned.
26493
- *
26494
- * For example,
26495
- *
26496
- * @Component({
26497
- * template: '<div></div>'
26498
- * ^^^^^^^^^^^^^^^^^^^^^^^---- property assignment
26499
- * })
26500
- * class AppComponent {}
26501
- * ^---- class declaration node
26502
- *
26503
- * @param propAsgn property assignment
26504
- */
26505
- function getClassDeclFromDecoratorProp(propAsgnNode) {
26506
- if (!propAsgnNode.parent || !ts.isObjectLiteralExpression(propAsgnNode.parent)) {
26507
- return;
26439
+ function refinedSpan(ast) {
26440
+ // nameSpan is an absolute span, but the spans returned by the expression visitor are expected to
26441
+ // be relative to the start of the expression.
26442
+ // TODO: migrate to only using absolute spans
26443
+ var absoluteOffset = ast.sourceSpan.start - ast.span.start;
26444
+ if (ast instanceof ASTWithName) {
26445
+ return offsetSpan(ast.nameSpan, -absoluteOffset);
26508
26446
  }
26509
- var objLitExprNode = propAsgnNode.parent;
26510
- if (!objLitExprNode.parent || !ts.isCallExpression(objLitExprNode.parent)) {
26511
- return;
26512
- }
26513
- var callExprNode = objLitExprNode.parent;
26514
- if (!callExprNode.parent || !ts.isDecorator(callExprNode.parent)) {
26515
- return;
26516
- }
26517
- var decorator = callExprNode.parent;
26518
- if (!decorator.parent || !ts.isClassDeclaration(decorator.parent)) {
26519
- return;
26520
- }
26521
- var classDeclNode = decorator.parent;
26522
- return classDeclNode;
26523
- }
26524
- /**
26525
- * Determines if a property assignment is on a class decorator.
26526
- * See `getClassDeclFromDecoratorProperty`, which gets the class the decorator is applied to, for
26527
- * more details.
26528
- *
26529
- * @param prop property assignment
26530
- */
26531
- function isClassDecoratorProperty(propAsgn) {
26532
- return !!getClassDeclFromDecoratorProp(propAsgn);
26447
+ return offsetSpan(ast.sourceSpan, -absoluteOffset);
26533
26448
  }
26534
26449
 
26535
26450
  /**
@@ -27058,6 +26973,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27058
26973
  function getType(ast) {
27059
26974
  return new AstType(scope, templateInfo.query, {}, templateInfo.source).getType(ast);
27060
26975
  }
26976
+ function spanFromName(ast) {
26977
+ // `nameSpan` is an absolute span, but the span expected by the result of this method is
26978
+ // relative to the start of the expression.
26979
+ // TODO(ayazhafiz): migrate to only using absolute spans
26980
+ var offset = ast.sourceSpan.start - ast.span.start;
26981
+ return {
26982
+ start: ast.nameSpan.start - offset,
26983
+ end: ast.nameSpan.end - offset,
26984
+ };
26985
+ }
27061
26986
  var symbol = undefined;
27062
26987
  var span = undefined;
27063
26988
  // If the completion request is in a not in a pipe or property access then the global scope
@@ -27078,21 +27003,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27078
27003
  visitMethodCall: function (ast) {
27079
27004
  var receiverType = getType(ast.receiver);
27080
27005
  symbol = receiverType && receiverType.members().get(ast.name);
27081
- span = ast.span;
27006
+ span = spanFromName(ast);
27082
27007
  },
27083
27008
  visitPipe: function (ast) {
27084
27009
  if (inSpan(position, ast.nameSpan, /* exclusive */ true)) {
27085
27010
  // We are in a position a pipe name is expected.
27086
27011
  var pipes = templateInfo.query.getPipes();
27087
27012
  symbol = pipes.get(ast.name);
27088
- // `nameSpan` is an absolute span, but the span expected by the result of this method is
27089
- // relative to the start of the expression.
27090
- // TODO(ayazhafiz): migrate to only using absolute spans
27091
- var offset = ast.sourceSpan.start - ast.span.start;
27092
- span = {
27093
- start: ast.nameSpan.start - offset,
27094
- end: ast.nameSpan.end - offset,
27095
- };
27013
+ span = spanFromName(ast);
27096
27014
  }
27097
27015
  },
27098
27016
  visitPrefixNot: function (_ast) { },
@@ -27100,29 +27018,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27100
27018
  visitPropertyRead: function (ast) {
27101
27019
  var receiverType = getType(ast.receiver);
27102
27020
  symbol = receiverType && receiverType.members().get(ast.name);
27103
- span = ast.span;
27021
+ span = spanFromName(ast);
27104
27022
  },
27105
27023
  visitPropertyWrite: function (ast) {
27106
27024
  var receiverType = getType(ast.receiver);
27107
- var start = ast.span.start;
27108
27025
  symbol = receiverType && receiverType.members().get(ast.name);
27109
- // A PropertyWrite span includes both the LHS (name) and the RHS (value) of the write. In this
27110
- // visit, only the name is relevant.
27111
- // prop=$event
27112
- // ^^^^ name
27113
- // ^^^^^^ value; visited separately as a nested AST
27114
- span = { start: start, end: start + ast.name.length };
27026
+ span = spanFromName(ast);
27115
27027
  },
27116
27028
  visitQuote: function (_ast) { },
27117
27029
  visitSafeMethodCall: function (ast) {
27118
27030
  var receiverType = getType(ast.receiver);
27119
27031
  symbol = receiverType && receiverType.members().get(ast.name);
27120
- span = ast.span;
27032
+ span = spanFromName(ast);
27121
27033
  },
27122
27034
  visitSafePropertyRead: function (ast) {
27123
27035
  var receiverType = getType(ast.receiver);
27124
27036
  symbol = receiverType && receiverType.members().get(ast.name);
27125
- span = ast.span;
27037
+ span = spanFromName(ast);
27126
27038
  },
27127
27039
  });
27128
27040
  if (symbol && span) {
@@ -29203,7 +29115,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29203
29115
  // no-op for now
29204
29116
  };
29205
29117
  ExpressionVisitor.prototype.visitAttr = function (ast) {
29206
- var _this = this;
29207
29118
  var binding = getBindingDescriptor(ast.name);
29208
29119
  if (binding && binding.kind === ATTR.KW_MICROSYNTAX) {
29209
29120
  // This a template binding given by micro syntax expression.
@@ -29217,8 +29128,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29217
29128
  var absKeyOffset = 0;
29218
29129
  var absValueOffset = ast.sourceSpan.start.offset;
29219
29130
  var templateBindings = this.info.expressionParser.parseTemplateBindings(templateKey, templateValue, templateUrl, absKeyOffset, absValueOffset).templateBindings;
29220
- // Find the template binding that contains the position.
29221
- var templateBinding = templateBindings.find(function (b) { return inSpan(_this.position, b.sourceSpan); });
29131
+ // Find the nearest template binding to the position.
29132
+ var lastBindingEnd = templateBindings.length > 0 &&
29133
+ templateBindings[templateBindings.length - 1].sourceSpan.end;
29134
+ var normalizedPositionToBinding_1 = lastBindingEnd && this.position > lastBindingEnd ? lastBindingEnd : this.position;
29135
+ var templateBinding = templateBindings.find(function (b) { return inSpan(normalizedPositionToBinding_1, b.sourceSpan); });
29222
29136
  if (!templateBinding) {
29223
29137
  return;
29224
29138
  }
@@ -29827,6 +29741,136 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29827
29741
  return OverrideKindSymbol;
29828
29742
  }());
29829
29743
 
29744
+ /**
29745
+ * @license
29746
+ * Copyright Google Inc. All Rights Reserved.
29747
+ *
29748
+ * Use of this source code is governed by an MIT-style license that can be
29749
+ * found in the LICENSE file at https://angular.io/license
29750
+ */
29751
+ /**
29752
+ * Return the node that most tightly encompass the specified `position`.
29753
+ * @param node
29754
+ * @param position
29755
+ */
29756
+ function findTightestNode(node, position) {
29757
+ if (node.getStart() <= position && position < node.getEnd()) {
29758
+ return node.forEachChild(function (c) { return findTightestNode(c, position); }) || node;
29759
+ }
29760
+ }
29761
+ /**
29762
+ * Returns a property assignment from the assignment value if the property name
29763
+ * matches the specified `key`, or `undefined` if there is no match.
29764
+ */
29765
+ function getPropertyAssignmentFromValue(value, key) {
29766
+ var propAssignment = value.parent;
29767
+ if (!propAssignment || !tss.isPropertyAssignment(propAssignment) ||
29768
+ propAssignment.name.getText() !== key) {
29769
+ return;
29770
+ }
29771
+ return propAssignment;
29772
+ }
29773
+ /**
29774
+ * Given a decorator property assignment, return the ClassDeclaration node that corresponds to the
29775
+ * directive class the property applies to.
29776
+ * If the property assignment is not on a class decorator, no declaration is returned.
29777
+ *
29778
+ * For example,
29779
+ *
29780
+ * @Component({
29781
+ * template: '<div></div>'
29782
+ * ^^^^^^^^^^^^^^^^^^^^^^^---- property assignment
29783
+ * })
29784
+ * class AppComponent {}
29785
+ * ^---- class declaration node
29786
+ *
29787
+ * @param propAsgn property assignment
29788
+ */
29789
+ function getClassDeclFromDecoratorProp(propAsgnNode) {
29790
+ if (!propAsgnNode.parent || !tss.isObjectLiteralExpression(propAsgnNode.parent)) {
29791
+ return;
29792
+ }
29793
+ var objLitExprNode = propAsgnNode.parent;
29794
+ if (!objLitExprNode.parent || !tss.isCallExpression(objLitExprNode.parent)) {
29795
+ return;
29796
+ }
29797
+ var callExprNode = objLitExprNode.parent;
29798
+ if (!callExprNode.parent || !tss.isDecorator(callExprNode.parent)) {
29799
+ return;
29800
+ }
29801
+ var decorator = callExprNode.parent;
29802
+ if (!decorator.parent || !tss.isClassDeclaration(decorator.parent)) {
29803
+ return;
29804
+ }
29805
+ var classDeclNode = decorator.parent;
29806
+ return classDeclNode;
29807
+ }
29808
+ /**
29809
+ * Return metadata about `node` if it looks like an Angular directive class.
29810
+ * In this case, potential matches are `@NgModule`, `@Component`, `@Directive`,
29811
+ * `@Pipe`, etc.
29812
+ * These class declarations all share some common attributes, namely their
29813
+ * decorator takes exactly one parameter and the parameter must be an object
29814
+ * literal.
29815
+ *
29816
+ * For example,
29817
+ * v---------- `decoratorId`
29818
+ * @NgModule({ <
29819
+ * declarations: [], < classDecl
29820
+ * }) <
29821
+ * class AppModule {} <
29822
+ * ^----- `classId`
29823
+ *
29824
+ * @param node Potential node that represents an Angular directive.
29825
+ */
29826
+ function getDirectiveClassLike(node) {
29827
+ var e_1, _a;
29828
+ if (!tss.isClassDeclaration(node) || !node.name || !node.decorators) {
29829
+ return;
29830
+ }
29831
+ try {
29832
+ for (var _b = __values(node.decorators), _c = _b.next(); !_c.done; _c = _b.next()) {
29833
+ var d = _c.value;
29834
+ var expr = d.expression;
29835
+ if (!tss.isCallExpression(expr) || expr.arguments.length !== 1 ||
29836
+ !tss.isIdentifier(expr.expression)) {
29837
+ continue;
29838
+ }
29839
+ var arg = expr.arguments[0];
29840
+ if (tss.isObjectLiteralExpression(arg)) {
29841
+ return {
29842
+ decoratorId: expr.expression,
29843
+ classId: node.name,
29844
+ };
29845
+ }
29846
+ }
29847
+ }
29848
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
29849
+ finally {
29850
+ try {
29851
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
29852
+ }
29853
+ finally { if (e_1) throw e_1.error; }
29854
+ }
29855
+ }
29856
+ /**
29857
+ * Finds the value of a property assignment that is nested in a TypeScript node and is of a certain
29858
+ * type T.
29859
+ *
29860
+ * @param startNode node to start searching for nested property assignment from
29861
+ * @param propName property assignment name
29862
+ * @param predicate function to verify that a node is of type T.
29863
+ * @return node property assignment value of type T, or undefined if none is found
29864
+ */
29865
+ function findPropertyValueOfType(startNode, propName, predicate) {
29866
+ if (tss.isPropertyAssignment(startNode) && startNode.name.getText() === propName) {
29867
+ var initializer = startNode.initializer;
29868
+ if (predicate(initializer))
29869
+ return initializer;
29870
+ }
29871
+ return startNode.forEachChild(function (c) { return findPropertyValueOfType(c, propName, predicate); });
29872
+ }
29873
+
29830
29874
  /**
29831
29875
  * @license
29832
29876
  * Copyright Google Inc. All Rights Reserved.
@@ -29949,19 +29993,20 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29949
29993
  // `styleUrls`'s property assignment can be found from the array (parent) node.
29950
29994
  //
29951
29995
  // First search for `templateUrl`.
29952
- var asgn = getPropertyAssignmentFromValue(urlNode);
29953
- if (!asgn || asgn.name.getText() !== 'templateUrl') {
29996
+ var asgn = getPropertyAssignmentFromValue(urlNode, 'templateUrl');
29997
+ if (!asgn) {
29954
29998
  // `templateUrl` assignment not found; search for `styleUrls` array assignment.
29955
- asgn = getPropertyAssignmentFromValue(urlNode.parent);
29956
- if (!asgn || asgn.name.getText() !== 'styleUrls') {
29999
+ asgn = getPropertyAssignmentFromValue(urlNode.parent, 'styleUrls');
30000
+ if (!asgn) {
29957
30001
  // Nothing found, bail.
29958
30002
  return;
29959
30003
  }
29960
30004
  }
29961
30005
  // If the property assignment is not a property of a class decorator, don't generate definitions
29962
30006
  // for it.
29963
- if (!isClassDecoratorProperty(asgn))
30007
+ if (!getClassDeclFromDecoratorProp(asgn)) {
29964
30008
  return;
30009
+ }
29965
30010
  var sf = urlNode.getSourceFile();
29966
30011
  // Extract url path specified by the url node, which is relative to the TypeScript source file
29967
30012
  // the url node is defined in.
@@ -31623,7 +31668,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31623
31668
  var FLAGS = 2;
31624
31669
  var PARENT = 3;
31625
31670
  var NEXT = 4;
31626
- var QUERIES = 5;
31671
+ var TRANSPLANTED_VIEWS_TO_REFRESH = 5;
31627
31672
  var T_HOST = 6;
31628
31673
  var CLEANUP = 7;
31629
31674
  var CONTEXT = 8;
@@ -31637,8 +31682,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31637
31682
  var DECLARATION_COMPONENT_VIEW = 16;
31638
31683
  var DECLARATION_LCONTAINER = 17;
31639
31684
  var PREORDER_HOOK_FLAGS = 18;
31685
+ var QUERIES = 19;
31640
31686
  /** Size of LView's header. Necessary to adjust for it when setting slots. */
31641
- var HEADER_OFFSET = 19;
31687
+ var HEADER_OFFSET = 20;
31642
31688
 
31643
31689
  /**
31644
31690
  * @license
@@ -31659,19 +31705,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31659
31705
  * Uglify will inline these when minifying so there shouldn't be a cost.
31660
31706
  */
31661
31707
  var ACTIVE_INDEX = 2;
31662
- // PARENT and NEXT are indices 3 and 4
31708
+ // PARENT, NEXT, TRANSPLANTED_VIEWS_TO_REFRESH are indices 3, 4, and 5
31663
31709
  // As we already have these constants in LView, we don't need to re-create them.
31664
- var MOVED_VIEWS = 5;
31665
31710
  // T_HOST is index 6
31666
31711
  // We already have this constants in LView, we don't need to re-create it.
31667
31712
  var NATIVE = 7;
31713
+ var MOVED_VIEWS = 9;
31668
31714
  /**
31669
31715
  * Size of LContainer's header. Represents the index after which all views in the
31670
31716
  * container will be inserted. We need to keep a record of current views so we know
31671
31717
  * which views are already in the DOM (and don't need to be re-added) and so we can
31672
31718
  * remove views from the DOM when they are no longer required.
31673
31719
  */
31674
- var CONTAINER_HEADER_OFFSET = 9;
31720
+ var CONTAINER_HEADER_OFFSET = 10;
31675
31721
 
31676
31722
  /**
31677
31723
  * @license
@@ -31954,6 +32000,25 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31954
32000
  function getLContainerActiveIndex(lContainer) {
31955
32001
  return lContainer[ACTIVE_INDEX] >> 1 /* SHIFT */;
31956
32002
  }
32003
+ /**
32004
+ * Updates the `TRANSPLANTED_VIEWS_TO_REFRESH` counter on the `LContainer` as well as the parents
32005
+ * whose
32006
+ * 1. counter goes from 0 to 1, indicating that there is a new child that has a view to refresh
32007
+ * or
32008
+ * 2. counter goes from 1 to 0, indicating there are no more descendant views to refresh
32009
+ */
32010
+ function updateTransplantedViewCount(lContainer, amount) {
32011
+ lContainer[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
32012
+ var viewOrContainer = lContainer;
32013
+ var parent = lContainer[PARENT];
32014
+ while (parent !== null &&
32015
+ ((amount === 1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 1) ||
32016
+ (amount === -1 && viewOrContainer[TRANSPLANTED_VIEWS_TO_REFRESH] === 0))) {
32017
+ parent[TRANSPLANTED_VIEWS_TO_REFRESH] += amount;
32018
+ viewOrContainer = parent;
32019
+ parent = parent[PARENT];
32020
+ }
32021
+ }
31957
32022
 
31958
32023
  /**
31959
32024
  * @license
@@ -32007,7 +32072,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32007
32072
  function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
32008
32073
  var lFrame = instructionState.lFrame;
32009
32074
  lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
32010
- lFrame.currentDirectiveIndex = currentDirectiveIndex;
32075
+ setCurrentDirectiveIndex(currentDirectiveIndex);
32076
+ }
32077
+ /**
32078
+ * Sets an index of a directive whose `hostBindings` are being processed.
32079
+ *
32080
+ * @param currentDirectiveIndex `TData` index where current directive instance can be found.
32081
+ */
32082
+ function setCurrentDirectiveIndex(currentDirectiveIndex) {
32083
+ instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
32011
32084
  }
32012
32085
  function setCurrentQueryIndex(value) {
32013
32086
  instructionState.lFrame.currentQueryIndex = value;
@@ -32295,7 +32368,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32295
32368
  assertNotEqual(initPhase, 3 /* InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');
32296
32369
  var flags = lView[FLAGS];
32297
32370
  if ((flags & 3 /* InitPhaseStateMask */) === initPhase) {
32298
- flags &= 1023 /* IndexWithinInitPhaseReset */;
32371
+ flags &= 2047 /* IndexWithinInitPhaseReset */;
32299
32372
  flags += 1 /* InitPhaseStateIncrementer */;
32300
32373
  lView[FLAGS] = flags;
32301
32374
  }
@@ -32358,13 +32431,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32358
32431
  var directiveIndex = isInitHook ? -arr[i] : arr[i];
32359
32432
  var directive = currentView[directiveIndex];
32360
32433
  if (isInitHook) {
32361
- var indexWithintInitPhase = currentView[FLAGS] >> 10 /* IndexWithinInitPhaseShift */;
32434
+ var indexWithintInitPhase = currentView[FLAGS] >> 11 /* IndexWithinInitPhaseShift */;
32362
32435
  // The init phase state must be always checked here as it may have been recursively
32363
32436
  // updated
32364
32437
  if (indexWithintInitPhase <
32365
32438
  (currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */) &&
32366
32439
  (currentView[FLAGS] & 3 /* InitPhaseStateMask */) === initPhase) {
32367
- currentView[FLAGS] += 1024 /* IndexWithinInitPhaseIncrementer */;
32440
+ currentView[FLAGS] += 2048 /* IndexWithinInitPhaseIncrementer */;
32368
32441
  hook.call(directive);
32369
32442
  }
32370
32443
  }
@@ -34255,7 +34328,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
34255
34328
  pipeRegistry, //
34256
34329
  firstChild, //
34257
34330
  schemas, //
34258
- consts) {
34331
+ consts, //
34332
+ incompleteFirstPass //
34333
+ ) {
34259
34334
  this.type = type;
34260
34335
  this.id = id;
34261
34336
  this.blueprint = blueprint;
@@ -34286,6 +34361,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
34286
34361
  this.firstChild = firstChild;
34287
34362
  this.schemas = schemas;
34288
34363
  this.consts = consts;
34364
+ this.incompleteFirstPass = incompleteFirstPass;
34289
34365
  }
34290
34366
  Object.defineProperty(TView.prototype, "template_", {
34291
34367
  get: function () {
@@ -34559,7 +34635,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
34559
34635
  attached: !!(flags & 128 /* Attached */),
34560
34636
  destroyed: !!(flags & 256 /* Destroyed */),
34561
34637
  isRoot: !!(flags & 512 /* IsRoot */),
34562
- indexWithinInitPhase: flags >> 10 /* IndexWithinInitPhaseShift */,
34638
+ indexWithinInitPhase: flags >> 11 /* IndexWithinInitPhaseShift */,
34563
34639
  };
34564
34640
  },
34565
34641
  enumerable: true,
@@ -35240,6 +35316,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35240
35316
  renderChildComponents(lView, components);
35241
35317
  }
35242
35318
  }
35319
+ catch (error) {
35320
+ // If we didn't manage to get past the first template pass due to
35321
+ // an error, mark the view as corrupted so we can try to recover.
35322
+ if (tView.firstCreatePass) {
35323
+ tView.incompleteFirstPass = true;
35324
+ }
35325
+ throw error;
35326
+ }
35243
35327
  finally {
35244
35328
  lView[FLAGS] &= ~4 /* CreationMode */;
35245
35329
  leaveView();
@@ -35284,6 +35368,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35284
35368
  incrementInitPhaseFlags(lView, 0 /* OnInitHooksToBeRun */);
35285
35369
  }
35286
35370
  }
35371
+ // First mark transplanted views that are declared in this lView as needing a refresh at their
35372
+ // insertion points. This is needed to avoid the situation where the template is defined in this
35373
+ // `LView` but its declaration appears after the insertion component.
35374
+ markTransplantedViewsForRefresh(lView);
35287
35375
  refreshDynamicEmbeddedViews(lView);
35288
35376
  // Content query results must be refreshed before content hooks are called.
35289
35377
  if (tView.contentQueries !== null) {
@@ -35354,6 +35442,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35354
35442
  if (!checkNoChangesMode) {
35355
35443
  lView[FLAGS] &= ~(64 /* Dirty */ | 8 /* FirstLViewPass */);
35356
35444
  }
35445
+ if (lView[FLAGS] & 1024 /* RefreshTransplantedView */) {
35446
+ lView[FLAGS] &= ~1024 /* RefreshTransplantedView */;
35447
+ updateTransplantedViewCount(lView[PARENT], -1);
35448
+ }
35357
35449
  }
35358
35450
  finally {
35359
35451
  leaveView();
@@ -35401,8 +35493,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35401
35493
  * @returns TView
35402
35494
  */
35403
35495
  function getOrCreateTComponentView(def) {
35404
- return def.tView ||
35405
- (def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts));
35496
+ var tView = def.tView;
35497
+ // Create a TView if there isn't one, or recreate it if the first create pass didn't
35498
+ // complete successfuly since we can't know for sure whether it's in a usable shape.
35499
+ if (tView === null || tView.incompleteFirstPass) {
35500
+ return def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
35501
+ }
35502
+ return tView;
35406
35503
  }
35407
35504
  /**
35408
35505
  * Creates a TView instance
@@ -35455,7 +35552,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35455
35552
  typeof pipes === 'function' ? pipes() : pipes, // pipeRegistry: PipeDefList|null,
35456
35553
  null, // firstChild: TNode|null,
35457
35554
  schemas, // schemas: SchemaMetadata[]|null,
35458
- consts) : // consts: TConstants|null
35555
+ consts, // consts: TConstants|null
35556
+ false // incompleteFirstPass: boolean
35557
+ ) :
35459
35558
  {
35460
35559
  type: type,
35461
35560
  id: viewIndex,
@@ -35487,6 +35586,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35487
35586
  firstChild: null,
35488
35587
  schemas: schemas,
35489
35588
  consts: consts,
35589
+ incompleteFirstPass: false
35490
35590
  };
35491
35591
  }
35492
35592
  function createViewBlueprint(bindingStartIndex, initialViewLength) {
@@ -35755,66 +35855,70 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35755
35855
  * them by executing an associated template function.
35756
35856
  */
35757
35857
  function refreshDynamicEmbeddedViews(lView) {
35758
- var viewOrContainer = lView[CHILD_HEAD];
35759
- while (viewOrContainer !== null) {
35760
- // Note: viewOrContainer can be an LView or an LContainer instance, but here we are only
35761
- // interested in LContainer
35762
- var activeIndexFlag = void 0;
35763
- if (isLContainer(viewOrContainer) &&
35764
- (activeIndexFlag = viewOrContainer[ACTIVE_INDEX]) >> 1 /* SHIFT */ ===
35765
- -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */) {
35766
- for (var i = CONTAINER_HEADER_OFFSET; i < viewOrContainer.length; i++) {
35767
- var embeddedLView = viewOrContainer[i];
35768
- var embeddedTView = embeddedLView[TVIEW];
35769
- ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
35770
- if (viewAttachedToChangeDetector(embeddedLView)) {
35771
- refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
35772
- }
35773
- }
35774
- if ((activeIndexFlag & 1 /* HAS_TRANSPLANTED_VIEWS */) !== 0) {
35775
- // We should only CD moved views if the component where they were inserted does not match
35776
- // the component where they were declared and insertion is on-push. Moved views also
35777
- // contains intra component moves, or check-always which need to be skipped.
35778
- refreshTransplantedViews(viewOrContainer, lView[DECLARATION_COMPONENT_VIEW]);
35858
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
35859
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
35860
+ var embeddedLView = lContainer[i];
35861
+ var embeddedTView = embeddedLView[TVIEW];
35862
+ ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
35863
+ if (viewAttachedToChangeDetector(embeddedLView)) {
35864
+ refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
35779
35865
  }
35780
35866
  }
35867
+ }
35868
+ }
35869
+ /**
35870
+ * Gets the first `LContainer` in the LView or `null` if none exists.
35871
+ */
35872
+ function getFirstLContainer(lView) {
35873
+ var viewOrContainer = lView[CHILD_HEAD];
35874
+ while (viewOrContainer !== null &&
35875
+ !(isLContainer(viewOrContainer) &&
35876
+ viewOrContainer[ACTIVE_INDEX] >> 1 /* SHIFT */ ===
35877
+ -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */)) {
35781
35878
  viewOrContainer = viewOrContainer[NEXT];
35782
35879
  }
35880
+ return viewOrContainer;
35783
35881
  }
35784
35882
  /**
35785
- * Refresh transplanted LViews.
35883
+ * Gets the next `LContainer` that is a sibling of the given container.
35884
+ */
35885
+ function getNextLContainer(container) {
35886
+ var viewOrContainer = container[NEXT];
35887
+ while (viewOrContainer !== null &&
35888
+ !(isLContainer(viewOrContainer) &&
35889
+ viewOrContainer[ACTIVE_INDEX] >> 1 /* SHIFT */ ===
35890
+ -1 /* DYNAMIC_EMBEDDED_VIEWS_ONLY */)) {
35891
+ viewOrContainer = viewOrContainer[NEXT];
35892
+ }
35893
+ return viewOrContainer;
35894
+ }
35895
+ /**
35896
+ * Mark transplanted views as needing to be refreshed at their insertion points.
35786
35897
  *
35787
35898
  * See: `ActiveIndexFlag.HAS_TRANSPLANTED_VIEWS` and `LView[DECLARATION_COMPONENT_VIEW]` for
35788
35899
  * explanation of transplanted views.
35789
35900
  *
35790
- * @param lContainer The `LContainer` which has transplanted views.
35791
- * @param declaredComponentLView The `lContainer` parent component `LView`.
35792
- */
35793
- function refreshTransplantedViews(lContainer, declaredComponentLView) {
35794
- var movedViews = lContainer[MOVED_VIEWS];
35795
- ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
35796
- for (var i = 0; i < movedViews.length; i++) {
35797
- var movedLView = movedViews[i];
35798
- var insertionLContainer = movedLView[PARENT];
35799
- ngDevMode && assertLContainer(insertionLContainer);
35800
- var insertedComponentLView = insertionLContainer[PARENT][DECLARATION_COMPONENT_VIEW];
35801
- ngDevMode && assertDefined(insertedComponentLView, 'Missing LView');
35802
- // Check if we have a transplanted view by compering declaration and insertion location.
35803
- if (insertedComponentLView !== declaredComponentLView) {
35804
- // Yes the `LView` is transplanted.
35805
- // Here we would like to know if the component is `OnPush`. We don't have
35806
- // explicit `OnPush` flag instead we set `CheckAlways` to false (which is `OnPush`)
35807
- // Not to be confused with `ManualOnPush` which is used with wether a DOM event
35808
- // should automatically mark a view as dirty.
35809
- var insertionComponentIsOnPush = (insertedComponentLView[FLAGS] & 16 /* CheckAlways */) === 0;
35810
- if (insertionComponentIsOnPush) {
35811
- // Here we know that the template has been transplanted across components and is
35812
- // on-push (not just moved within a component). If the insertion is marked dirty, then
35813
- // there is no need to CD here as we will do it again later when we get to insertion
35814
- // point.
35815
- var movedTView = movedLView[TVIEW];
35816
- ngDevMode && assertDefined(movedTView, 'TView must be allocated');
35817
- refreshView(movedTView, movedLView, movedTView.template, movedLView[CONTEXT]);
35901
+ * @param lView The `LView` that may have transplanted views.
35902
+ */
35903
+ function markTransplantedViewsForRefresh(lView) {
35904
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
35905
+ if ((lContainer[ACTIVE_INDEX] & 1 /* HAS_TRANSPLANTED_VIEWS */) !== 0) {
35906
+ var movedViews = lContainer[MOVED_VIEWS];
35907
+ ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
35908
+ for (var i = 0; i < movedViews.length; i++) {
35909
+ var movedLView = movedViews[i];
35910
+ var insertionLContainer = movedLView[PARENT];
35911
+ ngDevMode && assertLContainer(insertionLContainer);
35912
+ // We don't want to increment the counter if the moved LView was already marked for
35913
+ // refresh.
35914
+ if ((movedLView[FLAGS] & 1024 /* RefreshTransplantedView */) === 0) {
35915
+ updateTransplantedViewCount(insertionLContainer, 1);
35916
+ }
35917
+ // Note, it is possible that the `movedViews` is tracking views that are transplanted *and*
35918
+ // those that aren't (declaration component === insertion component). In the latter case,
35919
+ // it's fine to add the flag, as we will clear it immediately in
35920
+ // `refreshDynamicEmbeddedViews` for the view currently being refreshed.
35921
+ movedLView[FLAGS] |= 1024 /* RefreshTransplantedView */;
35818
35922
  }
35819
35923
  }
35820
35924
  }
@@ -35829,10 +35933,49 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35829
35933
  ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
35830
35934
  var componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
35831
35935
  // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
35832
- if (viewAttachedToChangeDetector(componentView) &&
35833
- componentView[FLAGS] & (16 /* CheckAlways */ | 64 /* Dirty */)) {
35834
- var componentTView = componentView[TVIEW];
35835
- refreshView(componentTView, componentView, componentTView.template, componentView[CONTEXT]);
35936
+ if (viewAttachedToChangeDetector(componentView)) {
35937
+ var tView = componentView[TVIEW];
35938
+ if (componentView[FLAGS] & (16 /* CheckAlways */ | 64 /* Dirty */)) {
35939
+ refreshView(tView, componentView, tView.template, componentView[CONTEXT]);
35940
+ }
35941
+ else if (componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
35942
+ // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
35943
+ refreshContainsDirtyView(componentView);
35944
+ }
35945
+ }
35946
+ }
35947
+ /**
35948
+ * Refreshes all transplanted views marked with `LViewFlags.RefreshTransplantedView` that are
35949
+ * children or descendants of the given lView.
35950
+ *
35951
+ * @param lView The lView which contains descendant transplanted views that need to be refreshed.
35952
+ */
35953
+ function refreshContainsDirtyView(lView) {
35954
+ for (var lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
35955
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
35956
+ var embeddedLView = lContainer[i];
35957
+ if (embeddedLView[FLAGS] & 1024 /* RefreshTransplantedView */) {
35958
+ var embeddedTView = embeddedLView[TVIEW];
35959
+ ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
35960
+ refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
35961
+ }
35962
+ else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
35963
+ refreshContainsDirtyView(embeddedLView);
35964
+ }
35965
+ }
35966
+ }
35967
+ var tView = lView[TVIEW];
35968
+ // Refresh child component views.
35969
+ var components = tView.components;
35970
+ if (components !== null) {
35971
+ for (var i = 0; i < components.length; i++) {
35972
+ var componentView = getComponentLViewByIndex(components[i], lView);
35973
+ // Only attached components that are CheckAlways or OnPush and dirty should be refreshed
35974
+ if (viewAttachedToChangeDetector(componentView) &&
35975
+ componentView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
35976
+ refreshContainsDirtyView(componentView);
35977
+ }
35978
+ }
35836
35979
  }
35837
35980
  }
35838
35981
  function renderComponent(hostLView, componentHostIdx) {
@@ -36135,8 +36278,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36135
36278
  ngDevMode &&
36136
36279
  assertDefined(declarationContainer[MOVED_VIEWS], 'A projected view should belong to a non-empty projected views collection');
36137
36280
  var movedViews = declarationContainer[MOVED_VIEWS];
36138
- var declaredViewIndex = movedViews.indexOf(lView);
36139
- movedViews.splice(declaredViewIndex, 1);
36281
+ var declarationViewIndex = movedViews.indexOf(lView);
36282
+ var insertionLContainer = lView[PARENT];
36283
+ ngDevMode && assertLContainer(insertionLContainer);
36284
+ // If the view was marked for refresh but then detached before it was checked (where the flag
36285
+ // would be cleared and the counter decremented), we need to decrement the view counter here
36286
+ // instead.
36287
+ if (lView[FLAGS] & 1024 /* RefreshTransplantedView */) {
36288
+ updateTransplantedViewCount(insertionLContainer, -1);
36289
+ }
36290
+ movedViews.splice(declarationViewIndex, 1);
36140
36291
  }
36141
36292
  /**
36142
36293
  * A standalone function which destroys an LView,
@@ -36849,10 +37000,18 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36849
37000
  else if (tNodeType === 1 /* Projection */) {
36850
37001
  var componentView = lView[DECLARATION_COMPONENT_VIEW];
36851
37002
  var componentHost = componentView[T_HOST];
36852
- var parentView = getLViewParent(componentView);
36853
- var firstProjectedNode = componentHost.projection[tNode.projection];
36854
- if (firstProjectedNode !== null && parentView !== null) {
36855
- collectNativeNodes(parentView[TVIEW], parentView, firstProjectedNode, result, true);
37003
+ var slotIdx = tNode.projection;
37004
+ ngDevMode &&
37005
+ assertDefined(componentHost.projection, 'Components with projection nodes (<ng-content>) must have projection slots defined.');
37006
+ var nodesInSlot = componentHost.projection[slotIdx];
37007
+ if (Array.isArray(nodesInSlot)) {
37008
+ result.push.apply(result, __spread(nodesInSlot));
37009
+ }
37010
+ else {
37011
+ var parentView = getLViewParent(componentView);
37012
+ ngDevMode &&
37013
+ assertDefined(parentView, 'Component views should always have a parent view (component\'s host view)');
37014
+ collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true);
36856
37015
  }
36857
37016
  }
36858
37017
  tNode = isProjection ? tNode.projectionNext : tNode.next;
@@ -39973,7 +40132,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
39973
40132
  /**
39974
40133
  * @publicApi
39975
40134
  */
39976
- var VERSION$2 = new Version$1('9.1.3');
40135
+ var VERSION$2 = new Version$1('9.1.7');
39977
40136
 
39978
40137
  /**
39979
40138
  * @license
@@ -42798,14 +42957,18 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
42798
42957
  }
42799
42958
  }
42800
42959
  }
42801
- tElementNode = getTNode(rootLView[TVIEW], 0);
42802
- if (projectableNodes) {
42803
- // projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
42804
- // case). Here we do normalize passed data structure to be an array of arrays to avoid
42805
- // complex checks down the line.
42806
- tElementNode.projection = projectableNodes.map(function (nodesforSlot) {
42807
- return Array.from(nodesforSlot);
42808
- });
42960
+ tElementNode = getTNode(rootTView, 0);
42961
+ if (projectableNodes !== undefined) {
42962
+ var projection = tElementNode.projection = [];
42963
+ for (var i = 0; i < this.ngContentSelectors.length; i++) {
42964
+ var nodesforSlot = projectableNodes[i];
42965
+ // Projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade
42966
+ // case). Here we do normalize passed data structure to be an array of arrays to avoid
42967
+ // complex checks down the line.
42968
+ // We also normalize the length of the passed in projectable nodes (to match the number of
42969
+ // <ng-container> slots defined by a component).
42970
+ projection.push(nodesforSlot != null ? Array.from(nodesforSlot) : null);
42971
+ }
42809
42972
  }
42810
42973
  // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
42811
42974
  // executed here?
@@ -51666,9 +51829,20 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
51666
51829
  var filesChangedOrRemoved = [];
51667
51830
  // Check if any source files have been added / changed since last computation.
51668
51831
  var seen = new Set();
51832
+ var ANGULAR_CORE = '@angular/core';
51833
+ var corePath = this.reflectorHost.moduleNameToFileName(ANGULAR_CORE);
51669
51834
  try {
51670
51835
  for (var _e = __values(program.getSourceFiles()), _f = _e.next(); !_f.done; _f = _e.next()) {
51671
51836
  var fileName = _f.value.fileName;
51837
+ // If `@angular/core` is edited, the language service would have to be
51838
+ // restarted, so ignore changes to `@angular/core`.
51839
+ // When the StaticReflector is initialized at startup, it loads core
51840
+ // symbols from @angular/core by calling initializeConversionMap(). This
51841
+ // is only done once. If the file is invalidated, some of the core symbols
51842
+ // will be lost permanently.
51843
+ if (fileName === corePath) {
51844
+ continue;
51845
+ }
51672
51846
  seen.add(fileName);
51673
51847
  var version = this.tsLsHost.getScriptVersion(fileName);
51674
51848
  var lastVersion = this.fileVersions.get(fileName);
@@ -51839,8 +52013,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
51839
52013
  if (!tss.isStringLiteralLike(node)) {
51840
52014
  return;
51841
52015
  }
51842
- var tmplAsgn = getPropertyAssignmentFromValue(node);
51843
- if (!tmplAsgn || tmplAsgn.name.getText() !== 'template') {
52016
+ var tmplAsgn = getPropertyAssignmentFromValue(node, 'template');
52017
+ if (!tmplAsgn) {
51844
52018
  return;
51845
52019
  }
51846
52020
  var classDecl = getClassDeclFromDecoratorProp(tmplAsgn);