@angular/language-service 10.1.3 → 10.2.0

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 v10.1.3
2
+ * @license Angular v10.2.0
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -8004,11 +8004,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8004
8004
  function extractCommentsWithHash(input) {
8005
8005
  return input.match(_commentWithHashRe) || [];
8006
8006
  }
8007
- const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
8008
- const _curlyRe = /([{}])/g;
8009
- const OPEN_CURLY = '{';
8010
- const CLOSE_CURLY = '}';
8011
8007
  const BLOCK_PLACEHOLDER = '%BLOCK%';
8008
+ const QUOTE_PLACEHOLDER = '%QUOTED%';
8009
+ const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
8010
+ const _quotedRe = /%QUOTED%/g;
8011
+ const CONTENT_PAIRS = new Map([['{', '}']]);
8012
+ const QUOTE_PAIRS = new Map([[`"`, `"`], [`'`, `'`]]);
8012
8013
  class CssRule {
8013
8014
  constructor(selector, content) {
8014
8015
  this.selector = selector;
@@ -8016,9 +8017,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8016
8017
  }
8017
8018
  }
8018
8019
  function processRules(input, ruleCallback) {
8019
- const inputWithEscapedBlocks = escapeBlocks(input);
8020
+ const inputWithEscapedQuotes = escapeBlocks(input, QUOTE_PAIRS, QUOTE_PLACEHOLDER);
8021
+ const inputWithEscapedBlocks = escapeBlocks(inputWithEscapedQuotes.escapedString, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
8020
8022
  let nextBlockIndex = 0;
8021
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function (...m) {
8023
+ let nextQuoteIndex = 0;
8024
+ return inputWithEscapedBlocks.escapedString
8025
+ .replace(_ruleRe, (...m) => {
8022
8026
  const selector = m[2];
8023
8027
  let content = '';
8024
8028
  let suffix = m[4];
@@ -8030,7 +8034,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8030
8034
  }
8031
8035
  const rule = ruleCallback(new CssRule(selector, content));
8032
8036
  return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
8033
- });
8037
+ })
8038
+ .replace(_quotedRe, () => inputWithEscapedQuotes.blocks[nextQuoteIndex++]);
8034
8039
  }
8035
8040
  class StringWithEscapedBlocks {
8036
8041
  constructor(escapedString, blocks) {
@@ -8038,35 +8043,46 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8038
8043
  this.blocks = blocks;
8039
8044
  }
8040
8045
  }
