@angular/language-service 13.0.0-next.3 → 13.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.0.0-next.3
2
+ * @license Angular v13.0.0-next.7
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -819,9 +819,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
819
819
  key(index, type, sourceSpan) {
820
820
  return new ReadKeyExpr(this, index, type, sourceSpan);
821
821
  }
822
- callMethod(name, params, sourceSpan) {
823
- return new InvokeMethodExpr(this, name, params, null, sourceSpan);
824
- }
825
822
  callFn(params, sourceSpan, pure) {
826
823
  return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
827
824
  }
@@ -1023,31 +1020,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
1023
1020
  BuiltinMethod[BuiltinMethod["SubscribeObservable"] = 1] = "SubscribeObservable";
1024
1021
  BuiltinMethod[BuiltinMethod["Bind"] = 2] = "Bind";
1025
1022
  })(BuiltinMethod || (BuiltinMethod = {}));
1026
- class InvokeMethodExpr extends Expression {
1027
- constructor(receiver, method, args, type, sourceSpan) {
1028
- super(type, sourceSpan);
1029
- this.receiver = receiver;
1030
- this.args = args;
1031
- if (typeof method === 'string') {
1032
- this.name = method;
1033
- this.builtin = null;
1034
- }
1035
- else {
1036
- this.name = null;
1037
- this.builtin = method;
1038
- }
1039
- }
1040
- isEquivalent(e) {
1041
- return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
1042
- this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
1043
- }
1044
- isConstant() {
1045
- return false;
1046
- }
1047
- visitExpression(visitor, context) {
1048
- return visitor.visitInvokeMethodExpr(this, context);
1049
- }
1050
- }
1051
1023
  class InvokeFunctionExpr extends Expression {
1052
1024
  constructor(fn, args, type, sourceSpan, pure = false) {
1053
1025
  super(type, sourceSpan);
@@ -1917,7 +1889,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
1917
1889
  this.visitWriteVarExpr = invalid;
1918
1890
  this.visitWriteKeyExpr = invalid;
1919
1891
  this.visitWritePropExpr = invalid;
1920
- this.visitInvokeMethodExpr = invalid;
1921
1892
  this.visitInvokeFunctionExpr = invalid;
1922
1893
  this.visitTaggedTemplateExpr = invalid;
1923
1894
  this.visitInstantiateExpr = invalid;
@@ -3993,21 +3964,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
3993
3964
  }
3994
3965
  return null;
3995
3966
  }
3996
- visitInvokeMethodExpr(expr, ctx) {
3997
- expr.receiver.visitExpression(this, ctx);
3998
- let name = expr.name;
3999
- if (expr.builtin != null) {
4000
- name = this.getBuiltinMethodName(expr.builtin);
4001
- if (name == null) {
4002
- // some builtins just mean to skip the call.
4003
- return null;
4004
- }
4005
- }
4006
- ctx.print(expr, `.${name}(`);
4007
- this.visitAllExpressions(expr.args, ctx, `,`);
4008
- ctx.print(expr, `)`);
4009
- return null;
4010
- }
4011
3967
  visitInvokeFunctionExpr(expr, ctx) {
4012
3968
  expr.fn.visitExpression(this, ctx);
4013
3969
  ctx.print(expr, `(`);
@@ -4646,7 +4602,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
4646
4602
  return createFactoryFunction(unwrappedType);
4647
4603
  }
4648
4604
  function createFactoryFunction(type) {
4649
- return fn([new FnParam('t', DYNAMIC_TYPE)], [new ReturnStatement(type.callMethod('ɵfac', [variable('t')]))]);
4605
+ return fn([new FnParam('t', DYNAMIC_TYPE)], [new ReturnStatement(type.prop('ɵfac').callFn([variable('t')]))]);
4650
4606
  }
4651
4607
 
4652
4608
  /**
@@ -6021,38 +5977,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6021
5977
  return visitor.visitNonNullAssert(this, context);
6022
5978
  }
6023
5979
  }
6024
- class MethodCall extends ASTWithName {
6025
- constructor(span, sourceSpan, nameSpan, receiver, name, args, argumentSpan) {
6026
- super(span, sourceSpan, nameSpan);
6027
- this.receiver = receiver;
6028
- this.name = name;
6029
- this.args = args;
6030
- this.argumentSpan = argumentSpan;
6031
- }
6032
- visit(visitor, context = null) {
6033
- return visitor.visitMethodCall(this, context);
6034
- }
6035
- }
6036
- class SafeMethodCall extends ASTWithName {
6037
- constructor(span, sourceSpan, nameSpan, receiver, name, args, argumentSpan) {
6038
- super(span, sourceSpan, nameSpan);
5980
+ class Call extends AST {
5981
+ constructor(span, sourceSpan, receiver, args, argumentSpan) {
5982
+ super(span, sourceSpan);
6039
5983
  this.receiver = receiver;
6040
- this.name = name;
6041
5984
  this.args = args;
6042
5985
  this.argumentSpan = argumentSpan;
6043
5986
  }
6044
5987
  visit(visitor, context = null) {
6045
- return visitor.visitSafeMethodCall(this, context);
6046
- }
6047
- }
6048
- class FunctionCall extends AST {
6049
- constructor(span, sourceSpan, target, args) {
6050
- super(span, sourceSpan);
6051
- this.target = target;
6052
- this.args = args;
6053
- }
6054
- visit(visitor, context = null) {
6055
- return visitor.visitFunctionCall(this, context);
5988
+ return visitor.visitCall(this, context);
6056
5989
  }
6057
5990
  }
6058
5991
  /**
@@ -6138,12 +6071,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6138
6071
  this.visit(ast.exp, context);
6139
6072
  this.visitAll(ast.args, context);
6140
6073
  }
6141
- visitFunctionCall(ast, context) {
6142
- if (ast.target) {
6143
- this.visit(ast.target, context);
6144
- }
6145
- this.visitAll(ast.args, context);
6146
- }
6147
6074
  visitImplicitReceiver(ast, context) { }
6148
6075
  visitThisReceiver(ast, context) { }
6149
6076
  visitInterpolation(ast, context) {
@@ -6165,10 +6092,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6165
6092
  this.visitAll(ast.values, context);
6166
6093
  }
6167
6094
  visitLiteralPrimitive(ast, context) { }
6168
- visitMethodCall(ast, context) {
6169
- this.visit(ast.receiver, context);
6170
- this.visitAll(ast.args, context);
6171
- }
6172
6095
  visitPrefixNot(ast, context) {
6173
6096
  this.visit(ast.expression, context);
6174
6097
  }
@@ -6185,14 +6108,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6185
6108
  visitSafePropertyRead(ast, context) {
6186
6109
  this.visit(ast.receiver, context);
6187
6110
  }
6188
- visitSafeMethodCall(ast, context) {
6189
- this.visit(ast.receiver, context);
6190
- this.visitAll(ast.args, context);
6191
- }
6192
6111
  visitSafeKeyedRead(ast, context) {
6193
6112
  this.visit(ast.receiver, context);
6194
6113
  this.visit(ast.key, context);
6195
6114
  }
6115
+ visitCall(ast, context) {
6116
+ this.visit(ast.receiver, context);
6117
+ this.visitAll(ast.args, context);
6118
+ }
6196
6119
  visitQuote(ast, context) { }
6197
6120
  // This is not part of the AstVisitor interface, just a helper method
6198
6121
  visitAll(asts, context) {
@@ -6223,15 +6146,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6223
6146
  visitSafePropertyRead(ast, context) {
6224
6147
  return new SafePropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name);
6225
6148
  }
6226
- visitMethodCall(ast, context) {
6227
- return new MethodCall(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args), ast.argumentSpan);
6228
- }
6229
- visitSafeMethodCall(ast, context) {
6230
- return new SafeMethodCall(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, this.visitAll(ast.args), ast.argumentSpan);
6231
- }
6232
- visitFunctionCall(ast, context) {
6233
- return new FunctionCall(ast.span, ast.sourceSpan, ast.target.visit(this), this.visitAll(ast.args));
6234
- }
6235
6149
  visitLiteralArray(ast, context) {
6236
6150
  return new LiteralArray(ast.span, ast.sourceSpan, this.visitAll(ast.expressions));
6237
6151
  }
@@ -6269,6 +6183,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6269
6183
  visitKeyedWrite(ast, context) {
6270
6184
  return new KeyedWrite(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this), ast.value.visit(this));
6271
6185
  }
6186
+ visitCall(ast, context) {
6187
+ return new Call(ast.span, ast.sourceSpan, ast.receiver.visit(this), this.visitAll(ast.args), ast.argumentSpan);
6188
+ }
6272
6189
  visitAll(asts) {
6273
6190
  const res = [];
6274
6191
  for (let i = 0; i < asts.length; ++i) {
@@ -6326,30 +6243,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6326
6243
  }
6327
6244
  return ast;
6328
6245
  }
6329
- visitMethodCall(ast, context) {
6330
- const receiver = ast.receiver.visit(this);
6331
- const args = this.visitAll(ast.args);
6332
- if (receiver !== ast.receiver || args !== ast.args) {
6333
- return new MethodCall(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, args, ast.argumentSpan);
6334
- }
6335
- return ast;
6336
- }
6337
- visitSafeMethodCall(ast, context) {
6338
- const receiver = ast.receiver.visit(this);
6339
- const args = this.visitAll(ast.args);
6340
- if (receiver !== ast.receiver || args !== ast.args) {
6341
- return new SafeMethodCall(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, args, ast.argumentSpan);
6342
- }
6343
- return ast;
6344
- }
6345
- visitFunctionCall(ast, context) {
6346
- const target = ast.target && ast.target.visit(this);
6347
- const args = this.visitAll(ast.args);
6348
- if (target !== ast.target || args !== ast.args) {
6349
- return new FunctionCall(ast.span, ast.sourceSpan, target, args);
6350
- }
6351
- return ast;
6352
- }
6353
6246
  visitLiteralArray(ast, context) {
6354
6247
  const expressions = this.visitAll(ast.expressions);
6355
6248
  if (expressions !== ast.expressions) {
@@ -6452,6 +6345,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6452
6345
  }
6453
6346
  return ast;
6454
6347
  }
6348
+ visitCall(ast, context) {
6349
+ const receiver = ast.receiver.visit(this);
6350
+ const args = this.visitAll(ast.args);
6351
+ if (receiver !== ast.receiver || args !== ast.args) {
6352
+ return new Call(ast.span, ast.sourceSpan, receiver, args, ast.argumentSpan);
6353
+ }
6354
+ return ast;
6355
+ }
6455
6356
  visitQuote(ast, context) {
6456
6357
  return ast;
6457
6358
  }
@@ -6984,18 +6885,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
6984
6885
  visitPipe(ast, mode) {
6985
6886
  throw new Error(`Illegal state: Pipes should have been converted into functions. Pipe: ${ast.name}`);
6986
6887
  }
6987
- visitFunctionCall(ast, mode) {
6988
- const convertedArgs = this.visitAll(ast.args, _Mode.Expression);
6989
- let fnResult;
6990
- if (ast instanceof BuiltinFunctionCall) {
6991
- fnResult = ast.converter(convertedArgs);
6992
- }
6993
- else {
6994
- fnResult = this._visit(ast.target, _Mode.Expression)
6995
- .callFn(convertedArgs, this.convertSourceSpan(ast.span));
6996
- }
6997
- return convertToStatementIfNeeded(mode, fnResult);
6998
- }
6999
6888
  visitImplicitReceiver(ast, mode) {
7000
6889
  ensureExpressionMode(mode, ast);
7001
6890
  this.usesImplicitReceiver = true;
@@ -7060,40 +6949,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7060
6949
  }
7061
6950
  return this._localResolver.getLocal(name);
7062
6951
  }
7063
- visitMethodCall(ast, mode) {
7064
- if (ast.receiver instanceof ImplicitReceiver &&
7065
- !(ast.receiver instanceof ThisReceiver) && ast.name === '$any') {
7066
- const args = this.visitAll(ast.args, _Mode.Expression);
7067
- if (args.length != 1) {
7068
- throw new Error(`Invalid call to $any, expected 1 argument but received ${args.length || 'none'}`);
7069
- }
7070
- return args[0].cast(DYNAMIC_TYPE, this.convertSourceSpan(ast.span));
7071
- }
7072
- const leftMostSafe = this.leftMostSafeNode(ast);
7073
- if (leftMostSafe) {
7074
- return this.convertSafeAccess(ast, leftMostSafe, mode);
7075
- }
7076
- else {
7077
- const args = this.visitAll(ast.args, _Mode.Expression);
7078
- const prevUsesImplicitReceiver = this.usesImplicitReceiver;
7079
- let result = null;
7080
- const receiver = this._visit(ast.receiver, _Mode.Expression);
7081
- if (receiver === this._implicitReceiver) {
7082
- const varExpr = this._getLocal(ast.name, ast.receiver);
7083
- if (varExpr) {
7084
- // Restore the previous "usesImplicitReceiver" state since the implicit
7085
- // receiver has been replaced with a resolved local expression.
7086
- this.usesImplicitReceiver = prevUsesImplicitReceiver;
7087
- result = varExpr.callFn(args);
7088
- this.addImplicitReceiverAccess(ast.name);
7089
- }
7090
- }
7091
- if (result == null) {
7092
- result = receiver.callMethod(ast.name, args, this.convertSourceSpan(ast.span));
7093
- }
7094
- return convertToStatementIfNeeded(mode, result);
7095
- }
7096
- }
7097
6952
  visitPrefixNot(ast, mode) {
7098
6953
  return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));
7099
6954
  }
@@ -7119,7 +6974,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7119
6974
  }
7120
6975
  }
7121
6976
  if (result == null) {
7122
- result = receiver.prop(ast.name);
6977
+ result = receiver.prop(ast.name, this.convertSourceSpan(ast.span));
7123
6978
  }
7124
6979
  return convertToStatementIfNeeded(mode, result);
7125
6980
  }
@@ -7152,16 +7007,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7152
7007
  // If no local expression could be produced, use the original receiver's
7153
7008
  // property as the target.
7154
7009
  if (varExpr === null) {
7155
- varExpr = receiver.prop(ast.name);
7010
+ varExpr = receiver.prop(ast.name, this.convertSourceSpan(ast.span));
7156
7011
  }
7157
7012
  return convertToStatementIfNeeded(mode, varExpr.set(this._visit(ast.value, _Mode.Expression)));
7158
7013
  }
7159
7014
  visitSafePropertyRead(ast, mode) {
7160
7015
  return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
7161
7016
  }
7162
- visitSafeMethodCall(ast, mode) {
7163
- return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
7164
- }
7165
7017
  visitSafeKeyedRead(ast, mode) {
7166
7018
  return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
7167
7019
  }
@@ -7172,6 +7024,29 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7172
7024
  throw new Error(`Quotes are not supported for evaluation!
7173
7025
  Statement: ${ast.uninterpretedExpression} located at ${ast.location}`);
7174
7026
  }
7027
+ visitCall(ast, mode) {
7028
+ const convertedArgs = this.visitAll(ast.args, _Mode.Expression);
7029
+ if (ast instanceof BuiltinFunctionCall) {
7030
+ return convertToStatementIfNeeded(mode, ast.converter(convertedArgs));
7031
+ }
7032
+ const receiver = ast.receiver;
7033
+ if (receiver instanceof PropertyRead &&
7034
+ receiver.receiver instanceof ImplicitReceiver &&
7035
+ !(receiver.receiver instanceof ThisReceiver) && receiver.name === '$any') {
7036
+ if (convertedArgs.length !== 1) {
7037
+ throw new Error(`Invalid call to $any, expected 1 argument but received ${convertedArgs.length || 'none'}`);
7038
+ }
7039
+ return convertedArgs[0]
7040
+ .cast(DYNAMIC_TYPE, this.convertSourceSpan(ast.span));
7041
+ }
7042
+ const leftMostSafe = this.leftMostSafeNode(ast);
7043
+ if (leftMostSafe) {
7044
+ return this.convertSafeAccess(ast, leftMostSafe, mode);
7045
+ }
7046
+ const call = this._visit(receiver, _Mode.Expression)
7047
+ .callFn(convertedArgs, this.convertSourceSpan(ast.span));
7048
+ return convertToStatementIfNeeded(mode, call);
7049
+ }
7175
7050
  _visit(ast, mode) {
7176
7051
  const result = this._resultMap.get(ast);
7177
7052
  if (result)
@@ -7228,10 +7103,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7228
7103
  const condition = guardedExpression.isBlank();
7229
7104
  // Convert the ast to an unguarded access to the receiver's member. The map will substitute
7230
7105
  // leftMostNode with its unguarded version in the call to `this.visit()`.
7231
- if (leftMostSafe instanceof SafeMethodCall) {
7232
- this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.nameSpan, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args, leftMostSafe.argumentSpan));
7233
- }
7234
- else if (leftMostSafe instanceof SafeKeyedRead) {
7106
+ if (leftMostSafe instanceof SafeKeyedRead) {
7235
7107
  this._nodeMap.set(leftMostSafe, new KeyedRead(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.receiver, leftMostSafe.key));
7236
7108
  }
7237
7109
  else {
@@ -7287,8 +7159,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7287
7159
  visitConditional(ast) {
7288
7160
  return null;
7289
7161
  },
7290
- visitFunctionCall(ast) {
7291
- return null;
7162
+ visitCall(ast) {
7163
+ return visit(this, ast.receiver);
7292
7164
  },
7293
7165
  visitImplicitReceiver(ast) {
7294
7166
  return null;
@@ -7314,9 +7186,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7314
7186
  visitLiteralPrimitive(ast) {
7315
7187
  return null;
7316
7188
  },
7317
- visitMethodCall(ast) {
7318
- return visit(this, ast.receiver);
7319
- },
7320
7189
  visitPipe(ast) {
7321
7190
  return null;
7322
7191
  },
@@ -7335,9 +7204,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7335
7204
  visitQuote(ast) {
7336
7205
  return null;
7337
7206
  },
7338
- visitSafeMethodCall(ast) {
7339
- return visit(this, ast.receiver) || ast;
7340
- },
7341
7207
  visitSafePropertyRead(ast) {
7342
7208
  return visit(this, ast.receiver) || ast;
7343
7209
  },
@@ -7369,7 +7235,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7369
7235
  visitConditional(ast) {
7370
7236
  return visit(this, ast.condition) || visit(this, ast.trueExp) || visit(this, ast.falseExp);
7371
7237
  },
7372
- visitFunctionCall(ast) {
7238
+ visitCall(ast) {
7373
7239
  return true;
7374
7240
  },
7375
7241
  visitImplicitReceiver(ast) {
@@ -7396,9 +7262,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7396
7262
  visitLiteralPrimitive(ast) {
7397
7263
  return false;
7398
7264
  },
7399
- visitMethodCall(ast) {
7400
- return true;
7401
- },
7402
7265
  visitPipe(ast) {
7403
7266
  return true;
7404
7267
  },
@@ -7417,9 +7280,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7417
7280
  visitQuote(ast) {
7418
7281
  return false;
7419
7282
  },
7420
- visitSafeMethodCall(ast) {
7421
- return true;
7422
- },
7423
7283
  visitSafePropertyRead(ast) {
7424
7284
  return false;
7425
7285
  },
@@ -7504,9 +7364,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7504
7364
  }
7505
7365
  return null;
7506
7366
  }
7507
- class BuiltinFunctionCall extends FunctionCall {
7367
+ class BuiltinFunctionCall extends Call {
7508
7368
  constructor(span, sourceSpan, args, converter) {
7509
- super(span, sourceSpan, null, args);
7369
+ super(span, sourceSpan, new EmptyExpr(span, sourceSpan), args, null);
7510
7370
  this.converter = converter;
7511
7371
  }
7512
7372
  }
@@ -8086,7 +7946,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8086
7946
  const _polyfillHostRe = /-shadowcsshost/gim;
8087
7947
  const _colonHostRe = /:host/gim;
8088
7948
  const _colonHostContextRe = /:host-context/gim;
8089
- const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
7949
+ const _commentRe = /\/\*[\s\S]*?\*\//g;
8090
7950
  function stripComments(input) {
8091
7951
  return input.replace(_commentRe, '');
8092
7952
  }
@@ -8677,9 +8537,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8677
8537
  }
8678
8538
  }
8679
8539
  class Text$2 extends NodeWithI18n {
8680
- constructor(value, sourceSpan, i18n) {
8540
+ constructor(value, sourceSpan, tokens, i18n) {
8681
8541
  super(sourceSpan, i18n);
8682
8542
  this.value = value;
8543
+ this.tokens = tokens;
8683
8544
  }
8684
8545
  visit(visitor, context) {
8685
8546
  return visitor.visitText(this, context);
@@ -8710,12 +8571,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
8710
8571
  }
8711
8572
  }
8712
8573
  class Attribute extends NodeWithI18n {
8713
- constructor(name, value, sourceSpan, keySpan, valueSpan, i18n) {
8574
+ constructor(name, value, sourceSpan, keySpan, valueSpan, valueTokens, i18n) {
8714
8575
  super(sourceSpan, i18n);
8715
8576
  this.name = name;
8716
8577
  this.value = value;
8717
8578
  this.keySpan = keySpan;
8718
8579
  this.valueSpan = valueSpan;
8580
+ this.valueTokens = valueTokens;
8719
8581
  }
8720
8582
  visit(visitor, context) {
8721
8583
  return visitor.visitAttribute(this, context);
@@ -10935,38 +10797,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
10935
10797
  * Use of this source code is governed by an MIT-style license that can be
10936
10798
  * found in the LICENSE file at https://angular.io/license
10937
10799
  */
