@angular/language-service 8.1.0-next.3 → 8.1.2

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 v8.1.0-next.3
2
+ * @license Angular v8.1.2
3
3
  * (c) 2010-2019 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2502,6 +2502,9 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
2502
2502
  if (token.name) {
2503
2503
  return "" + token.name;
2504
2504
  }
2505
+ if (!token.toString) {
2506
+ return 'object';
2507
+ }
2505
2508
  // WARNING: do not try to `JSON.stringify(token)` here
2506
2509
  // see https://github.com/angular/angular/issues/23440
2507
2510
  var res = token.toString();
@@ -3389,7 +3392,6 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
3389
3392
  Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE$1 };
3390
3393
  Identifiers.text = { name: 'ɵɵtext', moduleName: CORE$1 };
3391
3394
  Identifiers.textBinding = { name: 'ɵɵtextBinding', moduleName: CORE$1 };
3392
- Identifiers.bind = { name: 'ɵɵbind', moduleName: CORE$1 };
3393
3395
  Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE$1 };
3394
3396
  Identifiers.disableBindings = { name: 'ɵɵdisableBindings', moduleName: CORE$1 };
3395
3397
  Identifiers.allocHostVars = { name: 'ɵɵallocHostVars', moduleName: CORE$1 };
@@ -3525,6 +3527,237 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
3525
3527
  return Identifiers;
3526
3528
  }());
3527
3529
 
3530
+ /**
3531
+ * @license
3532
+ * Copyright Google Inc. All Rights Reserved.
3533
+ *
3534
+ * Use of this source code is governed by an MIT-style license that can be
3535
+ * found in the LICENSE file at https://angular.io/license
3536
+ */
3537
+ var $EOF = 0;
3538
+ var $BSPACE = 8;
3539
+ var $TAB = 9;
3540
+ var $LF = 10;
3541
+ var $VTAB = 11;
3542
+ var $FF = 12;
3543
+ var $CR = 13;
3544
+ var $SPACE = 32;
3545
+ var $BANG = 33;
3546
+ var $DQ = 34;
3547
+ var $HASH = 35;
3548
+ var $$ = 36;
3549
+ var $PERCENT = 37;
3550
+ var $AMPERSAND = 38;
3551
+ var $SQ = 39;
3552
+ var $LPAREN = 40;
3553
+ var $RPAREN = 41;
3554
+ var $STAR = 42;
3555
+ var $PLUS = 43;
3556
+ var $COMMA = 44;
3557
+ var $MINUS = 45;
3558
+ var $PERIOD = 46;
3559
+ var $SLASH = 47;
3560
+ var $COLON = 58;
3561
+ var $SEMICOLON = 59;
3562
+ var $LT = 60;
3563
+ var $EQ = 61;
3564
+ var $GT = 62;
3565
+ var $QUESTION = 63;
3566
+ var $0 = 48;
3567
+ var $7 = 55;
3568
+ var $9 = 57;
3569
+ var $A = 65;
3570
+ var $E = 69;
3571
+ var $F = 70;
3572
+ var $X = 88;
3573
+ var $Z = 90;
3574
+ var $LBRACKET = 91;
3575
+ var $BACKSLASH = 92;
3576
+ var $RBRACKET = 93;
3577
+ var $CARET = 94;
3578
+ var $_ = 95;
3579
+ var $a = 97;
3580
+ var $b = 98;
3581
+ var $e = 101;
3582
+ var $f = 102;
3583
+ var $n = 110;
3584
+ var $r = 114;
3585
+ var $t = 116;
3586
+ var $u = 117;
3587
+ var $v = 118;
3588
+ var $x = 120;
3589
+ var $z = 122;
3590
+ var $LBRACE = 123;
3591
+ var $BAR = 124;
3592
+ var $RBRACE = 125;
3593
+ var $NBSP = 160;
3594
+ var $BT = 96;
3595
+ function isWhitespace(code) {
3596
+ return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
3597
+ }
3598
+ function isDigit(code) {
3599
+ return $0 <= code && code <= $9;
3600
+ }
3601
+ function isAsciiLetter(code) {
3602
+ return code >= $a && code <= $z || code >= $A && code <= $Z;
3603
+ }
3604
+ function isAsciiHexDigit(code) {
3605
+ return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
3606
+ }
3607
+ function isNewLine(code) {
3608
+ return code === $LF || code === $CR;
3609
+ }
3610
+ function isOctalDigit(code) {
3611
+ return $0 <= code && code <= $7;
3612
+ }
3613
+
3614
+ /**
3615
+ * @license
3616
+ * Copyright Google Inc. All Rights Reserved.
3617
+ *
3618
+ * Use of this source code is governed by an MIT-style license that can be
3619
+ * found in the LICENSE file at https://angular.io/license
3620
+ */
3621
+ var ParseLocation = /** @class */ (function () {
3622
+ function ParseLocation(file, offset, line, col) {
3623
+ this.file = file;
3624
+ this.offset = offset;
3625
+ this.line = line;
3626
+ this.col = col;
3627
+ }
3628
+ ParseLocation.prototype.toString = function () {
3629
+ return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
3630
+ };
3631
+ ParseLocation.prototype.moveBy = function (delta) {
3632
+ var source = this.file.content;
3633
+ var len = source.length;
3634
+ var offset = this.offset;
3635
+ var line = this.line;
3636
+ var col = this.col;
3637
+ while (offset > 0 && delta < 0) {
3638
+ offset--;
3639
+ delta++;
3640
+ var ch = source.charCodeAt(offset);
3641
+ if (ch == $LF) {
3642
+ line--;
3643
+ var priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
3644
+ col = priorLine > 0 ? offset - priorLine : offset;
3645
+ }
3646
+ else {
3647
+ col--;
3648
+ }
3649
+ }
3650
+ while (offset < len && delta > 0) {
3651
+ var ch = source.charCodeAt(offset);
3652
+ offset++;
3653
+ delta--;
3654
+ if (ch == $LF) {
3655
+ line++;
3656
+ col = 0;
3657
+ }
3658
+ else {
3659
+ col++;
3660
+ }
3661
+ }
3662
+ return new ParseLocation(this.file, offset, line, col);
3663
+ };
3664
+ // Return the source around the location
3665
+ // Up to `maxChars` or `maxLines` on each side of the location
3666
+ ParseLocation.prototype.getContext = function (maxChars, maxLines) {
3667
+ var content = this.file.content;
3668
+ var startOffset = this.offset;
3669
+ if (startOffset != null) {
3670
+ if (startOffset > content.length - 1) {
3671
+ startOffset = content.length - 1;
3672
+ }
3673
+ var endOffset = startOffset;
3674
+ var ctxChars = 0;
3675
+ var ctxLines = 0;
3676
+ while (ctxChars < maxChars && startOffset > 0) {
3677
+ startOffset--;
3678
+ ctxChars++;
3679
+ if (content[startOffset] == '\n') {
3680
+ if (++ctxLines == maxLines) {
3681
+ break;
3682
+ }
3683
+ }
3684
+ }
3685
+ ctxChars = 0;
3686
+ ctxLines = 0;
3687
+ while (ctxChars < maxChars && endOffset < content.length - 1) {
3688
+ endOffset++;
3689
+ ctxChars++;
3690
+ if (content[endOffset] == '\n') {
3691
+ if (++ctxLines == maxLines) {
3692
+ break;
3693
+ }
3694
+ }
3695
+ }
3696
+ return {
3697
+ before: content.substring(startOffset, this.offset),
3698
+ after: content.substring(this.offset, endOffset + 1),
3699
+ };
3700
+ }
3701
+ return null;
3702
+ };
3703
+ return ParseLocation;
3704
+ }());
3705
+ var ParseSourceFile = /** @class */ (function () {
3706
+ function ParseSourceFile(content, url) {
3707
+ this.content = content;
3708
+ this.url = url;
3709
+ }
3710
+ return ParseSourceFile;
3711
+ }());
3712
+ var ParseSourceSpan = /** @class */ (function () {
3713
+ function ParseSourceSpan(start, end, details) {
3714
+ if (details === void 0) { details = null; }
3715
+ this.start = start;
3716
+ this.end = end;
3717
+ this.details = details;
3718
+ }
3719
+ ParseSourceSpan.prototype.toString = function () {
3720
+ return this.start.file.content.substring(this.start.offset, this.end.offset);
3721
+ };
3722
+ return ParseSourceSpan;
3723
+ }());
3724
+ var ParseErrorLevel;
3725
+ (function (ParseErrorLevel) {
3726
+ ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
3727
+ ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
3728
+ })(ParseErrorLevel || (ParseErrorLevel = {}));
3729
+ var ParseError = /** @class */ (function () {
3730
+ function ParseError(span, msg, level) {
3731
+ if (level === void 0) { level = ParseErrorLevel.ERROR; }
3732
+ this.span = span;
3733
+ this.msg = msg;
3734
+ this.level = level;
3735
+ }
3736
+ ParseError.prototype.contextualMessage = function () {
3737
+ var ctx = this.span.start.getContext(100, 3);
3738
+ return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
3739
+ this.msg;
3740
+ };
3741
+ ParseError.prototype.toString = function () {
3742
+ var details = this.span.details ? ", " + this.span.details : '';
3743
+ return this.contextualMessage() + ": " + this.span.start + details;
3744
+ };
3745
+ return ParseError;
3746
+ }());
3747
+ /**
3748
+ * Generates Source Span object for a given R3 Type for JIT mode.
3749
+ *
3750
+ * @param kind Component or Directive.
3751
+ * @param typeName name of the Component or Directive.
3752
+ * @param sourceUrl reference to Component or Directive source.
3753
+ * @returns instance of ParseSourceSpan that represent a given Component or Directive.
3754
+ */
3755
+ function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
3756
+ var sourceFileName = "in " + kind + " " + typeName + " in " + sourceUrl;
3757
+ var sourceFile = new ParseSourceFile('', sourceFileName);
3758
+ return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
3759
+ }
3760
+
3528
3761
  /**
3529
3762
  * @license
3530
3763
  * Copyright Google Inc. All Rights Reserved.
@@ -3608,7 +3841,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
3608
3841
  this.i18n = i18n;
3609
3842
  // If the element is empty then the source span should include any closing tag
3610
3843
  if (children.length === 0 && startSourceSpan && endSourceSpan) {
3611
- this.sourceSpan = __assign({}, sourceSpan, { end: endSourceSpan.end });
3844
+ this.sourceSpan = new ParseSourceSpan(sourceSpan.start, endSourceSpan.end);
3612
3845
  }
3613
3846
  }
3614
3847
  Element.prototype.visit = function (visitor) { return visitor.visitElement(this); };
@@ -4751,7 +4984,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
4751
4984
  * TODO(FW-1136): this is a temporary solution, we need to come up with a better way of working with
4752
4985
  * inputs that contain potentially unsafe chars.
4753
4986
  */
4754
- var UNSAFE_OBJECT_KEY_NAME_REGEXP = /-/;
4987
+ var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;
4755
4988
  /** Name of the temporary to use during data binding */
4756
4989
  var TEMPORARY_NAME = '_t';
4757
4990
  /** Name of the context parameter passed into a template function */
@@ -6195,237 +6428,6 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
6195
6428
  return statement.isEquivalent(literal('use strict').toStmt());
6196
6429
  }
6197
6430
 