8041
- function escapeBlocks(input) {
8042
- const inputParts = input.split(_curlyRe);
8046
+ function escapeBlocks(input, charPairs, placeholder) {
8043
8047
  const resultParts = [];
8044
8048
  const escapedBlocks = [];
8045
- let bracketCount = 0;
8046
- let currentBlockParts = [];
8047
- for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
8048
- const part = inputParts[partIndex];
8049
- if (part == CLOSE_CURLY) {
8050
- bracketCount--;
8051
- }
8052
- if (bracketCount > 0) {
8053
- currentBlockParts.push(part);
8049
+ let openCharCount = 0;
8050
+ let nonBlockStartIndex = 0;
8051
+ let blockStartIndex = -1;
8052
+ let openChar;
8053
+ let closeChar;
8054
+ for (let i = 0; i < input.length; i++) {
8055
+ const char = input[i];
8056
+ if (char === '\\') {
8057
+ i++;
8054
8058
  }
8055
- else {
8056
- if (currentBlockParts.length > 0) {
8057
- escapedBlocks.push(currentBlockParts.join(''));
8058
- resultParts.push(BLOCK_PLACEHOLDER);
8059
- currentBlockParts = [];
8059
+ else if (char === closeChar) {
8060
+ openCharCount--;
8061
+ if (openCharCount === 0) {
8062
+ escapedBlocks.push(input.substring(blockStartIndex, i));
8063
+ resultParts.push(placeholder);
8064
+ nonBlockStartIndex = i;
8065
+ blockStartIndex = -1;
8066
+ openChar = closeChar = undefined;
8060
8067
  }
8061
- resultParts.push(part);
8062
8068
  }
8063
- if (part == OPEN_CURLY) {
8064
- bracketCount++;
8069
+ else if (char === openChar) {
8070
+ openCharCount++;
8071
+ }
8072
+ else if (openCharCount === 0 && charPairs.has(char)) {
8073
+ openChar = char;
8074
+ closeChar = charPairs.get(char);
8075
+ openCharCount = 1;
8076
+ blockStartIndex = i + 1;
8077
+ resultParts.push(input.substring(nonBlockStartIndex, blockStartIndex));
8065
8078
  }
8066
8079
  }
8067
- if (currentBlockParts.length > 0) {
8068
- escapedBlocks.push(currentBlockParts.join(''));
8069
- resultParts.push(BLOCK_PLACEHOLDER);
8080
+ if (blockStartIndex !== -1) {
8081
+ escapedBlocks.push(input.substring(blockStartIndex));
8082
+ resultParts.push(placeholder);
8083
+ }
8084
+ else {
8085
+ resultParts.push(input.substring(nonBlockStartIndex));
8070
8086
  }
8071
8087
  return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
8072
8088
  }
@@ -12755,43 +12771,77 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12755
12771
  const span = new ParseSpan(0, input == null ? 0 : input.length);
12756
12772
  return new ASTWithSource(new Interpolation(span, span.toAbsolute(absoluteOffset), split.strings, expressions), input, location, absoluteOffset, this.errors);
12757
12773
  }
12774
+ /**
12775
+ * Splits a string of text into "raw" text segments and expressions present in interpolations in
12776
+ * the string.
12777
+ * Returns `null` if there are no interpolations, otherwise a
12778
+ * `SplitInterpolation` with splits that look like
12779
+ * <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
12780
+ */
12758
12781
  splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
12759
- const regexp = _getInterpolateRegExp(interpolationConfig);
12760
- const parts = input.split(regexp);
12761
- if (parts.length <= 1) {
12762
- return null;
12763
- }
12764
12782
  const strings = [];
12765
12783
  const expressions = [];
12766
12784
  const offsets = [];
12767
12785
  const stringSpans = [];
12768
12786
  const expressionSpans = [];
12769
- let offset = 0;
12770
- for (let i = 0; i < parts.length; i++) {
12771
- const part = parts[i];
12772
- if (i % 2 === 0) {
12773
- // fixed string
12787
+ let i = 0;
12788
+ let atInterpolation = false;
12789
+ let extendLastString = false;
12790
+ let { start: interpStart, end: interpEnd } = interpolationConfig;
12791
+ while (i < input.length) {
12792
+ if (!atInterpolation) {
12793
+ // parse until starting {{
12794
+ const start = i;
12795
+ i = input.indexOf(interpStart, i);
12796
+ if (i === -1) {
12797
+ i = input.length;
12798
+ }
12799
+ const part = input.substring(start, i);
12774
12800
  strings.push(part);
12775
- const start = offset;
12776
- offset += part.length;
12777
- stringSpans.push({ start, end: offset });
12778
- }
12779
- else if (part.trim().length > 0) {
12780
- const start = offset;
12781
- offset += interpolationConfig.start.length;
12782
- expressions.push(part);
12783
- offsets.push(offset);
12784
- offset += part.length + interpolationConfig.end.length;
12785
- expressionSpans.push({ start, end: offset });
12801
+ stringSpans.push({ start, end: i });
12802
+ atInterpolation = true;
12786
12803
  }
12787
12804
  else {
12788
- this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${this._findInterpolationErrorColumn(parts, i, interpolationConfig)} in`, location);
12789
- expressions.push('$implicit');
12790
- offsets.push(offset);
12791
- expressionSpans.push({ start: offset, end: offset });
12805
+ // parse from starting {{ to ending }}
12806
+ const fullStart = i;
12807
+ const exprStart = fullStart + interpStart.length;
12808
+ const exprEnd = input.indexOf(interpEnd, exprStart);
12809
+ if (exprEnd === -1) {
12810
+ // Could not find the end of the interpolation; do not parse an expression.
12811
+ // Instead we should extend the content on the last raw string.
12812
+ atInterpolation = false;
12813
+ extendLastString = true;
12814
+ break;
12815
+ }
12816
+ const fullEnd = exprEnd + interpEnd.length;
12817
+ const part = input.substring(exprStart, exprEnd);
12818
+ if (part.trim().length > 0) {
12819
+ expressions.push(part);
12820
+ }
12821
+ else {
12822
+ this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);
12823
+ expressions.push('$implicit');
12824
+ }
12825
+ offsets.push(exprStart);
12826
+ expressionSpans.push({ start: fullStart, end: fullEnd });
12827
+ i = fullEnd;
12828
+ atInterpolation = false;
12792
12829
  }
12793
12830
  }
12794
- return new SplitInterpolation(strings, stringSpans, expressions, expressionSpans, offsets);
12831
+ if (!atInterpolation) {
12832
+ // If we are now at a text section, add the remaining content as a raw string.
12833
+ if (extendLastString) {
12834
+ strings[strings.length - 1] += input.substring(i);
12835
+ stringSpans[stringSpans.length - 1].end = input.length;
12836
+ }
12837
+ else {
12838
+ strings.push(input.substring(i));
12839
+ stringSpans.push({ start: i, end: input.length });
12840
+ }
12841
+ }
12842
+ return expressions.length === 0 ?
12843
+ null :
12844
+ new SplitInterpolation(strings, stringSpans, expressions, expressionSpans, offsets);
12795
12845
  }
12796
12846
  wrapLiteralPrimitive(input, location, absoluteOffset) {
12797
12847
  const span = new ParseSpan(0, input == null ? 0 : input.length);
@@ -12840,6 +12890,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12840
12890
  this.simpleExpressionChecker = IvySimpleExpressionChecker; //
12841
12891
  }
12842
12892
  }
12893
+ /** Describes a stateful context an expression parser is in. */
12894
+ var ParseContextFlags;
12895
+ (function (ParseContextFlags) {
12896
+ ParseContextFlags[ParseContextFlags["None"] = 0] = "None";
12897
+ /**
12898
+ * A Writable context is one in which a value may be written to an lvalue.
12899
+ * For example, after we see a property access, we may expect a write to the
12900
+ * property via the "=" operator.
12901
+ * prop
12902
+ * ^ possible "=" after
12903
+ */
12904
+ ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
12905
+ })(ParseContextFlags || (ParseContextFlags = {}));
12843
12906
  class _ParseAST {
12844
12907
  constructor(input, location, absoluteOffset, tokens, inputLength, parseAction, errors, offset) {
12845
12908
  this.input = input;
@@ -12853,6 +12916,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12853
12916
  this.rparensExpected = 0;
12854
12917
  this.rbracketsExpected = 0;
12855
12918
  this.rbracesExpected = 0;
12919
+ this.context = ParseContextFlags.None;
12856
12920
  // Cache of expression start and input indeces to the absolute source span they map to, used to
12857
12921
  // prevent creating superfluous source spans in `sourceSpan`.
12858
12922
  // A serial of the expression start and input index is used for mapping because both are stateful
@@ -12913,6 +12977,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12913
12977
  advance() {
12914
12978
  this.index++;
12915
12979
  }
12980
+ /**
12981
+ * Executes a callback in the provided context.
12982
+ */
12983
+ withContext(context, cb) {
12984
+ this.context |= context;
12985
+ const ret = cb();
12986
+ this.context ^= context;
12987
+ return ret;
12988
+ }
12916
12989
  consumeOptionalCharacter(code) {
12917
12990
  if (this.next.isCharacter(code)) {
12918
12991
  this.advance();
@@ -12928,6 +13001,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12928
13001
  peekKeywordAs() {
12929
13002
  return this.next.isKeywordAs();
12930
13003
  }
13004
+ /**
13005
+ * Consumes an expected character, otherwise emits an error about the missing expected character
13006
+ * and skips over the token stream until reaching a recoverable point.
13007
+ *
13008
+ * See `this.error` and `this.skip` for more details.
13009
+ */
12931
13010
  expectCharacter(code) {
12932
13011
  if (this.consumeOptionalCharacter(code))
12933
13012
  return;
@@ -13163,17 +13242,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13163
13242
  result = this.parseAccessMemberOrMethodCall(result, true);
13164
13243
  }
13165
13244
  else if (this.consumeOptionalCharacter($LBRACKET)) {
13166
- this.rbracketsExpected++;
13167
- const key = this.parsePipe();
13168
- this.rbracketsExpected--;
13169
- this.expectCharacter($RBRACKET);
13170
- if (this.consumeOptionalOperator('=')) {
13171
- const value = this.parseConditional();
13172
- result = new KeyedWrite(this.span(resultStart), this.sourceSpan(resultStart), result, key, value);
13173
- }
13174
- else {
13175
- result = new KeyedRead(this.span(resultStart), this.sourceSpan(resultStart), result, key);
13176
- }
13245
+ this.withContext(ParseContextFlags.Writable, () => {
13246
+ this.rbracketsExpected++;
13247
+ const key = this.parsePipe();
13248
+ if (key instanceof EmptyExpr) {
13249
+ this.error(`Key access cannot be empty`);
13250
+ }
13251
+ this.rbracketsExpected--;
13252
+ this.expectCharacter($RBRACKET);
13253
+ if (this.consumeOptionalOperator('=')) {
13254
+ const value = this.parseConditional();
13255
+ result = new KeyedWrite(this.span(resultStart), this.sourceSpan(resultStart), result, key, value);
13256
+ }
13257
+ else {
13258
+ result =
13259
+ new KeyedRead(this.span(resultStart), this.sourceSpan(resultStart), result, key);
13260
+ }
13261
+ });
13177
13262
  }
13178
13263
  else if (this.consumeOptionalCharacter($LPAREN)) {
13179
13264
  this.rparensExpected++;
@@ -13512,6 +13597,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13512
13597
  consumeStatementTerminator() {
13513
13598
  this.consumeOptionalCharacter($SEMICOLON) || this.consumeOptionalCharacter($COMMA);
13514
13599
  }
13600
+ /**
13601
+ * Records an error and skips over the token stream until reaching a recoverable point. See
13602
+ * `this.skip` for more details on token skipping.
13603
+ */
13515
13604
  error(message, index = null) {
13516
13605
  this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
13517
13606
  this.skip();
@@ -13522,24 +13611,32 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13522
13611
  return (index < this.tokens.length) ? `at column ${this.tokens[index].index + 1} in` :
13523
13612
  `at the end of the expression`;
13524
13613
  }
13525
- // Error recovery should skip tokens until it encounters a recovery point. skip() treats
13526
- // the end of input and a ';' as unconditionally a recovery point. It also treats ')',
13527
- // '}' and ']' as conditional recovery points if one of calling productions is expecting
13528
- // one of these symbols. This allows skip() to recover from errors such as '(a.) + 1' allowing
13529
- // more of the AST to be retained (it doesn't skip any tokens as the ')' is retained because
13530
- // of the '(' begins an '(' <expr> ')' production). The recovery points of grouping symbols
13531
- // must be conditional as they must be skipped if none of the calling productions are not
13532
- // expecting the closing token else we will never make progress in the case of an
13533
- // extraneous group closing symbol (such as a stray ')'). This is not the case for ';' because
13534
- // parseChain() is always the root production and it expects a ';'.
13535
- // If a production expects one of these token it increments the corresponding nesting count,
13536
- // and then decrements it just prior to checking if the token is in the input.
13614
+ /**
13615
+ * Error recovery should skip tokens until it encounters a recovery point. skip() treats
13616
+ * the end of input and a ';' as unconditionally a recovery point. It also treats ')',
13617
+ * '}' and ']' as conditional recovery points if one of calling productions is expecting
13618
+ * one of these symbols. This allows skip() to recover from errors such as '(a.) + 1' allowing
13619
+ * more of the AST to be retained (it doesn't skip any tokens as the ')' is retained because
13620
+ * of the '(' begins an '(' <expr> ')' production). The recovery points of grouping symbols
13621
+ * must be conditional as they must be skipped if none of the calling productions are not
13622
+ * expecting the closing token else we will never make progress in the case of an
13623
+ * extraneous group closing symbol (such as a stray ')'). This is not the case for ';' because
13624
+ * parseChain() is always the root production and it expects a ';'.
13625
+ *
13626
+ * Furthermore, the presence of a stateful context can add more recovery points.
13627
+ * - in a `Writable` context, we are able to recover after seeing the `=` operator, which
13628
+ * signals the presence of an independent rvalue expression following the `=` operator.
13629
+ *
13630
+ * If a production expects one of these token it increments the corresponding nesting count,
13631
+ * and then decrements it just prior to checking if the token is in the input.
13632
+ */
13537
13633
  skip() {
13538
13634
  let n = this.next;
13539
13635
  while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) &&
13540
13636
  (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
13541
13637
  (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
13542
- (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) {
13638
+ (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET)) &&
13639
+ (!(this.context & ParseContextFlags.Writable) || !n.isOperator('='))) {
13543
13640
  if (this.next.isError()) {
13544
13641
  this.errors.push(new ParserError(this.next.toString(), this.input, this.locationText(), this.location));
13545
13642
  }
@@ -17863,7 +17960,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17863
17960
  * Use of this source code is governed by an MIT-style license that can be
17864
17961
  * found in the LICENSE file at https://angular.io/license
17865
17962
  */
17866
- const VERSION$1 = new Version('10.1.3');
17963
+ const VERSION$1 = new Version('10.2.0');
17867
17964
 
17868
17965
  /**
17869
17966
  * @license
@@ -26448,11 +26545,73 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26448
26545
  if (typeof ngDevMode !== 'object') {
26449
26546
  ngDevModeResetPerfCounters();
26450
26547
  }
26451
- return !!ngDevMode;
26548
+ return typeof ngDevMode !== 'undefined' && !!ngDevMode;
26452
26549
  }
26453
26550
  return false;
26454
26551
  }
26455
26552
 
26553
+ /**
26554
+ * @license
26555
+ * Copyright Google LLC All Rights Reserved.
26556
+ *
26557
+ * Use of this source code is governed by an MIT-style license that can be
26558
+ * found in the LICENSE file at https://angular.io/license
26559
+ */
26560
+ function assertNumber(actual, msg) {
26561
+ if (!(typeof actual === 'number')) {
26562
+ throwError(msg, typeof actual, 'number', '===');
26563
+ }
26564
+ }
26565
+ function assertString(actual, msg) {
26566
+ if (!(typeof actual === 'string')) {
26567
+ throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
26568
+ }
26569
+ }
26570
+ function assertEqual(actual, expected, msg) {
26571
+ if (!(actual == expected)) {
26572
+ throwError(msg, actual, expected, '==');
26573
+ }
26574
+ }
26575
+ function assertNotEqual(actual, expected, msg) {
26576
+ if (!(actual != expected)) {
26577
+ throwError(msg, actual, expected, '!=');
26578
+ }
26579
+ }
26580
+ function assertSame(actual, expected, msg) {
26581
+ if (!(actual === expected)) {
26582
+ throwError(msg, actual, expected, '===');
26583
+ }
26584
+ }
26585
+ function assertLessThan(actual, expected, msg) {
26586
+ if (!(actual < expected)) {
26587
+ throwError(msg, actual, expected, '<');
26588
+ }
26589
+ }
26590
+ function assertGreaterThan(actual, expected, msg) {
26591
+ if (!(actual > expected)) {
26592
+ throwError(msg, actual, expected, '>');
26593
+ }
26594
+ }
26595
+ function assertDefined(actual, msg) {
26596
+ if (actual == null) {
26597
+ throwError(msg, actual, null, '!=');
26598
+ }
26599
+ }
26600
+ function throwError(msg, actual, expected, comparison) {
26601
+ throw new Error(`ASSERTION ERROR: ${msg}` +
26602
+ (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
26603
+ }
26604
+ function assertDomNode(node) {
26605
+ // If we're in a worker, `Node` will not be defined.
26606
+ assertEqual((typeof Node !== 'undefined' && node instanceof Node) ||
26607
+ (typeof node === 'object' && node != null &&
26608
+ node.constructor.name === 'WebWorkerRenderNode'), true, `The provided value must be an instance of a DOM Node but got ${stringify$1(node)}`);
26609
+ }
26610
+ function assertIndexInRange(arr, index) {
26611
+ const maxLen = arr ? arr.length : 0;
26612
+ assertLessThan(index, maxLen, `Index expected to be less than ${maxLen} but got ${index}`);
26613
+ }
26614
+
26456
26615
  /**
26457
26616
  * @license
26458
26617
  * Copyright Google LLC All Rights Reserved.
@@ -26709,68 +26868,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26709
26868
  class NgModuleRef {
26710
26869
  }
26711
26870
 
26712
- /**
26713
- * @license
26714
- * Copyright Google LLC All Rights Reserved.
26715
- *
26716
- * Use of this source code is governed by an MIT-style license that can be
26717
- * found in the LICENSE file at https://angular.io/license
26718
- */
26719
- function assertNumber(actual, msg) {
26720
- if (!(typeof actual === 'number')) {
26721
- throwError(msg, typeof actual, 'number', '===');
26722
- }
26723
- }
26724
- function assertString(actual, msg) {
26725
- if (!(typeof actual === 'string')) {
26726
- throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
26727
- }
26728
- }
26729
- function assertEqual(actual, expected, msg) {
26730
- if (!(actual == expected)) {
26731
- throwError(msg, actual, expected, '==');
26732
- }
26733
- }
26734
- function assertNotEqual(actual, expected, msg) {
26735
- if (!(actual != expected)) {
26736
- throwError(msg, actual, expected, '!=');
26737
- }
26738
- }
26739
- function assertSame(actual, expected, msg) {
26740
- if (!(actual === expected)) {
26741
- throwError(msg, actual, expected, '===');
26742
- }
26743
- }
26744
- function assertLessThan(actual, expected, msg) {
26745
- if (!(actual < expected)) {
26746
- throwError(msg, actual, expected, '<');
26747
- }
26748
- }
26749
- function assertGreaterThan(actual, expected, msg) {
26750
- if (!(actual > expected)) {
26751
- throwError(msg, actual, expected, '>');
26752
- }
26753
- }
26754
- function assertDefined(actual, msg) {
26755
- if (actual == null) {
26756
- throwError(msg, actual, null, '!=');
26757
- }
26758
- }
26759
- function throwError(msg, actual, expected, comparison) {
26760
- throw new Error(`ASSERTION ERROR: ${msg}` +
26761
- (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
26762
- }
26763
- function assertDomNode(node) {
26764
- // If we're in a worker, `Node` will not be defined.
26765
- assertEqual((typeof Node !== 'undefined' && node instanceof Node) ||
26766
- (typeof node === 'object' && node != null &&
26767
- node.constructor.name === 'WebWorkerRenderNode'), true, `The provided value must be an instance of a DOM Node but got ${stringify$1(node)}`);
26768
- }
26769
- function assertIndexInRange(arr, index) {
26770
- const maxLen = arr ? arr.length : 0;
26771
- assertLessThan(index, maxLen, `Index expected to be less than ${maxLen} but got ${index}`);
26772
- }
26773
-
26774
26871
  /**
26775
26872
  * @license
26776
26873
  * Copyright Google LLC All Rights Reserved.
@@ -26980,6 +27077,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26980
27077
  const SANITIZER = 12;
26981
27078
  const CHILD_HEAD = 13;
26982
27079
  const CHILD_TAIL = 14;
27080
+ // FIXME(misko): Investigate if the three declarations aren't all same thing.
26983
27081
  const DECLARATION_VIEW = 15;
26984
27082
  const DECLARATION_COMPONENT_VIEW = 16;
26985
27083
  const DECLARATION_LCONTAINER = 17;
@@ -26987,6 +27085,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26987
27085
  const QUERIES = 19;
26988
27086
  /** Size of LView's header. Necessary to adjust for it when setting slots. */
26989
27087
  const HEADER_OFFSET = 20;
27088
+ /**
27089
+ * Converts `TViewType` into human readable text.
27090
+ * Make sure this matches with `TViewType`
27091
+ */
27092
+ const TViewTypeAsString = [
27093
+ 'Root',
27094
+ 'Component',
27095
+ 'Embedded',
27096
+ ];
26990
27097
 
26991
27098
  /**
26992
27099
  * @license
@@ -27070,8 +27177,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27070
27177
  // [Assert functions do not constraint type when they are guarded by a truthy
27071
27178
  // expression.](https://github.com/microsoft/TypeScript/issues/37295)
27072
27179
  function assertTNodeForLView(tNode, lView) {
27180
+ assertTNodeForTView(tNode, lView[TVIEW]);
27181
+ }
27182
+ function assertTNodeForTView(tNode, tView) {
27183
+ assertDefined(tNode, 'TNode must be defined');
27073
27184
  tNode.hasOwnProperty('tView_') &&
27074
- assertEqual(tNode.tView_, lView[TVIEW], 'This TNode does not belong to this LView.');
27185
+ assertEqual(tNode.tView_, tView, 'This TNode does not belong to this TView.');
27075
27186
  }
27076
27187
  function assertComponentType(actual, msg = 'Type passed in is not ComponentType, it does not have \'ɵcmp\' property.') {
27077
27188
  if (!getComponentDef(actual)) {
@@ -27101,6 +27212,35 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27101
27212
  throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
27102
27213
  }
27103
27214
  }
27215
+ function assertIndexInExpandoRange(lView, index) {
27216
+ const tView = lView[1];
27217
+ assertBetween(tView.expandoStartIndex, lView.length, index);
27218
+ }
27219
+ function assertBetween(lower, upper, index) {
27220
+ if (!(lower <= index && index < upper)) {
27221
+ throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
27222
+ }
27223
+ }
27224
+ /**
27225
+ * This is a basic sanity check that the `injectorIndex` seems to point to what looks like a
27226
+ * NodeInjector data structure.
27227
+ *
27228
+ * @param lView `LView` which should be checked.
27229
+ * @param injectorIndex index into the `LView` where the `NodeInjector` is expected.
27230
+ */
27231
+ function assertNodeInjector(lView, injectorIndex) {
27232
+ assertIndexInExpandoRange(lView, injectorIndex);
27233
+ assertIndexInExpandoRange(lView, injectorIndex + 8 /* PARENT */);
27234
+ assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');
27235
+ assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');
27236
+ assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');
27237
+ assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');
27238
+ assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');
27239
+ assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');
27240
+ assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');
27241
+ assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');
27242
+ assertNumber(lView[injectorIndex + 8 /* PARENT */], 'injectorIndex should point to parent injector');
27243
+ }
27104
27244
 
27105
27245
  /**
27106
27246
  * @license
@@ -27388,7 +27528,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27388
27528
  const instructionState = {
27389
27529
  lFrame: createLFrame(null),
27390
27530
  bindingsEnabled: true,
27391
- checkNoChangesMode: false,
27531
+ isInCheckNoChangesMode: false,
27392
27532
  };
27393
27533
  /**
27394
27534
  * Return the current `TView`.
@@ -27396,22 +27536,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27396
27536
  function getTView() {
27397
27537
  return instructionState.lFrame.tView;
27398
27538
  }
27399
- function getPreviousOrParentTNode() {
27400
- return instructionState.lFrame.previousOrParentTNode;
27539
+ function getCurrentTNode() {
27540
+ return instructionState.lFrame.currentTNode;
27401
27541
  }
27402
- function setPreviousOrParentTNode(tNode, isParent) {
27403
- instructionState.lFrame.previousOrParentTNode = tNode;
27542
+ function setCurrentTNode(tNode, isParent) {
27543
+ ngDevMode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
27544
+ instructionState.lFrame.currentTNode = tNode;
27404
27545
  instructionState.lFrame.isParent = isParent;
27405
27546
  }
27406
- function getIsParent() {
27547
+ function isCurrentTNodeParent() {
27407
27548
  return instructionState.lFrame.isParent;
27408
27549
  }
27409
- function getCheckNoChangesMode() {
27550
+ function isInCheckNoChangesMode() {
27410
27551
  // TODO(misko): remove this from the LView since it is ngDevMode=true mode only.
27411
- return instructionState.checkNoChangesMode;
27552
+ return instructionState.isInCheckNoChangesMode;
27412
27553
  }
27413
- function setCheckNoChangesMode(mode) {
27414
- instructionState.checkNoChangesMode = mode;
27554
+ function setIsInCheckNoChangesMode(mode) {
27555
+ instructionState.isInCheckNoChangesMode = mode;
27415
27556
  }
27416
27557
  function setBindingIndex(value) {
27417
27558
  return instructionState.lFrame.bindingIndex = value;
@@ -27452,7 +27593,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27452
27593
  ngDevMode && assertLViewOrUndefined(newView);
27453
27594
  const newLFrame = allocLFrame();
27454
27595
  instructionState.lFrame = newLFrame;
27455
- newLFrame.previousOrParentTNode = tNode;
27596
+ newLFrame.currentTNode = tNode;
27456
27597
  newLFrame.lView = newView;
27457
27598
  }
27458
27599
  /**
@@ -27464,10 +27605,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27464
27605
  * exited the state has to be restored
27465
27606
  *
27466
27607
  * @param newView New lView to become active
27467
- * @param tNode Element to which the View is a child of
27468
27608
  * @returns the previously active lView;
27469
27609
  */
27470
- function enterView(newView, tNode) {
27610
+ function enterView(newView) {
27471
27611
  ngDevMode && assertLViewOrUndefined(newView);
27472
27612
  const newLFrame = allocLFrame();
27473
27613
  if (ngDevMode) {
@@ -27483,7 +27623,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27483
27623
  }
27484
27624
  const tView = newView[TVIEW];
27485
27625
  instructionState.lFrame = newLFrame;
27486
- newLFrame.previousOrParentTNode = tNode;
27626
+ ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
27627
+ newLFrame.currentTNode = tView.firstChild;
27487
27628
  newLFrame.lView = newView;
27488
27629
  newLFrame.tView = tView;
27489
27630
  newLFrame.contextLView = newView;
@@ -27500,7 +27641,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27500
27641
  }
27501
27642
  function createLFrame(parent) {
27502
27643
  const lFrame = {
27503
- previousOrParentTNode: null,
27644
+ currentTNode: null,
27504
27645
  isParent: true,
27505
27646
  lView: null,
27506
27647
  tView: null,
@@ -27521,7 +27662,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27521
27662
  /**
27522
27663
  * A lightweight version of leave which is used with DI.
27523
27664
  *
27524
- * This function only resets `previousOrParentTNode` and `LView` as those are the only properties
27665
+ * This function only resets `currentTNode` and `LView` as those are the only properties
27525
27666
  * used with DI (`enterDI()`).
27526
27667
  *
27527
27668
  * NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where
@@ -27530,7 +27671,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27530
27671
  function leaveViewLight() {
27531
27672
  const oldLFrame = instructionState.lFrame;
27532
27673
  instructionState.lFrame = oldLFrame.parent;
27533
- oldLFrame.previousOrParentTNode = null;
27674
+ oldLFrame.currentTNode = null;
27534
27675
  oldLFrame.lView = null;
27535
27676
  return oldLFrame;
27536
27677
  }
@@ -27747,7 +27888,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27747
27888
  */
27748
27889
  function callHooks(currentView, arr, initPhase, currentNodeIndex) {
27749
27890
  ngDevMode &&
27750
- assertEqual(getCheckNoChangesMode(), false, 'Hooks should never be run in the check no changes mode.');
27891
+ assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');
27751
27892
  const startIndex = currentNodeIndex !== undefined ?
27752
27893
  (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :
27753
27894
  0;
@@ -27811,9 +27952,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27811
27952
  * Use of this source code is governed by an MIT-style license that can be
27812
27953
  * found in the LICENSE file at https://angular.io/license
27813
27954
  */
27814
- const TNODE = 8;
27815
- const PARENT_INJECTOR = 8;
27816
- const INJECTOR_BLOOM_PARENT_SIZE = 9;
27817
27955
  const NO_PARENT_INJECTOR = -1;
27818
27956
  /**
27819
27957
  * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in
@@ -27925,6 +28063,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27925
28063
  * Recursive loop causes an error to be displayed.
27926
28064
  */
27927
28065
  this.resolving = false;
28066
+ ngDevMode && assertDefined(factory, 'Factory not specified');
28067
+ ngDevMode && assertEqual(typeof factory, 'function', 'Expected factory function.');
27928
28068
  this.canSeeViewProviders = isViewProvider;
27929
28069
  this.injectImpl = injectImplementation;
27930
28070
  }
@@ -27933,6 +28073,18 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27933
28073
  return obj instanceof NodeInjectorFactory;
27934
28074
  }
27935
28075
 
28076
+ /**
28077
+ * Converts `TNodeType` into human readable text.
28078
+ * Make sure this matches with `TNodeType`
28079
+ */
28080
+ const TNodeTypeAsString = [
28081
+ 'Container',
28082
+ 'Projection',
28083
+ 'Element',
28084
+ 'ElementContainer',
28085
+ 'IcuContainer' // 4
28086
+ ];
28087
+
27936
28088
  /**
27937
28089
  * @license
27938
28090
  * Copyright Google LLC All Rights Reserved.
@@ -27940,29 +28092,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27940
28092
  * Use of this source code is governed by an MIT-style license that can be
27941
28093
  * found in the LICENSE file at https://angular.io/license
27942
28094
  */
27943
- function assertNodeType(tNode, type) {
27944
- assertDefined(tNode, 'should be called with a TNode');
27945
- assertEqual(tNode.type, type, `should be a ${typeName(type)}`);
27946
- }
27947
28095
  function assertNodeOfPossibleTypes(tNode, types, message) {
27948
28096
  assertDefined(tNode, 'should be called with a TNode');
27949
28097
  const found = types.some(type => tNode.type === type);
27950
28098
  assertEqual(found, true, message !== null && message !== void 0 ? message : `Should be one of ${types.map(typeName).join(', ')} but got ${typeName(tNode.type)}`);
27951
28099
  }
27952
28100
  function typeName(type) {
27953
- if (type == 1 /* Projection */)
27954
- return 'Projection';
27955
- if (type == 0 /* Container */)
27956
- return 'Container';
27957
- if (type == 5 /* IcuContainer */)
27958
- return 'IcuContainer';
27959
- if (type == 2 /* View */)
27960
- return 'View';
27961
- if (type == 3 /* Element */)
27962
- return 'Element';
27963
- if (type == 4 /* ElementContainer */)
27964
- return 'ElementContainer';
27965
- return '<unknown>';
28101
+ return TNodeTypeAsString[type] || '<unknown>';
27966
28102
  }
27967
28103
 
27968
28104
  /**
@@ -28058,6 +28194,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28058
28194
  return parentLocation !== NO_PARENT_INJECTOR;
28059
28195
  }
28060
28196
  function getParentInjectorIndex(parentLocation) {
28197
+ ngDevMode && assertNumber(parentLocation, 'Number expected');
28198
+ ngDevMode && assertNotEqual(parentLocation, -1, 'Not a valid state.');
28199
+ const parentInjectorIndex = parentLocation & 32767 /* InjectorIndexMask */;
28200
+ ngDevMode &&
28201
+ assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, 'Parent injector must be pointing past HEADER_OFFSET.');
28061
28202
  return parentLocation & 32767 /* InjectorIndexMask */;
28062
28203
  }
28063
28204
  function getParentInjectorViewOffset(parentLocation) {
@@ -28231,52 +28372,53 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28231
28372
  * Creates (or gets an existing) injector for a given element or container.
28232
28373
  *
28233
28374
  * @param tNode for which an injector should be retrieved / created.
28234
- * @param hostView View where the node is stored
28375
+ * @param lView View where the node is stored
28235
28376
  * @returns Node injector
28236
28377
  */
28237
- function getOrCreateNodeInjectorForNode(tNode, hostView) {
28238
- const existingInjectorIndex = getInjectorIndex(tNode, hostView);
28378
+ function getOrCreateNodeInjectorForNode(tNode, lView) {
28379
+ const existingInjectorIndex = getInjectorIndex(tNode, lView);
28239
28380
  if (existingInjectorIndex !== -1) {
28240
28381
  return existingInjectorIndex;
28241
28382
  }
28242
- const tView = hostView[TVIEW];
28383
+ const tView = lView[TVIEW];
28243
28384
  if (tView.firstCreatePass) {
28244
- tNode.injectorIndex = hostView.length;
28385
+ tNode.injectorIndex = lView.length;
28245
28386
  insertBloom(tView.data, tNode); // foundation for node bloom
28246
- insertBloom(hostView, null); // foundation for cumulative bloom
28387
+ insertBloom(lView, null); // foundation for cumulative bloom
28247
28388
  insertBloom(tView.blueprint, null);
28248
28389
  }
28249
- const parentLoc = getParentInjectorLocation(tNode, hostView);
28390
+ const parentLoc = getParentInjectorLocation(tNode, lView);
28250
28391
  const injectorIndex = tNode.injectorIndex;
28251
28392
  // If a parent injector can't be found, its location is set to -1.
28252
28393
  // In that case, we don't need to set up a cumulative bloom
28253
28394
  if (hasParentInjector(parentLoc)) {
28254
28395
  const parentIndex = getParentInjectorIndex(parentLoc);
28255
- const parentLView = getParentInjectorView(parentLoc, hostView);
28396
+ const parentLView = getParentInjectorView(parentLoc, lView);
28256
28397
  const parentData = parentLView[TVIEW].data;
28257
28398
  // Creates a cumulative bloom filter that merges the parent's bloom filter
28258
28399
  // and its own cumulative bloom (which contains tokens for all ancestors)
28259
- for (let i = 0; i < 8; i++) {
28260
- hostView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
28400
+ for (let i = 0; i < 8 /* BLOOM_SIZE */; i++) {
28401
+ lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];
28261
28402
  }
28262
28403
  }
28263
- hostView[injectorIndex + PARENT_INJECTOR] = parentLoc;
28404
+ lView[injectorIndex + 8 /* PARENT */] = parentLoc;
28264
28405
  return injectorIndex;
28265
28406
  }
28266
28407
  function insertBloom(arr, footer) {
28267
28408
  arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);
28268
28409
  }
28269
- function getInjectorIndex(tNode, hostView) {
28410
+ function getInjectorIndex(tNode, lView) {
28270
28411
  if (tNode.injectorIndex === -1 ||
28271
28412
  // If the injector index is the same as its parent's injector index, then the index has been
28272
28413
  // copied down from the parent node. No injector has been created yet on this node.
28273
28414
  (tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex) ||
28274
28415
  // After the first template pass, the injector index might exist but the parent values
28275
28416
  // might not have been calculated yet for this instance
28276
- hostView[tNode.injectorIndex + PARENT_INJECTOR] == null) {
28417
+ lView[tNode.injectorIndex + 8 /* PARENT */] === null) {
28277
28418
  return -1;
28278
28419
  }
28279
28420
  else {
28421
+ ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);
28280
28422
  return tNode.injectorIndex;
28281
28423
  }
28282
28424
  }
@@ -28284,25 +28426,57 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28284
28426
  * Finds the index of the parent injector, with a view offset if applicable. Used to set the
28285
28427
  * parent injector initially.
28286
28428
  *
28287
- * Returns a combination of number of `ViewData` we have to go up and index in that `Viewdata`
28429
+ * @returns Returns a number that is the combination of the number of LViews that we have to go up
28430
+ * to find the LView containing the parent inject AND the index of the injector within that LView.
28288
28431
  */
28289
- function getParentInjectorLocation(tNode, view) {
28432
+ function getParentInjectorLocation(tNode, lView) {
28290
28433
  if (tNode.parent && tNode.parent.injectorIndex !== -1) {
28434
+ // If we have a parent `TNode` and there is an injector associated with it we are done, because
28435
+ // the parent injector is within the current `LView`.
28291
28436
  return tNode.parent.injectorIndex; // ViewOffset is 0
28292
28437
  }
28293
- // For most cases, the parent injector index can be found on the host node (e.g. for component
28294
- // or container), so this loop will be skipped, but we must keep the loop here to support
28295
- // the rarer case of deeply nested <ng-template> tags or inline views.
28296
- let hostTNode = view[T_HOST];
28297
- let viewOffset = 1;
28298
- while (hostTNode && hostTNode.injectorIndex === -1) {
28299
- view = view[DECLARATION_VIEW];
28300
- hostTNode = view ? view[T_HOST] : null;
28301
- viewOffset++;
28438
+ // When parent injector location is computed it may be outside of the current view. (ie it could
28439
+ // be pointing to a declared parent location). This variable stores number of declaration parents
28440
+ // we need to walk up in order to find the parent injector location.
28441
+ let declarationViewOffset = 0;
28442
+ let parentTNode = null;
28443
+ let lViewCursor = lView;
28444
+ // The parent injector is not in the current `LView`. We will have to walk the declared parent
28445
+ // `LView` hierarchy and look for it. If we walk of the top, that means that there is no parent
28446
+ // `NodeInjector`.
28447
+ while (lViewCursor !== null) {
28448
+ // First determine the `parentTNode` location. The parent pointer differs based on `TView.type`.
28449
+ const tView = lViewCursor[TVIEW];
28450
+ const tViewType = tView.type;
28451
+ if (tViewType === 2 /* Embedded */) {
28452
+ ngDevMode &&
28453
+ assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
28454
+ parentTNode = tView.declTNode;
28455
+ }
28456
+ else if (tViewType === 1 /* Component */) {
28457
+ // Components don't have `TView.declTNode` because each instance of component could be
28458
+ // inserted in different location, hence `TView.declTNode` is meaningless.
28459
+ parentTNode = lViewCursor[T_HOST];
28460
+ }
28461
+ else {
28462
+ ngDevMode && assertEqual(tView.type, 0 /* Root */, 'Root type expected');
28463
+ parentTNode = null;
28464
+ }
28465
+ if (parentTNode === null) {
28466
+ // If we have no parent, than we are done.
28467
+ return NO_PARENT_INJECTOR;
28468
+ }
28469
+ ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);
28470
+ // Every iteration of the loop requires that we go to the declared parent.
28471
+ declarationViewOffset++;
28472
+ lViewCursor = lViewCursor[DECLARATION_VIEW];
28473
+ if (parentTNode.injectorIndex !== -1) {
28474
+ // We found a NodeInjector which points to something.
28475
+ return (parentTNode.injectorIndex |
28476
+ (declarationViewOffset << 16 /* ViewOffsetShift */));
28477
+ }
28302
28478
  }
28303
- return hostTNode ?
28304
- hostTNode.injectorIndex | (viewOffset << 16 /* ViewOffsetShift */) :
28305
- -1;
28479
+ return NO_PARENT_INJECTOR;
28306
28480
  }
28307
28481
  /**
28308
28482
  * Makes a type or an injection token public to the DI system by adding it to an
@@ -28365,12 +28539,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28365
28539
  let parentLocation = NO_PARENT_INJECTOR;
28366
28540
  let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
28367
28541
  // If we should skip this injector, or if there is no injector on this node, start by
28368
- // searching
28369
- // the parent injector.
28542
+ // searching the parent injector.
28370
28543
  if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
28371
28544
  parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) :
28372
- lView[injectorIndex + PARENT_INJECTOR];
28373
- if (!shouldSearchParent(flags, false)) {
28545
+ lView[injectorIndex + 8 /* PARENT */];
28546
+ if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {
28374
28547
  injectorIndex = -1;
28375
28548
  }
28376
28549
  else {
@@ -28382,9 +28555,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28382
28555
  // Traverse up the injector tree until we find a potential match or until we know there
28383
28556
  // *isn't* a match.
28384
28557
  while (injectorIndex !== -1) {
28385
- parentLocation = lView[injectorIndex + PARENT_INJECTOR];
28558
+ ngDevMode && assertNodeInjector(lView, injectorIndex);
28386
28559
  // Check the current injector. If it matches, see if it contains token.
28387
28560
  const tView = lView[TVIEW];
28561
+ ngDevMode &&
28562
+ assertTNodeForLView(tView.data[injectorIndex + 8 /* TNODE */], lView);
28388
28563
  if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
28389
28564
  // At this point, we have an injector which *may* contain the token, so we step through
28390
28565
  // the providers and directives associated with the injector's corresponding node to get
@@ -28394,7 +28569,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28394
28569
  return instance;
28395
28570
  }
28396
28571
  }
28397
- if (shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + TNODE] === hostTElementNode) &&
28572
+ parentLocation = lView[injectorIndex + 8 /* PARENT */];
28573
+ if (parentLocation !== NO_PARENT_INJECTOR &&
28574
+ shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + 8 /* TNODE */] === hostTElementNode) &&
28398
28575
  bloomHasToken(bloomHash, injectorIndex, lView)) {
28399
28576
  // The def wasn't found anywhere on this node, so it was a false positive.
28400
28577
  // Traverse up the tree and continue searching.
@@ -28443,9 +28620,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28443
28620
  const NOT_FOUND = {};
28444
28621
  function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
28445
28622
  const currentTView = lView[TVIEW];
28446
- const tNode = currentTView.data[injectorIndex + TNODE];
28623
+ const tNode = currentTView.data[injectorIndex + 8 /* TNODE */];
28447
28624
  // First, we need to determine if view providers can be accessed by the starting element.
28448
- // There are two possibities
28625
+ // There are two possibilities
28449
28626
  const canAccessViewProviders = previousTView == null ?
28450
28627
  // 1) This is the first invocation `previousTView == null` which means that we are at the
28451
28628
  // `TNode` of where injector is starting to look. In such a case the only time we are allowed
@@ -28461,7 +28638,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28461
28638
  // - AND the parent TNode is an Element.
28462
28639
  // This means that we just came from the Component's View and therefore are allowed to see
28463
28640
  // into the ViewProviders.
28464
- (previousTView != currentTView && (tNode.type === 3 /* Element */));
28641
+ (previousTView != currentTView && (tNode.type === 2 /* Element */));
28465
28642
  // This special case happens when there is a @host on the inject and when we are searching
28466
28643
  // on the host element node.
28467
28644
  const isHostSpecialCase = (flags & InjectFlags.Host) && hostTElementNode === tNode;
@@ -28525,10 +28702,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28525
28702
  }
28526
28703
  const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
28527
28704
  factory.resolving = true;
28528
- let previousInjectImplementation;
28529
- if (factory.injectImpl) {
28530
- previousInjectImplementation = setInjectImplementation(factory.injectImpl);
28531
- }
28705
+ const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;
28532
28706
  enterDI(lView, tNode);
28533
28707
  try {
28534
28708
  value = lView[index] = factory.factory(undefined, tData, lView, tNode);
@@ -28544,7 +28718,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28544
28718
  }
28545
28719
  }
28546
28720
  finally {
28547
- if (factory.injectImpl)
28721
+ previousInjectImplementation !== null &&
28548
28722
  setInjectImplementation(previousInjectImplementation);
28549
28723
  setIncludeViewProviders(previousIncludeViewProviders);
28550
28724
  factory.resolving = false;
@@ -28900,19 +29074,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28900
29074
  target[MONKEY_PATCH_KEY_NAME] = data;
28901
29075
  }
28902
29076
 
28903
- /**
28904
- * Converts `TNodeType` into human readable text.
28905
- * Make sure this matches with `TNodeType`
28906
- */
28907
- const TNodeTypeAsString = [
28908
- 'Container',
28909
- 'Projection',
28910
- 'View',
28911
- 'Element',
28912
- 'ElementContainer',
28913
- 'IcuContainer' // 5
28914
- ];
28915
-
28916
29077
  /**
28917
29078
  * @license
28918
29079
  * Copyright Google LLC All Rights Reserved.
@@ -29255,12 +29416,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29255
29416
  */
29256
29417
  const TViewConstructor = class TView {
29257
29418
  constructor(type, //
29258
- id, //
29259
29419
  blueprint, //
29260
29420
  template, //
29261
29421
  queries, //
29262
29422
  viewQuery, //
29263
- node, //
29423
+ declTNode, //
29264
29424
  data, //
29265
29425
  bindingStartIndex, //
29266
29426
  expandoStartIndex, //
@@ -29288,12 +29448,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29288
29448
  _decls, //
29289
29449
  _vars) {
29290
29450
  this.type = type;
29291
- this.id = id;
29292
29451
  this.blueprint = blueprint;
29293
29452
  this.template = template;
29294
29453
  this.queries = queries;
29295
29454
  this.viewQuery = viewQuery;
29296
- this.node = node;
29455
+ this.declTNode = declTNode;
29297
29456
  this.data = data;
29298
29457
  this.bindingStartIndex = bindingStartIndex;
29299
29458
  this.expandoStartIndex = expandoStartIndex;
@@ -29326,6 +29485,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29326
29485
  processTNodeChildren(this.firstChild, buf);
29327
29486
  return buf.join('');
29328
29487
  }
29488
+ get type_() {
29489
+ return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`;
29490
+ }
29491
+ get i18nStartIndex() {
29492
+ return HEADER_OFFSET + this._decls + this._vars;
29493
+ }
29329
29494
  };
29330
29495
  class TNode {
29331
29496
  constructor(tView_, //
@@ -29391,23 +29556,39 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29391
29556
  this.classBindings = classBindings;
29392
29557
  this.styleBindings = styleBindings;
29393
29558
  }
29394
- get type_() {
29395
- switch (this.type) {
29396
- case 0 /* Container */:
29397
- return 'TNodeType.Container';
29398
- case 3 /* Element */:
29399
- return 'TNodeType.Element';
29400
- case 4 /* ElementContainer */:
29401
- return 'TNodeType.ElementContainer';
29402
- case 5 /* IcuContainer */:
29403
- return 'TNodeType.IcuContainer';
29404
- case 1 /* Projection */:
29405
- return 'TNodeType.Projection';
29406
- case 2 /* View */:
29407
- return 'TNodeType.View';
29408
- default:
29409
- return 'TNodeType.???';
29559
+ /**
29560
+ * Return a human debug version of the set of `NodeInjector`s which will be consulted when
29561
+ * resolving tokens from this `TNode`.
29562
+ *
29563
+ * When debugging applications, it is often difficult to determine which `NodeInjector`s will be
29564
+ * consulted. This method shows a list of `DebugNode`s representing the `TNode`s which will be
29565
+ * consulted in order when resolving a token starting at this `TNode`.
29566
+ *
29567
+ * The original data is stored in `LView` and `TView` with a lot of offset indexes, and so it is
29568
+ * difficult to reason about.
29569
+ *
29570
+ * @param lView The `LView` instance for this `TNode`.
29571
+ */
29572
+ debugNodeInjectorPath(lView) {
29573
+ const path = [];
29574
+ let injectorIndex = getInjectorIndex(this, lView);
29575
+ ngDevMode && assertNodeInjector(lView, injectorIndex);
29576
+ while (injectorIndex !== -1) {
29577
+ const tNode = lView[TVIEW].data[injectorIndex + 8 /* TNODE */];
29578
+ path.push(buildDebugNode(tNode, lView));
29579
+ const parentLocation = lView[injectorIndex + 8 /* PARENT */];
29580
+ if (parentLocation === NO_PARENT_INJECTOR) {
29581
+ injectorIndex = -1;
29582
+ }
29583
+ else {
29584
+ injectorIndex = getParentInjectorIndex(parentLocation);
29585
+ lView = getParentInjectorView(parentLocation, lView);
29586
+ }
29410
29587
  }
29588
+ return path;
29589
+ }
29590
+ get type_() {
29591
+ return TNodeTypeAsString[this.type] || `TNodeType.?${this.type}?`;
29411
29592
  }
29412
29593
  get flags_() {
29413
29594
  const flags = [];
@@ -29453,6 +29634,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29453
29634
  get classBindings_() {
29454
29635
  return toDebugStyleBinding(this, true);
29455
29636
  }
29637
+ get providerIndexStart_() {
29638
+ return this.providerIndexes & 1048575 /* ProvidersStartIndexMask */;
29639
+ }
29640
+ get providerIndexEnd_() {
29641
+ return this.providerIndexStart_ +
29642
+ (this.providerIndexes >>> 20 /* CptViewProvidersCountShift */);
29643
+ }
29456
29644
  }
29457
29645
  const TNodeDebug = TNode;
29458
29646
  function toDebugStyleBinding(tNode, isClassBased) {
@@ -29634,19 +29822,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29634
29822
  return this._raw_lView[T_HOST];
29635
29823
  }
29636
29824
  get decls() {
29637
- const tView = this.tView;
29638
- const start = HEADER_OFFSET;
29639
- return toLViewRange(this.tView, this._raw_lView, start, start + tView._decls);
29825
+ return toLViewRange(this.tView, this._raw_lView, HEADER_OFFSET, this.tView.bindingStartIndex);
29640
29826
  }
29641
29827
  get vars() {
29642
29828
  const tView = this.tView;
29643
- const start = HEADER_OFFSET + tView._decls;
29644
- return toLViewRange(this.tView, this._raw_lView, start, start + tView._vars);
29829
+ return toLViewRange(tView, this._raw_lView, tView.bindingStartIndex, tView.i18nStartIndex);
29645
29830
  }
29646
29831
  get i18n() {
29647
29832
  const tView = this.tView;
29648
- const start = HEADER_OFFSET + tView._decls + tView._vars;
29649
- return toLViewRange(this.tView, this._raw_lView, start, this.tView.expandoStartIndex);
29833
+ return toLViewRange(tView, this._raw_lView, tView.i18nStartIndex, tView.expandoStartIndex);
29650
29834
  }
29651
29835
  get expando() {
29652
29836
  const tView = this.tView;
@@ -29683,7 +29867,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29683
29867
  const debugNodes = [];
29684
29868
  let tNodeCursor = tNode;
29685
29869
  while (tNodeCursor) {
29686
- debugNodes.push(buildDebugNode(tNodeCursor, lView, tNodeCursor.index));
29870
+ debugNodes.push(buildDebugNode(tNodeCursor, lView));
29687
29871
  tNodeCursor = tNodeCursor.next;
29688
29872
  }
29689
29873
  return debugNodes;
@@ -29692,15 +29876,69 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29692
29876
  return [];
29693
29877
  }
29694
29878
  }
29695
- function buildDebugNode(tNode, lView, nodeIndex) {
29696
- const rawValue = lView[nodeIndex];
29879
+ function buildDebugNode(tNode, lView) {
29880
+ const rawValue = lView[tNode.index];
29697
29881
  const native = unwrapRNode(rawValue);
29882
+ const factories = [];
29883
+ const instances = [];
29884
+ const tView = lView[TVIEW];
29885
+ for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
29886
+ const def = tView.data[i];
29887
+ factories.push(def.type);
29888
+ instances.push(lView[i]);
29889
+ }
29698
29890
  return {
29699
29891
  html: toHtml(native),
29700
29892
  type: TNodeTypeAsString[tNode.type],
29701
29893
  native: native,
29702
29894
  children: toDebugNodes(tNode.child, lView),
29895
+ factories,
29896
+ instances,
29897
+ injector: buildNodeInjectorDebug(tNode, tView, lView)
29898
+ };
29899
+ }
29900
+ function buildNodeInjectorDebug(tNode, tView, lView) {
29901
+ const viewProviders = [];
29902
+ for (let i = tNode.providerIndexStart_; i < tNode.providerIndexEnd_; i++) {
29903
+ viewProviders.push(tView.data[i]);
29904
+ }
29905
+ const providers = [];
29906
+ for (let i = tNode.providerIndexEnd_; i < tNode.directiveEnd; i++) {
29907
+ providers.push(tView.data[i]);
29908
+ }
29909
+ const nodeInjectorDebug = {
29910
+ bloom: toBloom(lView, tNode.injectorIndex),
29911
+ cumulativeBloom: toBloom(tView.data, tNode.injectorIndex),
29912
+ providers,
29913
+ viewProviders,
29914
+ parentInjectorIndex: lView[tNode.providerIndexStart_ - 1],
29703
29915
  };
29916
+ return nodeInjectorDebug;
29917
+ }
29918
+ /**
29919
+ * Convert a number at `idx` location in `array` into binary representation.
29920
+ *
29921
+ * @param array
29922
+ * @param idx
29923
+ */
29924
+ function binary(array, idx) {
29925
+ const value = array[idx];
29926
+ // If not a number we print 8 `?` to retain alignment but let user know that it was called on
29927
+ // wrong type.
29928
+ if (typeof value !== 'number')
29929
+ return '????????';
29930
+ // We prefix 0s so that we have constant length number
29931
+ const text = '00000000' + value.toString(2);
29932
+ return text.substring(text.length - 8);
29933
+ }
29934
+ /**
29935
+ * Convert a bloom filter at location `idx` in `array` into binary representation.
29936
+ *
29937
+ * @param array
29938
+ * @param idx
29939
+ */
29940
+ function toBloom(array, idx) {
29941
+ return `${binary(array, idx + 7)}_${binary(array, idx + 6)}_${binary(array, idx + 5)}_${binary(array, idx + 4)}_${binary(array, idx + 3)}_${binary(array, idx + 2)}_${binary(array, idx + 1)}_${binary(array, idx + 0)}`;
29704
29942
  }
29705
29943
 
29706
29944
  const ɵ0$4 = () => Promise.resolve(null);
@@ -29745,7 +29983,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29745
29983
  setSelectedIndex(currentElementIndex);
29746
29984
  // Injector block and providers are taken into account.
29747
29985
  const providerCount = expandoInstructions[++i];
29748
- bindingRootIndex += INJECTOR_BLOOM_PARENT_SIZE + providerCount;
29986
+ bindingRootIndex += 9 /* SIZE */ + providerCount;
29749
29987
  currentDirectiveIndex = bindingRootIndex;
29750
29988
  }
29751
29989
  else {
@@ -29828,6 +30066,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29828
30066
  lView[HOST] = host;
29829
30067
  lView[FLAGS] = flags | 4 /* CreationMode */ | 128 /* Attached */ | 8 /* FirstLViewPass */;
29830
30068
  resetPreOrderHookFlags(lView);
30069
+ ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView);
29831
30070
  lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
29832
30071
  lView[CONTEXT] = context;
29833
30072
  lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY]);
@@ -29844,54 +30083,38 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29844
30083
  ngDevMode && attachLViewDebug(lView);
29845
30084
  return lView;
29846
30085
  }
29847
- function getOrCreateTNode(tView, tHostNode, index, type, name, attrs) {
30086
+ function getOrCreateTNode(tView, index, type, name, attrs) {
29848
30087
  // Keep this function short, so that the VM will inline it.
29849
30088
  const adjustedIndex = index + HEADER_OFFSET;
29850
30089
  const tNode = tView.data[adjustedIndex] ||
29851
- createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs);
29852
- setPreviousOrParentTNode(tNode, true);
30090
+ createTNodeAtIndex(tView, adjustedIndex, type, name, attrs);
30091
+ setCurrentTNode(tNode, true);
29853
30092
  return tNode;
29854
30093
  }
29855
- function createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs) {
29856
- const previousOrParentTNode = getPreviousOrParentTNode();
29857
- const isParent = getIsParent();
29858
- const parent = isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent;
29859
- // Parents cannot cross component boundaries because components will be used in multiple places,
29860
- // so it's only set if the view is the same.
29861
- const parentInSameView = parent && parent !== tHostNode;
29862
- const tParentNode = parentInSameView ? parent : null;
30094
+ function createTNodeAtIndex(tView, adjustedIndex, type, name, attrs) {
30095
+ const currentTNode = getCurrentTNode();
30096
+ const isParent = isCurrentTNodeParent();
30097
+ const parent = isParent ? currentTNode : currentTNode && currentTNode.parent;
30098
+ // Parents cannot cross component boundaries because components will be used in multiple places.
29863
30099
  const tNode = tView.data[adjustedIndex] =
29864
- createTNode(tView, tParentNode, type, adjustedIndex, name, attrs);
30100
+ createTNode(tView, parent, type, adjustedIndex, name, attrs);
29865
30101
  // Assign a pointer to the first child node of a given view. The first node is not always the one
29866
30102
  // at index 0, in case of i18n, index 0 can be the instruction `i18nStart` and the first node has
29867
30103
  // the index 1 or more, so we can't just check node index.
29868
30104
  if (tView.firstChild === null) {
29869
30105
  tView.firstChild = tNode;
29870
30106
  }
29871
- if (previousOrParentTNode) {
29872
- if (isParent && previousOrParentTNode.child == null &&
29873
- (tNode.parent !== null || previousOrParentTNode.type === 2 /* View */)) {
30107
+ if (currentTNode !== null) {
30108
+ if (isParent && currentTNode.child == null && tNode.parent !== null) {
29874
30109
  // We are in the same view, which means we are adding content node to the parent view.
29875
- previousOrParentTNode.child = tNode;
30110
+ currentTNode.child = tNode;
29876
30111
  }
29877
30112
  else if (!isParent) {
29878
- previousOrParentTNode.next = tNode;
30113
+ currentTNode.next = tNode;
29879
30114
  }
29880
30115
  }
29881
30116
  return tNode;
29882
30117
  }
29883
- function assignTViewNodeToLView(tView, tParentNode, index, lView) {
29884
- // View nodes are not stored in data because they can be added / removed at runtime (which
29885
- // would cause indices to change). Their TNodes are instead stored in tView.node.
29886
- let tNode = tView.node;
29887
- if (tNode == null) {
29888
- ngDevMode && tParentNode &&
29889
- assertNodeOfPossibleTypes(tParentNode, [3 /* Element */, 0 /* Container */]);
29890
- tView.node = tNode = createTNode(tView, tParentNode, //
29891
- 2 /* View */, index, null, null);
29892
- }
29893
- lView[T_HOST] = tNode;
29894
- }
29895
30118
  //////////////////////////
29896
30119
  //// Render
29897
30120
  //////////////////////////
@@ -29904,7 +30127,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29904
30127
  */
29905
30128
  function renderView(tView, lView, context) {
29906
30129
  ngDevMode && assertEqual(isCreationMode(lView), true, 'Should be run in creation mode');
29907
- enterView(lView, lView[T_HOST]);
30130
+ enterView(lView);
29908
30131
  try {
29909
30132
  const viewQuery = tView.viewQuery;
29910
30133
  if (viewQuery !== null) {
@@ -29968,8 +30191,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29968
30191
  const flags = lView[FLAGS];
29969
30192
  if ((flags & 256 /* Destroyed */) === 256 /* Destroyed */)
29970
30193
  return;
29971
- enterView(lView, lView[T_HOST]);
29972
- const checkNoChangesMode = getCheckNoChangesMode();
30194
+ enterView(lView);
30195
+ // Check no changes mode is a dev only mode used to verify that bindings have not changed
30196
+ // since they were assigned. We do not want to execute lifecycle hooks in that mode.
30197
+ const isInCheckNoChangesPass = isInCheckNoChangesMode();
29973
30198
  try {
29974
30199
  resetPreOrderHookFlags(lView);
29975
30200
  setBindingIndex(tView.bindingStartIndex);
@@ -29979,7 +30204,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29979
30204
  const hooksInitPhaseCompleted = (flags & 3 /* InitPhaseStateMask */) === 3 /* InitPhaseCompleted */;
29980
30205
  // execute pre-order hooks (OnInit, OnChanges, DoCheck)
29981
30206
  // PERF WARNING: do NOT extract this to a separate function without running benchmarks
29982
- if (!checkNoChangesMode) {
30207
+ if (!isInCheckNoChangesPass) {
29983
30208
  if (hooksInitPhaseCompleted) {
29984
30209
  const preOrderCheckHooks = tView.preOrderCheckHooks;
29985
30210
  if (preOrderCheckHooks !== null) {
@@ -30005,7 +30230,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30005
30230
  }
30006
30231
  // execute content hooks (AfterContentInit, AfterContentChecked)
30007
30232
  // PERF WARNING: do NOT extract this to a separate function without running benchmarks
30008
- if (!checkNoChangesMode) {
30233
+ if (!isInCheckNoChangesPass) {
30009
30234
  if (hooksInitPhaseCompleted) {
30010
30235
  const contentCheckHooks = tView.contentCheckHooks;
30011
30236
  if (contentCheckHooks !== null) {
@@ -30035,7 +30260,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30035
30260
  }
30036
30261
  // execute view hooks (AfterViewInit, AfterViewChecked)
30037
30262
  // PERF WARNING: do NOT extract this to a separate function without running benchmarks
30038
- if (!checkNoChangesMode) {
30263
+ if (!isInCheckNoChangesPass) {
30039
30264
  if (hooksInitPhaseCompleted) {
30040
30265
  const viewCheckHooks = tView.viewCheckHooks;
30041
30266
  if (viewCheckHooks !== null) {
@@ -30065,7 +30290,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30065
30290
  // refresh a `NgClass` binding should work. If we would reset the dirty state in the check
30066
30291
  // no changes cycle, the component would be not be dirty for the next update pass. This would
30067
30292
  // be different in production mode where the component dirty state is not reset.
30068
- if (!checkNoChangesMode) {
30293
+ if (!isInCheckNoChangesPass) {
30069
30294
  lView[FLAGS] &= ~(64 /* Dirty */ | 8 /* FirstLViewPass */);
30070
30295
  }
30071
30296
  if (lView[FLAGS] & 1024 /* RefreshTransplantedView */) {
@@ -30079,7 +30304,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30079
30304
  }
30080
30305
  function renderComponentOrTemplate(tView, lView, templateFn, context) {
30081
30306
  const rendererFactory = lView[RENDERER_FACTORY];
30082
- const normalExecutionPath = !getCheckNoChangesMode();
30307
+ const normalExecutionPath = !isInCheckNoChangesMode();
30083
30308
  const creationModeIsActive = isCreationMode(lView);
30084
30309
  try {
30085
30310
  if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
@@ -30103,7 +30328,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30103
30328
  if (rf & 2 /* Update */ && lView.length > HEADER_OFFSET) {
30104
30329
  // When we're updating, inherently select 0 so we don't
30105
30330
  // have to generate that instruction for most update blocks.
30106
- selectIndexInternal(tView, lView, 0, getCheckNoChangesMode());
30331
+ selectIndexInternal(tView, lView, 0, isInCheckNoChangesMode());
30107
30332
  }
30108
30333
  templateFn(rf, context);
30109
30334
  }
@@ -30121,16 +30346,20 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30121
30346
  function getOrCreateTComponentView(def) {
30122
30347
  const tView = def.tView;
30123
30348
  // Create a TView if there isn't one, or recreate it if the first create pass didn't
30124
- // complete successfuly since we can't know for sure whether it's in a usable shape.
30349
+ // complete successfully since we can't know for sure whether it's in a usable shape.
30125
30350
  if (tView === null || tView.incompleteFirstPass) {
30126
- return def.tView = createTView(1 /* Component */, -1, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
30351
+ // Declaration node here is null since this function is called when we dynamically create a
30352
+ // component and hence there is no declaration.
30353
+ const declTNode = null;
30354
+ return def.tView = createTView(1 /* Component */, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts);
30127
30355
  }
30128
30356
  return tView;
30129
30357
  }
30130
30358
  /**
30131
30359
  * Creates a TView instance
30132
30360
  *
30133
- * @param viewIndex The viewBlockId for inline views, or -1 if it's a component/dynamic
30361
+ * @param type Type of `TView`.
30362
+ * @param declTNode Declaration location of this `TView`.
30134
30363
  * @param templateFn Template function
30135
30364
  * @param decls The number of nodes, local refs, and pipes in this template
30136
30365
  * @param directives Registry of directives for this view
@@ -30139,7 +30368,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30139
30368
  * @param schemas Schemas for this view
30140
30369
  * @param consts Constants for this view
30141
30370
  */
30142
- function createTView(type, viewIndex, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory) {
30371
+ function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory) {
30143
30372
  ngDevMode && ngDevMode.tView++;
30144
30373
  const bindingStartIndex = HEADER_OFFSET + decls;
30145
30374
  // This length does not yet contain host bindings from child directives because at this point,
@@ -30149,12 +30378,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30149
30378
  const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength);
30150
30379
  const consts = typeof constsOrFactory === 'function' ? constsOrFactory() : constsOrFactory;
30151
30380
  const tView = blueprint[TVIEW] = ngDevMode ?
30152
- new TViewConstructor(type, viewIndex, // id: number,
30153
- blueprint, // blueprint: LView,
30381
+ new TViewConstructor(type, blueprint, // blueprint: LView,
30154
30382
  templateFn, // template: ComponentTemplate<{}>|null,
30155
30383
  null, // queries: TQueries|null
30156
30384
  viewQuery, // viewQuery: ViewQueriesFunction<{}>|null,
30157
- null, // node: TViewNode|TElementNode|null,
30385
+ declTNode, // declTNode: TNode|null,
30158
30386
  cloneToTViewData(blueprint).fill(null, bindingStartIndex), // data: TData,
30159
30387
  bindingStartIndex, // bindingStartIndex: number,
30160
30388
  initialViewLength, // expandoStartIndex: number,
@@ -30185,12 +30413,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30185
30413
  vars) :
30186
30414
  {
30187
30415
  type: type,
30188
- id: viewIndex,
30189
30416
  blueprint: blueprint,
30190
30417
  template: templateFn,
30191
30418
  queries: null,
30192
30419
  viewQuery: viewQuery,
30193
- node: null,
30420
+ declTNode: declTNode,
30194
30421
  data: blueprint.slice().fill(null, bindingStartIndex),
30195
30422
  bindingStartIndex: bindingStartIndex,
30196
30423
  expandoStartIndex: initialViewLength,
@@ -30282,17 +30509,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30282
30509
  getTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
30283
30510
  }
30284
30511
  }
30285
- /**
30286
- * Constructs a TNode object from the arguments.
30287
- *
30288
- * @param tView `TView` to which this `TNode` belongs (used only in `ngDevMode`)
30289
- * @param type The type of the node
30290
- * @param adjustedIndex The index of the TNode in TView.data, adjusted for HEADER_OFFSET
30291
- * @param tagName The tag name of the node
30292
- * @param attrs The attributes defined on this node
30293
- * @param tViews Any TViews attached to this node
30294
- * @returns the TNode object
30295
- */
30296
30512
  function createTNode(tView, tParent, type, adjustedIndex, tagName, attrs) {
30297
30513
  ngDevMode && ngDevMode.tNode++;
30298
30514
  let injectorIndex = tParent ? tParent.injectorIndex : -1;
@@ -30372,7 +30588,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30372
30588
  * Instantiate a root component.
30373
30589
  */
30374
30590
  function instantiateRootComponent(tView, lView, def) {
30375
- const rootTNode = getPreviousOrParentTNode();
30591
+ const rootTNode = getCurrentTNode();
30376
30592
  if (tView.firstCreatePass) {
30377
30593
  if (def.providersResolver)
30378
30594
  def.providersResolver(def);
@@ -30720,12 +30936,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30720
30936
  tickRootContext(lView[CONTEXT]);
30721
30937
  }
30722
30938
  function checkNoChangesInternal(tView, view, context) {
30723
- setCheckNoChangesMode(true);
30939
+ setIsInCheckNoChangesMode(true);
30724
30940
  try {
30725
30941
  detectChangesInternal(tView, view, context);
30726
30942
  }
30727
30943
  finally {
30728
- setCheckNoChangesMode(false);
30944
+ setIsInCheckNoChangesMode(false);
30729
30945
  }
30730
30946
  }
30731
30947
  /**
@@ -30738,12 +30954,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30738
30954
  * @param lView The view which the change detection should be checked on.
30739
30955
  */
30740
30956
  function checkNoChangesInRootView(lView) {
30741
- setCheckNoChangesMode(true);
30957
+ setIsInCheckNoChangesMode(true);
30742
30958
  try {
30743
30959
  detectChangesInRootView(lView);
30744
30960
  }
30745
30961
  finally {
30746
- setCheckNoChangesMode(false);
30962
+ setIsInCheckNoChangesMode(false);
30747
30963
  }
30748
30964
  }
30749
30965
  function executeViewQueryFn(flags, viewQueryFn, component) {
@@ -30773,20 +30989,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30773
30989
  * Use of this source code is governed by an MIT-style license that can be
30774
30990
  * found in the LICENSE file at https://angular.io/license
30775
30991
  */
30776
- function getLContainer(tNode, embeddedView) {
30777
- ngDevMode && assertLView(embeddedView);
30778
- const container = embeddedView[PARENT];
30779
- if (tNode.index === -1) {
30780
- // This is a dynamically created view inside a dynamic container.
30781
- // The parent isn't an LContainer if the embedded view hasn't been attached yet.
30782
- return isLContainer(container) ? container : null;
30783
- }
30784
- else {
30785
- ngDevMode && assertLContainer(container);
30786
- // This is a inline view node (e.g. embeddedViewStart)
30787
- return container;
30788
- }
30789
- }
30790
30992
  /**
30791
30993
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
30792
30994
  * being passed as an argument.
@@ -30880,12 +31082,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30880
31082
  // Only clean up view when moving to the side or up, as destroy hooks
30881
31083
  // should be called in order from the bottom up.
30882
31084
  while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) {
30883
- isLView(lViewOrLContainer) && cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
30884
- lViewOrLContainer = getParentState(lViewOrLContainer, rootView);
31085
+ if (isLView(lViewOrLContainer)) {
31086
+ cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
31087
+ }
31088
+ lViewOrLContainer = lViewOrLContainer[PARENT];
30885
31089
  }
30886
31090
  if (lViewOrLContainer === null)
30887
31091
  lViewOrLContainer = rootView;
30888
- isLView(lViewOrLContainer) && cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
31092
+ if (isLView(lViewOrLContainer)) {
31093
+ cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer);
31094
+ }
30889
31095
  next = lViewOrLContainer && lViewOrLContainer[NEXT];
30890
31096
  }
30891
31097
  lViewOrLContainer = next;
@@ -30924,31 +31130,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30924
31130
  destroyViewTree(lView);
30925
31131
  }
30926
31132
  }
30927
- /**
30928
- * Determines which LViewOrLContainer to jump to when traversing back up the
30929
- * tree in destroyViewTree.
30930
- *
30931
- * Normally, the view's parent LView should be checked, but in the case of
30932
- * embedded views, the container (which is the view node's parent, but not the
30933
- * LView's parent) needs to be checked for a possible next property.
30934
- *
30935
- * @param lViewOrLContainer The LViewOrLContainer for which we need a parent state
30936
- * @param rootView The rootView, so we don't propagate too far up the view tree
30937
- * @returns The correct parent LViewOrLContainer
30938
- */
30939
- function getParentState(lViewOrLContainer, rootView) {
30940
- let tNode;
30941
- if (isLView(lViewOrLContainer) && (tNode = lViewOrLContainer[T_HOST]) &&
30942
- tNode.type === 2 /* View */) {
30943
- // if it's an embedded view, the state needs to go up to the container, in case the
30944
- // container has a next
30945
- return getLContainer(tNode, lViewOrLContainer);
30946
- }
30947
- else {
30948
- // otherwise, use parent view for containers or component views
30949
- return lViewOrLContainer[PARENT] === rootView ? null : lViewOrLContainer[PARENT];
30950
- }
30951
- }
30952
31133
  /**
30953
31134
  * Calls onDestroys hooks for all directives and pipes in a given view and then removes all
30954
31135
  * listeners. Listeners are removed as the last step so events delivered in the onDestroys hooks
@@ -30970,10 +31151,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30970
31151
  lView[FLAGS] |= 256 /* Destroyed */;
30971
31152
  executeOnDestroys(tView, lView);
30972
31153
  removeListeners(tView, lView);
30973
- const hostTNode = lView[T_HOST];
30974
- // For component views only, the local renderer is destroyed as clean up time.
30975
- if (hostTNode && hostTNode.type === 3 /* Element */ &&
30976
- isProceduralRenderer(lView[RENDERER])) {
31154
+ // For component views only, the local renderer is destroyed at clean up time.
31155
+ if (lView[TVIEW].type === 1 /* Component */ && isProceduralRenderer(lView[RENDERER])) {
30977
31156
  ngDevMode && ngDevMode.rendererDestroy++;
30978
31157
  lView[RENDERER].destroy();
30979
31158
  }
@@ -31114,8 +31293,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31114
31293
  while (tNode != null) {
31115
31294
  ngDevMode && assertTNodeForLView(tNode, lView);
31116
31295
  ngDevMode && assertNodeOfPossibleTypes(tNode, [
31117
- 0 /* Container */, 3 /* Element */, 4 /* ElementContainer */, 1 /* Projection */,
31118
- 5 /* IcuContainer */
31296
+ 0 /* Container */, 2 /* Element */, 3 /* ElementContainer */, 1 /* Projection */,
31297
+ 4 /* IcuContainer */
31119
31298
  ]);
31120
31299
  const rawSlotValue = lView[tNode.index];
31121
31300
  const tNodeType = tNode.type;
@@ -31126,7 +31305,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31126
31305
  }
31127
31306
  }
31128
31307
  if ((tNode.flags & 64 /* isDetached */) !== 64 /* isDetached */) {
31129
- if (tNodeType === 4 /* ElementContainer */ || tNodeType === 5 /* IcuContainer */) {
31308
+ if (tNodeType === 3 /* ElementContainer */ || tNodeType === 4 /* IcuContainer */) {
31130
31309
  applyNodes(renderer, action, tNode.child, lView, renderParent, beforeNode, false);
31131
31310
  applyToElementOrContainer(action, renderer, renderParent, rawSlotValue, beforeNode);
31132
31311
  }
@@ -31134,40 +31313,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31134
31313
  applyProjectionRecursive(renderer, action, lView, tNode, renderParent, beforeNode);
31135
31314
  }
31136
31315
  else {
31137
- ngDevMode && assertNodeOfPossibleTypes(tNode, [3 /* Element */, 0 /* Container */]);
31316
+ ngDevMode && assertNodeOfPossibleTypes(tNode, [2 /* Element */, 0 /* Container */]);
31138
31317
  applyToElementOrContainer(action, renderer, renderParent, rawSlotValue, beforeNode);
31139
31318
  }
31140
31319
  }
31141
31320
  tNode = isProjection ? tNode.projectionNext : tNode.next;
31142
31321
  }
31143
31322
  }
31144
- /**
31145
- * `applyView` performs operation on the view as specified in `action` (insert, detach, destroy)
31146
- *
31147
- * Inserting a view without projection or containers at top level is simple. Just iterate over the
31148
- * root nodes of the View, and for each node perform the `action`.
31149
- *
31150
- * Things get more complicated with containers and projections. That is because coming across:
31151
- * - Container: implies that we have to insert/remove/destroy the views of that container as well
31152
- * which in turn can have their own Containers at the View roots.
31153
- * - Projection: implies that we have to insert/remove/destroy the nodes of the projection. The
31154
- * complication is that the nodes we are projecting can themselves have Containers
31155
- * or other Projections.
31156
- *
31157
- * As you can see this is a very recursive problem. Yes recursion is not most efficient but the
31158
- * code is complicated enough that trying to implemented with recursion becomes unmaintainable.
31159
- *
31160
- * @param tView The `TView' which needs to be inserted, detached, destroyed
31161
- * @param lView The LView which needs to be inserted, detached, destroyed.
31162
- * @param renderer Renderer to use
31163
- * @param action action to perform (insert, detach, destroy)
31164
- * @param renderParent parent DOM element for insertion/removal.
31165
- * @param beforeNode Before which node the insertions should happen.
31166
- */
31167
31323
  function applyView(tView, lView, renderer, action, renderParent, beforeNode) {
31168
- ngDevMode && assertNodeType(tView.node, 2 /* View */);
31169
- const viewRootTNode = tView.node.child;
31170
- applyNodes(renderer, action, viewRootTNode, lView, renderParent, beforeNode, false);
31324
+ applyNodes(renderer, action, tView.firstChild, lView, renderParent, beforeNode, false);
31171
31325
  }
31172
31326
  /**
31173
31327
  * `applyProjectionRecursive` performs operation on the projection specified by `action` (insert,
@@ -31323,11 +31477,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31323
31477
  }
31324
31478
  get rootNodes() {
31325
31479
  const lView = this._lView;
31326
- if (lView[HOST] == null) {
31327
- const hostTView = lView[T_HOST];
31328
- return collectNativeNodes(lView[TVIEW], lView, hostTView.child, []);
31329
- }
31330
- return [];
31480
+ const tView = lView[TVIEW];
31481
+ return collectNativeNodes(tView, lView, tView.firstChild, []);
31331
31482
  }
31332
31483
  get context() {
31333
31484
  return this._lView[CONTEXT];
@@ -31572,8 +31723,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31572
31723
  function collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
31573
31724
  while (tNode !== null) {
31574
31725
  ngDevMode && assertNodeOfPossibleTypes(tNode, [
31575
- 3 /* Element */, 0 /* Container */, 1 /* Projection */, 4 /* ElementContainer */,
31576
- 5 /* IcuContainer */
31726
+ 2 /* Element */, 0 /* Container */, 1 /* Projection */, 3 /* ElementContainer */,
31727
+ 4 /* IcuContainer */
31577
31728
  ]);
31578
31729
  const lNode = lView[tNode.index];
31579
31730
  if (lNode !== null) {
@@ -31592,7 +31743,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
31592
31743
  }
31593
31744
  }
31594
31745
  const tNodeType = tNode.type;
31595
- if (tNodeType === 4 /* ElementContainer */ || tNodeType === 5 /* IcuContainer */) {
31746
+ if (tNodeType === 3 /* ElementContainer */ || tNodeType === 4 /* IcuContainer */) {
31596
31747
  collectNativeNodes(tView, lView, tNode.child, result);
31597
31748
  }
31598
31749
  else if (tNodeType === 1 /* Projection */) {
@@ -33438,7 +33589,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33438
33589
  const tView = rootView[TVIEW];
33439
33590
  ngDevMode && assertIndexInRange(rootView, 0 + HEADER_OFFSET);
33440
33591
  rootView[0 + HEADER_OFFSET] = rNode;
33441
- const tNode = getOrCreateTNode(tView, null, 0, 3 /* Element */, null, null);
33592
+ const tNode = getOrCreateTNode(tView, 0, 2 /* Element */, null, null);
33442
33593
  const mergedAttrs = tNode.mergedAttrs = def.hostAttrs;
33443
33594
  if (mergedAttrs !== null) {
33444
33595
  computeStaticStyling(tNode, mergedAttrs, true);
@@ -33453,7 +33604,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33453
33604
  }
33454
33605
  }
33455
33606
  const viewRenderer = rendererFactory.createRenderer(rNode, def);
33456
- const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 64 /* Dirty */ : 16 /* CheckAlways */, rootView[HEADER_OFFSET], tNode, rendererFactory, viewRenderer, sanitizer);
33607
+ const componentView = createLView(rootView, getOrCreateTComponentView(def), null, def.onPush ? 64 /* Dirty */ : 16 /* CheckAlways */, rootView[HEADER_OFFSET], tNode, rendererFactory, viewRenderer, sanitizer || null, null);
33457
33608
  if (tView.firstCreatePass) {
33458
33609
  diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type);
33459
33610
  markAsComponentHost(tView, tNode);
@@ -33479,7 +33630,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33479
33630
  if (componentDef.contentQueries) {
33480
33631
  componentDef.contentQueries(1 /* Create */, component, rootLView.length - 1);
33481
33632
  }
33482
- const rootTNode = getPreviousOrParentTNode();
33633
+ const rootTNode = getCurrentTNode();
33634
+ ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
33483
33635
  if (tView.firstCreatePass &&
33484
33636
  (componentDef.hostBindings !== null || componentDef.hostAttrs !== null)) {
33485
33637
  const elementIndex = rootTNode.index - HEADER_OFFSET;
@@ -33623,6 +33775,110 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33623
33775
  Object.freeze(EMPTY_ARRAY$2);
33624
33776
  }
33625
33777
 
33778
+ /**
33779
+ * @license
33780
+ * Copyright Google LLC All Rights Reserved.
33781
+ *
33782
+ * Use of this source code is governed by an MIT-style license that can be
33783
+ * found in the LICENSE file at https://angular.io/license
33784
+ */
33785
+ /**
33786
+ * NOTE: changes to the `ngI18nClosureMode` name must be synced with `compiler-cli/src/tooling.ts`.
33787
+ */
33788
+ if (typeof ngI18nClosureMode === 'undefined') {
33789
+ // These property accesses can be ignored because ngI18nClosureMode will be set to false
33790
+ // when optimizing code and the whole if statement will be dropped.
33791
+ // Make sure to refer to ngI18nClosureMode as ['ngI18nClosureMode'] for closure.
33792
+ // NOTE: we need to have it in IIFE so that the tree-shaker is happy.
33793
+ (function () {
33794
+ // tslint:disable-next-line:no-toplevel-property-access
33795
+ _global$1['ngI18nClosureMode'] =
33796
+ // TODO(FW-1250): validate that this actually, you know, works.
33797
+ // tslint:disable-next-line:no-toplevel-property-access
33798
+ typeof goog !== 'undefined' && typeof goog.getMsg === 'function';
33799
+ })();
33800
+ }
33801
+
33802
+ /**
33803
+ * @license
33804
+ * Copyright Google LLC All Rights Reserved.
33805
+ *
33806
+ * Use of this source code is governed by an MIT-style license that can be
33807
+ * found in the LICENSE file at https://angular.io/license
33808
+ */
33809
+ /**
33810
+ * Index of each type of locale data from the locale data array
33811
+ */
33812
+ var LocaleDataIndex;
33813
+ (function (LocaleDataIndex) {
33814
+ LocaleDataIndex[LocaleDataIndex["LocaleId"] = 0] = "LocaleId";
33815
+ LocaleDataIndex[LocaleDataIndex["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
33816
+ LocaleDataIndex[LocaleDataIndex["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
33817
+ LocaleDataIndex[LocaleDataIndex["DaysFormat"] = 3] = "DaysFormat";
33818
+ LocaleDataIndex[LocaleDataIndex["DaysStandalone"] = 4] = "DaysStandalone";
33819
+ LocaleDataIndex[LocaleDataIndex["MonthsFormat"] = 5] = "MonthsFormat";
33820
+ LocaleDataIndex[LocaleDataIndex["MonthsStandalone"] = 6] = "MonthsStandalone";
33821
+ LocaleDataIndex[LocaleDataIndex["Eras"] = 7] = "Eras";
33822
+ LocaleDataIndex[LocaleDataIndex["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
33823
+ LocaleDataIndex[LocaleDataIndex["WeekendRange"] = 9] = "WeekendRange";
33824
+ LocaleDataIndex[LocaleDataIndex["DateFormat"] = 10] = "DateFormat";
33825
+ LocaleDataIndex[LocaleDataIndex["TimeFormat"] = 11] = "TimeFormat";
33826
+ LocaleDataIndex[LocaleDataIndex["DateTimeFormat"] = 12] = "DateTimeFormat";
33827
+ LocaleDataIndex[LocaleDataIndex["NumberSymbols"] = 13] = "NumberSymbols";
33828
+ LocaleDataIndex[LocaleDataIndex["NumberFormats"] = 14] = "NumberFormats";
33829
+ LocaleDataIndex[LocaleDataIndex["CurrencyCode"] = 15] = "CurrencyCode";
33830
+ LocaleDataIndex[LocaleDataIndex["CurrencySymbol"] = 16] = "CurrencySymbol";
33831
+ LocaleDataIndex[LocaleDataIndex["CurrencyName"] = 17] = "CurrencyName";
33832
+ LocaleDataIndex[LocaleDataIndex["Currencies"] = 18] = "Currencies";
33833
+ LocaleDataIndex[LocaleDataIndex["Directionality"] = 19] = "Directionality";
33834
+ LocaleDataIndex[LocaleDataIndex["PluralCase"] = 20] = "PluralCase";
33835
+ LocaleDataIndex[LocaleDataIndex["ExtraData"] = 21] = "ExtraData";
33836
+ })(LocaleDataIndex || (LocaleDataIndex = {}));
33837
+
33838
+ /**
33839
+ * @license
33840
+ * Copyright Google LLC All Rights Reserved.
33841
+ *
33842
+ * Use of this source code is governed by an MIT-style license that can be
33843
+ * found in the LICENSE file at https://angular.io/license
33844
+ */
33845
+ /**
33846
+ * The locale id that the application is using by default (for translations and ICU expressions).
33847
+ */
33848
+ const DEFAULT_LOCALE_ID = 'en-US';
33849
+ /**
33850
+ * USD currency code that the application uses by default for CurrencyPipe when no
33851
+ * DEFAULT_CURRENCY_CODE is provided.
33852
+ */
33853
+ const USD_CURRENCY_CODE = 'USD';
33854
+
33855
+ /**
33856
+ * @license
33857
+ * Copyright Google LLC All Rights Reserved.
33858
+ *
33859
+ * Use of this source code is governed by an MIT-style license that can be
33860
+ * found in the LICENSE file at https://angular.io/license
33861
+ */
33862
+ /**
33863
+ * The locale id that the application is currently using (for translations and ICU expressions).
33864
+ * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine
33865
+ * but is now defined as a global value.
33866
+ */
33867
+ let LOCALE_ID = DEFAULT_LOCALE_ID;
33868
+ /**
33869
+ * Sets the locale id that will be used for translations and ICU expressions.
33870
+ * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine
33871
+ * but is now defined as a global value.
33872
+ *
33873
+ * @param localeId
33874
+ */
33875
+ function setLocaleId(localeId) {
33876
+ assertDefined(localeId, `Expected localeId to be defined`);
33877
+ if (typeof localeId === 'string') {
33878
+ LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-');
33879
+ }
33880
+ }
33881
+
33626
33882
  /**
33627
33883
  * @license
33628
33884
  * Copyright Google LLC All Rights Reserved.
@@ -33845,7 +34101,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33845
34101
  /**
33846
34102
  * @publicApi
33847
34103
  */
33848
- const VERSION$2 = new Version$1('10.1.3');
34104
+ const VERSION$2 = new Version$1('10.2.0');
33849
34105
 
33850
34106
  /**
33851
34107
  * @license
@@ -35159,14 +35415,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35159
35415
  16 /* CheckAlways */ | 512 /* IsRoot */;
35160
35416
  const rootContext = createRootContext();
35161
35417
  // Create the root view. Uses empty TView and ContentTemplate.
35162
- const rootTView = createTView(0 /* Root */, -1, null, 1, 0, null, null, null, null, null);
35418
+ const rootTView = createTView(0 /* Root */, null, null, 1, 0, null, null, null, null, null);
35163
35419
  const rootLView = createLView(null, rootTView, rootContext, rootFlags, null, null, rendererFactory, hostRenderer, sanitizer, rootViewInjector);
35164
35420
  // rootView is the parent when bootstrapping
35165
35421
  // TODO(misko): it looks like we are entering view here but we don't really need to as
35166
35422
  // `renderView` does that. However as the code is written it is needed because
35167
35423
  // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
35168
35424
  // issues would allow us to drop this.
35169
- enterView(rootLView, null);
35425
+ enterView(rootLView);
35170
35426
  let component;
35171
35427
  let tElementNode;
35172
35428
  try {
@@ -35210,11 +35466,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35210
35466
  finally {
35211
35467
  leaveView();
35212
35468
  }
35213
- const componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);
35214
- // The host element of the internal root view is attached to the component's host view node.
35215
- ngDevMode && assertNodeOfPossibleTypes(rootTView.node, [2 /* View */]);
35216
- rootTView.node.child = tElementNode;
35217
- return componentRef;
35469
+ return new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode);
35218
35470
  }
35219
35471
  }
35220
35472
  const componentFactoryResolver = new ComponentFactoryResolver$1();
@@ -35235,7 +35487,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35235
35487
  this.destroyCbs = [];
35236
35488
  this.instance = instance;
35237
35489
  this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView);
35238
- assignTViewNodeToLView(_rootLView[TVIEW], null, -1, _rootLView);
35239
35490
  this.componentType = componentType;
35240
35491
  }
35241
35492
  get injector() {
@@ -35255,110 +35506,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35255
35506
  }
35256
35507
  }
35257
35508
 
35258
- /**
35259
- * @license
35260
- * Copyright Google LLC All Rights Reserved.
35261
- *
35262
- * Use of this source code is governed by an MIT-style license that can be
35263
- * found in the LICENSE file at https://angular.io/license
35264
- */
35265
- /**
35266
- * Index of each type of locale data from the locale data array
35267
- */
35268
- var LocaleDataIndex;
35269
- (function (LocaleDataIndex) {
35270
- LocaleDataIndex[LocaleDataIndex["LocaleId"] = 0] = "LocaleId";
35271
- LocaleDataIndex[LocaleDataIndex["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
35272
- LocaleDataIndex[LocaleDataIndex["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
35273
- LocaleDataIndex[LocaleDataIndex["DaysFormat"] = 3] = "DaysFormat";
35274
- LocaleDataIndex[LocaleDataIndex["DaysStandalone"] = 4] = "DaysStandalone";
35275
- LocaleDataIndex[LocaleDataIndex["MonthsFormat"] = 5] = "MonthsFormat";
35276
- LocaleDataIndex[LocaleDataIndex["MonthsStandalone"] = 6] = "MonthsStandalone";
35277
- LocaleDataIndex[LocaleDataIndex["Eras"] = 7] = "Eras";
35278
- LocaleDataIndex[LocaleDataIndex["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
35279
- LocaleDataIndex[LocaleDataIndex["WeekendRange"] = 9] = "WeekendRange";
35280
- LocaleDataIndex[LocaleDataIndex["DateFormat"] = 10] = "DateFormat";
35281
- LocaleDataIndex[LocaleDataIndex["TimeFormat"] = 11] = "TimeFormat";
35282
- LocaleDataIndex[LocaleDataIndex["DateTimeFormat"] = 12] = "DateTimeFormat";
35283
- LocaleDataIndex[LocaleDataIndex["NumberSymbols"] = 13] = "NumberSymbols";
35284
- LocaleDataIndex[LocaleDataIndex["NumberFormats"] = 14] = "NumberFormats";
35285
- LocaleDataIndex[LocaleDataIndex["CurrencyCode"] = 15] = "CurrencyCode";
35286
- LocaleDataIndex[LocaleDataIndex["CurrencySymbol"] = 16] = "CurrencySymbol";
35287
- LocaleDataIndex[LocaleDataIndex["CurrencyName"] = 17] = "CurrencyName";
35288
- LocaleDataIndex[LocaleDataIndex["Currencies"] = 18] = "Currencies";
35289
- LocaleDataIndex[LocaleDataIndex["Directionality"] = 19] = "Directionality";
35290
- LocaleDataIndex[LocaleDataIndex["PluralCase"] = 20] = "PluralCase";
35291
- LocaleDataIndex[LocaleDataIndex["ExtraData"] = 21] = "ExtraData";
35292
- })(LocaleDataIndex || (LocaleDataIndex = {}));
35293
-
35294
- /**
35295
- * @license
35296
- * Copyright Google LLC All Rights Reserved.
35297
- *
35298
- * Use of this source code is governed by an MIT-style license that can be
35299
- * found in the LICENSE file at https://angular.io/license
35300
- */
35301
- /**
35302
- * The locale id that the application is using by default (for translations and ICU expressions).
35303
- */
35304
- const DEFAULT_LOCALE_ID = 'en-US';
35305
- /**
35306
- * USD currency code that the application uses by default for CurrencyPipe when no
35307
- * DEFAULT_CURRENCY_CODE is provided.
35308
- */
35309
- const USD_CURRENCY_CODE = 'USD';
35310
-
35311
- /**
35312
- * @license
35313
- * Copyright Google LLC All Rights Reserved.
35314
- *
35315
- * Use of this source code is governed by an MIT-style license that can be
35316
- * found in the LICENSE file at https://angular.io/license
35317
- */
35318
- /**
35319
- * The locale id that the application is currently using (for translations and ICU expressions).
35320
- * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine
35321
- * but is now defined as a global value.
35322
- */
35323
- let LOCALE_ID = DEFAULT_LOCALE_ID;
35324
- /**
35325
- * Sets the locale id that will be used for translations and ICU expressions.
35326
- * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine
35327
- * but is now defined as a global value.
35328
- *
35329
- * @param localeId
35330
- */
35331
- function setLocaleId(localeId) {
35332
- assertDefined(localeId, `Expected localeId to be defined`);
35333
- if (typeof localeId === 'string') {
35334
- LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-');
35335
- }
35336
- }
35337
-
35338
- /**
35339
- * @license
35340
- * Copyright Google LLC All Rights Reserved.
35341
- *
35342
- * Use of this source code is governed by an MIT-style license that can be
35343
- * found in the LICENSE file at https://angular.io/license
35344
- */
35345
- /**
35346
- * NOTE: changes to the `ngI18nClosureMode` name must be synced with `compiler-cli/src/tooling.ts`.
35347
- */
35348
- if (typeof ngI18nClosureMode === 'undefined') {
35349
- // These property accesses can be ignored because ngI18nClosureMode will be set to false
35350
- // when optimizing code and the whole if statement will be dropped.
35351
- // Make sure to refer to ngI18nClosureMode as ['ngI18nClosureMode'] for closure.
35352
- // NOTE: we need to have it in IIFE so that the tree-shaker is happy.
35353
- (function () {
35354
- // tslint:disable-next-line:no-toplevel-property-access
35355
- _global$1['ngI18nClosureMode'] =
35356
- // TODO(FW-1250): validate that this actually, you know, works.
35357
- // tslint:disable-next-line:no-toplevel-property-access
35358
- typeof goog !== 'undefined' && typeof goog.getMsg === 'function';
35359
- })();
35360
- }
35361
-
35362
35509
  /*! *****************************************************************************
35363
35510
  Copyright (c) Microsoft Corporation. All rights reserved.
35364
35511
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use