10938
- var TokenType;
10939
- (function (TokenType) {
10940
- TokenType[TokenType["TAG_OPEN_START"] = 0] = "TAG_OPEN_START";
10941
- TokenType[TokenType["TAG_OPEN_END"] = 1] = "TAG_OPEN_END";
10942
- TokenType[TokenType["TAG_OPEN_END_VOID"] = 2] = "TAG_OPEN_END_VOID";
10943
- TokenType[TokenType["TAG_CLOSE"] = 3] = "TAG_CLOSE";
10944
- TokenType[TokenType["INCOMPLETE_TAG_OPEN"] = 4] = "INCOMPLETE_TAG_OPEN";
10945
- TokenType[TokenType["TEXT"] = 5] = "TEXT";
10946
- TokenType[TokenType["ESCAPABLE_RAW_TEXT"] = 6] = "ESCAPABLE_RAW_TEXT";
10947
- TokenType[TokenType["RAW_TEXT"] = 7] = "RAW_TEXT";
10948
- TokenType[TokenType["COMMENT_START"] = 8] = "COMMENT_START";
10949
- TokenType[TokenType["COMMENT_END"] = 9] = "COMMENT_END";
10950
- TokenType[TokenType["CDATA_START"] = 10] = "CDATA_START";
10951
- TokenType[TokenType["CDATA_END"] = 11] = "CDATA_END";
10952
- TokenType[TokenType["ATTR_NAME"] = 12] = "ATTR_NAME";
10953
- TokenType[TokenType["ATTR_QUOTE"] = 13] = "ATTR_QUOTE";
10954
- TokenType[TokenType["ATTR_VALUE"] = 14] = "ATTR_VALUE";
10955
- TokenType[TokenType["DOC_TYPE"] = 15] = "DOC_TYPE";
10956
- TokenType[TokenType["EXPANSION_FORM_START"] = 16] = "EXPANSION_FORM_START";
10957
- TokenType[TokenType["EXPANSION_CASE_VALUE"] = 17] = "EXPANSION_CASE_VALUE";
10958
- TokenType[TokenType["EXPANSION_CASE_EXP_START"] = 18] = "EXPANSION_CASE_EXP_START";
10959
- TokenType[TokenType["EXPANSION_CASE_EXP_END"] = 19] = "EXPANSION_CASE_EXP_END";
10960
- TokenType[TokenType["EXPANSION_FORM_END"] = 20] = "EXPANSION_FORM_END";
10961
- TokenType[TokenType["EOF"] = 21] = "EOF";
10962
- })(TokenType || (TokenType = {}));
10963
- class Token {
10964
- constructor(type, parts, sourceSpan) {
10965
- this.type = type;
10966
- this.parts = parts;
10967
- this.sourceSpan = sourceSpan;
10968
- }
10969
- }
10970
10800
  class TokenError extends ParseError {
10971
10801
  constructor(errorMsg, tokenType, span) {
10972
10802
  super(span, errorMsg);
@@ -11073,14 +10903,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11073
10903
  }
11074
10904
  }
11075
10905
  else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
11076
- this._consumeText();
10906
+ // In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
10907
+ // the premature end of an interpolation is given by the start of a new HTML element.
10908
+ this._consumeWithInterpolation(5 /* TEXT */, 8 /* INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
11077
10909
  }
11078
10910
  }
11079
10911
  catch (e) {
11080
10912
  this.handleError(e);
11081
10913
  }
11082
10914
  }
11083
- this._beginToken(TokenType.EOF);
10915
+ this._beginToken(24 /* EOF */);
11084
10916
  this._endToken([]);
11085
10917
  }
11086
10918
  /**
@@ -11119,7 +10951,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11119
10951
  if (this._currentTokenType === null) {
11120
10952
  throw new TokenError('Programming error - attempted to end a token which has no token type', null, this._cursor.getSpan(this._currentTokenStart));
11121
10953
  }
11122
- const token = new Token(this._currentTokenType, parts, this._cursor.getSpan(this._currentTokenStart, this._leadingTriviaCodePoints));
10954
+ const token = {
10955
+ type: this._currentTokenType,
10956
+ parts,
10957
+ sourceSpan: (end !== null && end !== void 0 ? end : this._cursor).getSpan(this._currentTokenStart, this._leadingTriviaCodePoints),
10958
+ };
11123
10959
  this.tokens.push(token);
11124
10960
  this._currentTokenStart = null;
11125
10961
  this._currentTokenType = null;
@@ -11212,19 +11048,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11212
11048
  this._cursor.advance();
11213
11049
  }
11214
11050
  }
11215
- _readChar(decodeEntities) {
11216
- if (decodeEntities && this._cursor.peek() === $AMPERSAND) {
11217
- return this._decodeEntity();
11218
- }
11219
- else {
11220
- // Don't rely upon reading directly from `_input` as the actual char value
11221
- // may have been generated from an escape sequence.
11222
- const char = String.fromCodePoint(this._cursor.peek());
11223
- this._cursor.advance();
11224
- return char;
11225
- }
11051
+ _readChar() {
11052
+ // Don't rely upon reading directly from `_input` as the actual char value
11053
+ // may have been generated from an escape sequence.
11054
+ const char = String.fromCodePoint(this._cursor.peek());
11055
+ this._cursor.advance();
11056
+ return char;
11226
11057
  }
11227
- _decodeEntity() {
11058
+ _consumeEntity(textTokenType) {
11059
+ this._beginToken(9 /* ENCODED_ENTITY */);
11228
11060
  const start = this._cursor.clone();
11229
11061
  this._cursor.advance();
11230
11062
  if (this._attemptCharCode($HASH)) {
@@ -11242,7 +11074,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11242
11074
  this._cursor.advance();
11243
11075
  try {
11244
11076
  const charCode = parseInt(strNum, isHex ? 16 : 10);
11245
- return String.fromCharCode(charCode);
11077
+ this._endToken([String.fromCharCode(charCode), this._cursor.getChars(start)]);
11246
11078
  }
11247
11079
  catch (_a) {
11248
11080
  throw this._createError(_unknownEntityErrorMsg(this._cursor.getChars(start)), this._cursor.getSpan());
@@ -11252,20 +11084,25 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11252
11084
  const nameStart = this._cursor.clone();
11253
11085
  this._attemptCharCodeUntilFn(isNamedEntityEnd);
11254
11086
  if (this._cursor.peek() != $SEMICOLON) {
11087
+ // No semicolon was found so abort the encoded entity token that was in progress, and treat
11088
+ // this as a text token
11089
+ this._beginToken(textTokenType, start);
11255
11090
  this._cursor = nameStart;
11256
- return '&';
11091
+ this._endToken(['&']);
11257
11092
  }
11258
- const name = this._cursor.getChars(nameStart);
11259
- this._cursor.advance();
11260
- const char = NAMED_ENTITIES[name];
11261
- if (!char) {
11262
- throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));
11093
+ else {
11094
+ const name = this._cursor.getChars(nameStart);
11095
+ this._cursor.advance();
11096
+ const char = NAMED_ENTITIES[name];
11097
+ if (!char) {
11098
+ throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));
11099
+ }
11100
+ this._endToken([char, `&${name};`]);
11263
11101
  }
11264
- return char;
11265
11102
  }
11266
11103
  }