6198
- /**
6199
- * @license
6200
- * Copyright Google Inc. All Rights Reserved.
6201
- *
6202
- * Use of this source code is governed by an MIT-style license that can be
6203
- * found in the LICENSE file at https://angular.io/license
6204
- */
6205
- var $EOF = 0;
6206
- var $BSPACE = 8;
6207
- var $TAB = 9;
6208
- var $LF = 10;
6209
- var $VTAB = 11;
6210
- var $FF = 12;
6211
- var $CR = 13;
6212
- var $SPACE = 32;
6213
- var $BANG = 33;
6214
- var $DQ = 34;
6215
- var $HASH = 35;
6216
- var $$ = 36;
6217
- var $PERCENT = 37;
6218
- var $AMPERSAND = 38;
6219
- var $SQ = 39;
6220
- var $LPAREN = 40;
6221
- var $RPAREN = 41;
6222
- var $STAR = 42;
6223
- var $PLUS = 43;
6224
- var $COMMA = 44;
6225
- var $MINUS = 45;
6226
- var $PERIOD = 46;
6227
- var $SLASH = 47;
6228
- var $COLON = 58;
6229
- var $SEMICOLON = 59;
6230
- var $LT = 60;
6231
- var $EQ = 61;
6232
- var $GT = 62;
6233
- var $QUESTION = 63;
6234
- var $0 = 48;
6235
- var $7 = 55;
6236
- var $9 = 57;
6237
- var $A = 65;
6238
- var $E = 69;
6239
- var $F = 70;
6240
- var $X = 88;
6241
- var $Z = 90;
6242
- var $LBRACKET = 91;
6243
- var $BACKSLASH = 92;
6244
- var $RBRACKET = 93;
6245
- var $CARET = 94;
6246
- var $_ = 95;
6247
- var $a = 97;
6248
- var $b = 98;
6249
- var $e = 101;
6250
- var $f = 102;
6251
- var $n = 110;
6252
- var $r = 114;
6253
- var $t = 116;
6254
- var $u = 117;
6255
- var $v = 118;
6256
- var $x = 120;
6257
- var $z = 122;
6258
- var $LBRACE = 123;
6259
- var $BAR = 124;
6260
- var $RBRACE = 125;
6261
- var $NBSP = 160;
6262
- var $BT = 96;
6263
- function isWhitespace(code) {
6264
- return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
6265
- }
6266
- function isDigit(code) {
6267
- return $0 <= code && code <= $9;
6268
- }
6269
- function isAsciiLetter(code) {
6270
- return code >= $a && code <= $z || code >= $A && code <= $Z;
6271
- }
6272
- function isAsciiHexDigit(code) {
6273
- return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
6274
- }
6275
- function isNewLine(code) {
6276
- return code === $LF || code === $CR;
6277
- }
6278
- function isOctalDigit(code) {
6279
- return $0 <= code && code <= $7;
6280
- }
6281
-
6282
- /**
6283
- * @license
6284
- * Copyright Google Inc. All Rights Reserved.
6285
- *
6286
- * Use of this source code is governed by an MIT-style license that can be
6287
- * found in the LICENSE file at https://angular.io/license
6288
- */
6289
- var ParseLocation = /** @class */ (function () {
6290
- function ParseLocation(file, offset, line, col) {
6291
- this.file = file;
6292
- this.offset = offset;
6293
- this.line = line;
6294
- this.col = col;
6295
- }
6296
- ParseLocation.prototype.toString = function () {
6297
- return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
6298
- };
6299
- ParseLocation.prototype.moveBy = function (delta) {
6300
- var source = this.file.content;
6301
- var len = source.length;
6302
- var offset = this.offset;
6303
- var line = this.line;
6304
- var col = this.col;
6305
- while (offset > 0 && delta < 0) {
6306
- offset--;
6307
- delta++;
6308
- var ch = source.charCodeAt(offset);
6309
- if (ch == $LF) {
6310
- line--;
6311
- var priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
6312
- col = priorLine > 0 ? offset - priorLine : offset;
6313
- }
6314
- else {
6315
- col--;
6316
- }
6317
- }
6318
- while (offset < len && delta > 0) {
6319
- var ch = source.charCodeAt(offset);
6320
- offset++;
6321
- delta--;
6322
- if (ch == $LF) {
6323
- line++;
6324
- col = 0;
6325
- }
6326
- else {
6327
- col++;
6328
- }
6329
- }
6330
- return new ParseLocation(this.file, offset, line, col);
6331
- };
6332
- // Return the source around the location
6333
- // Up to `maxChars` or `maxLines` on each side of the location
6334
- ParseLocation.prototype.getContext = function (maxChars, maxLines) {
6335
- var content = this.file.content;
6336
- var startOffset = this.offset;
6337
- if (startOffset != null) {
6338
- if (startOffset > content.length - 1) {
6339
- startOffset = content.length - 1;
6340
- }
6341
- var endOffset = startOffset;
6342
- var ctxChars = 0;
6343
- var ctxLines = 0;
6344
- while (ctxChars < maxChars && startOffset > 0) {
6345
- startOffset--;
6346
- ctxChars++;
6347
- if (content[startOffset] == '\n') {
6348
- if (++ctxLines == maxLines) {
6349
- break;
6350
- }
6351
- }
6352
- }
6353
- ctxChars = 0;
6354
- ctxLines = 0;
6355
- while (ctxChars < maxChars && endOffset < content.length - 1) {
6356
- endOffset++;
6357
- ctxChars++;
6358
- if (content[endOffset] == '\n') {
6359
- if (++ctxLines == maxLines) {
6360
- break;
6361
- }
6362
- }
6363
- }
6364
- return {
6365
- before: content.substring(startOffset, this.offset),
6366
- after: content.substring(this.offset, endOffset + 1),
6367
- };
6368
- }
6369
- return null;
6370
- };
6371
- return ParseLocation;
6372
- }());
6373
- var ParseSourceFile = /** @class */ (function () {
6374
- function ParseSourceFile(content, url) {
6375
- this.content = content;
6376
- this.url = url;
6377
- }
6378
- return ParseSourceFile;
6379
- }());
6380
- var ParseSourceSpan = /** @class */ (function () {
6381
- function ParseSourceSpan(start, end, details) {
6382
- if (details === void 0) { details = null; }
6383
- this.start = start;
6384
- this.end = end;
6385
- this.details = details;
6386
- }
6387
- ParseSourceSpan.prototype.toString = function () {
6388
- return this.start.file.content.substring(this.start.offset, this.end.offset);
6389
- };
6390
- return ParseSourceSpan;
6391
- }());
6392
- var ParseErrorLevel;
6393
- (function (ParseErrorLevel) {
6394
- ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
6395
- ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
6396
- })(ParseErrorLevel || (ParseErrorLevel = {}));
6397
- var ParseError = /** @class */ (function () {
6398
- function ParseError(span, msg, level) {
6399
- if (level === void 0) { level = ParseErrorLevel.ERROR; }
6400
- this.span = span;
6401
- this.msg = msg;
6402
- this.level = level;
6403
- }
6404
- ParseError.prototype.contextualMessage = function () {
6405
- var ctx = this.span.start.getContext(100, 3);
6406
- return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
6407
- this.msg;
6408
- };
6409
- ParseError.prototype.toString = function () {
6410
- var details = this.span.details ? ", " + this.span.details : '';
6411
- return this.contextualMessage() + ": " + this.span.start + details;
6412
- };
6413
- return ParseError;
6414
- }());
6415
- /**
6416
- * Generates Source Span object for a given R3 Type for JIT mode.
6417
- *
6418
- * @param kind Component or Directive.
6419
- * @param typeName name of the Component or Directive.
6420
- * @param sourceUrl reference to Component or Directive source.
6421
- * @returns instance of ParseSourceSpan that represent a given Component or Directive.
6422
- */
6423
- function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
6424
- var sourceFileName = "in " + kind + " " + typeName + " in " + sourceUrl;
6425
- var sourceFile = new ParseSourceFile('', sourceFileName);
6426
- return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
6427
- }
6428
-
6429
6431
  /**
6430
6432
  * @license
6431
6433
  * Copyright Google Inc. All Rights Reserved.
@@ -7004,24 +7006,24 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
7004
7006
  function RecursiveAstVisitor() {
7005
7007
  }
7006
7008
  RecursiveAstVisitor.prototype.visitBinary = function (ast, context) {
7007
- ast.left.visit(this);
7008
- ast.right.visit(this);
7009
+ ast.left.visit(this, context);
7010
+ ast.right.visit(this, context);
7009
7011
  return null;
7010
7012
  };
7011
7013
  RecursiveAstVisitor.prototype.visitChain = function (ast, context) { return this.visitAll(ast.expressions, context); };
7012
7014
  RecursiveAstVisitor.prototype.visitConditional = function (ast, context) {
7013
- ast.condition.visit(this);
7014
- ast.trueExp.visit(this);
7015
- ast.falseExp.visit(this);
7015
+ ast.condition.visit(this, context);
7016
+ ast.trueExp.visit(this, context);
7017
+ ast.falseExp.visit(this, context);
7016
7018
  return null;
7017
7019
  };
7018
7020
  RecursiveAstVisitor.prototype.visitPipe = function (ast, context) {
7019
- ast.exp.visit(this);
7021
+ ast.exp.visit(this, context);
7020
7022
  this.visitAll(ast.args, context);
7021
7023
  return null;
7022
7024
  };
7023
7025
  RecursiveAstVisitor.prototype.visitFunctionCall = function (ast, context) {
7024
- ast.target.visit(this);
7026
+ ast.target.visit(this, context);
7025
7027
  this.visitAll(ast.args, context);
7026
7028
  return null;
7027
7029
  };
@@ -7030,14 +7032,14 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
7030
7032
  return this.visitAll(ast.expressions, context);
7031
7033
  };
7032
7034
  RecursiveAstVisitor.prototype.visitKeyedRead = function (ast, context) {
7033
- ast.obj.visit(this);
7034
- ast.key.visit(this);
7035
+ ast.obj.visit(this, context);
7036
+ ast.key.visit(this, context);
7035
7037
  return null;
7036
7038
  };
7037
7039
  RecursiveAstVisitor.prototype.visitKeyedWrite = function (ast, context) {
7038
- ast.obj.visit(this);
7039
- ast.key.visit(this);
7040
- ast.value.visit(this);
7040
+ ast.obj.visit(this, context);
7041
+ ast.key.visit(this, context);
7042
+ ast.value.visit(this, context);
7041
7043
  return null;
7042
7044
  };
7043
7045
  RecursiveAstVisitor.prototype.visitLiteralArray = function (ast, context) {
@@ -7046,32 +7048,32 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
7046
7048
  RecursiveAstVisitor.prototype.visitLiteralMap = function (ast, context) { return this.visitAll(ast.values, context); };
7047
7049
  RecursiveAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { return null; };
7048
7050
  RecursiveAstVisitor.prototype.visitMethodCall = function (ast, context) {
7049
- ast.receiver.visit(this);
7051
+ ast.receiver.visit(this, context);
7050
7052
  return this.visitAll(ast.args, context);
7051
7053
  };
7052
7054
  RecursiveAstVisitor.prototype.visitPrefixNot = function (ast, context) {
7053
- ast.expression.visit(this);
7055
+ ast.expression.visit(this, context);
7054
7056
  return null;
7055
7057
  };
7056
7058
  RecursiveAstVisitor.prototype.visitNonNullAssert = function (ast, context) {
7057
- ast.expression.visit(this);
7059
+ ast.expression.visit(this, context);
7058
7060
  return null;
7059
7061
  };
7060
7062
  RecursiveAstVisitor.prototype.visitPropertyRead = function (ast, context) {
7061
- ast.receiver.visit(this);
7063
+ ast.receiver.visit(this, context);
7062
7064
  return null;
7063
7065
  };
7064
7066
  RecursiveAstVisitor.prototype.visitPropertyWrite = function (ast, context) {
7065
- ast.receiver.visit(this);
7066
- ast.value.visit(this);
7067
+ ast.receiver.visit(this, context);
7068
+ ast.value.visit(this, context);
7067
7069
  return null;
7068
7070
  };
7069
7071
  RecursiveAstVisitor.prototype.visitSafePropertyRead = function (ast, context) {
7070
- ast.receiver.visit(this);
7072
+ ast.receiver.visit(this, context);
7071
7073
  return null;
7072
7074
  };
7073
7075
  RecursiveAstVisitor.prototype.visitSafeMethodCall = function (ast, context) {
7074
- ast.receiver.visit(this);
7076
+ ast.receiver.visit(this, context);
7075
7077
  return this.visitAll(ast.args, context);
7076
7078
  };
7077
7079
  RecursiveAstVisitor.prototype.visitAll = function (asts, context) {
@@ -15797,9 +15799,11 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
15797
15799
  // setup accumulated bindings
15798
15800
  var _a = this.i18n, index = _a.index, bindings = _a.bindings;
15799
15801
  if (bindings.size) {
15802
+ var chainBindings_1 = [];
15800
15803
  bindings.forEach(function (binding) {
15801
- _this.updateInstruction(index, span, Identifiers$1.i18nExp, function () { return [_this.convertPropertyBinding(binding, /* skipBindFn */ true)]; });
15804
+ chainBindings_1.push({ sourceSpan: span, value: function () { return _this.convertPropertyBinding(binding); } });
15802
15805
  });
15806
+ this.updateInstructionChain(index, Identifiers$1.i18nExp, chainBindings_1);
15803
15807
  this.updateInstruction(index, span, Identifiers$1.i18nApply, [literal(index)]);
15804
15808
  }
15805
15809
  if (!selfClosing) {
@@ -15968,6 +15972,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
15968
15972
  if (i18nAttrs.length) {
15969
15973
  var hasBindings_1 = false;
15970
15974
  var i18nAttrArgs_1 = [];
15975
+ var bindings_1 = [];
15971
15976
  i18nAttrs.forEach(function (attr) {
15972
15977
  var message = attr.i18n;
15973
15978
  if (attr instanceof TextAttribute) {
@@ -15982,11 +15987,17 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
15982
15987
  i18nAttrArgs_1.push(literal(attr.name), _this.i18nTranslate(message, params));
15983
15988
  converted.expressions.forEach(function (expression) {
15984
15989
  hasBindings_1 = true;
15985
- _this.updateInstruction(elementIndex, element.sourceSpan, Identifiers$1.i18nExp, function () { return [_this.convertExpressionBinding(expression, /* skipBindFn */ true)]; });
15990
+ bindings_1.push({
15991
+ sourceSpan: element.sourceSpan,
15992
+ value: function () { return _this.convertExpressionBinding(expression); }
15993
+ });
15986
15994
  });
15987
15995
  }
15988
15996
  }
15989
15997
  });
15998
+ if (bindings_1.length) {
15999
+ this.updateInstructionChain(elementIndex, Identifiers$1.i18nExp, bindings_1);
16000
+ }
15990
16001
  if (i18nAttrArgs_1.length) {
15991
16002
  var index = literal(this.allocateDataSlot());
15992
16003
  var args = this.constantPool.getConstLiteral(literalArr(i18nAttrArgs_1), true);
@@ -16028,6 +16039,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16028
16039
  // special value to symbolize that there is no RHS to this binding
16029
16040
  // TODO (matsko): revisit this once FW-959 is approached
16030
16041
  var emptyValueBindInstruction = literal(undefined);
16042
+ var propertyBindings = [];
16043
+ var attributeBindings = [];
16031
16044
  // Generate element input bindings
16032
16045
  allOtherInputs.forEach(function (input) {
16033
16046
  var inputType = input.type;
@@ -16044,13 +16057,10 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16044
16057
  // defined in...
16045
16058
  var hasValue_1 = value_1 instanceof LiteralPrimitive ? !!value_1.value : true;
16046
16059
  _this.allocateBindingSlots(value_1);
16047
- var bindingName_1 = prepareSyntheticPropertyName(input.name);
16048
- _this.updateInstruction(elementIndex, input.sourceSpan, Identifiers$1.property, function () {
16049
- return [
16050
- literal(bindingName_1),
16051
- (hasValue_1 ? _this.convertPropertyBinding(value_1, /* skipBindFn */ true) :
16052
- emptyValueBindInstruction),
16053
- ];
16060
+ propertyBindings.push({
16061
+ name: prepareSyntheticPropertyName(input.name),
16062
+ sourceSpan: input.sourceSpan,
16063
+ value: function () { return hasValue_1 ? _this.convertPropertyBinding(value_1) : emptyValueBindInstruction; }
16054
16064
  });
16055
16065
  }
16056
16066
  else {
@@ -16085,7 +16095,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16085
16095
  }
16086
16096
  else {
16087
16097
  // [prop]="value"
16088
- _this.boundUpdateInstruction(Identifiers$1.property, elementIndex, attrName_1, input, value_2, params_2);
16098
+ // Collect all the properties so that we can chain into a single function at the end.
16099
+ propertyBindings.push({
16100
+ name: attrName_1,
16101
+ sourceSpan: input.sourceSpan,
16102
+ value: function () { return _this.convertPropertyBinding(value_2); }, params: params_2
16103
+ });
16089
16104
  }
16090
16105
  }
16091
16106
  else if (inputType === 1 /* Attribute */) {
@@ -16094,9 +16109,14 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16094
16109
  _this.interpolatedUpdateInstruction(getAttributeInterpolationExpression(value_2), elementIndex, attrName_1, input, value_2, params_2);
16095
16110
  }
16096
16111
  else {
16097
- var boundValue = value_2 instanceof Interpolation ? value_2.expressions[0] : value_2;
16112
+ var boundValue_1 = value_2 instanceof Interpolation ? value_2.expressions[0] : value_2;
16098
16113
  // [attr.name]="value" or attr.name="{{value}}"
16099
- _this.boundUpdateInstruction(Identifiers$1.attribute, elementIndex, attrName_1, input, boundValue, params_2);
16114
+ // Collect the attribute bindings so that they can be chained at the end.
16115
+ attributeBindings.push({
16116
+ name: attrName_1,
16117
+ sourceSpan: input.sourceSpan,
16118
+ value: function () { return _this.convertPropertyBinding(boundValue_1); }, params: params_2
16119
+ });
16100
16120
  }
16101
16121
  }
16102
16122
  else {
@@ -16110,6 +16130,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16110
16130
  }
16111
16131
  }
16112
16132
  });
16133
+ if (propertyBindings.length > 0) {
16134
+ this.updateInstructionChain(elementIndex, Identifiers$1.property, propertyBindings);
16135
+ }
16136
+ if (attributeBindings.length > 0) {
16137
+ this.updateInstructionChain(elementIndex, Identifiers$1.attribute, attributeBindings);
16138
+ }
16113
16139
  // Traverse element child nodes
16114
16140
  visitAll(this, element.children);
16115
16141
  if (!isI18nRootElement && this.i18n) {
@@ -16127,18 +16153,6 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16127
16153
  this.creationInstruction(span, isNgContainer$1 ? Identifiers$1.elementContainerEnd : Identifiers$1.elementEnd);
16128
16154
  }
16129
16155
  };
16130
- /**
16131
- * Adds an update instruction for a bound property or attribute, such as `[prop]="value"` or
16132
- * `[attr.title]="value"`
16133
- */
16134
- TemplateDefinitionBuilder.prototype.boundUpdateInstruction = function (instruction, elementIndex, attrName, input, value, params) {
16135
- var _this = this;
16136
- this.updateInstruction(elementIndex, input.sourceSpan, instruction, function () {
16137
- return __spread([
16138
- literal(attrName), _this.convertPropertyBinding(value, /* skipBindFn */ true)
16139
- ], params);
16140
- });
16141
- };
16142
16156
  /**
16143
16157
  * Adds an update instruction for an interpolated property or attribute, such as
16144
16158
  * `prop="{{value}}"` or `attr.title="{{value}}"`
@@ -16196,11 +16210,11 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16196
16210
  return trimTrailingNulls(parameters);
16197
16211
  });
16198
16212
  // handle property bindings e.g. ɵɵproperty('ngForOf', ctx.items), et al;
16199
- this.templatePropertyBindings(template, templateIndex, template.templateAttrs);
16213
+ this.templatePropertyBindings(templateIndex, template.templateAttrs);
16200
16214
  // Only add normal input/output binding instructions on explicit ng-template elements.
16201
16215
  if (template.tagName === NG_TEMPLATE_TAG_NAME) {
16202
16216
  // Add the input bindings
16203
- this.templatePropertyBindings(template, templateIndex, template.inputs);
16217
+ this.templatePropertyBindings(templateIndex, template.inputs);
16204
16218
  // Generate listeners for directive output
16205
16219
  template.outputs.forEach(function (outputAst) {
16206
16220
  _this.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this.prepareListenerParameter('ng_template', outputAst, templateIndex));
@@ -16279,20 +16293,25 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16279
16293
  null;
16280
16294
  };
16281
16295
  TemplateDefinitionBuilder.prototype.bindingContext = function () { return "" + this._bindingContext++; };
16282
- TemplateDefinitionBuilder.prototype.templatePropertyBindings = function (template, templateIndex, attrs) {
16296
+ TemplateDefinitionBuilder.prototype.templatePropertyBindings = function (templateIndex, attrs) {
16283
16297
  var _this = this;
16298
+ var propertyBindings = [];
16284
16299
  attrs.forEach(function (input) {
16285
16300
  if (input instanceof BoundAttribute) {
16286
16301
  var value_4 = input.value.visit(_this._valueConverter);
16287
16302
  if (value_4 !== undefined) {
16288
16303
  _this.allocateBindingSlots(value_4);
16289
- _this.updateInstruction(templateIndex, template.sourceSpan, Identifiers$1.property, function () {
16290
- return [literal(input.name),
16291
- _this.convertPropertyBinding(value_4, /* skipBindFn */ true)];
16304
+ propertyBindings.push({
16305
+ name: input.name,
16306
+ sourceSpan: input.sourceSpan,
16307
+ value: function () { return _this.convertPropertyBinding(value_4); }
16292
16308
  });
16293
16309
  }
16294
16310
  }
16295
16311
  });
16312
+ if (propertyBindings.length > 0) {
16313
+ this.updateInstructionChain(templateIndex, Identifiers$1.property, propertyBindings);
16314
+ }
16296
16315
  };
16297
16316
  // Bindings must only be resolved after all local refs have been visited, so all
16298
16317
  // instructions are queued in callbacks that execute once the initial pass has completed.
@@ -16308,7 +16327,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16308
16327
  TemplateDefinitionBuilder.prototype.processStylingInstruction = function (elementIndex, instruction, createMode) {
16309
16328
  var _this = this;
16310
16329
  if (instruction) {
16311
- var paramsFn = function () { return instruction.buildParams(function (value) { return _this.convertPropertyBinding(value, /* skipBindFn */ true); }); };
16330
+ var paramsFn = function () { return instruction.buildParams(function (value) { return _this.convertPropertyBinding(value); }); };
16312
16331
  if (createMode) {
16313
16332
  this.creationInstruction(instruction.sourceSpan, instruction.reference, paramsFn);
16314
16333
  }
@@ -16321,13 +16340,30 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16321
16340
  this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend);
16322
16341
  };