11267
- _consumeRawText(decodeEntities, endMarkerPredicate) {
11268
- this._beginToken(decodeEntities ? TokenType.ESCAPABLE_RAW_TEXT : TokenType.RAW_TEXT);
11104
+ _consumeRawText(consumeEntities, endMarkerPredicate) {
11105
+ this._beginToken(consumeEntities ? 6 /* ESCAPABLE_RAW_TEXT */ : 7 /* RAW_TEXT */);
11269
11106
  const parts = [];
11270
11107
  while (true) {
11271
11108
  const tagCloseStart = this._cursor.clone();
@@ -11274,30 +11111,38 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11274
11111
  if (foundEndMarker) {
11275
11112
  break;
11276
11113
  }
11277
- parts.push(this._readChar(decodeEntities));
11114
+ if (consumeEntities && this._cursor.peek() === $AMPERSAND) {
11115
+ this._endToken([this._processCarriageReturns(parts.join(''))]);
11116
+ parts.length = 0;
11117
+ this._consumeEntity(6 /* ESCAPABLE_RAW_TEXT */);
11118
+ this._beginToken(6 /* ESCAPABLE_RAW_TEXT */);
11119
+ }
11120
+ else {
11121
+ parts.push(this._readChar());
11122
+ }
11278
11123
  }
11279
- return this._endToken([this._processCarriageReturns(parts.join(''))]);
11124
+ this._endToken([this._processCarriageReturns(parts.join(''))]);
11280
11125
  }
11281
11126
  _consumeComment(start) {
11282
- this._beginToken(TokenType.COMMENT_START, start);
11127
+ this._beginToken(10 /* COMMENT_START */, start);
11283
11128
  this._requireCharCode($MINUS);
11284
11129
  this._endToken([]);
11285
11130
  this._consumeRawText(false, () => this._attemptStr('-->'));
11286
- this._beginToken(TokenType.COMMENT_END);
11131
+ this._beginToken(11 /* COMMENT_END */);
11287
11132
  this._requireStr('-->');
11288
11133
  this._endToken([]);
11289
11134
  }
11290
11135
  _consumeCdata(start) {
11291
- this._beginToken(TokenType.CDATA_START, start);
11136
+ this._beginToken(12 /* CDATA_START */, start);
11292
11137
  this._requireStr('CDATA[');
11293
11138
  this._endToken([]);
11294
11139
  this._consumeRawText(false, () => this._attemptStr(']]>'));
11295
- this._beginToken(TokenType.CDATA_END);
11140
+ this._beginToken(13 /* CDATA_END */);
11296
11141
  this._requireStr(']]>');
11297
11142
  this._endToken([]);
11298
11143
  }
11299
11144
  _consumeDocType(start) {
11300
- this._beginToken(TokenType.DOC_TYPE, start);
11145
+ this._beginToken(18 /* DOC_TYPE */, start);
11301
11146
  const contentStart = this._cursor.clone();
11302
11147
  this._attemptUntilChar($GT);
11303
11148
  const content = this._cursor.getChars(contentStart);
@@ -11351,12 +11196,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11351
11196
  if (e instanceof _ControlFlowError) {
11352
11197
  if (openTagToken) {
11353
11198
  // We errored before we could close the opening tag, so it is incomplete.
11354
- openTagToken.type = TokenType.INCOMPLETE_TAG_OPEN;
11199
+ openTagToken.type = 4 /* INCOMPLETE_TAG_OPEN */;
11355
11200
  }
11356
11201
  else {
11357
11202
  // When the start tag is invalid, assume we want a "<" as text.
11358
11203
  // Back to back text tokens are merged at the end.
11359
- this._beginToken(TokenType.TEXT, start);
11204
+ this._beginToken(5 /* TEXT */, start);
11360
11205
  this._endToken(['<']);
11361
11206
  }
11362
11207
  return;
@@ -11371,8 +11216,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11371
11216
  this._consumeRawTextWithTagClose(prefix, tagName, true);
11372
11217
  }
11373
11218
  }
11374
- _consumeRawTextWithTagClose(prefix, tagName, decodeEntities) {
11375
- this._consumeRawText(decodeEntities, () => {
11219
+ _consumeRawTextWithTagClose(prefix, tagName, consumeEntities) {
11220
+ this._consumeRawText(consumeEntities, () => {
11376
11221
  if (!this._attemptCharCode($LT))
11377
11222
  return false;
11378
11223
  if (!this._attemptCharCode($SLASH))
@@ -11383,13 +11228,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11383
11228
  this._attemptCharCodeUntilFn(isNotWhitespace);
11384
11229
  return this._attemptCharCode($GT);
11385
11230
  });
11386
- this._beginToken(TokenType.TAG_CLOSE);
11231
+ this._beginToken(3 /* TAG_CLOSE */);
11387
11232
  this._requireCharCodeUntilFn(code => code === $GT, 3);
11388
11233
  this._cursor.advance(); // Consume the `>`
11389
11234
  this._endToken([prefix, tagName]);
11390
11235
  }
11391
11236
  _consumeTagOpenStart(start) {
11392
- this._beginToken(TokenType.TAG_OPEN_START, start);
11237
+ this._beginToken(0 /* TAG_OPEN_START */, start);
11393
11238
  const parts = this._consumePrefixAndName();
11394
11239
  return this._endToken(parts);
11395
11240
  }
@@ -11398,44 +11243,38 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11398
11243
  if (attrNameStart === $SQ || attrNameStart === $DQ) {
11399
11244
  throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
11400
11245
  }
11401
- this._beginToken(TokenType.ATTR_NAME);
11246
+ this._beginToken(14 /* ATTR_NAME */);
11402
11247
  const prefixAndName = this._consumePrefixAndName();
11403
11248
  this._endToken(prefixAndName);
11404
11249
  }
11405
11250
  _consumeAttributeValue() {
11406
- let value;
11407
11251
  if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) {
11408
- this._beginToken(TokenType.ATTR_QUOTE);
11409
11252
  const quoteChar = this._cursor.peek();
11410
- this._cursor.advance();
11411
- this._endToken([String.fromCodePoint(quoteChar)]);
11412
- this._beginToken(TokenType.ATTR_VALUE);
11413
- const parts = [];
11414
- while (this._cursor.peek() !== quoteChar) {
11415
- parts.push(this._readChar(true));
11416
- }
11417
- value = parts.join('');
11418
- this._endToken([this._processCarriageReturns(value)]);
11419
- this._beginToken(TokenType.ATTR_QUOTE);
11420
- this._cursor.advance();
11421
- this._endToken([String.fromCodePoint(quoteChar)]);
11253
+ this._consumeQuote(quoteChar);
11254
+ // In an attribute then end of the attribute value and the premature end to an interpolation
11255
+ // are both triggered by the `quoteChar`.
11256
+ const endPredicate = () => this._cursor.peek() === quoteChar;
11257
+ this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
11258
+ this._consumeQuote(quoteChar);
11422
11259
  }
11423
11260
  else {
11424
- this._beginToken(TokenType.ATTR_VALUE);
11425
- const valueStart = this._cursor.clone();
11426
- this._requireCharCodeUntilFn(isNameEnd, 1);
11427
- value = this._cursor.getChars(valueStart);
11428
- this._endToken([this._processCarriageReturns(value)]);
11261
+ const endPredicate = () => isNameEnd(this._cursor.peek());
11262
+ this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
11429
11263
  }
11430
11264
  }
11265
+ _consumeQuote(quoteChar) {
11266
+ this._beginToken(15 /* ATTR_QUOTE */);
11267
+ this._requireCharCode(quoteChar);
11268
+ this._endToken([String.fromCodePoint(quoteChar)]);
11269
+ }
11431
11270
  _consumeTagOpenEnd() {
11432
- const tokenType = this._attemptCharCode($SLASH) ? TokenType.TAG_OPEN_END_VOID : TokenType.TAG_OPEN_END;
11271
+ const tokenType = this._attemptCharCode($SLASH) ? 2 /* TAG_OPEN_END_VOID */ : 1 /* TAG_OPEN_END */;
11433
11272
  this._beginToken(tokenType);
11434
11273
  this._requireCharCode($GT);
11435
11274
  this._endToken([]);
11436
11275
  }
11437
11276
  _consumeTagClose(start) {
11438
- this._beginToken(TokenType.TAG_CLOSE, start);
11277
+ this._beginToken(3 /* TAG_CLOSE */, start);
11439
11278
  this._attemptCharCodeUntilFn(isNotWhitespace);
11440
11279
  const prefixAndName = this._consumePrefixAndName();
11441
11280
  this._attemptCharCodeUntilFn(isNotWhitespace);
@@ -11443,11 +11282,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11443
11282
  this._endToken(prefixAndName);
11444
11283
  }
11445
11284
  _consumeExpansionFormStart() {
11446
- this._beginToken(TokenType.EXPANSION_FORM_START);
11285
+ this._beginToken(19 /* EXPANSION_FORM_START */);
11447
11286
  this._requireCharCode($LBRACE);
11448
11287
  this._endToken([]);
11449
- this._expansionCaseStack.push(TokenType.EXPANSION_FORM_START);
11450
- this._beginToken(TokenType.RAW_TEXT);
11288
+ this._expansionCaseStack.push(19 /* EXPANSION_FORM_START */);
11289
+ this._beginToken(7 /* RAW_TEXT */);
11451
11290
  const condition = this._readUntil($COMMA);
11452
11291
  const normalizedCondition = this._processCarriageReturns(condition);
11453
11292
  if (this._i18nNormalizeLineEndingsInICUs) {
@@ -11463,59 +11302,139 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11463
11302
  }
11464
11303
  this._requireCharCode($COMMA);
11465
11304
  this._attemptCharCodeUntilFn(isNotWhitespace);
11466
- this._beginToken(TokenType.RAW_TEXT);
11305
+ this._beginToken(7 /* RAW_TEXT */);
11467
11306
  const type = this._readUntil($COMMA);
11468
11307
  this._endToken([type]);
11469
11308
  this._requireCharCode($COMMA);
11470
11309
  this._attemptCharCodeUntilFn(isNotWhitespace);
11471
11310
  }
11472
11311
  _consumeExpansionCaseStart() {
11473
- this._beginToken(TokenType.EXPANSION_CASE_VALUE);
11312
+ this._beginToken(20 /* EXPANSION_CASE_VALUE */);
11474
11313
  const value = this._readUntil($LBRACE).trim();
11475
11314
  this._endToken([value]);
11476
11315
  this._attemptCharCodeUntilFn(isNotWhitespace);
11477
- this._beginToken(TokenType.EXPANSION_CASE_EXP_START);
11316
+ this._beginToken(21 /* EXPANSION_CASE_EXP_START */);
11478
11317
  this._requireCharCode($LBRACE);
11479
11318
  this._endToken([]);
11480
11319
  this._attemptCharCodeUntilFn(isNotWhitespace);
11481
- this._expansionCaseStack.push(TokenType.EXPANSION_CASE_EXP_START);
11320
+ this._expansionCaseStack.push(21 /* EXPANSION_CASE_EXP_START */);
11482
11321
  }
11483
11322
  _consumeExpansionCaseEnd() {
11484
- this._beginToken(TokenType.EXPANSION_CASE_EXP_END);
11323
+ this._beginToken(22 /* EXPANSION_CASE_EXP_END */);
11485
11324
  this._requireCharCode($RBRACE);
11486
11325
  this._endToken([]);
11487
11326
  this._attemptCharCodeUntilFn(isNotWhitespace);
11488
11327
  this._expansionCaseStack.pop();
11489
11328
  }
11490
11329
  _consumeExpansionFormEnd() {
11491
- this._beginToken(TokenType.EXPANSION_FORM_END);
11330
+ this._beginToken(23 /* EXPANSION_FORM_END */);
11492
11331
  this._requireCharCode($RBRACE);
11493
11332
  this._endToken([]);
11494
11333
  this._expansionCaseStack.pop();
11495
11334
  }
11496
- _consumeText() {
11497
- const start = this._cursor.clone();
11498
- this._beginToken(TokenType.TEXT, start);
11335
+ /**
11336
+ * Consume a string that may contain interpolation expressions.
11337
+ *
11338
+ * The first token consumed will be of `tokenType` and then there will be alternating
11339
+ * `interpolationTokenType` and `tokenType` tokens until the `endPredicate()` returns true.
11340
+ *
11341
+ * If an interpolation token ends prematurely it will have no end marker in its `parts` array.
11342
+ *
11343
+ * @param textTokenType the kind of tokens to interleave around interpolation tokens.
11344
+ * @param interpolationTokenType the kind of tokens that contain interpolation.
11345
+ * @param endPredicate a function that should return true when we should stop consuming.
11346
+ * @param endInterpolation a function that should return true if there is a premature end to an
11347
+ * interpolation expression - i.e. before we get to the normal interpolation closing marker.
11348
+ */
11349
+ _consumeWithInterpolation(textTokenType, interpolationTokenType, endPredicate, endInterpolation) {
11350
+ this._beginToken(textTokenType);
11499
11351
  const parts = [];
11500
- do {
11352
+ while (!endPredicate()) {
11353
+ const current = this._cursor.clone();
11501
11354
  if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {
11502
- parts.push(this._interpolationConfig.start);
11503
- this._inInterpolation = true;
11355
+ this._endToken([this._processCarriageReturns(parts.join(''))], current);
11356
+ parts.length = 0;
11357
+ this._consumeInterpolation(interpolationTokenType, current, endInterpolation);
11358
+ this._beginToken(textTokenType);
11504
11359
  }
11505
- else if (this._interpolationConfig && this._inInterpolation &&
11506
- this._attemptStr(this._interpolationConfig.end)) {
11507
- parts.push(this._interpolationConfig.end);
11508
- this._inInterpolation = false;
11360
+ else if (this._cursor.peek() === $AMPERSAND) {
11361
+ this._endToken([this._processCarriageReturns(parts.join(''))]);
11362
+ parts.length = 0;
11363
+ this._consumeEntity(textTokenType);
11364
+ this._beginToken(textTokenType);
11509
11365
  }
11510
11366
  else {
11511
- parts.push(this._readChar(true));
11367
+ parts.push(this._readChar());
11512
11368
  }
11513
- } while (!this._isTextEnd());
11369
+ }
11514
11370
  // It is possible that an interpolation was started but not ended inside this text token.
11515
11371
  // Make sure that we reset the state of the lexer correctly.
11516
11372
  this._inInterpolation = false;
11517
11373
  this._endToken([this._processCarriageReturns(parts.join(''))]);
11518
11374
  }
11375
+ /**
11376
+ * Consume a block of text that has been interpreted as an Angular interpolation.
11377
+ *
11378
+ * @param interpolationTokenType the type of the interpolation token to generate.
11379
+ * @param interpolationStart a cursor that points to the start of this interpolation.
11380
+ * @param prematureEndPredicate a function that should return true if the next characters indicate
11381
+ * an end to the interpolation before its normal closing marker.
11382
+ */
11383
+ _consumeInterpolation(interpolationTokenType, interpolationStart, prematureEndPredicate) {
11384
+ const parts = [];
11385
+ this._beginToken(interpolationTokenType, interpolationStart);
11386
+ parts.push(this._interpolationConfig.start);
11387
+ // Find the end of the interpolation, ignoring content inside quotes.
11388
+ const expressionStart = this._cursor.clone();
11389
+ let inQuote = null;
11390
+ let inComment = false;
11391
+ while (this._cursor.peek() !== $EOF &&
11392
+ (prematureEndPredicate === null || !prematureEndPredicate())) {
11393
+ const current = this._cursor.clone();
11394
+ if (this._isTagStart()) {
11395
+ // We are starting what looks like an HTML element in the middle of this interpolation.
11396
+ // Reset the cursor to before the `<` character and end the interpolation token.
11397
+ // (This is actually wrong but here for backward compatibility).
11398
+ this._cursor = current;
11399
+ parts.push(this._getProcessedChars(expressionStart, current));
11400
+ this._endToken(parts);
11401
+ return;
11402
+ }
11403
+ if (inQuote === null) {
11404
+ if (this._attemptStr(this._interpolationConfig.end)) {
11405
+ // We are not in a string, and we hit the end interpolation marker
11406
+ parts.push(this._getProcessedChars(expressionStart, current));
11407
+ parts.push(this._interpolationConfig.end);
11408
+ this._endToken(parts);
11409
+ return;
11410
+ }
11411
+ else if (this._attemptStr('//')) {
11412
+ // Once we are in a comment we ignore any quotes
11413
+ inComment = true;
11414
+ }
11415
+ }
11416
+ const char = this._cursor.peek();
11417
+ this._cursor.advance();
11418
+ if (char === $BACKSLASH) {
11419
+ // Skip the next character because it was escaped.
11420
+ this._cursor.advance();
11421
+ }
11422
+ else if (char === inQuote) {
11423
+ // Exiting the current quoted string
11424
+ inQuote = null;
11425
+ }
11426
+ else if (!inComment && inQuote === null && isQuote(char)) {
11427
+ // Entering a new quoted string
11428
+ inQuote = char;
11429
+ }
11430
+ }
11431
+ // We hit EOF without finding a closing interpolation marker
11432
+ parts.push(this._getProcessedChars(expressionStart, this._cursor));
11433
+ this._endToken(parts);
11434
+ }
11435
+ _getProcessedChars(start, end) {
11436
+ return this._processCarriageReturns(end.getChars(start));
11437
+ }
11519
11438
  _isTextEnd() {
11520
11439
  if (this._isTagStart() || this._cursor.peek() === $EOF) {
11521
11440
  return true;
@@ -11558,12 +11477,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11558
11477
  _isInExpansionCase() {
11559
11478
  return this._expansionCaseStack.length > 0 &&
11560
11479
  this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
11561
- TokenType.EXPANSION_CASE_EXP_START;
11480
+ 21 /* EXPANSION_CASE_EXP_START */;
11562
11481
  }
11563
11482
  _isInExpansionForm() {
11564
11483
  return this._expansionCaseStack.length > 0 &&
11565
11484
  this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
11566
- TokenType.EXPANSION_FORM_START;
11485
+ 19 /* EXPANSION_FORM_START */;
11567
11486
  }
11568
11487
  isExpansionFormStart() {
11569
11488
  if (this._cursor.peek() !== $LBRACE) {
@@ -11610,7 +11529,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11610
11529
  let lastDstToken = undefined;
11611
11530
  for (let i = 0; i < srcTokens.length; i++) {
11612
11531
  const token = srcTokens[i];
11613
- if (lastDstToken && lastDstToken.type === TokenType.TEXT && token.type === TokenType.TEXT) {
11532
+ if ((lastDstToken && lastDstToken.type === 5 /* TEXT */ && token.type === 5 /* TEXT */) ||
11533
+ (lastDstToken && lastDstToken.type === 16 /* ATTR_VALUE_TEXT */ &&
11534
+ token.type === 16 /* ATTR_VALUE_TEXT */)) {
11614
11535
  lastDstToken.parts[0] += token.parts[0];
11615
11536
  lastDstToken.sourceSpan.end = token.sourceSpan.end;
11616
11537
  }
@@ -11903,28 +11824,28 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11903
11824
  this._advance();
11904
11825
  }
11905
11826
  build() {
11906
- while (this._peek.type !== TokenType.EOF) {
11907
- if (this._peek.type === TokenType.TAG_OPEN_START ||
11908
- this._peek.type === TokenType.INCOMPLETE_TAG_OPEN) {
11827
+ while (this._peek.type !== 24 /* EOF */) {
11828
+ if (this._peek.type === 0 /* TAG_OPEN_START */ ||
11829
+ this._peek.type === 4 /* INCOMPLETE_TAG_OPEN */) {
11909
11830
  this._consumeStartTag(this._advance());
11910
11831
  }
11911
- else if (this._peek.type === TokenType.TAG_CLOSE) {
11832
+ else if (this._peek.type === 3 /* TAG_CLOSE */) {
11912
11833
  this._consumeEndTag(this._advance());
11913
11834
  }
11914
- else if (this._peek.type === TokenType.CDATA_START) {
11835
+ else if (this._peek.type === 12 /* CDATA_START */) {
11915
11836
  this._closeVoidElement();
11916
11837
  this._consumeCdata(this._advance());
11917
11838
  }
11918
- else if (this._peek.type === TokenType.COMMENT_START) {
11839
+ else if (this._peek.type === 10 /* COMMENT_START */) {
11919
11840
  this._closeVoidElement();
11920
11841
  this._consumeComment(this._advance());
11921
11842
  }
11922
- else if (this._peek.type === TokenType.TEXT || this._peek.type === TokenType.RAW_TEXT ||
11923
- this._peek.type === TokenType.ESCAPABLE_RAW_TEXT) {
11843
+ else if (this._peek.type === 5 /* TEXT */ || this._peek.type === 7 /* RAW_TEXT */ ||
11844
+ this._peek.type === 6 /* ESCAPABLE_RAW_TEXT */) {
11924
11845
  this._closeVoidElement();
11925
11846
  this._consumeText(this._advance());
11926
11847
  }
11927
- else if (this._peek.type === TokenType.EXPANSION_FORM_START) {
11848
+ else if (this._peek.type === 19 /* EXPANSION_FORM_START */) {
11928
11849
  this._consumeExpansion(this._advance());
11929
11850
  }
11930
11851
  else {
@@ -11950,11 +11871,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11950
11871
  }
11951
11872
  _consumeCdata(_startToken) {
11952
11873
  this._consumeText(this._advance());
11953
- this._advanceIf(TokenType.CDATA_END);
11874
+ this._advanceIf(13 /* CDATA_END */);
11954
11875
  }
11955
11876
  _consumeComment(token) {
11956
- const text = this._advanceIf(TokenType.RAW_TEXT);
11957
- this._advanceIf(TokenType.COMMENT_END);
11877
+ const text = this._advanceIf(7 /* RAW_TEXT */);
11878
+ this._advanceIf(11 /* COMMENT_END */);
11958
11879
  const value = text != null ? text.parts[0].trim() : null;
11959
11880
  this._addToParent(new Comment$1(value, token.sourceSpan));
11960
11881
  }
@@ -11963,14 +11884,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11963
11884
  const type = this._advance();
11964
11885
  const cases = [];
11965
11886
  // read =
11966
- while (this._peek.type === TokenType.EXPANSION_CASE_VALUE) {
11887
+ while (this._peek.type === 20 /* EXPANSION_CASE_VALUE */) {
11967
11888
  const expCase = this._parseExpansionCase();
11968
11889
  if (!expCase)
11969
11890
  return; // error
11970
11891
  cases.push(expCase);
11971
11892
  }
11972
11893
  // read the final }
11973
- if (this._peek.type !== TokenType.EXPANSION_FORM_END) {
11894
+ if (this._peek.type !== 23 /* EXPANSION_FORM_END */) {
11974
11895
  this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
11975
11896
  return;
11976
11897
  }
@@ -11981,7 +11902,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11981
11902
  _parseExpansionCase() {
11982
11903
  const value = this._advance();
11983
11904
  // read {
11984
- if (this._peek.type !== TokenType.EXPANSION_CASE_EXP_START) {
11905
+ if (this._peek.type !== 21 /* EXPANSION_CASE_EXP_START */) {
11985
11906
  this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));
11986
11907
  return null;
11987
11908
  }
@@ -11991,7 +11912,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11991
11912
  if (!exp)
11992
11913
  return null;
11993
11914
  const end = this._advance();
11994
- exp.push(new Token(TokenType.EOF, [], end.sourceSpan));
11915
+ exp.push({ type: 24 /* EOF */, parts: [], sourceSpan: end.sourceSpan });
11995
11916
  // parse everything in between { and }
11996
11917
  const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
11997
11918
  expansionCaseParser.build();
@@ -12005,14 +11926,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12005
11926
  }
12006
11927
  _collectExpansionExpTokens(start) {
12007
11928
  const exp = [];
12008
- const expansionFormStack = [TokenType.EXPANSION_CASE_EXP_START];
11929
+ const expansionFormStack = [21 /* EXPANSION_CASE_EXP_START */];
12009
11930
  while (true) {
12010
- if (this._peek.type === TokenType.EXPANSION_FORM_START ||
12011
- this._peek.type === TokenType.EXPANSION_CASE_EXP_START) {
11931
+ if (this._peek.type === 19 /* EXPANSION_FORM_START */ ||
11932
+ this._peek.type === 21 /* EXPANSION_CASE_EXP_START */) {
12012
11933
  expansionFormStack.push(this._peek.type);
12013
11934
  }
12014
- if (this._peek.type === TokenType.EXPANSION_CASE_EXP_END) {
12015
- if (lastOnStack(expansionFormStack, TokenType.EXPANSION_CASE_EXP_START)) {
11935
+ if (this._peek.type === 22 /* EXPANSION_CASE_EXP_END */) {
11936
+ if (lastOnStack(expansionFormStack, 21 /* EXPANSION_CASE_EXP_START */)) {
12016
11937
  expansionFormStack.pop();
12017
11938
  if (expansionFormStack.length === 0)
12018
11939
  return exp;
@@ -12022,8 +11943,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12022
11943
  return null;
12023
11944
  }
12024
11945
  }
12025
- if (this._peek.type === TokenType.EXPANSION_FORM_END) {
12026
- if (lastOnStack(expansionFormStack, TokenType.EXPANSION_FORM_START)) {
11946
+ if (this._peek.type === 23 /* EXPANSION_FORM_END */) {
11947
+ if (lastOnStack(expansionFormStack, 19 /* EXPANSION_FORM_START */)) {
12027
11948
  expansionFormStack.pop();
12028
11949
  }
12029
11950
  else {
@@ -12031,7 +11952,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12031
11952
  return null;
12032
11953
  }
12033
11954
  }
12034
- if (this._peek.type === TokenType.EOF) {
11955
+ if (this._peek.type === 24 /* EOF */) {
12035
11956
  this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
12036
11957
  return null;
12037
11958
  }
@@ -12039,16 +11960,38 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12039
11960
  }
12040
11961
  }
12041
11962
  _consumeText(token) {
11963
+ const tokens = [token];
11964
+ const startSpan = token.sourceSpan;
12042
11965
  let text = token.parts[0];
12043
11966
  if (text.length > 0 && text[0] === '\n') {
12044
11967
  const parent = this._getParentElement();
12045
11968
  if (parent != null && parent.children.length === 0 &&
12046
11969
  this.getTagDefinition(parent.name).ignoreFirstLf) {
12047
11970
  text = text.substring(1);
11971
+ tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text] };
11972
+ }
11973
+ }
11974
+ while (this._peek.type === 8 /* INTERPOLATION */ || this._peek.type === 5 /* TEXT */ ||
11975
+ this._peek.type === 9 /* ENCODED_ENTITY */) {
11976
+ token = this._advance();
11977
+ tokens.push(token);
11978
+ if (token.type === 8 /* INTERPOLATION */) {
11979
+ // For backward compatibility we decode HTML entities that appear in interpolation
11980
+ // expressions. This is arguably a bug, but it could be a considerable breaking change to
11981
+ // fix it. It should be addressed in a larger project to refactor the entire parser/lexer
11982
+ // chain after View Engine has been removed.
11983
+ text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);
11984
+ }
11985
+ else if (token.type === 9 /* ENCODED_ENTITY */) {
11986
+ text += token.parts[0];
11987
+ }
11988
+ else {
11989
+ text += token.parts.join('');
12048
11990
  }
12049
11991
  }
12050
11992
  if (text.length > 0) {
12051
- this._addToParent(new Text$2(text, token.sourceSpan));
11993
+ const endSpan = token.sourceSpan;
11994
+ this._addToParent(new Text$2(text, new ParseSourceSpan(startSpan.start, endSpan.end, startSpan.fullStart, startSpan.details), tokens));
12052
11995
  }
12053
11996
  }
12054
11997
  _closeVoidElement() {
@@ -12060,14 +12003,14 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12060
12003
  _consumeStartTag(startTagToken) {
12061
12004
  const [prefix, name] = startTagToken.parts;
12062
12005
  const attrs = [];
12063
- while (this._peek.type === TokenType.ATTR_NAME) {
12006
+ while (this._peek.type === 14 /* ATTR_NAME */) {
12064
12007
  attrs.push(this._consumeAttr(this._advance()));
12065
12008
  }
12066
12009
  const fullName = this._getElementFullName(prefix, name, this._getParentElement());
12067
12010
  let selfClosing = false;
12068
12011
  // Note: There could have been a tokenizer error
12069
12012
  // so that we don't get a token for the end tag...
12070
- if (this._peek.type === TokenType.TAG_OPEN_END_VOID) {
12013
+ if (this._peek.type === 2 /* TAG_OPEN_END_VOID */) {
12071
12014
  this._advance();
12072
12015
  selfClosing = true;
12073
12016
  const tagDef = this.getTagDefinition(fullName);
@@ -12075,7 +12018,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12075
12018
  this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`));
12076
12019
  }
12077
12020
  }
12078
- else if (this._peek.type === TokenType.TAG_OPEN_END) {
12021
+ else if (this._peek.type === 1 /* TAG_OPEN_END */) {
12079
12022
  this._advance();
12080
12023
  selfClosing = false;
12081
12024
  }
@@ -12090,7 +12033,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12090
12033
  // element start tag also represents the end tag.
12091
12034
  this._popElement(fullName, span);
12092
12035
  }
12093
- else if (startTagToken.type === TokenType.INCOMPLETE_TAG_OPEN) {
12036
+ else if (startTagToken.type === 4 /* INCOMPLETE_TAG_OPEN */) {
12094
12037
  // We already know the opening tag is not complete, so it is unlikely it has a corresponding
12095
12038
  // close tag. Let's optimistically parse it as a full element and emit an error.
12096
12039
  this._popElement(fullName, null);
@@ -12145,24 +12088,53 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12145
12088
  }
12146
12089
  _consumeAttr(attrName) {
12147
12090
  const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
12148
- let end = attrName.sourceSpan.end;
12149
- let value = '';
12150
- let valueSpan = undefined;
12151
- if (this._peek.type === TokenType.ATTR_QUOTE) {
12091
+ let attrEnd = attrName.sourceSpan.end;
12092
+ // Consume any quote
12093
+ if (this._peek.type === 15 /* ATTR_QUOTE */) {
12152
12094
  this._advance();
12153
12095
  }
12154
- if (this._peek.type === TokenType.ATTR_VALUE) {
12155
- const valueToken = this._advance();
12156
- value = valueToken.parts[0];
12157
- end = valueToken.sourceSpan.end;
12158
- valueSpan = valueToken.sourceSpan;
12096
+ // Consume the attribute value
12097
+ let value = '';
12098
+ const valueTokens = [];
12099
+ let valueStartSpan = undefined;
12100
+ let valueEnd = undefined;
12101
+ // NOTE: We need to use a new variable `nextTokenType` here to hide the actual type of
12102
+ // `_peek.type` from TS. Otherwise TS will narrow the type of `_peek.type` preventing it from
12103
+ // being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not
12104
+ // able to see that `_advance()` will actually mutate `_peek`.
12105
+ const nextTokenType = this._peek.type;
12106
+ if (nextTokenType === 16 /* ATTR_VALUE_TEXT */) {
12107
+ valueStartSpan = this._peek.sourceSpan;
12108
+ valueEnd = this._peek.sourceSpan.end;
12109
+ while (this._peek.type === 16 /* ATTR_VALUE_TEXT */ ||
12110
+ this._peek.type === 17 /* ATTR_VALUE_INTERPOLATION */ ||
12111
+ this._peek.type === 9 /* ENCODED_ENTITY */) {
12112
+ const valueToken = this._advance();
12113
+ valueTokens.push(valueToken);
12114
+ if (valueToken.type === 17 /* ATTR_VALUE_INTERPOLATION */) {
12115
+ // For backward compatibility we decode HTML entities that appear in interpolation
12116
+ // expressions. This is arguably a bug, but it could be a considerable breaking change to
12117
+ // fix it. It should be addressed in a larger project to refactor the entire parser/lexer
12118
+ // chain after View Engine has been removed.
12119
+ value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);
12120
+ }
12121
+ else if (valueToken.type === 9 /* ENCODED_ENTITY */) {
12122
+ value += valueToken.parts[0];
12123
+ }
12124
+ else {
12125
+ value += valueToken.parts.join('');
12126
+ }
12127
+ valueEnd = attrEnd = valueToken.sourceSpan.end;
12128
+ }
12159
12129
  }
12160
- if (this._peek.type === TokenType.ATTR_QUOTE) {
12130
+ // Consume any quote
12131
+ if (this._peek.type === 15 /* ATTR_QUOTE */) {
12161
12132
  const quoteToken = this._advance();
12162
- end = quoteToken.sourceSpan.end;
12133
+ attrEnd = quoteToken.sourceSpan.end;
12163
12134
  }
12164
- const keySpan = new ParseSourceSpan(attrName.sourceSpan.start, attrName.sourceSpan.end);
12165
- return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end, attrName.sourceSpan.fullStart), keySpan, valueSpan);
12135
+ const valueSpan = valueStartSpan && valueEnd &&
12136
+ new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
12137
+ return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : undefined, undefined);
12166
12138
  }
12167
12139
  _getParentElement() {
12168
12140
  return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
@@ -12193,6 +12165,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12193
12165
  function lastOnStack(stack, element) {
12194
12166
  return stack.length > 0 && stack[stack.length - 1] === element;
12195
12167
  }
12168
+ /**
12169
+ * Decode the `entity` string, which we believe is the contents of an HTML entity.
12170
+ *
12171
+ * If the string is not actually a valid/known entity then just return the original `match` string.
12172
+ */
12173
+ function decodeEntity(match, entity) {
12174
+ if (NAMED_ENTITIES[entity] !== undefined) {
12175
+ return NAMED_ENTITIES[entity] || match;
12176
+ }
12177
+ if (/^#x[a-f0-9]+$/i.test(entity)) {
12178
+ return String.fromCodePoint(parseInt(entity.slice(2), 16));
12179
+ }
12180
+ if (/^#\d+$/.test(entity)) {
12181
+ return String.fromCodePoint(parseInt(entity.slice(1), 10));
12182
+ }
12183
+ return match;
12184
+ }
12196
12185
 
12197
12186
  /**
12198
12187
  * @license
@@ -12268,7 +12257,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12268
12257
  const hasExpansionSibling = context &&
12269
12258
  (context.prev instanceof Expansion || context.next instanceof Expansion);
12270
12259
  if (isNotBlank || hasExpansionSibling) {
12271
- return new Text$2(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan, text.i18n);
12260
+ // Process the whitespace in the tokens of this Text node
12261
+ const tokens = text.tokens.map(token => token.type === 5 /* TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
12262
+ // Process the whitespace of the value of this Text node
12263
+ const value = processWhitespace(text.value);
12264
+ return new Text$2(value, text.sourceSpan, tokens, text.i18n);
12272
12265
  }
12273
12266
  return null;
12274
12267
  }
@@ -12282,6 +12275,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12282
12275
  return expansionCase;
12283
12276
  }
12284
12277
  }
12278
+ function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
12279
+ return { type, parts: [processWhitespace(parts[0])], sourceSpan };
12280
+ }
12281
+ function processWhitespace(text) {
12282
+ return replaceNgsp(text).replace(WS_REPLACE_REGEXP, ' ');
12283
+ }
12285
12284
  function removeWhitespaces(htmlAstWithErrors) {
12286
12285
  return new ParseTreeResult(visitAll$1(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
12287
12286
  }
@@ -12384,9 +12383,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12384
12383
  }
12385
12384
  const expansionResult = expandNodes(c.expression);
12386
12385
  errors.push(...expansionResult.errors);
12387
- return new Element$1(`ng-template`, [new Attribute('ngPluralCase', `${c.value}`, c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12386
+ return new Element$1(`ng-template`, [new Attribute('ngPluralCase', `${c.value}`, c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12388
12387
  });
12389
- const switchAttr = new Attribute('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* i18n */);
12388
+ const switchAttr = new Attribute('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */);
12390
12389
  return new Element$1('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
12391
12390
  }
12392
12391
  // ICU messages (excluding plural form) are expanded to `NgSwitch` and `NgSwitchCase`s
@@ -12396,11 +12395,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
12396
12395
  errors.push(...expansionResult.errors);
12397
12396
  if (c.value === 'other') {
12398
12397
  // other is the default case when no values match
12399
- return new Element$1(`ng-template`, [new Attribute('ngSwitchDefault', '', c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12398
+ return new Element$1(`ng-template`, [new Attribute('ngSwitchDefault', '', c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12400
12399
  }
12401
- return new Element$1(`ng-template`, [new Attribute('ngSwitchCase', `${c.value}`, c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12400
+ return new Element$1(`ng-template`, [new Attribute('ngSwitchCase', `${c.value}`, c.valueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
12402
12401
  });
12403
- const switchAttr = new Attribute('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* i18n */);
12402
+ const switchAttr = new Attribute('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan, undefined /* keySpan */, undefined /* valueSpan */, undefined /* valueTokens */, undefined /* i18n */);
12404
12403
  return new Element$1('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
12405
12404
  }
12406
12405
 
@@ -15018,7 +15017,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15018
15017
  * Use of this source code is governed by an MIT-style license that can be
15019
15018
  * found in the LICENSE file at https://angular.io/license
15020
15019
  */
15021
- var TokenType$1;
15020
+ var TokenType;
15022
15021
  (function (TokenType) {
15023
15022
  TokenType[TokenType["Character"] = 0] = "Character";
15024
15023
  TokenType[TokenType["Identifier"] = 1] = "Identifier";
@@ -15028,7 +15027,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15028
15027
  TokenType[TokenType["Operator"] = 5] = "Operator";
15029
15028
  TokenType[TokenType["Number"] = 6] = "Number";
15030
15029
  TokenType[TokenType["Error"] = 7] = "Error";
15031
- })(TokenType$1 || (TokenType$1 = {}));
15030
+ })(TokenType || (TokenType = {}));
15032
15031
  const KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
15033
15032
  class Lexer {
15034
15033
  tokenize(text) {
@@ -15042,7 +15041,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15042
15041
  return tokens;
15043
15042
  }
15044
15043
  }
15045
- class Token$1 {
15044
+ class Token {
15046
15045
  constructor(index, end, type, numValue, strValue) {
15047
15046
  this.index = index;
15048
15047
  this.end = end;
@@ -15051,64 +15050,64 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15051
15050
  this.strValue = strValue;
15052
15051
  }
15053
15052
  isCharacter(code) {
15054
- return this.type == TokenType$1.Character && this.numValue == code;
15053
+ return this.type == TokenType.Character && this.numValue == code;
15055
15054
  }
15056
15055
  isNumber() {
15057
- return this.type == TokenType$1.Number;
15056
+ return this.type == TokenType.Number;
15058
15057
  }
15059
15058
  isString() {
15060
- return this.type == TokenType$1.String;
15059
+ return this.type == TokenType.String;
15061
15060
  }
15062
15061
  isOperator(operator) {
15063
- return this.type == TokenType$1.Operator && this.strValue == operator;
15062
+ return this.type == TokenType.Operator && this.strValue == operator;
15064
15063
  }
15065
15064
  isIdentifier() {
15066
- return this.type == TokenType$1.Identifier;
15065
+ return this.type == TokenType.Identifier;
15067
15066
  }
15068
15067
  isPrivateIdentifier() {
15069
- return this.type == TokenType$1.PrivateIdentifier;
15068
+ return this.type == TokenType.PrivateIdentifier;
15070
15069
  }
15071
15070
  isKeyword() {
15072
- return this.type == TokenType$1.Keyword;
15071
+ return this.type == TokenType.Keyword;
15073
15072
  }
15074
15073
  isKeywordLet() {
15075
- return this.type == TokenType$1.Keyword && this.strValue == 'let';
15074
+ return this.type == TokenType.Keyword && this.strValue == 'let';
15076
15075
  }
15077
15076
  isKeywordAs() {
15078
- return this.type == TokenType$1.Keyword && this.strValue == 'as';
15077
+ return this.type == TokenType.Keyword && this.strValue == 'as';
15079
15078
  }
15080
15079
  isKeywordNull() {
15081
- return this.type == TokenType$1.Keyword && this.strValue == 'null';
15080
+ return this.type == TokenType.Keyword && this.strValue == 'null';
15082
15081
  }
15083
15082
  isKeywordUndefined() {
15084
- return this.type == TokenType$1.Keyword && this.strValue == 'undefined';
15083
+ return this.type == TokenType.Keyword && this.strValue == 'undefined';
15085
15084
  }
15086
15085
  isKeywordTrue() {
15087
- return this.type == TokenType$1.Keyword && this.strValue == 'true';
15086
+ return this.type == TokenType.Keyword && this.strValue == 'true';
15088
15087
  }
15089
15088
  isKeywordFalse() {
15090
- return this.type == TokenType$1.Keyword && this.strValue == 'false';
15089
+ return this.type == TokenType.Keyword && this.strValue == 'false';
15091
15090
  }
15092
15091
  isKeywordThis() {
15093
- return this.type == TokenType$1.Keyword && this.strValue == 'this';
15092
+ return this.type == TokenType.Keyword && this.strValue == 'this';
15094
15093
  }
15095
15094
  isError() {
15096
- return this.type == TokenType$1.Error;
15095
+ return this.type == TokenType.Error;
15097
15096
  }
15098
15097
  toNumber() {
15099
- return this.type == TokenType$1.Number ? this.numValue : -1;
15098
+ return this.type == TokenType.Number ? this.numValue : -1;
15100
15099
  }
15101
15100
  toString() {
15102
15101
  switch (this.type) {
15103
- case TokenType$1.Character:
15104
- case TokenType$1.Identifier:
15105
- case TokenType$1.Keyword:
15106
- case TokenType$1.Operator:
15107
- case TokenType$1.PrivateIdentifier:
15108
- case TokenType$1.String:
15109
- case TokenType$1.Error:
15102
+ case TokenType.Character:
15103
+ case TokenType.Identifier:
15104
+ case TokenType.Keyword:
15105
+ case TokenType.Operator:
15106
+ case TokenType.PrivateIdentifier:
15107
+ case TokenType.String:
15108
+ case TokenType.Error:
15110
15109
  return this.strValue;
15111
- case TokenType$1.Number:
15110
+ case TokenType.Number:
15112
15111
  return this.numValue.toString();
15113
15112
  default:
15114
15113
  return null;
@@ -15116,30 +15115,30 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15116
15115
  }
15117
15116
  }
15118
15117
  function newCharacterToken(index, end, code) {
15119
- return new Token$1(index, end, TokenType$1.Character, code, String.fromCharCode(code));
15118
+ return new Token(index, end, TokenType.Character, code, String.fromCharCode(code));
15120
15119
  }
15121
15120
  function newIdentifierToken(index, end, text) {
15122
- return new Token$1(index, end, TokenType$1.Identifier, 0, text);
15121
+ return new Token(index, end, TokenType.Identifier, 0, text);
15123
15122
  }
15124
15123
  function newPrivateIdentifierToken(index, end, text) {
15125
- return new Token$1(index, end, TokenType$1.PrivateIdentifier, 0, text);
15124
+ return new Token(index, end, TokenType.PrivateIdentifier, 0, text);
15126
15125
  }
15127
15126
  function newKeywordToken(index, end, text) {
15128
- return new Token$1(index, end, TokenType$1.Keyword, 0, text);
15127
+ return new Token(index, end, TokenType.Keyword, 0, text);
15129
15128
  }
15130
15129
  function newOperatorToken(index, end, text) {
15131
- return new Token$1(index, end, TokenType$1.Operator, 0, text);
15130
+ return new Token(index, end, TokenType.Operator, 0, text);
15132
15131
  }
15133
15132
  function newStringToken(index, end, text) {
15134
- return new Token$1(index, end, TokenType$1.String, 0, text);
15133
+ return new Token(index, end, TokenType.String, 0, text);
15135
15134
  }
15136
15135
  function newNumberToken(index, end, n) {
15137
- return new Token$1(index, end, TokenType$1.Number, n, '');
15136
+ return new Token(index, end, TokenType.Number, n, '');
15138
15137
  }
15139
15138
  function newErrorToken(index, end, message) {
15140
- return new Token$1(index, end, TokenType$1.Error, 0, message);
15139
+ return new Token(index, end, TokenType.Error, 0, message);
15141
15140
  }
15142
- const EOF = new Token$1(-1, -1, TokenType$1.Character, 0, '');
15141
+ const EOF = new Token(-1, -1, TokenType.Character, 0, '');
15143
15142
  class _Scanner {
15144
15143
  constructor(input) {
15145
15144
  this.input = input;
@@ -16046,7 +16045,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16046
16045
  // '==','!=','===','!=='
16047
16046
  const start = this.inputIndex;
16048
16047
  let result = this.parseRelational();
16049
- while (this.next.type == TokenType$1.Operator) {
16048
+ while (this.next.type == TokenType.Operator) {
16050
16049
  const operator = this.next.strValue;
16051
16050
  switch (operator) {
16052
16051
  case '==':
@@ -16066,7 +16065,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16066
16065
  // '<', '>', '<=', '>='
16067
16066
  const start = this.inputIndex;
16068
16067
  let result = this.parseAdditive();
16069
- while (this.next.type == TokenType$1.Operator) {
16068
+ while (this.next.type == TokenType.Operator) {
16070
16069
  const operator = this.next.strValue;
16071
16070
  switch (operator) {
16072
16071
  case '<':
@@ -16086,7 +16085,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16086
16085
  // '+', '-'
16087
16086
  const start = this.inputIndex;
16088
16087
  let result = this.parseMultiplicative();
16089
- while (this.next.type == TokenType$1.Operator) {
16088
+ while (this.next.type == TokenType.Operator) {
16090
16089
  const operator = this.next.strValue;
16091
16090
  switch (operator) {
16092
16091
  case '+':
@@ -16104,7 +16103,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16104
16103
  // '*', '%', '/'
16105
16104
  const start = this.inputIndex;
16106
16105
  let result = this.parsePrefix();
16107
- while (this.next.type == TokenType$1.Operator) {
16106
+ while (this.next.type == TokenType.Operator) {
16108
16107
  const operator = this.next.strValue;
16109
16108
  switch (operator) {
16110
16109
  case '*':
@@ -16120,7 +16119,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16120
16119
  return result;
16121
16120
  }
16122
16121
  parsePrefix() {
16123
- if (this.next.type == TokenType$1.Operator) {
16122
+ if (this.next.type == TokenType.Operator) {
16124
16123
  const start = this.inputIndex;
16125
16124
  const operator = this.next.strValue;
16126
16125
  let result;
@@ -16146,22 +16145,24 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16146
16145
  let result = this.parsePrimary();
16147
16146
  while (true) {
16148
16147
  if (this.consumeOptionalCharacter($PERIOD)) {
16149
- result = this.parseAccessMemberOrMethodCall(result, start, false);
16148
+ result = this.parseAccessMemberOrCall(result, start, false);
16150
16149
  }
16151
16150
  else if (this.consumeOptionalOperator('?.')) {
16152
16151
  result = this.consumeOptionalCharacter($LBRACKET) ?
16153
16152
  this.parseKeyedReadOrWrite(result, start, true) :
16154
- this.parseAccessMemberOrMethodCall(result, start, true);
16153
+ this.parseAccessMemberOrCall(result, start, true);
16155
16154
  }
16156
16155
  else if (this.consumeOptionalCharacter($LBRACKET)) {
16157
16156
  result = this.parseKeyedReadOrWrite(result, start, false);
16158
16157
  }
16159
16158
  else if (this.consumeOptionalCharacter($LPAREN)) {
16159
+ const argumentStart = this.inputIndex;
16160
16160
  this.rparensExpected++;
16161
16161
  const args = this.parseCallArguments();
16162
+ const argumentSpan = this.span(argumentStart, this.inputIndex).toAbsolute(this.absoluteOffset);
16162
16163
  this.rparensExpected--;
16163
16164
  this.expectCharacter($RPAREN);
16164
- result = new FunctionCall(this.span(start), this.sourceSpan(start), result, args);
16165
+ result = new Call(this.span(start), this.sourceSpan(start), result, args, argumentSpan);
16165
16166
  }
16166
16167
  else if (this.consumeOptionalOperator('!')) {
16167
16168
  result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
@@ -16211,7 +16212,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16211
16212
  return this.parseLiteralMap();
16212
16213
  }
16213
16214
  else if (this.next.isIdentifier()) {
16214
- return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start), this.sourceSpan(start)), start, false);
16215
+ return this.parseAccessMemberOrCall(new ImplicitReceiver(this.span(start), this.sourceSpan(start)), start, false);
16215
16216
  }
16216
16217
  else if (this.next.isNumber()) {
16217
16218
  const value = this.next.toNumber();
@@ -16279,17 +16280,41 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16279
16280
  }
16280
16281
  return new LiteralMap(this.span(start), this.sourceSpan(start), keys, values);
16281
16282
  }
16282
- parseAccessMemberOrMethodCall(receiver, start, isSafe) {
16283
+ parseAccessMemberOrCall(readReceiver, start, isSafe) {
16283
16284
  const nameStart = this.inputIndex;
16284
16285
  const id = this.withContext(ParseContextFlags.Writable, () => {
16285
16286
  var _a;
16286
16287
  const id = (_a = this.expectIdentifierOrKeyword()) !== null && _a !== void 0 ? _a : '';
16287
16288
  if (id.length === 0) {
16288
- this.error(`Expected identifier for property access`, receiver.span.end);
16289
+ this.error(`Expected identifier for property access`, readReceiver.span.end);
16289
16290
  }
16290
16291
  return id;
16291
16292
  });
16292
16293
  const nameSpan = this.sourceSpan(nameStart);
16294
+ let receiver;
16295
+ if (isSafe) {
16296
+ if (this.consumeOptionalOperator('=')) {
16297
+ this.error('The \'?.\' operator cannot be used in the assignment');
16298
+ receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
16299
+ }
16300
+ else {
16301
+ receiver = new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
16302
+ }
16303
+ }
16304
+ else {
16305
+ if (this.consumeOptionalOperator('=')) {
16306
+ if (!this.parseAction) {
16307
+ this.error('Bindings cannot contain assignments');
16308
+ return new EmptyExpr(this.span(start), this.sourceSpan(start));
16309
+ }
16310
+ const value = this.parseConditional();
16311
+ receiver = new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id, value);
16312
+ }
16313
+ else {
16314
+ receiver =
16315
+ new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
16316
+ }
16317
+ }
16293
16318
  if (this.consumeOptionalCharacter($LPAREN)) {
16294
16319
  const argumentStart = this.inputIndex;
16295
16320
  this.rparensExpected++;
@@ -16299,34 +16324,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16299
16324
  this.rparensExpected--;
16300
16325
  const span = this.span(start);
16301
16326
  const sourceSpan = this.sourceSpan(start);
16302
- return isSafe ?
16303
- new SafeMethodCall(span, sourceSpan, nameSpan, receiver, id, args, argumentSpan) :
16304
- new MethodCall(span, sourceSpan, nameSpan, receiver, id, args, argumentSpan);
16305
- }
16306
- else {
16307
- if (isSafe) {
16308
- if (this.consumeOptionalOperator('=')) {
16309
- this.error('The \'?.\' operator cannot be used in the assignment');
16310
- return new EmptyExpr(this.span(start), this.sourceSpan(start));
16311
- }
16312
- else {
16313
- return new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, receiver, id);
16314
- }
16315
- }
16316
- else {
16317
- if (this.consumeOptionalOperator('=')) {
16318
- if (!this.parseAction) {
16319
- this.error('Bindings cannot contain assignments');
16320
- return new EmptyExpr(this.span(start), this.sourceSpan(start));
16321
- }
16322
- const value = this.parseConditional();
16323
- return new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, receiver, id, value);
16324
- }
16325
- else {
16326
- return new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, receiver, id);
16327
- }
16328
- }
16327
+ return new Call(span, sourceSpan, receiver, args, argumentSpan);
16329
16328
  }
16329
+ return receiver;
16330
16330
  }
16331
16331
  parseCallArguments() {
16332
16332
  if (this.next.isCharacter($RPAREN))
@@ -16622,9 +16622,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
16622
16622
  visitPropertyRead(ast, context) { }
16623
16623
  visitPropertyWrite(ast, context) { }
16624
16624
  visitSafePropertyRead(ast, context) { }
16625
- visitMethodCall(ast, context) { }
16626
- visitSafeMethodCall(ast, context) { }
16627
- visitFunctionCall(ast, context) { }
16625
+ visitCall(ast, context) { }
16628
16626
  visitLiteralArray(ast, context) {
16629
16627
  this.visitAll(ast.expressions, context);
16630
16628
  }
@@ -18052,11 +18050,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18052
18050
  return context.visitNodeFn(el, node);
18053
18051
  }
18054
18052
  visitAttribute(attribute, context) {
18055
- const node = this._visitTextWithInterpolation(attribute.value, attribute.valueSpan || attribute.sourceSpan, context, attribute.i18n);
18053
+ const node = attribute.valueTokens === undefined || attribute.valueTokens.length === 1 ?
18054
+ new Text$1(attribute.value, attribute.valueSpan || attribute.sourceSpan) :
18055
+ this._visitTextWithInterpolation(attribute.valueTokens, attribute.valueSpan || attribute.sourceSpan, context, attribute.i18n);
18056
18056
  return context.visitNodeFn(attribute, node);
18057
18057
  }
18058
18058
  visitText(text, context) {
18059
- const node = this._visitTextWithInterpolation(text.value, text.sourceSpan, context, text.i18n);
18059
+ const node = text.tokens.length === 1 ?
18060
+ new Text$1(text.value, text.sourceSpan) :
18061
+ this._visitTextWithInterpolation(text.tokens, text.sourceSpan, context, text.i18n);
18060
18062
  return context.visitNodeFn(text, node);
18061
18063
  }
18062
18064
  visitComment(comment, context) {
@@ -18095,61 +18097,58 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18095
18097
  throw new Error('Unreachable code');
18096
18098
  }
18097
18099
  /**
18098
- * Split the, potentially interpolated, text up into text and placeholder pieces.
18100
+ * Convert, text and interpolated tokens up into text and placeholder pieces.
18099
18101
  *
18100
- * @param text The potentially interpolated string to be split.
18102
+ * @param tokens The text and interpolated tokens.
18101
18103
  * @param sourceSpan The span of the whole of the `text` string.
18102
18104
  * @param context The current context of the visitor, used to compute and store placeholders.
18103
18105
  * @param previousI18n Any i18n metadata associated with this `text` from a previous pass.
18104
18106
  */
18105
- _visitTextWithInterpolation(text, sourceSpan, context, previousI18n) {
18106
- const { strings, expressions } = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig);
18107
- // No expressions, return a single text.
18108
- if (expressions.length === 0) {
18109
- return new Text$1(text, sourceSpan);
18110
- }
18107
+ _visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
18111
18108
  // Return a sequence of `Text` and `Placeholder` nodes grouped in a `Container`.
18112
18109
  const nodes = [];
18113
- for (let i = 0; i < strings.length - 1; i++) {
18114
- this._addText(nodes, strings[i], sourceSpan);
18115
- this._addPlaceholder(nodes, context, expressions[i], sourceSpan);
18110
+ // We will only create a container if there are actually interpolations,
18111
+ // so this flag tracks that.
18112
+ let hasInterpolation = false;
18113
+ for (const token of tokens) {
18114
+ switch (token.type) {
18115
+ case 8 /* INTERPOLATION */:
18116
+ case 17 /* ATTR_VALUE_INTERPOLATION */:
18117
+ hasInterpolation = true;
18118
+ const expression = token.parts[1];
18119
+ const baseName = extractPlaceholderName(expression) || 'INTERPOLATION';
18120
+ const phName = context.placeholderRegistry.getPlaceholderName(baseName, expression);
18121
+ context.placeholderToContent[phName] = {
18122
+ text: token.parts.join(''),
18123
+ sourceSpan: token.sourceSpan
18124
+ };
18125
+ nodes.push(new Placeholder(expression, phName, token.sourceSpan));
18126
+ break;
18127
+ default:
18128
+ if (token.parts[0].length > 0) {
18129
+ // This token is text or an encoded entity.
18130
+ // If it is following on from a previous text node then merge it into that node
18131
+ // Otherwise, if it is following an interpolation, then add a new node.
18132
+ const previous = nodes[nodes.length - 1];
18133
+ if (previous instanceof Text$1) {
18134
+ previous.value += token.parts[0];
18135
+ previous.sourceSpan = new ParseSourceSpan(previous.sourceSpan.start, token.sourceSpan.end, previous.sourceSpan.fullStart, previous.sourceSpan.details);
18136
+ }
18137
+ else {
18138
+ nodes.push(new Text$1(token.parts[0], token.sourceSpan));
18139
+ }
18140
+ }
18141
+ break;
18142
+ }
18116
18143
  }
18117
- // The last index contains no expression
18118
- this._addText(nodes, strings[strings.length - 1], sourceSpan);
18119
- // Whitespace removal may have invalidated the interpolation source-spans.
18120
- reusePreviousSourceSpans(nodes, previousI18n);
18121
- return new Container(nodes, sourceSpan);
18122
- }
18123
- /**
18124
- * Create a new `Text` node from the `textPiece` and add it to the `nodes` collection.
18125
- *
18126
- * @param nodes The nodes to which the created `Text` node should be added.
18127
- * @param textPiece The text and relative span information for this `Text` node.
18128
- * @param interpolationSpan The span of the whole interpolated text.
18129
- */
18130
- _addText(nodes, textPiece, interpolationSpan) {
18131
- if (textPiece.text.length > 0) {
18132
- // No need to add empty strings
18133
- const stringSpan = getOffsetSourceSpan(interpolationSpan, textPiece);
18134
- nodes.push(new Text$1(textPiece.text, stringSpan));
18144
+ if (hasInterpolation) {
18145
+ // Whitespace removal may have invalidated the interpolation source-spans.
18146
+ reusePreviousSourceSpans(nodes, previousI18n);
18147
+ return new Container(nodes, sourceSpan);
18148
+ }
18149
+ else {
18150
+ return nodes[0];
18135
18151
  }
18136
- }
18137
- /**
18138
- * Create a new `Placeholder` node from the `expression` and add it to the `nodes` collection.
18139
- *
18140
- * @param nodes The nodes to which the created `Text` node should be added.
18141
- * @param context The current context of the visitor, used to compute and store placeholders.
18142
- * @param expression The expression text and relative span information for this `Placeholder`
18143
- * node.
18144
- * @param interpolationSpan The span of the whole interpolated text.
18145
- */
18146
- _addPlaceholder(nodes, context, expression, interpolationSpan) {
18147
- const sourceSpan = getOffsetSourceSpan(interpolationSpan, expression);
18148
- const baseName = extractPlaceholderName(expression.text) || 'INTERPOLATION';
18149
- const phName = context.placeholderRegistry.getPlaceholderName(baseName, expression.text);
18150
- const text = this._interpolationConfig.start + expression.text + this._interpolationConfig.end;
18151
- context.placeholderToContent[phName] = { text, sourceSpan };
18152
- nodes.push(new Placeholder(expression.text, phName, sourceSpan));
18153
18152
  }
18154
18153
  }
18155
18154
  /**
@@ -18171,7 +18170,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18171
18170
  }
18172
18171
  if (previousI18n instanceof Container) {
18173
18172
  // The `previousI18n` is a `Container`, which means that this is a second i18n extraction pass
18174
- // after whitespace has been removed from the AST ndoes.
18173
+ // after whitespace has been removed from the AST nodes.
18175
18174
  assertEquivalentNodes(previousI18n.children, nodes);
18176
18175
  // Reuse the source-spans from the first pass.
18177
18176
  for (let i = 0; i < nodes.length; i++) {
@@ -18200,12 +18199,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18200
18199
  throw new Error('The types of the i18n message children changed between first and second pass.');
18201
18200
  }
18202
18201
  }
18203
- /**
18204
- * Create a new `ParseSourceSpan` from the `sourceSpan`, offset by the `start` and `end` values.
18205
- */
18206
- function getOffsetSourceSpan(sourceSpan, { start, end }) {
18207
- return new ParseSourceSpan(sourceSpan.fullStart.moveBy(start), sourceSpan.fullStart.moveBy(end));
18208
- }
18209
18202
  const _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
18210
18203
  function extractPlaceholderName(input) {
18211
18204
  return input.split(_CUSTOM_PH_EXP)[2];
@@ -18525,7 +18518,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18525
18518
  context[context.length - 1].text += text.value;
18526
18519
  }
18527
18520
  else {
18528
- context.push(new LiteralPiece(text.value, text.sourceSpan));
18521
+ const sourceSpan = new ParseSourceSpan(text.sourceSpan.fullStart, text.sourceSpan.end, text.sourceSpan.fullStart, text.sourceSpan.details);
18522
+ context.push(new LiteralPiece(text.value, sourceSpan));
18529
18523
  }
18530
18524
  }
18531
18525
  visitContainer(container, context) {
@@ -18569,7 +18563,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
18569
18563
  function getSourceSpan(message) {
18570
18564
  const startNode = message.nodes[0];
18571
18565
  const endNode = message.nodes[message.nodes.length - 1];
18572
- return new ParseSourceSpan(startNode.sourceSpan.start, endNode.sourceSpan.end, startNode.sourceSpan.fullStart, startNode.sourceSpan.details);
18566
+ return new ParseSourceSpan(startNode.sourceSpan.fullStart, endNode.sourceSpan.end, startNode.sourceSpan.fullStart, startNode.sourceSpan.details);
18573
18567
  }
18574
18568
  /**
18575
18569
  * Convert the list of serialized MessagePieces into two arrays.
@@ -19803,11 +19797,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
19803
19797
  const convertedArgs = isVarLength ?
19804
19798
  this.visitAll([new LiteralArray(pipe.span, pipe.sourceSpan, args)]) :
19805
19799
  this.visitAll(args);
19806
- const pipeBindExpr = new FunctionCall(pipe.span, pipe.sourceSpan, target, [
19800
+ const pipeBindExpr = new Call(pipe.span, pipe.sourceSpan, target, [
19807
19801
  new LiteralPrimitive(pipe.span, pipe.sourceSpan, slot),
19808
19802
  new LiteralPrimitive(pipe.span, pipe.sourceSpan, pureFunctionSlot),
19809
19803
  ...convertedArgs,
19810
- ]);
19804
+ ], null);
19811
19805
  this._pipeBindExprs.push(pipeBindExpr);
19812
19806
  return pipeBindExpr;
19813
19807
  }
@@ -20602,7 +20596,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
20602
20596
  return fn([], [new ReturnStatement(list)]);
20603
20597
  case 2 /* ClosureResolved */:
20604
20598
  // directives: function () { return [MyDir].map(ng.resolveForwardRef); }
20605
- const resolvedList = list.callMethod('map', [importExpr(Identifiers.resolveForwardRef)]);
20599
+ const resolvedList = list.prop('map').callFn([importExpr(Identifiers.resolveForwardRef)]);
20606
20600
  return fn([], [new ReturnStatement(resolvedList)]);
20607
20601
  }
20608
20602
  }
@@ -21475,7 +21469,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
21475
21469
  * Use of this source code is governed by an MIT-style license that can be
21476
21470
  * found in the LICENSE file at https://angular.io/license
21477
21471
  */
21478
- const VERSION$1 = new Version('13.0.0-next.3');
21472
+ const VERSION$1 = new Version('13.0.0-next.7');
21479
21473
 
21480
21474
  /**
21481
21475
  * @license
@@ -25576,26 +25570,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25576
25570
  ast.falseExp.visit(this);
25577
25571
  return this.query.getTypeUnion(this.getType(ast.trueExp), this.getType(ast.falseExp));
25578
25572
  }
25579
- visitFunctionCall(ast) {
25580
- // The type of a function call is the return type of the selected signature.
25581
- // The signature is selected based on the types of the arguments. Angular doesn't
25582
- // support contextual typing of arguments so this is simpler than TypeScript's
25583
- // version.
25584
- const args = ast.args.map(arg => this.getType(arg));
25585
- const target = this.getType(ast.target);
25586
- if (!target || !target.callable) {
25587
- this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.call_target_not_callable, this.sourceOf(ast.target), target.name));
25588
- return this.anyType;
25589
- }
25590
- const signature = target.selectSignature(args);
25591
- if (signature) {
25592
- return signature.result;
25593
- }
25594
- // TODO: Consider a better error message here. See `typescript_symbols#selectSignature` for more
25595
- // details.
25596
- this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_compatible_call_signature));
25597
- return this.anyType;
25598
- }
25599
25573
  visitImplicitReceiver(_ast) {
25600
25574
  const _this = this;
25601
25575
  // Return a pseudo-symbol for the implicit receiver.
@@ -25683,9 +25657,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25683
25657
  }
25684
25658
  }
25685
25659
  }
25686
- visitMethodCall(ast) {
25687
- return this.resolveMethodCall(this.getType(ast.receiver), ast);
25688
- }
25689
25660
  visitPipe(ast) {
25690
25661
  // The type of a pipe node is the return type of the pipe's transform method. The table returned
25691
25662
  // by getPipes() is expected to contain symbols with the corresponding transform method type.
@@ -25723,9 +25694,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25723
25694
  // The type of a quoted expression is any.
25724
25695
  return this.query.getBuiltinType(BuiltinType$1.Any);
25725
25696
  }
25726
- visitSafeMethodCall(ast) {
25727
- return this.resolveMethodCall(this.query.getNonNullableType(this.getType(ast.receiver)), ast);
25728
- }
25729
25697
  visitSafePropertyRead(ast) {
25730
25698
  return this.resolvePropertyRead(this.query.getNonNullableType(this.getType(ast.receiver)), ast);
25731
25699
  }
@@ -25735,6 +25703,56 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25735
25703
  const result = targetType.indexed(keyType, ast.key instanceof LiteralPrimitive ? ast.key.value : undefined);
25736
25704
  return result || this.anyType;
25737
25705
  }
25706
+ visitCall(ast) {
25707
+ if (ast.receiver instanceof Call) {
25708
+ // The type of a function call is the return type of the selected signature.
25709
+ // The signature is selected based on the types of the arguments. Angular doesn't
25710
+ // support contextual typing of arguments so this is simpler than TypeScript's
25711
+ // version.
25712
+ const args = ast.args.map(arg => this.getType(arg));
25713
+ const target = this.getType(ast.receiver);
25714
+ if (!target || !target.callable) {
25715
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.call_target_not_callable, this.sourceOf(ast.receiver), target.name));
25716
+ return this.anyType;
25717
+ }
25718
+ const signature = target.selectSignature(args);
25719
+ if (signature) {
25720
+ return signature.result;
25721
+ }
25722
+ // TODO: Consider a better error message here. See `typescript_symbols#selectSignature` for
25723
+ // more details.
25724
+ this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_compatible_call_signature));
25725
+ return this.anyType;
25726
+ }
25727
+ if (ast.receiver instanceof PropertyRead || ast.receiver instanceof SafePropertyRead) {
25728
+ const receiver = ast.receiver;
25729
+ const receiverType = receiver instanceof SafePropertyRead ?
25730
+ this.query.getNonNullableType(this.getType(receiver.receiver)) :
25731
+ this.getType(receiver.receiver);
25732
+ if (this.isAny(receiverType)) {
25733
+ return this.anyType;
25734
+ }
25735
+ const methodType = this.resolvePropertyRead(receiverType, receiver);
25736
+ if (!methodType) {
25737
+ this.diagnostics.push(createDiagnostic(refinedSpan(receiver), Diagnostic.could_not_resolve_type, receiver.name));
25738
+ return this.anyType;
25739
+ }
25740
+ if (this.isAny(methodType)) {
25741
+ return this.anyType;
25742
+ }
25743
+ if (!methodType.callable) {
25744
+ this.diagnostics.push(createDiagnostic(refinedSpan(receiver), Diagnostic.identifier_not_callable, receiver.name));
25745
+ return this.anyType;
25746
+ }
25747
+ const signature = methodType.selectSignature(ast.args.map(arg => this.getType(arg)));
25748
+ if (!signature) {
25749
+ this.diagnostics.push(createDiagnostic(refinedSpan(receiver), Diagnostic.unable_to_resolve_signature, receiver.name));
25750
+ return this.anyType;
25751
+ }
25752
+ return signature.result;
25753
+ }
25754
+ return this.anyType;
25755
+ }
25738
25756
  /**
25739
25757
  * Gets the source of an expession AST.
25740
25758
  * The AST's sourceSpan is relative to the start of the template source code, which is contained
@@ -25757,29 +25775,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
25757
25775
  }
25758
25776
  return result;
25759
25777
  }
25760
- resolveMethodCall(receiverType, ast) {
25761
- if (this.isAny(receiverType)) {
25762
- return this.anyType;
25763
- }
25764
- const methodType = this.resolvePropertyRead(receiverType, ast);
25765
- if (!methodType) {
25766
- this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.could_not_resolve_type, ast.name));
25767
- return this.anyType;
25768
- }
25769
- if (this.isAny(methodType)) {
25770
- return this.anyType;
25771
- }
25772
- if (!methodType.callable) {
25773
- this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.identifier_not_callable, ast.name));
25774
- return this.anyType;
25775
- }
25776
- const signature = methodType.selectSignature(ast.args.map(arg => this.getType(arg)));
25777
- if (!signature) {
25778
- this.diagnostics.push(createDiagnostic(refinedSpan(ast), Diagnostic.unable_to_resolve_signature, ast.name));
25779
- return this.anyType;
25780
- }
25781
- return signature.result;
25782
- }
25783
25778
  resolvePropertyRead(receiverType, ast) {
25784
25779
  if (this.isAny(receiverType)) {
25785
25780
  return this.anyType;
@@ -26222,7 +26217,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26222
26217
  visitBinary(_ast) { },
26223
26218
  visitChain(_ast) { },
26224
26219
  visitConditional(_ast) { },
26225
- visitFunctionCall(_ast) { },
26220
+ visitCall(_ast) { },
26226
26221
  visitImplicitReceiver(_ast) { },
26227
26222
  visitThisReceiver(_ast) { },
26228
26223
  visitInterpolation(_ast) {
@@ -26243,7 +26238,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26243
26238
  result = undefined;
26244
26239
  }
26245
26240
  },
26246
- visitMethodCall(_ast) { },
26247
26241
  visitPipe(ast) {
26248
26242
  if (position >= ast.exp.span.end &&
26249
26243
  (!ast.args || !ast.args.length || position < ast.args[0].span.start)) {
@@ -26265,10 +26259,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26265
26259
  // For a quote, return the members of any (if there are any).
26266
26260
  result = templateInfo.query.getBuiltinType(BuiltinType$1.Any).members();
26267
26261
  },
26268
- visitSafeMethodCall(ast) {
26269
- const receiverType = getType(ast.receiver);
26270
- result = receiverType ? receiverType.members() : scope;
26271
- },
26272
26262
  visitSafePropertyRead(ast) {
26273
26263
  const receiverType = getType(ast.receiver);
26274
26264
  result = receiverType ? receiverType.members() : scope;
@@ -26312,7 +26302,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26312
26302
  visitBinary(_ast) { },
26313
26303
  visitChain(_ast) { },
26314
26304
  visitConditional(_ast) { },
26315
- visitFunctionCall(_ast) { },
26305
+ visitCall(_ast) { },
26316
26306
  visitImplicitReceiver(_ast) { },
26317
26307
  visitThisReceiver(_ast) { },
26318
26308
  visitInterpolation(_ast) { },
@@ -26322,11 +26312,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26322
26312
  visitLiteralArray(_ast) { },
26323
26313
  visitLiteralMap(_ast) { },
26324
26314
  visitLiteralPrimitive(_ast) { },
26325
- visitMethodCall(ast) {
26326
- const receiverType = getType(ast.receiver);
26327
- symbol = receiverType && receiverType.members().get(ast.name);
26328
- span = spanFromName(ast);
26329
- },
26330
26315
  visitPipe(ast) {
26331
26316
  if (inSpan(position, ast.nameSpan, /* exclusive */ true)) {
26332
26317
  // We are in a position a pipe name is expected.
@@ -26348,11 +26333,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26348
26333
  span = spanFromName(ast);
26349
26334
  },
26350
26335
  visitQuote(_ast) { },
26351
- visitSafeMethodCall(ast) {
26352
- const receiverType = getType(ast.receiver);
26353
- symbol = receiverType && receiverType.members().get(ast.name);
26354
- span = spanFromName(ast);
26355
- },
26356
26336
  visitSafePropertyRead(ast) {
26357
26337
  const receiverType = getType(ast.receiver);
26358
26338
  symbol = receiverType && receiverType.members().get(ast.name);
@@ -32958,12 +32938,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
32958
32938
  const ERROR_DEBUG_CONTEXT = 'ngDebugContext';
32959
32939
  const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
32960
32940
  const ERROR_LOGGER = 'ngErrorLogger';
32961
- function wrappedError(message, originalError) {
32962
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
32963
- const error = Error(msg);
32964
- error[ERROR_ORIGINAL_ERROR] = originalError;
32965
- return error;
32966
- }
32967
32941
 
32968
32942
  /**
32969
32943
  * @license
@@ -35794,7 +35768,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35794
35768
  }
35795
35769
  }
35796
35770
  Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
35797
- Injector.NULL = new NullInjector();
35771
+ Injector.NULL = ( /* @__PURE__ */new NullInjector());
35798
35772
  /** @nocollapse */
35799
35773
  Injector.ɵprov = ɵɵdefineInjectable({
35800
35774
  token: Injector,
@@ -36316,864 +36290,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
36316
36290
  const SWITCH_COMPILE_INJECTABLE__PRE_R3__ = render2CompileInjectable;
36317
36291
  const SWITCH_COMPILE_INJECTABLE = SWITCH_COMPILE_INJECTABLE__PRE_R3__;
36318
36292
 
36319
- /**
36320
- * @license
36321
- * Copyright Google LLC All Rights Reserved.
36322
- *
36323
- * Use of this source code is governed by an MIT-style license that can be
36324
- * found in the LICENSE file at https://angular.io/license
36325
- */
36326
- function findFirstClosedCycle(keys) {
36327
- const res = [];
36328
- for (let i = 0; i < keys.length; ++i) {
36329
- if (res.indexOf(keys[i]) > -1) {
36330
- res.push(keys[i]);
36331
- return res;
36332
- }
36333
- res.push(keys[i]);
36334
- }
36335
- return res;
36336
- }
36337
- function constructResolvingPath(keys) {
36338
- if (keys.length > 1) {
36339
- const reversed = findFirstClosedCycle(keys.slice().reverse());
36340
- const tokenStrs = reversed.map(k => stringify$1(k.token));
36341
- return ' (' + tokenStrs.join(' -> ') + ')';
36342
- }
36343
- return '';
36344
- }
36345
- function injectionError(injector, key, constructResolvingMessage, originalError) {
36346
- const keys = [key];
36347
- const errMsg = constructResolvingMessage(keys);
36348
- const error = (originalError ? wrappedError(errMsg, originalError) : Error(errMsg));
36349
- error.addKey = addKey;
36350
- error.keys = keys;
36351
- error.injectors = [injector];
36352
- error.constructResolvingMessage = constructResolvingMessage;
36353
- error[ERROR_ORIGINAL_ERROR] = originalError;
36354
- return error;
36355
- }
36356
- function addKey(injector, key) {
36357
- this.injectors.push(injector);
36358
- this.keys.push(key);
36359
- // Note: This updated message won't be reflected in the `.stack` property
36360
- this.message = this.constructResolvingMessage(this.keys);
36361
- }
36362
- /**
36363
- * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the
36364
- * {@link Injector} does not have a {@link Provider} for the given key.
36365
- *
36366
- * @usageNotes
36367
- * ### Example
36368
- *
36369
- * ```typescript
36370
- * class A {
36371
- * constructor(b:B) {}
36372
- * }
36373
- *
36374
- * expect(() => Injector.resolveAndCreate([A])).toThrowError();
36375
- * ```
36376
- */
36377
- function noProviderError(injector, key) {
36378
- return injectionError(injector, key, function (keys) {
36379
- const first = stringify$1(keys[0].token);
36380
- return `No provider for ${first}!${constructResolvingPath(keys)}`;
36381
- });
36382
- }
36383
- /**
36384
- * Thrown when dependencies form a cycle.
36385
- *
36386
- * @usageNotes
36387
- * ### Example
36388
- *
36389
- * ```typescript
36390
- * var injector = Injector.resolveAndCreate([
36391
- * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
36392
- * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
36393
- * ]);
36394
- *
36395
- * expect(() => injector.get("one")).toThrowError();
36396
- * ```
36397
- *
36398
- * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
36399
- */
36400
- function cyclicDependencyError(injector, key) {
36401
- return injectionError(injector, key, function (keys) {
36402
- return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
36403
- });
36404
- }
36405
- /**
36406
- * Thrown when a constructing type returns with an Error.
36407
- *
36408
- * The `InstantiationError` class contains the original error plus the dependency graph which caused
36409
- * this object to be instantiated.
36410
- *
36411
- * @usageNotes
36412
- * ### Example
36413
- *
36414
- * ```typescript
36415
- * class A {
36416
- * constructor() {
36417
- * throw new Error('message');
36418
- * }
36419
- * }
36420
- *
36421
- * var injector = Injector.resolveAndCreate([A]);
36422
-
36423
- * try {
36424
- * injector.get(A);
36425
- * } catch (e) {
36426
- * expect(e instanceof InstantiationError).toBe(true);
36427
- * expect(e.originalException.message).toEqual("message");
36428
- * expect(e.originalStack).toBeDefined();
36429
- * }
36430
- * ```
36431
- */
36432
- function instantiationError(injector, originalException, originalStack, key) {
36433
- return injectionError(injector, key, function (keys) {
36434
- const first = stringify$1(keys[0].token);
36435
- return `${originalException.message}: Error during instantiation of ${first}!${constructResolvingPath(keys)}.`;
36436
- }, originalException);
36437
- }
36438
- /**
36439
- * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector}
36440
- * creation.
36441
- *
36442
- * @usageNotes
36443
- * ### Example
36444
- *
36445
- * ```typescript
36446
- * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
36447
- * ```
36448
- */
36449
- function invalidProviderError(provider) {
36450
- return Error(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
36451
- }
36452
- /**
36453
- * Thrown when the class has no annotation information.
36454
- *
36455
- * Lack of annotation information prevents the {@link Injector} from determining which dependencies
36456
- * need to be injected into the constructor.
36457
- *
36458
- * @usageNotes
36459
- * ### Example
36460
- *
36461
- * ```typescript
36462
- * class A {
36463
- * constructor(b) {}
36464
- * }
36465
- *
36466
- * expect(() => Injector.resolveAndCreate([A])).toThrowError();
36467
- * ```
36468
- *
36469
- * This error is also thrown when the class not marked with {@link Injectable} has parameter types.
36470
- *
36471
- * ```typescript
36472
- * class B {}
36473
- *
36474
- * class A {
36475
- * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
36476
- * }
36477
- *
36478
- * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
36479
- * ```
36480
- *
36481
- */
36482
- function noAnnotationError(typeOrFunc, params) {
36483
- const signature = [];
36484
- for (let i = 0, ii = params.length; i < ii; i++) {
36485
- const parameter = params[i];
36486
- if (!parameter || parameter.length == 0) {
36487
- signature.push('?');
36488
- }
36489
- else {
36490
- signature.push(parameter.map(stringify$1).join(' '));
36491
- }
36492
- }
36493
- return Error('Cannot resolve all parameters for \'' + stringify$1(typeOrFunc) + '\'(' +
36494
- signature.join(', ') + '). ' +
36495
- 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
36496
- stringify$1(typeOrFunc) + '\' is decorated with Injectable.');
36497
- }
36498
- /**
36499
- * Thrown when getting an object by index.
36500
- *
36501
- * @usageNotes
36502
- * ### Example
36503
- *
36504
- * ```typescript
36505
- * class A {}
36506
- *
36507
- * var injector = Injector.resolveAndCreate([A]);
36508
- *
36509
- * expect(() => injector.getAt(100)).toThrowError();
36510
- * ```
36511
- *
36512
- */
36513
- function outOfBoundsError(index) {
36514
- return Error(`Index ${index} is out-of-bounds.`);
36515
- }
36516
- // TODO: add a working example after alpha38 is released
36517
- /**
36518
- * Thrown when a multi provider and a regular provider are bound to the same token.
36519
- *
36520
- * @usageNotes
36521
- * ### Example
36522
- *
36523
- * ```typescript
36524
- * expect(() => Injector.resolveAndCreate([
36525
- * { provide: "Strings", useValue: "string1", multi: true},
36526
- * { provide: "Strings", useValue: "string2", multi: false}
36527
- * ])).toThrowError();
36528
- * ```
36529
- */
36530
- function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
36531
- return Error(`Cannot mix multi providers and regular providers, got: ${provider1} ${provider2}`);
36532
- }
36533
-
36534
- /**
36535
- * @license
36536
- * Copyright Google LLC All Rights Reserved.
36537
- *
36538
- * Use of this source code is governed by an MIT-style license that can be
36539
- * found in the LICENSE file at https://angular.io/license
36540
- */
36541
- /**
36542
- * A unique object used for retrieving items from the {@link ReflectiveInjector}.
36543
- *
36544
- * Keys have:
36545
- * - a system-wide unique `id`.
36546
- * - a `token`.
36547
- *
36548
- * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows
36549
- * the
36550
- * injector to store created objects in a more efficient way.
36551
- *
36552
- * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
36553
- * resolving
36554
- * providers.
36555
- *
36556
- * @deprecated No replacement
36557
- * @publicApi
36558
- */
36559
- class ReflectiveKey {
36560
- /**
36561
- * Private
36562
- */
36563
- constructor(token, id) {
36564
- this.token = token;
36565
- this.id = id;
36566
- if (!token) {
36567
- throw new Error('Token must be defined!');
36568
- }
36569
- this.displayName = stringify$1(this.token);
36570
- }
36571
- /**
36572
- * Retrieves a `Key` for a token.
36573
- */
36574
- static get(token) {
36575
- return _globalKeyRegistry.get(resolveForwardRef$1(token));
36576
- }
36577
- /**
36578
- * @returns the number of keys registered in the system.
36579
- */
36580
- static get numberOfKeys() {
36581
- return _globalKeyRegistry.numberOfKeys;
36582
- }
36583
- }
36584
- class KeyRegistry {
36585
- constructor() {
36586
- this._allKeys = new Map();
36587
- }
36588
- get(token) {
36589
- if (token instanceof ReflectiveKey)
36590
- return token;
36591
- if (this._allKeys.has(token)) {
36592
- return this._allKeys.get(token);
36593
- }
36594
- const newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
36595
- this._allKeys.set(token, newKey);
36596
- return newKey;
36597
- }
36598
- get numberOfKeys() {
36599
- return this._allKeys.size;
36600
- }
36601
- }
36602
- const _globalKeyRegistry = new KeyRegistry();
36603
-
36604
- /**
36605
- * @license
36606
- * Copyright Google LLC All Rights Reserved.
36607
- *
36608
- * Use of this source code is governed by an MIT-style license that can be
36609
- * found in the LICENSE file at https://angular.io/license
36610
- */
36611
- /**
36612
- * Provides access to reflection data about symbols. Used internally by Angular
36613
- * to power dependency injection and compilation.
36614
- */
36615
- class Reflector {
36616
- constructor(reflectionCapabilities) {
36617
- this.reflectionCapabilities = reflectionCapabilities;
36618
- }
36619
- updateCapabilities(caps) {
36620
- this.reflectionCapabilities = caps;
36621
- }
36622
- factory(type) {
36623
- return this.reflectionCapabilities.factory(type);
36624
- }
36625
- parameters(typeOrFunc) {
36626
- return this.reflectionCapabilities.parameters(typeOrFunc);
36627
- }
36628
- annotations(typeOrFunc) {
36629
- return this.reflectionCapabilities.annotations(typeOrFunc);
36630
- }
36631
- propMetadata(typeOrFunc) {
36632
- return this.reflectionCapabilities.propMetadata(typeOrFunc);
36633
- }
36634
- hasLifecycleHook(type, lcProperty) {
36635
- return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
36636
- }
36637
- getter(name) {
36638
- return this.reflectionCapabilities.getter(name);
36639
- }
36640
- setter(name) {
36641
- return this.reflectionCapabilities.setter(name);
36642
- }
36643
- method(name) {
36644
- return this.reflectionCapabilities.method(name);
36645
- }
36646
- importUri(type) {
36647
- return this.reflectionCapabilities.importUri(type);
36648
- }
36649
- resourceUri(type) {
36650
- return this.reflectionCapabilities.resourceUri(type);
36651
- }
36652
- resolveIdentifier(name, moduleUrl, members, runtime) {
36653
- return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
36654
- }
36655
- resolveEnum(identifier, name) {
36656
- return this.reflectionCapabilities.resolveEnum(identifier, name);
36657
- }
36658
- }
36659
-
36660
- /**
36661
- * @license
36662
- * Copyright Google LLC All Rights Reserved.
36663
- *
36664
- * Use of this source code is governed by an MIT-style license that can be
36665
- * found in the LICENSE file at https://angular.io/license
36666
- */
36667
- /**
36668
- * The {@link Reflector} used internally in Angular to access metadata
36669
- * about symbols.
36670
- */
36671
- const reflector = new Reflector(new ReflectionCapabilities());
36672
-
36673
- /**
36674
- * @license
36675
- * Copyright Google LLC All Rights Reserved.
36676
- *
36677
- * Use of this source code is governed by an MIT-style license that can be
36678
- * found in the LICENSE file at https://angular.io/license
36679
- */
36680
- /**
36681
- * `Dependency` is used by the framework to extend DI.
36682
- * This is internal to Angular and should not be used directly.
36683
- */
36684
- class ReflectiveDependency {
36685
- constructor(key, optional, visibility) {
36686
- this.key = key;
36687
- this.optional = optional;
36688
- this.visibility = visibility;
36689
- }
36690
- static fromKey(key) {
36691
- return new ReflectiveDependency(key, false, null);
36692
- }
36693
- }
36694
- const _EMPTY_LIST = [];
36695
- class ResolvedReflectiveProvider_ {
36696
- constructor(key, resolvedFactories, multiProvider) {
36697
- this.key = key;
36698
- this.resolvedFactories = resolvedFactories;
36699
- this.multiProvider = multiProvider;
36700
- this.resolvedFactory = this.resolvedFactories[0];
36701
- }
36702
- }
36703
- /**
36704
- * An internal resolved representation of a factory function created by resolving `Provider`.
36705
- * @publicApi
36706
- */
36707
- class ResolvedReflectiveFactory {
36708
- constructor(
36709
- /**
36710
- * Factory function which can return an instance of an object represented by a key.
36711
- */
36712
- factory,
36713
- /**
36714
- * Arguments (dependencies) to the `factory` function.
36715
- */
36716
- dependencies) {
36717
- this.factory = factory;
36718
- this.dependencies = dependencies;
36719
- }
36720
- }
36721
- /**
36722
- * Resolve a single provider.
36723
- */
36724
- function resolveReflectiveFactory(provider) {
36725
- let factoryFn;
36726
- let resolvedDeps;
36727
- if (provider.useClass) {
36728
- const useClass = resolveForwardRef$1(provider.useClass);
36729
- factoryFn = reflector.factory(useClass);
36730
- resolvedDeps = _dependenciesFor(useClass);
36731
- }
36732
- else if (provider.useExisting) {
36733
- factoryFn = (aliasInstance) => aliasInstance;
36734
- resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
36735
- }
36736
- else if (provider.useFactory) {
36737
- factoryFn = provider.useFactory;
36738
- resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
36739
- }
36740
- else {
36741
- factoryFn = () => provider.useValue;
36742
- resolvedDeps = _EMPTY_LIST;
36743
- }
36744
- return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
36745
- }
36746
- /**
36747
- * Converts the `Provider` into `ResolvedProvider`.
36748
- *
36749
- * `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider
36750
- * syntax.
36751
- */
36752
- function resolveReflectiveProvider(provider) {
36753
- return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
36754
- }
36755
- /**
36756
- * Resolve a list of Providers.
36757
- */
36758
- function resolveReflectiveProviders(providers) {
36759
- const normalized = _normalizeProviders(providers, []);
36760
- const resolved = normalized.map(resolveReflectiveProvider);
36761
- const resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
36762
- return Array.from(resolvedProviderMap.values());
36763
- }
36764
- /**
36765
- * Merges a list of ResolvedProviders into a list where each key is contained exactly once and
36766
- * multi providers have been merged.
36767
- */
36768
- function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
36769
- for (let i = 0; i < providers.length; i++) {
36770
- const provider = providers[i];
36771
- const existing = normalizedProvidersMap.get(provider.key.id);
36772
- if (existing) {
36773
- if (provider.multiProvider !== existing.multiProvider) {
36774
- throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
36775
- }
36776
- if (provider.multiProvider) {
36777
- for (let j = 0; j < provider.resolvedFactories.length; j++) {
36778
- existing.resolvedFactories.push(provider.resolvedFactories[j]);
36779
- }
36780
- }
36781
- else {
36782
- normalizedProvidersMap.set(provider.key.id, provider);
36783
- }
36784
- }
36785
- else {
36786
- let resolvedProvider;
36787
- if (provider.multiProvider) {
36788
- resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
36789
- }
36790
- else {
36791
- resolvedProvider = provider;
36792
- }
36793
- normalizedProvidersMap.set(provider.key.id, resolvedProvider);
36794
- }
36795
- }
36796
- return normalizedProvidersMap;
36797
- }
36798
- function _normalizeProviders(providers, res) {
36799
- providers.forEach(b => {
36800
- if (b instanceof Type$2) {
36801
- res.push({ provide: b, useClass: b });
36802
- }
36803
- else if (b && typeof b == 'object' && b.provide !== undefined) {
36804
- res.push(b);
36805
- }
36806
- else if (Array.isArray(b)) {
36807
- _normalizeProviders(b, res);
36808
- }
36809
- else {
36810
- throw invalidProviderError(b);
36811
- }
36812
- });
36813
- return res;
36814
- }
36815
- function constructDependencies(typeOrFunc, dependencies) {
36816
- if (!dependencies) {
36817
- return _dependenciesFor(typeOrFunc);
36818
- }
36819
- else {
36820
- const params = dependencies.map(t => [t]);
36821
- return dependencies.map(t => _extractToken(typeOrFunc, t, params));
36822
- }
36823
- }
36824
- function _dependenciesFor(typeOrFunc) {
36825
- const params = reflector.parameters(typeOrFunc);
36826
- if (!params)
36827
- return [];
36828
- if (params.some(p => p == null)) {
36829
- throw noAnnotationError(typeOrFunc, params);
36830
- }
36831
- return params.map(p => _extractToken(typeOrFunc, p, params));
36832
- }
36833
- function _extractToken(typeOrFunc, metadata, params) {
36834
- let token = null;
36835
- let optional = false;
36836
- if (!Array.isArray(metadata)) {
36837
- if (metadata instanceof Inject) {
36838
- return _createDependency(metadata.token, optional, null);
36839
- }
36840
- else {
36841
- return _createDependency(metadata, optional, null);
36842
- }
36843
- }
36844
- let visibility = null;
36845
- for (let i = 0; i < metadata.length; ++i) {
36846
- const paramMetadata = metadata[i];
36847
- if (paramMetadata instanceof Type$2) {
36848
- token = paramMetadata;
36849
- }
36850
- else if (paramMetadata instanceof Inject) {
36851
- token = paramMetadata.token;
36852
- }
36853
- else if (paramMetadata instanceof Optional) {
36854
- optional = true;
36855
- }
36856
- else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
36857
- visibility = paramMetadata;
36858
- }
36859
- else if (paramMetadata instanceof InjectionToken) {
36860
- token = paramMetadata;
36861
- }
36862
- }
36863
- token = resolveForwardRef$1(token);
36864
- if (token != null) {
36865
- return _createDependency(token, optional, visibility);
36866
- }
36867
- else {
36868
- throw noAnnotationError(typeOrFunc, params);
36869
- }
36870
- }
36871
- function _createDependency(token, optional, visibility) {
36872
- return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
36873
- }
36874
-
36875
- /**
36876
- * @license
36877
- * Copyright Google LLC All Rights Reserved.
36878
- *
36879
- * Use of this source code is governed by an MIT-style license that can be
36880
- * found in the LICENSE file at https://angular.io/license
36881
- */
36882
- // Threshold for the dynamic version
36883
- const UNDEFINED = {};
36884
- /**
36885
- * A ReflectiveDependency injection container used for instantiating objects and resolving
36886
- * dependencies.
36887
- *
36888
- * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
36889
- * constructor dependencies.
36890
- *
36891
- * In typical use, application code asks for the dependencies in the constructor and they are
36892
- * resolved by the `Injector`.
36893
- *
36894
- * @usageNotes
36895
- * ### Example
36896
- *
36897
- * The following example creates an `Injector` configured to create `Engine` and `Car`.
36898
- *
36899
- * ```typescript
36900
- * @Injectable()
36901
- * class Engine {
36902
- * }
36903
- *
36904
- * @Injectable()
36905
- * class Car {
36906
- * constructor(public engine:Engine) {}
36907
- * }
36908
- *
36909
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
36910
- * var car = injector.get(Car);
36911
- * expect(car instanceof Car).toBe(true);
36912
- * expect(car.engine instanceof Engine).toBe(true);
36913
- * ```
36914
- *
36915
- * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
36916
- * resolve all of the object's dependencies automatically.
36917
- *
36918
- * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
36919
- * @publicApi
36920
- */
36921
- class ReflectiveInjector {
36922
- /**
36923
- * Turns an array of provider definitions into an array of resolved providers.
36924
- *
36925
- * A resolution is a process of flattening multiple nested arrays and converting individual
36926
- * providers into an array of `ResolvedReflectiveProvider`s.
36927
- *
36928
- * @usageNotes
36929
- * ### Example
36930
- *
36931
- * ```typescript
36932
- * @Injectable()
36933
- * class Engine {
36934
- * }
36935
- *
36936
- * @Injectable()
36937
- * class Car {
36938
- * constructor(public engine:Engine) {}
36939
- * }
36940
- *
36941
- * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
36942
- *
36943
- * expect(providers.length).toEqual(2);
36944
- *
36945
- * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
36946
- * expect(providers[0].key.displayName).toBe("Car");
36947
- * expect(providers[0].dependencies.length).toEqual(1);
36948
- * expect(providers[0].factory).toBeDefined();
36949
- *
36950
- * expect(providers[1].key.displayName).toBe("Engine");
36951
- * });
36952
- * ```
36953
- *
36954
- */
36955
- static resolve(providers) {
36956
- return resolveReflectiveProviders(providers);
36957
- }
36958
- /**
36959
- * Resolves an array of providers and creates an injector from those providers.
36960
- *
36961
- * The passed-in providers can be an array of `Type`, `Provider`,
36962
- * or a recursive array of more providers.
36963
- *
36964
- * @usageNotes
36965
- * ### Example
36966
- *
36967
- * ```typescript
36968
- * @Injectable()
36969
- * class Engine {
36970
- * }
36971
- *
36972
- * @Injectable()
36973
- * class Car {
36974
- * constructor(public engine:Engine) {}
36975
- * }
36976
- *
36977
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
36978
- * expect(injector.get(Car) instanceof Car).toBe(true);
36979
- * ```
36980
- */
36981
- static resolveAndCreate(providers, parent) {
36982
- const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
36983
- return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
36984
- }
36985
- /**
36986
- * Creates an injector from previously resolved providers.
36987
- *
36988
- * This API is the recommended way to construct injectors in performance-sensitive parts.
36989
- *
36990
- * @usageNotes
36991
- * ### Example
36992
- *
36993
- * ```typescript
36994
- * @Injectable()
36995
- * class Engine {
36996
- * }
36997
- *
36998
- * @Injectable()
36999
- * class Car {
37000
- * constructor(public engine:Engine) {}
37001
- * }
37002
- *
37003
- * var providers = ReflectiveInjector.resolve([Car, Engine]);
37004
- * var injector = ReflectiveInjector.fromResolvedProviders(providers);
37005
- * expect(injector.get(Car) instanceof Car).toBe(true);
37006
- * ```
37007
- */
37008
- static fromResolvedProviders(providers, parent) {
37009
- return new ReflectiveInjector_(providers, parent);
37010
- }
37011
- }
37012
- class ReflectiveInjector_ {
37013
- /**
37014
- * Private
37015
- */
37016
- constructor(_providers, _parent) {
37017
- /** @internal */
37018
- this._constructionCounter = 0;
37019
- this._providers = _providers;
37020
- this.parent = _parent || null;
37021
- const len = _providers.length;
37022
- this.keyIds = [];
37023
- this.objs = [];
37024
- for (let i = 0; i < len; i++) {
37025
- this.keyIds[i] = _providers[i].key.id;
37026
- this.objs[i] = UNDEFINED;
37027
- }
37028
- }
37029
- get(token, notFoundValue = THROW_IF_NOT_FOUND) {
37030
- return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
37031
- }
37032
- resolveAndCreateChild(providers) {
37033
- const ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
37034
- return this.createChildFromResolved(ResolvedReflectiveProviders);
37035
- }
37036
- createChildFromResolved(providers) {
37037
- const inj = new ReflectiveInjector_(providers);
37038
- inj.parent = this;
37039
- return inj;
37040
- }
37041
- resolveAndInstantiate(provider) {
37042
- return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
37043
- }
37044
- instantiateResolved(provider) {
37045
- return this._instantiateProvider(provider);
37046
- }
37047
- getProviderAtIndex(index) {
37048
- if (index < 0 || index >= this._providers.length) {
37049
- throw outOfBoundsError(index);
37050
- }
37051
- return this._providers[index];
37052
- }
37053
- /** @internal */
37054
- _new(provider) {
37055
- if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
37056
- throw cyclicDependencyError(this, provider.key);
37057
- }
37058
- return this._instantiateProvider(provider);
37059
- }
37060
- _getMaxNumberOfObjects() {
37061
- return this.objs.length;
37062
- }
37063
- _instantiateProvider(provider) {
37064
- if (provider.multiProvider) {
37065
- const res = [];
37066
- for (let i = 0; i < provider.resolvedFactories.length; ++i) {
37067
- res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
37068
- }
37069
- return res;
37070
- }
37071
- else {
37072
- return this._instantiate(provider, provider.resolvedFactories[0]);
37073
- }
37074
- }
37075
- _instantiate(provider, ResolvedReflectiveFactory) {
37076
- const factory = ResolvedReflectiveFactory.factory;
37077
- let deps;
37078
- try {
37079
- deps =
37080
- ResolvedReflectiveFactory.dependencies.map(dep => this._getByReflectiveDependency(dep));
37081
- }
37082
- catch (e) {
37083
- if (e.addKey) {
37084
- e.addKey(this, provider.key);
37085
- }
37086
- throw e;
37087
- }
37088
- let obj;
37089
- try {
37090
- obj = factory(...deps);
37091
- }
37092
- catch (e) {
37093
- throw instantiationError(this, e, e.stack, provider.key);
37094
- }
37095
- return obj;
37096
- }
37097
- _getByReflectiveDependency(dep) {
37098
- return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
37099
- }
37100
- _getByKey(key, visibility, notFoundValue) {
37101
- if (key === ReflectiveInjector_.INJECTOR_KEY) {
37102
- return this;
37103
- }
37104
- if (visibility instanceof Self) {
37105
- return this._getByKeySelf(key, notFoundValue);
37106
- }
37107
- else {
37108
- return this._getByKeyDefault(key, notFoundValue, visibility);
37109
- }
37110
- }
37111
- _getObjByKeyId(keyId) {
37112
- for (let i = 0; i < this.keyIds.length; i++) {
37113
- if (this.keyIds[i] === keyId) {
37114
- if (this.objs[i] === UNDEFINED) {
37115
- this.objs[i] = this._new(this._providers[i]);
37116
- }
37117
- return this.objs[i];
37118
- }
37119
- }
37120
- return UNDEFINED;
37121
- }
37122
- /** @internal */
37123
- _throwOrNull(key, notFoundValue) {
37124
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
37125
- return notFoundValue;
37126
- }
37127
- else {
37128
- throw noProviderError(this, key);
37129
- }
37130
- }
37131
- /** @internal */
37132
- _getByKeySelf(key, notFoundValue) {
37133
- const obj = this._getObjByKeyId(key.id);
37134
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
37135
- }
37136
- /** @internal */
37137
- _getByKeyDefault(key, notFoundValue, visibility) {
37138
- let inj;
37139
- if (visibility instanceof SkipSelf) {
37140
- inj = this.parent;
37141
- }
37142
- else {
37143
- inj = this;
37144
- }
37145
- while (inj instanceof ReflectiveInjector_) {
37146
- const inj_ = inj;
37147
- const obj = inj_._getObjByKeyId(key.id);
37148
- if (obj !== UNDEFINED)
37149
- return obj;
37150
- inj = inj_.parent;
37151
- }
37152
- if (inj !== null) {
37153
- return inj.get(key.token, notFoundValue);
37154
- }
37155
- else {
37156
- return this._throwOrNull(key, notFoundValue);
37157
- }
37158
- }
37159
- get displayName() {
37160
- const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
37161
- .join(', ');
37162
- return `ReflectiveInjector(providers: [${providers}])`;
37163
- }
37164
- toString() {
37165
- return this.displayName;
37166
- }
37167
- }
37168
- ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
37169
- function _mapProviders(injector, fn) {
37170
- const res = [];
37171
- for (let i = 0; i < injector._providers.length; ++i) {
37172
- res[i] = fn(injector.getProviderAtIndex(i));
37173
- }
37174
- return res;
37175
- }
37176
-
37177
36293
  /**
37178
36294
  * @license
37179
36295
  * Copyright Google LLC All Rights Reserved.
@@ -37397,7 +36513,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
37397
36513
  */
37398
36514
  class ComponentFactoryResolver {
37399
36515
  }
37400
- ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
36516
+ ComponentFactoryResolver.NULL = ( /* @__PURE__ */new _NullComponentFactoryResolver());
37401
36517
  class ComponentFactoryBoundToModule extends ComponentFactory {
37402
36518
  constructor(factory, ngModule) {
37403
36519
  super();
@@ -37554,7 +36670,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
37554
36670
  /**
37555
36671
  * @publicApi
37556
36672
  */
37557
- const VERSION$2 = new Version$1('13.0.0-next.3');
36673
+ const VERSION$2 = new Version$1('13.0.0-next.7');
37558
36674
 
37559
36675
  /**
37560
36676
  * @license