16323
16342
  TemplateDefinitionBuilder.prototype.updateInstruction = function (nodeIndex, span, reference, paramsOrFn) {
16343
+ this.addSelectInstructionIfNecessary(nodeIndex, span);
16344
+ this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
16345
+ };
16346
+ TemplateDefinitionBuilder.prototype.updateInstructionChain = function (nodeIndex, reference, bindings) {
16347
+ var span = bindings.length ? bindings[0].sourceSpan : null;
16348
+ this.addSelectInstructionIfNecessary(nodeIndex, span);
16349
+ this._updateCodeFns.push(function () {
16350
+ var calls = bindings.map(function (property) {
16351
+ var fnParams = __spread([property.value()], (property.params || []));
16352
+ if (property.name) {
16353
+ fnParams.unshift(literal(property.name));
16354
+ }
16355
+ return fnParams;
16356
+ });
16357
+ return chainedInstruction(span, reference, calls).toStmt();
16358
+ });
16359
+ };
16360
+ TemplateDefinitionBuilder.prototype.addSelectInstructionIfNecessary = function (nodeIndex, span) {
16324
16361
  if (this._lastNodeIndexWithFlush < nodeIndex) {
16325
16362
  if (nodeIndex > 0) {
16326
16363
  this.instructionFn(this._updateCodeFns, span, Identifiers$1.select, [literal(nodeIndex)]);
16327
16364
  }
16328
16365
  this._lastNodeIndexWithFlush = nodeIndex;
16329
16366
  }
16330
- this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
16331
16367
  };
16332
16368
  TemplateDefinitionBuilder.prototype.allocatePureFunctionSlots = function (numSlots) {
16333
16369
  var originalSlots = this._pureFunctionSlots;
@@ -16349,19 +16385,17 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16349
16385
  variable(CONTEXT_NAME) :
16350
16386
  this._bindingScope.getOrCreateSharedContextVar(0);
16351
16387
  };
16352
- TemplateDefinitionBuilder.prototype.convertExpressionBinding = function (value, skipBindFn) {
16388
+ TemplateDefinitionBuilder.prototype.convertExpressionBinding = function (value) {
16353
16389
  var convertedPropertyBinding = convertPropertyBinding(this, this.getImplicitReceiverExpr(), value, this.bindingContext(), BindingForm.TrySimple);
16354
- var valExpr = convertedPropertyBinding.currValExpr;
16355
- return skipBindFn ? valExpr : importExpr(Identifiers$1.bind).callFn([valExpr]);
16390
+ return convertedPropertyBinding.currValExpr;
16356
16391
  };
16357
- TemplateDefinitionBuilder.prototype.convertPropertyBinding = function (value, skipBindFn) {
16392
+ TemplateDefinitionBuilder.prototype.convertPropertyBinding = function (value) {
16358
16393
  var _a;
16359
16394
  var interpolationFn = value instanceof Interpolation ? interpolate : function () { return error('Unexpected interpolation'); };
16360
16395
  var convertedPropertyBinding = convertPropertyBinding(this, this.getImplicitReceiverExpr(), value, this.bindingContext(), BindingForm.TrySimple, interpolationFn);
16361
16396
  var valExpr = convertedPropertyBinding.currValExpr;
16362
16397
  (_a = this._tempVariables).push.apply(_a, __spread(convertedPropertyBinding.stmts));
16363
- return value instanceof Interpolation || skipBindFn ? valExpr :
16364
- importExpr(Identifiers$1.bind).callFn([valExpr]);
16398
+ return valExpr;
16365
16399
  };
16366
16400
  /**
16367
16401
  * Gets a list of argument expressions to pass to an update instruction expression. Also updates
@@ -16587,6 +16621,19 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16587
16621
  function instruction(span, reference, params) {
16588
16622
  return importExpr(reference, null, span).callFn(params, span);
16589
16623
  }
16624
+ function chainedInstruction(span, reference, calls) {
16625
+ var expression = importExpr(reference, null, span);
16626
+ if (calls.length > 0) {
16627
+ for (var i = 0; i < calls.length; i++) {
16628
+ expression = expression.callFn(calls[i], span);
16629
+ }
16630
+ }
16631
+ else {
16632
+ // Add a blank invocation, in case the `calls` array is empty.
16633
+ expression = expression.callFn([], span);
16634
+ }
16635
+ return expression;
16636
+ }
16590
16637
  // e.g. x(2);
16591
16638
  function generateNextContextExpr(relativeLevelDiff) {
16592
16639
  return importExpr(Identifiers$1.nextContext)
@@ -16993,7 +17040,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
16993
17040
  var interpolationConfig = options.interpolationConfig, preserveWhitespaces = options.preserveWhitespaces;
16994
17041
  var bindingParser = makeBindingParser(interpolationConfig);
16995
17042
  var htmlParser = new HtmlParser();
16996
- var parseResult = htmlParser.parse(template, templateUrl, __assign({}, options, { tokenizeExpansionForms: true, leadingTriviaChars: LEADING_TRIVIA_CHARS }));
17043
+ var parseResult = htmlParser.parse(template, templateUrl, __assign({ leadingTriviaChars: LEADING_TRIVIA_CHARS }, options, { tokenizeExpansionForms: true }));
16997
17044
  if (parseResult.errors && parseResult.errors.length > 0) {
16998
17045
  return { errors: parseResult.errors, nodes: [], styleUrls: [], styles: [] };
16999
17046
  }
@@ -17961,7 +18008,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
17961
18008
  * Use of this source code is governed by an MIT-style license that can be
17962
18009
  * found in the LICENSE file at https://angular.io/license
17963
18010
  */
17964
- var VERSION$1 = new Version('8.1.0-next.3');
18011
+ var VERSION$1 = new Version('8.1.2');
17965
18012
 
17966
18013
  /**
17967
18014
  * @license
@@ -20701,7 +20748,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
20701
20748
  else if (createInject.isTypeOf(paramEntry)) {
20702
20749
  token = paramEntry.token;
20703
20750
  }
20704
- else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) {
20751
+ else if (createInjectionToken.isTypeOf(paramEntry) ||
20752
+ paramEntry instanceof StaticSymbol) {
20705
20753
  token = paramEntry;
20706
20754
  }
20707
20755
  else if (isValidType(paramEntry) && token == null) {
@@ -25697,11 +25745,11 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
25697
25745
  else if (type.flags & ts.TypeFlags.Union) {
25698
25746
  // If all the constituent types of a union are the same kind, it is also that kind.
25699
25747
  var candidate = null;
25700
- var unionType = type;
25701
- if (unionType.types.length > 0) {
25702
- candidate = typeKindOf(unionType.types[0]);
25748
+ var unionType_1 = type;
25749
+ if (unionType_1.types.length > 0) {
25750
+ candidate = typeKindOf(unionType_1.types[0]);
25703
25751
  try {
25704
- for (var _b = __values(unionType.types), _c = _b.next(); !_c.done; _c = _b.next()) {
25752
+ for (var _b = __values(unionType_1.types), _c = _b.next(); !_c.done; _c = _b.next()) {
25705
25753
  var subType = _c.value;
25706
25754
  if (candidate != typeKindOf(subType)) {
25707
25755
  return BuiltinType$1.Other;
@@ -26250,9 +26298,9 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
26250
26298
  }
26251
26299
  return recordEntry(typeReference, node);
26252
26300
  case ts.SyntaxKind.UnionType:
26253
- var unionType = node;
26301
+ var unionType_1 = node;
26254
26302
  // Remove null and undefined from the list of unions.
26255
- var references = unionType.types
26303
+ var references = unionType_1.types
26256
26304
  .filter(function (n) { return n.kind != ts.SyntaxKind.NullKeyword &&
26257
26305
  n.kind != ts.SyntaxKind.UndefinedKeyword; })
26258
26306
  .map(function (n) { return _this.evaluateNode(n); });
@@ -26973,8 +27021,9 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
26973
27021
  if (name) {
26974
27022
  if (!metadata)
26975
27023
  metadata = {};
26976
- metadata[name] =
26977
- maybeFunc ? recordEntry(maybeFunc.func, node) : { __symbolic: 'function' };
27024
+ // TODO(alxhub): The literal here is not valid FunctionMetadata.
27025
+ metadata[name] = maybeFunc ? recordEntry(maybeFunc.func, node) :
27026
+ { __symbolic: 'function' };
26978
27027
  }
26979
27028
  }
26980
27029
  break;
@@ -27006,13 +27055,15 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
27006
27055
  nextDefaultValue = enumValue + 1;
27007
27056
  }
27008
27057
  else if (name) {
27058
+ // TODO(alxhub): 'left' here has a name propery which is not valid for
27059
+ // MetadataSymbolicSelectExpression.
27009
27060
  nextDefaultValue = {
27010
27061
  __symbolic: 'binary',
27011
27062
  operator: '+',
27012
27063
  left: {
27013
27064
  __symbolic: 'select',
27014
27065
  expression: recordEntry({ __symbolic: 'reference', name: enumName }, node), name: name
27015
- }
27066
+ },
27016
27067
  };
27017
27068
  }
27018
27069
  else {
@@ -29007,56 +29058,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29007
29058
  * Use of this source code is governed by an MIT-style license that can be
29008
29059
  * found in the LICENSE file at https://angular.io/license
29009
29060
  */
29010
- function getTemplateDiagnostics(fileName, astProvider, templates) {
29011
- var e_1, _a;
29012
- var results = [];
29013
- var _loop_1 = function (template) {
29014
- var ast = astProvider.getTemplateAst(template, fileName);
29015
- if (ast) {
29016
- if (ast.parseErrors && ast.parseErrors.length) {
29017
- results.push.apply(results, __spread(ast.parseErrors.map(function (e) { return ({
29018
- kind: DiagnosticKind$1.Error,
29019
- span: offsetSpan$1(spanOf$2(e.span), template.span.start),
29020
- message: e.msg
29021
- }); })));
29022
- }
29023
- else if (ast.templateAst && ast.htmlAst) {
29024
- var info = {
29025
- templateAst: ast.templateAst,
29026
- htmlAst: ast.htmlAst,
29027
- offset: template.span.start,
29028
- query: template.query,
29029
- members: template.members
29030
- };
29031
- var expressionDiagnostics = getTemplateExpressionDiagnostics(info);
29032
- results.push.apply(results, __spread(expressionDiagnostics));
29033
- }
29034
- if (ast.errors) {
29035
- results.push.apply(results, __spread(ast.errors.map(function (e) { return ({ kind: e.kind, span: e.span || template.span, message: e.message }); })));
29036
- }
29037
- }
29038
- };
29039
- try {
29040
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
29041
- var template = templates_1_1.value;
29042
- _loop_1(template);
29043
- }
29044
- }
29045
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
29046
- finally {
29047
- try {
29048
- if (templates_1_1 && !templates_1_1.done && (_a = templates_1.return)) _a.call(templates_1);
29049
- }
29050
- finally { if (e_1) throw e_1.error; }
29051
- }
29052
- return results;
29053
- }
29054
29061
  function getDeclarationDiagnostics(declarations, modules) {
29055
- var e_2, _a;
29062
+ var e_1, _a;
29056
29063
  var results = [];
29057
29064
  var directives = undefined;
29058
- var _loop_2 = function (declaration) {
29059
- var e_3, _a;
29065
+ var _loop_1 = function (declaration) {
29066
+ var e_2, _a;
29060
29067
  var report = function (message, span) {
29061
29068
  results.push({
29062
29069
  kind: DiagnosticKind$1.Error,
@@ -29069,12 +29076,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29069
29076
  report(error.message, error.span);
29070
29077
  }
29071
29078
  }
29072
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
29079
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
29073
29080
  finally {
29074
29081
  try {
29075
29082
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
29076
29083
  }
29077
- finally { if (e_3) throw e_3.error; }
29084
+ finally { if (e_2) throw e_2.error; }
29078
29085
  }
29079
29086
  if (declaration.metadata) {
29080
29087
  if (declaration.metadata.isComponent) {
@@ -29105,15 +29112,15 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29105
29112
  try {
29106
29113
  for (var declarations_1 = __values(declarations), declarations_1_1 = declarations_1.next(); !declarations_1_1.done; declarations_1_1 = declarations_1.next()) {
29107
29114
  var declaration = declarations_1_1.value;
29108
- _loop_2(declaration);
29115
+ _loop_1(declaration);
29109
29116
  }
29110
29117
  }
29111
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
29118
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
29112
29119
  finally {
29113
29120
  try {
29114
29121
  if (declarations_1_1 && !declarations_1_1.done && (_a = declarations_1.return)) _a.call(declarations_1);
29115
29122
  }
29116
- finally { if (e_2) throw e_2.error; }
29123
+ finally { if (e_1) throw e_1.error; }
29117
29124
  }
29118
29125
  return results;
29119
29126
  }
@@ -29169,7 +29176,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29169
29176
  var results = [];
29170
29177
  var templates = this.host.getTemplates(fileName);
29171
29178
  if (templates && templates.length) {
29172
- results.push.apply(results, __spread(getTemplateDiagnostics(fileName, this, templates)));
29179
+ results.push.apply(results, __spread(this.getTemplateDiagnostics(fileName, templates)));
29173
29180
  }
29174
29181
  var declarations = this.host.getDeclarations(fileName);
29175
29182
  if (declarations && declarations.length) {
@@ -29179,101 +29186,79 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29179
29186
  return uniqueBySpan(results);
29180
29187
  };
29181
29188
  LanguageServiceImpl.prototype.getPipesAt = function (fileName, position) {
29182
- var templateInfo = this.getTemplateAstAtPosition(fileName, position);
29189
+ var templateInfo = this.host.getTemplateAstAtPosition(fileName, position);
29183
29190
  if (templateInfo) {
29184
29191
  return templateInfo.pipes;
29185
29192
  }
29186
29193
  return [];
29187
29194
  };
29188
29195
  LanguageServiceImpl.prototype.getCompletionsAt = function (fileName, position) {
29189
- var templateInfo = this.getTemplateAstAtPosition(fileName, position);
29196
+ var templateInfo = this.host.getTemplateAstAtPosition(fileName, position);
29190
29197
  if (templateInfo) {
29191
29198
  return getTemplateCompletions(templateInfo);
29192
29199
  }
29193
29200
  };
29194
29201
  LanguageServiceImpl.prototype.getDefinitionAt = function (fileName, position) {
29195
- var templateInfo = this.getTemplateAstAtPosition(fileName, position);
29202
+ var templateInfo = this.host.getTemplateAstAtPosition(fileName, position);
29196
29203
  if (templateInfo) {
29197
29204
  return getDefinition(templateInfo);
29198
29205
  }
29199
29206
  };
29200
29207
  LanguageServiceImpl.prototype.getHoverAt = function (fileName, position) {
29201
- var templateInfo = this.getTemplateAstAtPosition(fileName, position);
29208
+ var templateInfo = this.host.getTemplateAstAtPosition(fileName, position);
29202
29209
  if (templateInfo) {
29203
29210
  return getHover(templateInfo);
29204
29211
  }
29205
29212
  };
29206
- LanguageServiceImpl.prototype.getTemplateAstAtPosition = function (fileName, position) {
29207
- var template = this.host.getTemplateAt(fileName, position);
29208
- if (template) {
29209
- var astResult = this.getTemplateAst(template, fileName);
29210
- if (astResult && astResult.htmlAst && astResult.templateAst && astResult.directive &&
29211
- astResult.directives && astResult.pipes && astResult.expressionParser)
29212
- return {
29213
- position: position,
29214
- fileName: fileName,
29215
- template: template,
29216
- htmlAst: astResult.htmlAst,
29217
- directive: astResult.directive,
29218
- directives: astResult.directives,
29219
- pipes: astResult.pipes,
29220
- templateAst: astResult.templateAst,
29221
- expressionParser: astResult.expressionParser
29222
- };
29223
- }
29224
- return undefined;
29225
- };
29226
- LanguageServiceImpl.prototype.getTemplateAst = function (template, contextFile) {
29227
- var _this = this;
29228
- var result = undefined;
29229
- try {
29230
- var resolvedMetadata = this.metadataResolver.getNonNormalizedDirectiveMetadata(template.type);
29231
- var metadata = resolvedMetadata && resolvedMetadata.metadata;
29232
- if (metadata) {
29233
- var rawHtmlParser = new HtmlParser();
29234
- var htmlParser = new I18NHtmlParser(rawHtmlParser);
29235
- var expressionParser = new Parser$1(new Lexer());
29236
- var config = new CompilerConfig();
29237
- var parser = new TemplateParser(config, this.host.resolver.getReflector(), expressionParser, new DomElementSchemaRegistry(), htmlParser, null, []);
29238
- var htmlResult = htmlParser.parse(template.source, '', { tokenizeExpansionForms: true });
29239
- var analyzedModules = this.host.getAnalyzedModules();
29240
- var errors = undefined;
29241
- var ngModule = analyzedModules.ngModuleByPipeOrDirective.get(template.type);
29242
- if (!ngModule) {
29243
- // Reported by the the declaration diagnostics.
29244
- ngModule = findSuitableDefaultModule(analyzedModules);
29245
- }
29246
- if (ngModule) {
29247
- var resolvedDirectives = ngModule.transitiveModule.directives.map(function (d) { return _this.host.resolver.getNonNormalizedDirectiveMetadata(d.reference); });
29248
- var directives = removeMissing(resolvedDirectives).map(function (d) { return d.metadata.toSummary(); });
29249
- var pipes = ngModule.transitiveModule.pipes.map(function (p) { return _this.host.resolver.getOrLoadPipeMetadata(p.reference).toSummary(); });
29250
- var schemas = ngModule.schemas;
29251
- var parseResult = parser.tryParseHtml(htmlResult, metadata, directives, pipes, schemas);
29252
- result = {
29253
- htmlAst: htmlResult.rootNodes,
29254
- templateAst: parseResult.templateAst,
29255
- directive: metadata, directives: directives, pipes: pipes,
29256
- parseErrors: parseResult.errors, expressionParser: expressionParser, errors: errors
29213
+ LanguageServiceImpl.prototype.getTemplateDiagnostics = function (fileName, templates) {
29214
+ var e_1, _a;
29215
+ var results = [];
29216
+ var _loop_1 = function (template) {
29217
+ var ast = this_1.host.getTemplateAst(template, fileName);
29218
+ if (ast) {
29219
+ if (ast.parseErrors && ast.parseErrors.length) {
29220
+ results.push.apply(results, __spread(ast.parseErrors.map(function (e) { return ({
29221
+ kind: DiagnosticKind$1.Error,
29222
+ span: offsetSpan$1(spanOf$2(e.span), template.span.start),
29223
+ message: e.msg
29224
+ }); })));
29225
+ }
29226
+ else if (ast.templateAst && ast.htmlAst) {
29227
+ var info = {
29228
+ templateAst: ast.templateAst,
29229
+ htmlAst: ast.htmlAst,
29230
+ offset: template.span.start,
29231
+ query: template.query,
29232
+ members: template.members
29257
29233
  };
29234
+ var expressionDiagnostics = getTemplateExpressionDiagnostics(info);
29235
+ results.push.apply(results, __spread(expressionDiagnostics));
29258
29236
  }
29237
+ if (ast.errors) {
29238
+ results.push.apply(results, __spread(ast.errors.map(function (e) { return ({ kind: e.kind, span: e.span || template.span, message: e.message }); })));
29239
+ }
29240
+ }
29241
+ };
29242
+ var this_1 = this;
29243
+ try {
29244
+ for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
29245
+ var template = templates_1_1.value;
29246
+ _loop_1(template);
29259
29247
  }
29260
29248
  }
29261
- catch (e) {
29262
- var span = template.span;
29263
- if (e.fileName == contextFile) {
29264
- span = template.query.getSpanAt(e.line, e.column) || span;
29249
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
29250
+ finally {
29251
+ try {
29252
+ if (templates_1_1 && !templates_1_1.done && (_a = templates_1.return)) _a.call(templates_1);
29265
29253
  }
29266
- result = { errors: [{ kind: DiagnosticKind$1.Error, message: e.message, span: span }] };
29254
+ finally { if (e_1) throw e_1.error; }
29267
29255
  }
29268
- return result || {};
29256
+ return results;
29269
29257
  };
29270
29258
  return LanguageServiceImpl;
29271
29259
  }());
29272
- function removeMissing(values) {
29273
- return values.filter(function (e) { return !!e; });
29274
- }
29275
29260
  function uniqueBySpan(elements) {
29276
- var e_1, _a;
29261
+ var e_2, _a;
29277
29262
  if (elements) {
29278
29263
  var result = [];
29279
29264
  var map = new Map();
@@ -29292,39 +29277,16 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
29292
29277
  }
29293
29278
  }
29294
29279
  }
29295
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
29280
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
29296
29281
  finally {
29297
29282
  try {
29298
29283
  if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
29299
29284
  }
29300
- finally { if (e_1) throw e_1.error; }
29285
+ finally { if (e_2) throw e_2.error; }
29301
29286
  }
29302
29287
  return result;
29303
29288
  }
29304
29289
  }
29305
- function findSuitableDefaultModule(modules) {
29306
- var e_2, _a;
29307
- var result = undefined;
29308
- var resultSize = 0;
29309
- try {
29310
- for (var _b = __values(modules.ngModules), _c = _b.next(); !_c.done; _c = _b.next()) {
29311
- var module_1 = _c.value;
29312
- var moduleSize = module_1.transitiveModule.directives.length;
29313
- if (moduleSize > resultSize) {
29314
- result = module_1;
29315
- resultSize = moduleSize;
29316
- }
29317
- }
29318
- }
29319
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
29320
- finally {
29321
- try {
29322
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
29323
- }
29324
- finally { if (e_2) throw e_2.error; }
29325
- }
29326
- return result;
29327
- }
29328
29290
 
29329
29291
  /**
29330
29292
  * @license
@@ -30107,7 +30069,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
30107
30069
  if (typeof paramTypes === 'undefined') {
30108
30070
  result[i] = [];
30109
30071
  }
30110
- else if (paramTypes[i] != Object) {
30072
+ else if (paramTypes[i] && paramTypes[i] != Object) {
30111
30073
  result[i] = [paramTypes[i]];
30112
30074
  }
30113
30075
  else {
@@ -32574,7 +32536,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
32574
32536
  function assertDomNode(node) {
32575
32537
  // If we're in a worker, `Node` will not be defined.
32576
32538
  assertEqual((typeof Node !== 'undefined' && node instanceof Node) ||
32577
- (typeof node === 'object' && node.constructor.name === 'WebWorkerRenderNode'), true, 'The provided value must be an instance of a DOM Node');
32539
+ (typeof node === 'object' && node.constructor.name === 'WebWorkerRenderNode'), true, "The provided value must be an instance of a DOM Node but got " + stringify$1(node));
32578
32540
  }
32579
32541
  function assertDataInRange(arr, index) {
32580
32542
  var maxLen = arr ? arr.length : 0;
@@ -32609,7 +32571,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
32609
32571
  * which views are already in the DOM (and don't need to be re-added) and so we can
32610
32572
  * remove views from the DOM when they are no longer required.
32611
32573
  */
32612
- var CONTAINER_HEADER_OFFSET = 8;
32574
+ var CONTAINER_HEADER_OFFSET = 9;
32613
32575
 
32614
32576
  /**
32615
32577
  * @license
@@ -33120,8 +33082,11 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
33120
33082
  * the direction of traversal (up or down the view tree) a bit clearer.
33121
33083
  *
33122
33084
  * @param newView New state to become active
33085
+ * @param safeToRunHooks Whether the runtime is in a state where running lifecycle hooks is valid.
33086
+ * This is not always the case (for example, the application may have crashed and `leaveView` is
33087
+ * being executed while unwinding the call stack).
33123
33088
  */
33124
- function leaveView(newView) {
33089
+ function leaveView(newView, safeToRunHooks) {
33125
33090
  var tView = lView[TVIEW];
33126
33091
  if (isCreationMode(lView)) {
33127
33092
  lView[FLAGS] &= ~4 /* CreationMode */;
@@ -33129,7 +33094,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
33129
33094
  else {
33130
33095
  try {
33131
33096
  resetPreOrderHookFlags(lView);
33132
- executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode, 2 /* AfterViewInitHooksToBeRun */, undefined);
33097
+ safeToRunHooks && executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode, 2 /* AfterViewInitHooksToBeRun */, undefined);
33133
33098
  }
33134
33099
  finally {
33135
33100
  // Views are clean and in update mode after being checked, so these bits are cleared
@@ -34014,7 +33979,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
34014
33979
  return lView;
34015
33980
  }
34016
33981
  /**
34017
- * Given a current view, finds the nearest component's host (LElement).
33982
+ * Given an `LView`, find the closest declaration view which is not an embedded view.
33983
+ *
33984
+ * This method searches for the `LView` associated with the component which declared the `LView`.
33985
+ *
33986
+ * This function may return itself if the `LView` passed in is not an embedded `LView`. Otherwise
33987
+ * it walks the declaration parents until it finds a component view (non-embedded-view.)
34018
33988
  *
34019
33989
  * @param lView LView for which we want a host element node
34020
33990
  * @returns The host node
@@ -36413,6 +36383,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36413
36383
  tickRootContext(getRootContext(viewToRender));
36414
36384
  }
36415
36385
  else {
36386
+ // Will become true if the `try` block executes with no errors.
36387
+ var safeToRunHooks = false;
36416
36388
  try {
36417
36389
  setPreviousOrParentTNode(null, true);
36418
36390
  oldView = enterView(viewToRender, viewToRender[T_HOST]);
@@ -36424,9 +36396,10 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36424
36396
  // matching, etc again and again.
36425
36397
  viewToRender[TVIEW].firstTemplatePass = false;
36426
36398
  refreshDescendantViews(viewToRender);
36399
+ safeToRunHooks = true;
36427
36400
  }
36428
36401
  finally {
36429
- leaveView(oldView);
36402
+ leaveView(oldView, safeToRunHooks);
36430
36403
  setPreviousOrParentTNode(_previousOrParentTNode, _isParent);
36431
36404
  }
36432
36405
  }
@@ -36436,6 +36409,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36436
36409
  var oldView = enterView(hostView, hostView[T_HOST]);
36437
36410
  var normalExecutionPath = !getCheckNoChangesMode();
36438
36411
  var creationModeIsActive = isCreationMode(hostView);
36412
+ // Will become true if the `try` block executes with no errors.
36413
+ var safeToRunHooks = false;
36439
36414
  try {
36440
36415
  if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
36441
36416
  rendererFactory.begin();
@@ -36450,12 +36425,13 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36450
36425
  resetPreOrderHookFlags(hostView);
36451
36426
  templateFn && executeTemplate(hostView, templateFn, 2 /* Update */, context);
36452
36427
  refreshDescendantViews(hostView);
36428
+ safeToRunHooks = true;
36453
36429
  }
36454
36430
  finally {
36455
36431
  if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) {
36456
36432
  rendererFactory.end();
36457
36433
  }
36458
- leaveView(oldView);
36434
+ leaveView(oldView, safeToRunHooks);
36459
36435
  }
36460
36436
  }
36461
36437
  function executeTemplate(lView, templateFn, rf, context) {
@@ -36935,6 +36911,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36935
36911
  var oldView = enterView(hostView, hostView[T_HOST]);
36936
36912
  var templateFn = hostTView.template;
36937
36913
  var creationMode = isCreationMode(hostView);
36914
+ // Will become true if the `try` block executes with no errors.
36915
+ var safeToRunHooks = false;
36938
36916
  try {
36939
36917
  resetPreOrderHookFlags(hostView);
36940
36918
  creationMode && executeViewQueryFn(1 /* Create */, hostTView, component);
@@ -36944,9 +36922,10 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
36944
36922
  if (!creationMode || hostTView.staticViewQueries) {
36945
36923
  executeViewQueryFn(2 /* Update */, hostTView, component);
36946
36924
  }
36925
+ safeToRunHooks = true;
36947
36926
  }
36948
36927
  finally {
36949
- leaveView(oldView);
36928
+ leaveView(oldView, safeToRunHooks);
36950
36929
  }
36951
36930
  }
36952
36931
  function executeViewQueryFn(flags, tView, component) {
@@ -37201,181 +37180,39 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
37201
37180
  return container;
37202
37181
  }
37203
37182
  }
37204
- /**
37205
- * Stack used to keep track of projection nodes in walkTNodeTree.
37206
- *
37207
- * This is deliberately created outside of walkTNodeTree to avoid allocating
37208
- * a new array each time the function is called. Instead the array will be
37209
- * re-used by each invocation. This works because the function is not reentrant.
37210
- */
37211
- var projectionNodeStack = [];
37212
- /**
37213
- * Walks a tree of TNodes, applying a transformation on the element nodes, either only on the first
37214
- * one found, or on all of them.
37215
- *
37216
- * @param viewToWalk the view to walk
37217
- * @param action identifies the action to be performed on the elements
37218
- * @param renderer the current renderer.
37219
- * @param renderParent Optional the render parent node to be set in all LContainers found,
37220
- * required for action modes Insert and Destroy.
37221
- * @param beforeNode Optional the node before which elements should be added, required for action
37222
- * Insert.
37223
- */
37224
- function walkTNodeTree(viewToWalk, action, renderer, renderParent, beforeNode) {
37225
- var e_1, _a;
37226
- var rootTNode = viewToWalk[TVIEW].node;
37227
- var projectionNodeIndex = -1;
37228
- var currentView = viewToWalk;
37229
- var tNode = rootTNode.child;
37230
- while (tNode) {
37231
- var nextTNode = null;
37232
- if (tNode.type === 3 /* Element */ || tNode.type === 4 /* ElementContainer */) {
37233
- executeNodeAction(action, renderer, renderParent, getNativeByTNode(tNode, currentView), tNode, beforeNode);
37234
- var nodeOrContainer = currentView[tNode.index];
37235
- if (isLContainer(nodeOrContainer)) {
37236
- // This element has an LContainer, and its comment needs to be handled
37237
- executeNodeAction(action, renderer, renderParent, nodeOrContainer[NATIVE], tNode, beforeNode);
37238
- var firstView = nodeOrContainer[CONTAINER_HEADER_OFFSET];
37239
- if (firstView) {
37240
- currentView = firstView;
37241
- nextTNode = currentView[TVIEW].node;
37242
- // When the walker enters a container, then the beforeNode has to become the local native
37243
- // comment node.
37244
- beforeNode = nodeOrContainer[NATIVE];
37245
- }
37246
- }
37247
- }
37248
- else if (tNode.type === 0 /* Container */) {
37249
- var lContainer = currentView[tNode.index];
37250
- executeNodeAction(action, renderer, renderParent, lContainer[NATIVE], tNode, beforeNode);
37251
- var firstView = lContainer[CONTAINER_HEADER_OFFSET];
37252
- if (firstView) {
37253
- currentView = firstView;
37254
- nextTNode = currentView[TVIEW].node;
37255
- // When the walker enters a container, then the beforeNode has to become the local native
37256
- // comment node.
37257
- beforeNode = lContainer[NATIVE];
37258
- }
37259
- }
37260
- else if (tNode.type === 1 /* Projection */) {
37261
- var componentView = findComponentView(currentView);
37262
- var componentHost = componentView[T_HOST];
37263
- var head = componentHost.projection[tNode.projection];
37264
- if (Array.isArray(head)) {
37265
- try {
37266
- for (var head_1 = __values(head), head_1_1 = head_1.next(); !head_1_1.done; head_1_1 = head_1.next()) {
37267
- var nativeNode = head_1_1.value;
37268
- executeNodeAction(action, renderer, renderParent, nativeNode, tNode, beforeNode);
37269
- }
37270
- }
37271
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
37272
- finally {
37273
- try {
37274
- if (head_1_1 && !head_1_1.done && (_a = head_1.return)) _a.call(head_1);
37275
- }
37276
- finally { if (e_1) throw e_1.error; }
37277
- }
37278
- }
37279
- else {
37280
- // Must store both the TNode and the view because this projection node could be nested
37281
- // deeply inside embedded views, and we need to get back down to this particular nested
37282
- // view.
37283
- projectionNodeStack[++projectionNodeIndex] = tNode;
37284
- projectionNodeStack[++projectionNodeIndex] = currentView;
37285
- if (head) {
37286
- currentView = componentView[PARENT];
37287
- nextTNode = currentView[TVIEW].data[head.index];
37288
- }
37289
- }
37290
- }
37291
- else {
37292
- // Otherwise, this is a View
37293
- nextTNode = tNode.child;
37294
- }
37295
- if (nextTNode === null) {
37296
- // this last node was projected, we need to get back down to its projection node
37297
- if (tNode.projectionNext === null && (tNode.flags & 2 /* isProjected */)) {
37298
- currentView = projectionNodeStack[projectionNodeIndex--];
37299
- tNode = projectionNodeStack[projectionNodeIndex--];
37300
- }
37301
- if (tNode.flags & 2 /* isProjected */) {
37302
- nextTNode = tNode.projectionNext;
37303
- }
37304
- else if (tNode.type === 4 /* ElementContainer */) {
37305
- nextTNode = tNode.child || tNode.next;
37306
- }
37307
- else {
37308
- nextTNode = tNode.next;
37309
- }
37310
- /**
37311
- * Find the next node in the TNode tree, taking into account the place where a node is
37312
- * projected (in the shadow DOM) rather than where it comes from (in the light DOM).
37313
- *
37314
- * If there is no sibling node, then it goes to the next sibling of the parent node...
37315
- * until it reaches rootNode (at which point null is returned).
37316
- */
37317
- while (!nextTNode) {
37318
- // If parent is null, we're crossing the view boundary, so we should get the host TNode.
37319
- tNode = tNode.parent || currentView[T_HOST];
37320
- if (tNode === null || tNode === rootTNode)
37321
- return;
37322
- // When exiting a container, the beforeNode must be restored to the previous value
37323
- if (tNode.type === 0 /* Container */) {
37324
- currentView = getLViewParent(currentView);
37325
- beforeNode = currentView[tNode.index][NATIVE];
37326
- }
37327
- if (tNode.type === 2 /* View */) {
37328
- /**
37329
- * If current lView doesn't have next pointer, we try to find it by going up parents
37330
- * chain until:
37331
- * - we find an lView with a next pointer
37332
- * - or find a tNode with a parent that has a next pointer
37333
- * - or find a lContainer
37334
- * - or reach root TNode (in which case we exit, since we traversed all nodes)
37335
- */
37336
- while (!currentView[NEXT] && currentView[PARENT] &&
37337
- !(tNode.parent && tNode.parent.next)) {
37338
- if (tNode === rootTNode)
37339
- return;
37340
- currentView = currentView[PARENT];
37341
- if (isLContainer(currentView)) {
37342
- tNode = currentView[T_HOST];
37343
- currentView = currentView[PARENT];
37344
- beforeNode = currentView[tNode.index][NATIVE];
37345
- break;
37346
- }
37347
- tNode = currentView[T_HOST];
37348
- }
37349
- if (currentView[NEXT]) {
37350
- currentView = currentView[NEXT];
37351
- nextTNode = currentView[T_HOST];
37352
- }
37353
- else {
37354
- nextTNode = tNode.type === 4 /* ElementContainer */ && tNode.child || tNode.next;
37355
- }
37356
- }
37357
- else {
37358
- nextTNode = tNode.next;
37359
- }
37360
- }
37361
- }
37362
- tNode = nextTNode;
37363
- }
37364
- }
37365
37183
  /**
37366
37184
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
37367
37185
  * being passed as an argument.
37368
37186
  */
37369
- function executeNodeAction(action, renderer, parent, node, tNode, beforeNode) {
37187
+ function executeActionOnElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) {
37188
+ ngDevMode && assertDefined(lNodeToHandle, '\'lNodeToHandle\' is undefined');
37189
+ var lContainer;
37190
+ var isComponent = false;
37191
+ // We are expecting an RNode, but in the case of a component or LContainer the `RNode` is wrapped
37192
+ // in an array which needs to be unwrapped. We need to know if it is a component and if
37193
+ // it has LContainer so that we can process all of those cases appropriately.
37194
+ if (isLContainer(lNodeToHandle)) {
37195
+ lContainer = lNodeToHandle;
37196
+ }
37197
+ else if (isLView(lNodeToHandle)) {
37198
+ isComponent = true;
37199
+ ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView');
37200
+ lNodeToHandle = lNodeToHandle[HOST];
37201
+ }
37202
+ var rNode = unwrapRNode(lNodeToHandle);
37203
+ ngDevMode && assertDomNode(rNode);
37370
37204
  if (action === 0 /* Insert */) {
37371
- nativeInsertBefore(renderer, parent, node, beforeNode || null);
37205
+ nativeInsertBefore(renderer, parent, rNode, beforeNode || null);
37372
37206
  }
37373
37207
  else if (action === 1 /* Detach */) {
37374
- nativeRemoveNode(renderer, node, isComponent(tNode));
37208
+ nativeRemoveNode(renderer, rNode, isComponent);
37375
37209
  }
37376
37210
  else if (action === 2 /* Destroy */) {
37377
37211
  ngDevMode && ngDevMode.rendererDestroyNode++;
37378
- renderer.destroyNode(node);
37212
+ renderer.destroyNode(rNode);
37213
+ }
37214
+ if (lContainer != null) {
37215
+ executeActionOnContainer(renderer, action, lContainer, parent, beforeNode);
37379
37216
  }
37380
37217
  }
37381
37218
  /**
@@ -37384,7 +37221,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
37384
37221
  * @param lView the `LView` to be detached.
37385
37222
  */
37386
37223
  function renderDetachView(lView) {
37387
- walkTNodeTree(lView, 1 /* Detach */, lView[RENDERER], null);
37224
+ executeActionOnView(lView[RENDERER], 1 /* Detach */, lView, null, null);
37388
37225
  }
37389
37226
  /**
37390
37227
  * Traverses down and up the tree of views and containers to remove listeners and
@@ -37435,15 +37272,15 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
37435
37272
  * A standalone function which destroys an LView,
37436
37273
  * conducting cleanup (e.g. removing listeners, calling onDestroys).
37437
37274
  *
37438
- * @param view The view to be destroyed.
37275
+ * @param lView The view to be destroyed.
37439
37276
  */
37440
- function destroyLView(view) {
37441
- if (!(view[FLAGS] & 256 /* Destroyed */)) {
37442
- var renderer = view[RENDERER];
37277
+ function destroyLView(lView) {
37278
+ if (!(lView[FLAGS] & 256 /* Destroyed */)) {
37279
+ var renderer = lView[RENDERER];
37443
37280
  if (isProceduralRenderer(renderer) && renderer.destroyNode) {
37444
- walkTNodeTree(view, 2 /* Destroy */, renderer, null);
37281
+ executeActionOnView(renderer, 2 /* Destroy */, lView, null, null);
37445
37282
  }
37446
- destroyViewTree(view);
37283
+ destroyViewTree(lView);
37447
37284
  }
37448
37285
  }
37449
37286
  /**
@@ -37506,7 +37343,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
37506
37343
  /** Removes listeners and unsubscribes from output subscriptions */
37507
37344
  function removeListeners(lView) {
37508
37345
  var tCleanup = lView[TVIEW].cleanup;
37509
- if (tCleanup != null) {
37346
+ if (tCleanup !== null) {
37510
37347
  var lCleanup = lView[CLEANUP];
37511
37348
  for (var i = 0; i < tCleanup.length - 1; i += 2) {
37512
37349
  if (typeof tCleanup[i] === 'string') {
@@ -37600,6 +37437,137 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
37600
37437
  nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);
37601
37438
  }
37602
37439
  }
37440
+ /**
37441
+ * `executeActionOnView` performs an operation on the view as specified in `action` (insert, detach,
37442
+ * destroy)
37443
+ *
37444
+ * Inserting a view without projection or containers at top level is simple. Just iterate over the
37445
+ * root nodes of the View, and for each node perform the `action`.
37446
+ *
37447
+ * Things get more complicated with containers and projections. That is because coming across:
37448
+ * - Container: implies that we have to insert/remove/destroy the views of that container as well
37449
+ * which in turn can have their own Containers at the View roots.
37450
+ * - Projection: implies that we have to insert/remove/destroy the nodes of the projection. The
37451
+ * complication is that the nodes we are projecting can themselves have Containers
37452
+ * or other Projections.
37453
+ *
37454
+ * As you can see this is a very recursive problem. While the recursive implementation is not the
37455
+ * most efficient one, trying to unroll the nodes non-recursively results in very complex code that
37456
+ * is very hard (to maintain). We are sacrificing a bit of performance for readability using a
37457
+ * recursive implementation.
37458
+ *
37459
+ * @param renderer Renderer to use
37460
+ * @param action action to perform (insert, detach, destroy)
37461
+ * @param lView The LView which needs to be inserted, detached, destroyed.
37462
+ * @param renderParent parent DOM element for insertion/removal.
37463
+ * @param beforeNode Before which node the insertions should happen.
37464
+ */
37465
+ function executeActionOnView(renderer, action, lView, renderParent, beforeNode) {
37466
+ var tView = lView[TVIEW];
37467
+ ngDevMode && assertNodeType(tView.node, 2 /* View */);
37468
+ var viewRootTNode = tView.node.child;
37469
+ while (viewRootTNode !== null) {
37470
+ executeActionOnNode(renderer, action, lView, viewRootTNode, renderParent, beforeNode);
37471
+ viewRootTNode = viewRootTNode.next;
37472
+ }
37473
+ }
37474
+ /**
37475
+ * `executeActionOnProjection` performs an operation on the projection specified by `action`
37476
+ * (insert, detach, destroy).
37477
+ *
37478
+ * Inserting a projection requires us to locate the projected nodes from the parent component. The
37479
+ * complication is that those nodes themselves could be re-projected from their parent component.
37480
+ *
37481
+ * @param renderer Renderer to use
37482
+ * @param action action to perform (insert, detach, destroy)
37483
+ * @param lView The LView which needs to be inserted, detached, destroyed.
37484
+ * @param renderParent parent DOM element for insertion/removal.
37485
+ * @param beforeNode Before which node the insertions should happen.
37486
+ */
37487
+ function executeActionOnProjection(renderer, action, lView, tProjectionNode, renderParent, beforeNode) {
37488
+ var componentLView = findComponentView(lView);
37489
+ var componentNode = componentLView[T_HOST];
37490
+ var nodeToProject = componentNode.projection[tProjectionNode.projection];
37491
+ if (Array.isArray(nodeToProject)) {
37492
+ for (var i = 0; i < nodeToProject.length; i++) {
37493
+ var rNode = nodeToProject[i];
37494
+ ngDevMode && assertDomNode(rNode);
37495
+ executeActionOnElementOrContainer(action, renderer, renderParent, rNode, beforeNode);
37496
+ }
37497
+ }
37498
+ else {
37499
+ var projectionTNode = nodeToProject;
37500
+ var projectedComponentLView = componentLView[PARENT];
37501
+ while (projectionTNode !== null) {
37502
+ executeActionOnNode(renderer, action, projectedComponentLView, projectionTNode, renderParent, beforeNode);
37503
+ projectionTNode = projectionTNode.projectionNext;
37504
+ }
37505
+ }
37506
+ }
37507
+ /**
37508
+ * `executeActionOnContainer` performs an operation on the container and its views as specified by
37509
+ * `action` (insert, detach, destroy)
37510
+ *
37511
+ * Inserting a Container is complicated by the fact that the container may have Views which
37512
+ * themselves have containers or projections.
37513
+ *
37514
+ * @param renderer Renderer to use
37515
+ * @param action action to perform (insert, detach, destroy)
37516
+ * @param lContainer The LContainer which needs to be inserted, detached, destroyed.
37517
+ * @param renderParent parent DOM element for insertion/removal.
37518
+ * @param beforeNode Before which node the insertions should happen.
37519
+ */
37520
+ function executeActionOnContainer(renderer, action, lContainer, renderParent, beforeNode) {
37521
+ ngDevMode && assertLContainer(lContainer);
37522
+ var anchor = lContainer[NATIVE]; // LContainer has its own before node.
37523
+ var native = unwrapRNode(lContainer);
37524
+ // An LContainer can be created dynamically on any node by injecting ViewContainerRef.
37525
+ // Asking for a ViewContainerRef on an element will result in a creation of a separate anchor node
37526
+ // (comment in the DOM) that will be different from the LContainer's host node. In this particular
37527
+ // case we need to execute action on 2 nodes:
37528
+ // - container's host node (this is done in the executeNodeAction)
37529
+ // - container's host node (this is done here)
37530
+ if (anchor !== native) {
37531
+ executeActionOnElementOrContainer(action, renderer, renderParent, anchor, beforeNode);
37532
+ }
37533
+ for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
37534
+ var lView = lContainer[i];
37535
+ executeActionOnView(renderer, action, lView, renderParent, anchor);
37536
+ }
37537
+ }
37538
+ /**
37539
+ * `executeActionOnElementContainer` performs an operation on the ng-container node and its child
37540
+ * nodes as specified by the `action` (insert, detach, destroy).
37541
+ *
37542
+ * @param renderer Renderer to use
37543
+ * @param action action to perform (insert, detach, destroy)
37544
+ * @param lView The LView which needs to be inserted, detached, destroyed.
37545
+ * @param tElementContainerNode The TNode associated with the ElementContainer.
37546
+ * @param renderParent parent DOM element for insertion/removal.
37547
+ * @param beforeNode Before which node the insertions should happen.
37548
+ */
37549
+ function executeActionOnElementContainer(renderer, action, lView, tElementContainerNode, renderParent, beforeNode) {
37550
+ var node = lView[tElementContainerNode.index];
37551
+ executeActionOnElementOrContainer(action, renderer, renderParent, node, beforeNode);
37552
+ var childTNode = tElementContainerNode.child;
37553
+ while (childTNode) {
37554
+ executeActionOnNode(renderer, action, lView, childTNode, renderParent, beforeNode);
37555
+ childTNode = childTNode.next;
37556
+ }
37557
+ }
37558
+ function executeActionOnNode(renderer, action, lView, tNode, renderParent, beforeNode) {
37559
+ var elementContainerRootTNodeType = tNode.type;
37560
+ if (elementContainerRootTNodeType === 4 /* ElementContainer */) {
37561
+ executeActionOnElementContainer(renderer, action, lView, tNode, renderParent, beforeNode);
37562
+ }
37563
+ else if (elementContainerRootTNodeType === 1 /* Projection */) {
37564
+ executeActionOnProjection(renderer, action, lView, tNode, renderParent, beforeNode);
37565
+ }
37566
+ else {
37567
+ ngDevMode && assertNodeOfPossibleTypes(tNode, 3 /* Element */, 0 /* Container */);
37568
+ executeActionOnElementOrContainer(action, renderer, renderParent, lView[tNode.index], beforeNode);
37569
+ }
37570
+ }
37603
37571
 
37604
37572
  /**
37605
37573
  * @license
@@ -38143,6 +38111,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
38143
38111
  return ComponentRef;
38144
38112
  }());
38145
38113
  /**
38114
+ * Base class for a factory that can create a component dynamically.
38115
+ * Instantiate a factory for a given type of component with `resolveComponentFactory()`.
38116
+ * Use the resulting `ComponentFactory.create()` method to create a component of that type.
38117
+ *
38118
+ * @see [Dynamic Components](guide/dynamic-component-loader)
38119
+ *
38146
38120
  * @publicApi
38147
38121
  */
38148
38122
  var ComponentFactory = /** @class */ (function () {
@@ -38173,6 +38147,12 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
38173
38147
  return _NullComponentFactoryResolver;
38174
38148
  }());
38175
38149
  /**
38150
+ * A simple registry that maps `Components` to generated `ComponentFactory` classes
38151
+ * that can be used to create instances of components.
38152
+ * Use to obtain the factory for a given component type,
38153
+ * then use the factory's `create()` method to create a component of that type.
38154
+ *
38155
+ * @see [Dynamic Components](guide/dynamic-component-loader)
38176
38156
  * @publicApi
38177
38157
  */
38178
38158
  var ComponentFactoryResolver = /** @class */ (function () {
@@ -38696,7 +38676,7 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
38696
38676
  /**
38697
38677
  * @publicApi
38698
38678
  */
38699
- var VERSION$2 = new Version$1('8.1.0-next.3');
38679
+ var VERSION$2 = new Version$1('8.1.2');
38700
38680
 
38701
38681
  /**
38702
38682
  * @license
@@ -41655,6 +41635,8 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
41655
41635
  var oldLView = enterView(rootLView, null);
41656
41636
  var component;
41657
41637
  var tElementNode;
41638
+ // Will become true if the `try` block executes with no errors.
41639
+ var safeToRunHooks = false;
41658
41640
  try {
41659
41641
  var componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, renderer);
41660
41642
  tElementNode = getTNode(0, rootLView);
@@ -41671,9 +41653,10 @@ define(['exports', 'path', 'typescript', 'fs'], function (exports, path, ts, fs)
41671
41653
  component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
41672
41654
  addToViewTree(rootLView, componentView);
41673
41655
  refreshDescendantViews(rootLView);
41656
+ safeToRunHooks = true;
41674
41657
  }
41675
41658
  finally {
41676
- leaveView(oldLView);
41659
+ leaveView(oldLView, safeToRunHooks);
41677
41660
  }
41678
41661
  var componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);
41679
41662
  if (isInternalRootView) {
@@ -43652,7 +43635,7 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
43652
43635
  * that create event emitters. When the title is clicked, the emitter
43653
43636
  * emits an open or close event to toggle the current visibility state.
43654
43637
  *
43655
- * ```
43638
+ * ```html
43656
43639
  * @Component({
43657
43640
  * selector: 'zippy',
43658
43641
  * template: `
@@ -43681,17 +43664,10 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
43681
43664
  * Access the event object with the `$event` argument passed to the output event
43682
43665
  * handler:
43683
43666
  *
43684
- * ```
43667
+ * ```html
43685
43668
  * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
43686
43669
  * ```
43687
43670
  *
43688
- * ### Notes
43689
- *
43690
- * Uses Rx.Observable but provides an adapter to make it work as specified here:
43691
- * https://github.com/jhusain/observable-spec
43692
- *
43693
- * Once a reference implementation of the spec is available, switch to it.
43694
- *
43695
43671
  * @publicApi
43696
43672
  */
43697
43673
  var EventEmitter = /** @class */ (function (_super) {
@@ -44008,9 +43984,10 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
44008
43984
  var HostBinding = makePropDecorator('HostBinding', ɵ8);
44009
43985
  var ɵ9 = function (eventName, args) { return ({ eventName: eventName, args: args }); };
44010
43986
  /**
44011
- * Binds a CSS event to a host listener and supplies configuration metadata.
43987
+ * Decorator that binds a DOM event to a host listener and supplies configuration metadata.
44012
43988
  * Angular invokes the supplied handler method when the host element emits the specified event,
44013
43989
  * and updates the bound element with the result.
43990
+ *
44014
43991
  * If the handler method returns false, applies `preventDefault` on the bound element.
44015
43992
  *
44016
43993
  * @usageNotes
@@ -44018,7 +43995,7 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
44018
43995
  * The following example declares a directive
44019
43996
  * that attaches a click listener to a button and counts clicks.
44020
43997
  *
44021
- * ```
43998
+ * ```ts
44022
43999
  * @Directive({selector: 'button[counting]'})
44023
44000
  * class CountClicks {
44024
44001
  * numberOfClicks = 0;
@@ -48662,7 +48639,6 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
48662
48639
  function createLanguageServiceFromTypescript(host, service) {
48663
48640
  var ngHost = new TypeScriptServiceHost(host, service);
48664
48641
  var ngServer = createLanguageService(ngHost);
48665
- ngHost.setSite(ngServer);
48666
48642
  return ngServer;
48667
48643
  }
48668
48644
  /**
@@ -48707,7 +48683,6 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
48707
48683
  this.modulesOutOfDate = true;
48708
48684
  this.fileVersions = new Map();
48709
48685
  }
48710
- TypeScriptServiceHost.prototype.setSite = function (service) { this.service = service; };
48711
48686
  Object.defineProperty(TypeScriptServiceHost.prototype, "resolver", {
48712
48687
  /**
48713
48688
  * Angular LanguageServiceHost implementation
@@ -48965,7 +48940,11 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
48965
48940
  },
48966
48941
  get query() {
48967
48942
  if (!queryCache) {
48968
- var pipes_1 = t.service.getPipesAt(fileName, node.getStart());
48943
+ var pipes_1 = [];
48944
+ var templateInfo = t.getTemplateAstAtPosition(fileName, node.getStart());
48945
+ if (templateInfo) {
48946
+ pipes_1 = templateInfo.pipes;
48947
+ }
48969
48948
  queryCache = getSymbolQuery(t.program, t.checker, sourceFile, function () { return getPipesTable(sourceFile, t.program, t.checker, pipes_1); });
48970
48949
  }
48971
48950
  return queryCache;
@@ -49220,9 +49199,98 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
49220
49199
  }
49221
49200
  return find(sourceFile);
49222
49201
  };
49202
+ TypeScriptServiceHost.prototype.getTemplateAstAtPosition = function (fileName, position) {
49203
+ var template = this.getTemplateAt(fileName, position);
49204
+ if (template) {
49205
+ var astResult = this.getTemplateAst(template, fileName);
49206
+ if (astResult && astResult.htmlAst && astResult.templateAst && astResult.directive &&
49207
+ astResult.directives && astResult.pipes && astResult.expressionParser)
49208
+ return {
49209
+ position: position,
49210
+ fileName: fileName,
49211
+ template: template,
49212
+ htmlAst: astResult.htmlAst,
49213
+ directive: astResult.directive,
49214
+ directives: astResult.directives,
49215
+ pipes: astResult.pipes,
49216
+ templateAst: astResult.templateAst,
49217
+ expressionParser: astResult.expressionParser
49218
+ };
49219
+ }
49220
+ return undefined;
49221
+ };
49222
+ TypeScriptServiceHost.prototype.getTemplateAst = function (template, contextFile) {
49223
+ var _this = this;
49224
+ var result = undefined;
49225
+ try {
49226
+ var resolvedMetadata = this.resolver.getNonNormalizedDirectiveMetadata(template.type);
49227
+ var metadata = resolvedMetadata && resolvedMetadata.metadata;
49228
+ if (metadata) {
49229
+ var rawHtmlParser = new HtmlParser();
49230
+ var htmlParser = new I18NHtmlParser(rawHtmlParser);
49231
+ var expressionParser = new Parser$1(new Lexer());
49232
+ var config = new CompilerConfig();
49233
+ var parser = new TemplateParser(config, this.resolver.getReflector(), expressionParser, new DomElementSchemaRegistry(), htmlParser, null, []);
49234
+ var htmlResult = htmlParser.parse(template.source, '', { tokenizeExpansionForms: true });
49235
+ var analyzedModules = this.getAnalyzedModules();
49236
+ var errors = undefined;
49237
+ var ngModule = analyzedModules.ngModuleByPipeOrDirective.get(template.type);
49238
+ if (!ngModule) {
49239
+ // Reported by the the declaration diagnostics.
49240
+ ngModule = findSuitableDefaultModule(analyzedModules);
49241
+ }
49242
+ if (ngModule) {
49243
+ var directives = ngModule.transitiveModule.directives
49244
+ .map(function (d) { return _this.resolver.getNonNormalizedDirectiveMetadata(d.reference); })
49245
+ .filter(function (d) { return d; })
49246
+ .map(function (d) { return d.metadata.toSummary(); });
49247
+ var pipes = ngModule.transitiveModule.pipes.map(function (p) { return _this.resolver.getOrLoadPipeMetadata(p.reference).toSummary(); });
49248
+ var schemas = ngModule.schemas;
49249
+ var parseResult = parser.tryParseHtml(htmlResult, metadata, directives, pipes, schemas);
49250
+ result = {
49251
+ htmlAst: htmlResult.rootNodes,
49252
+ templateAst: parseResult.templateAst,
49253
+ directive: metadata, directives: directives, pipes: pipes,
49254
+ parseErrors: parseResult.errors, expressionParser: expressionParser, errors: errors
49255
+ };
49256
+ }
49257
+ }
49258
+ }
49259
+ catch (e) {
49260
+ var span = template.span;
49261
+ if (e.fileName == contextFile) {
49262
+ span = template.query.getSpanAt(e.line, e.column) || span;
49263
+ }
49264
+ result = { errors: [{ kind: DiagnosticKind$1.Error, message: e.message, span: span }] };
49265
+ }
49266
+ return result || {};
49267
+ };
49223
49268
  TypeScriptServiceHost.missingTemplate = [undefined, undefined];
49224
49269
  return TypeScriptServiceHost;
49225
49270
  }());
49271
+ function findSuitableDefaultModule(modules) {
49272
+ var e_5, _a;
49273
+ var result = undefined;
49274
+ var resultSize = 0;
49275
+ try {
49276
+ for (var _b = __values(modules.ngModules), _c = _b.next(); !_c.done; _c = _b.next()) {
49277
+ var module_2 = _c.value;
49278
+ var moduleSize = module_2.transitiveModule.directives.length;
49279
+ if (moduleSize > resultSize) {
49280
+ result = module_2;
49281
+ resultSize = moduleSize;
49282
+ }
49283
+ }
49284
+ }
49285
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
49286
+ finally {
49287
+ try {
49288
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
49289
+ }
49290
+ finally { if (e_5) throw e_5.error; }
49291
+ }
49292
+ return result;
49293
+ }
49226
49294
  function findTsConfig(fileName) {
49227
49295
  var dir = path.dirname(fileName);
49228
49296
  while (fs.existsSync(dir)) {
@@ -49331,7 +49399,6 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
49331
49399
  }
49332
49400
  var serviceHost = new TypeScriptServiceHost(info.languageServiceHost, oldLS);
49333
49401
  var ls = createLanguageService(serviceHost);
49334
- serviceHost.setSite(ls);
49335
49402
  projectHostMap.set(info.project, serviceHost);
49336
49403
  proxy.getCompletionsAtPosition = function (fileName, position, options) {
49337
49404
  var base = oldLS.getCompletionsAtPosition(fileName, position, options) || {
@@ -49470,7 +49537,7 @@ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
49470
49537
  * Use of this source code is governed by an MIT-style license that can be
49471
49538
  * found in the LICENSE file at https://angular.io/license
49472
49539
  */
49473
- var VERSION$3 = new Version$1('8.1.0-next.3');
49540
+ var VERSION$3 = new Version$1('8.1.2');
49474
49541
 
49475
49542
  /**
49476
49543
  * @license