@angular-eslint/bundled-angular-compiler 18.0.2-alpha.1 → 18.0.2-alpha.11
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.
- package/dist/index.js +312 -70
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @license Angular v18.0.
|
|
4
|
+
* @license Angular v18.0.5
|
|
5
5
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
6
6
|
* License: MIT
|
|
7
7
|
*/
|
|
@@ -2886,6 +2886,9 @@ class Identifiers {
|
|
|
2886
2886
|
static { this.twoWayProperty = { name: 'ɵɵtwoWayProperty', moduleName: CORE }; }
|
|
2887
2887
|
static { this.twoWayBindingSet = { name: 'ɵɵtwoWayBindingSet', moduleName: CORE }; }
|
|
2888
2888
|
static { this.twoWayListener = { name: 'ɵɵtwoWayListener', moduleName: CORE }; }
|
|
2889
|
+
static { this.declareLet = { name: 'ɵɵdeclareLet', moduleName: CORE }; }
|
|
2890
|
+
static { this.storeLet = { name: 'ɵɵstoreLet', moduleName: CORE }; }
|
|
2891
|
+
static { this.readContextLet = { name: 'ɵɵreadContextLet', moduleName: CORE }; }
|
|
2889
2892
|
static { this.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE }; }
|
|
2890
2893
|
static { this.InheritDefinitionFeature = {
|
|
2891
2894
|
name: 'ɵɵInheritDefinitionFeature',
|
|
@@ -8204,46 +8207,54 @@ var OpKind;
|
|
|
8204
8207
|
* An operation declaring the event side of a two-way binding.
|
|
8205
8208
|
*/
|
|
8206
8209
|
OpKind[OpKind["TwoWayListener"] = 37] = "TwoWayListener";
|
|
8210
|
+
/**
|
|
8211
|
+
* A creation-time operation that initializes the slot for a `@let` declaration.
|
|
8212
|
+
*/
|
|
8213
|
+
OpKind[OpKind["DeclareLet"] = 38] = "DeclareLet";
|
|
8214
|
+
/**
|
|
8215
|
+
* An update-time operation that stores the current value of a `@let` declaration.
|
|
8216
|
+
*/
|
|
8217
|
+
OpKind[OpKind["StoreLet"] = 39] = "StoreLet";
|
|
8207
8218
|
/**
|
|
8208
8219
|
* The start of an i18n block.
|
|
8209
8220
|
*/
|
|
8210
|
-
OpKind[OpKind["I18nStart"] =
|
|
8221
|
+
OpKind[OpKind["I18nStart"] = 40] = "I18nStart";
|
|
8211
8222
|
/**
|
|
8212
8223
|
* A self-closing i18n on a single element.
|
|
8213
8224
|
*/
|
|
8214
|
-
OpKind[OpKind["I18n"] =
|
|
8225
|
+
OpKind[OpKind["I18n"] = 41] = "I18n";
|
|
8215
8226
|
/**
|
|
8216
8227
|
* The end of an i18n block.
|
|
8217
8228
|
*/
|
|
8218
|
-
OpKind[OpKind["I18nEnd"] =
|
|
8229
|
+
OpKind[OpKind["I18nEnd"] = 42] = "I18nEnd";
|
|
8219
8230
|
/**
|
|
8220
8231
|
* An expression in an i18n message.
|
|
8221
8232
|
*/
|
|
8222
|
-
OpKind[OpKind["I18nExpression"] =
|
|
8233
|
+
OpKind[OpKind["I18nExpression"] = 43] = "I18nExpression";
|
|
8223
8234
|
/**
|
|
8224
8235
|
* An instruction that applies a set of i18n expressions.
|
|
8225
8236
|
*/
|
|
8226
|
-
OpKind[OpKind["I18nApply"] =
|
|
8237
|
+
OpKind[OpKind["I18nApply"] = 44] = "I18nApply";
|
|
8227
8238
|
/**
|
|
8228
8239
|
* An instruction to create an ICU expression.
|
|
8229
8240
|
*/
|
|
8230
|
-
OpKind[OpKind["IcuStart"] =
|
|
8241
|
+
OpKind[OpKind["IcuStart"] = 45] = "IcuStart";
|
|
8231
8242
|
/**
|
|
8232
8243
|
* An instruction to update an ICU expression.
|
|
8233
8244
|
*/
|
|
8234
|
-
OpKind[OpKind["IcuEnd"] =
|
|
8245
|
+
OpKind[OpKind["IcuEnd"] = 46] = "IcuEnd";
|
|
8235
8246
|
/**
|
|
8236
8247
|
* An instruction representing a placeholder in an ICU expression.
|
|
8237
8248
|
*/
|
|
8238
|
-
OpKind[OpKind["IcuPlaceholder"] =
|
|
8249
|
+
OpKind[OpKind["IcuPlaceholder"] = 47] = "IcuPlaceholder";
|
|
8239
8250
|
/**
|
|
8240
8251
|
* An i18n context containing information needed to generate an i18n message.
|
|
8241
8252
|
*/
|
|
8242
|
-
OpKind[OpKind["I18nContext"] =
|
|
8253
|
+
OpKind[OpKind["I18nContext"] = 48] = "I18nContext";
|
|
8243
8254
|
/**
|
|
8244
8255
|
* A creation op that corresponds to i18n attributes on an element.
|
|
8245
8256
|
*/
|
|
8246
|
-
OpKind[OpKind["I18nAttributes"] =
|
|
8257
|
+
OpKind[OpKind["I18nAttributes"] = 49] = "I18nAttributes";
|
|
8247
8258
|
})(OpKind || (OpKind = {}));
|
|
8248
8259
|
/**
|
|
8249
8260
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -8274,78 +8285,86 @@ var ExpressionKind;
|
|
|
8274
8285
|
* Runtime operation to retrieve the value of a local reference.
|
|
8275
8286
|
*/
|
|
8276
8287
|
ExpressionKind[ExpressionKind["Reference"] = 5] = "Reference";
|
|
8288
|
+
/**
|
|
8289
|
+
* A call storing the value of a `@let` declaration.
|
|
8290
|
+
*/
|
|
8291
|
+
ExpressionKind[ExpressionKind["StoreLet"] = 6] = "StoreLet";
|
|
8292
|
+
/**
|
|
8293
|
+
* A reference to a `@let` declaration read from the context view.
|
|
8294
|
+
*/
|
|
8295
|
+
ExpressionKind[ExpressionKind["ContextLetReference"] = 7] = "ContextLetReference";
|
|
8277
8296
|
/**
|
|
8278
8297
|
* Runtime operation to snapshot the current view context.
|
|
8279
8298
|
*/
|
|
8280
|
-
ExpressionKind[ExpressionKind["GetCurrentView"] =
|
|
8299
|
+
ExpressionKind[ExpressionKind["GetCurrentView"] = 8] = "GetCurrentView";
|
|
8281
8300
|
/**
|
|
8282
8301
|
* Runtime operation to restore a snapshotted view.
|
|
8283
8302
|
*/
|
|
8284
|
-
ExpressionKind[ExpressionKind["RestoreView"] =
|
|
8303
|
+
ExpressionKind[ExpressionKind["RestoreView"] = 9] = "RestoreView";
|
|
8285
8304
|
/**
|
|
8286
8305
|
* Runtime operation to reset the current view context after `RestoreView`.
|
|
8287
8306
|
*/
|
|
8288
|
-
ExpressionKind[ExpressionKind["ResetView"] =
|
|
8307
|
+
ExpressionKind[ExpressionKind["ResetView"] = 10] = "ResetView";
|
|
8289
8308
|
/**
|
|
8290
8309
|
* Defines and calls a function with change-detected arguments.
|
|
8291
8310
|
*/
|
|
8292
|
-
ExpressionKind[ExpressionKind["PureFunctionExpr"] =
|
|
8311
|
+
ExpressionKind[ExpressionKind["PureFunctionExpr"] = 11] = "PureFunctionExpr";
|
|
8293
8312
|
/**
|
|
8294
8313
|
* Indicates a positional parameter to a pure function definition.
|
|
8295
8314
|
*/
|
|
8296
|
-
ExpressionKind[ExpressionKind["PureFunctionParameterExpr"] =
|
|
8315
|
+
ExpressionKind[ExpressionKind["PureFunctionParameterExpr"] = 12] = "PureFunctionParameterExpr";
|
|
8297
8316
|
/**
|
|
8298
8317
|
* Binding to a pipe transformation.
|
|
8299
8318
|
*/
|
|
8300
|
-
ExpressionKind[ExpressionKind["PipeBinding"] =
|
|
8319
|
+
ExpressionKind[ExpressionKind["PipeBinding"] = 13] = "PipeBinding";
|
|
8301
8320
|
/**
|
|
8302
8321
|
* Binding to a pipe transformation with a variable number of arguments.
|
|
8303
8322
|
*/
|
|
8304
|
-
ExpressionKind[ExpressionKind["PipeBindingVariadic"] =
|
|
8323
|
+
ExpressionKind[ExpressionKind["PipeBindingVariadic"] = 14] = "PipeBindingVariadic";
|
|
8305
8324
|
/*
|
|
8306
8325
|
* A safe property read requiring expansion into a null check.
|
|
8307
8326
|
*/
|
|
8308
|
-
ExpressionKind[ExpressionKind["SafePropertyRead"] =
|
|
8327
|
+
ExpressionKind[ExpressionKind["SafePropertyRead"] = 15] = "SafePropertyRead";
|
|
8309
8328
|
/**
|
|
8310
8329
|
* A safe keyed read requiring expansion into a null check.
|
|
8311
8330
|
*/
|
|
8312
|
-
ExpressionKind[ExpressionKind["SafeKeyedRead"] =
|
|
8331
|
+
ExpressionKind[ExpressionKind["SafeKeyedRead"] = 16] = "SafeKeyedRead";
|
|
8313
8332
|
/**
|
|
8314
8333
|
* A safe function call requiring expansion into a null check.
|
|
8315
8334
|
*/
|
|
8316
|
-
ExpressionKind[ExpressionKind["SafeInvokeFunction"] =
|
|
8335
|
+
ExpressionKind[ExpressionKind["SafeInvokeFunction"] = 17] = "SafeInvokeFunction";
|
|
8317
8336
|
/**
|
|
8318
8337
|
* An intermediate expression that will be expanded from a safe read into an explicit ternary.
|
|
8319
8338
|
*/
|
|
8320
|
-
ExpressionKind[ExpressionKind["SafeTernaryExpr"] =
|
|
8339
|
+
ExpressionKind[ExpressionKind["SafeTernaryExpr"] = 18] = "SafeTernaryExpr";
|
|
8321
8340
|
/**
|
|
8322
8341
|
* An empty expression that will be stipped before generating the final output.
|
|
8323
8342
|
*/
|
|
8324
|
-
ExpressionKind[ExpressionKind["EmptyExpr"] =
|
|
8343
|
+
ExpressionKind[ExpressionKind["EmptyExpr"] = 19] = "EmptyExpr";
|
|
8325
8344
|
/*
|
|
8326
8345
|
* An assignment to a temporary variable.
|
|
8327
8346
|
*/
|
|
8328
|
-
ExpressionKind[ExpressionKind["AssignTemporaryExpr"] =
|
|
8347
|
+
ExpressionKind[ExpressionKind["AssignTemporaryExpr"] = 20] = "AssignTemporaryExpr";
|
|
8329
8348
|
/**
|
|
8330
8349
|
* A reference to a temporary variable.
|
|
8331
8350
|
*/
|
|
8332
|
-
ExpressionKind[ExpressionKind["ReadTemporaryExpr"] =
|
|
8351
|
+
ExpressionKind[ExpressionKind["ReadTemporaryExpr"] = 21] = "ReadTemporaryExpr";
|
|
8333
8352
|
/**
|
|
8334
8353
|
* An expression that will cause a literal slot index to be emitted.
|
|
8335
8354
|
*/
|
|
8336
|
-
ExpressionKind[ExpressionKind["SlotLiteralExpr"] =
|
|
8355
|
+
ExpressionKind[ExpressionKind["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
|
|
8337
8356
|
/**
|
|
8338
8357
|
* A test expression for a conditional op.
|
|
8339
8358
|
*/
|
|
8340
|
-
ExpressionKind[ExpressionKind["ConditionalCase"] =
|
|
8359
|
+
ExpressionKind[ExpressionKind["ConditionalCase"] = 23] = "ConditionalCase";
|
|
8341
8360
|
/**
|
|
8342
8361
|
* An expression that will be automatically extracted to the component const array.
|
|
8343
8362
|
*/
|
|
8344
|
-
ExpressionKind[ExpressionKind["ConstCollected"] =
|
|
8363
|
+
ExpressionKind[ExpressionKind["ConstCollected"] = 24] = "ConstCollected";
|
|
8345
8364
|
/**
|
|
8346
8365
|
* Operation that sets the value of a two-way binding.
|
|
8347
8366
|
*/
|
|
8348
|
-
ExpressionKind[ExpressionKind["TwoWayBindingSet"] =
|
|
8367
|
+
ExpressionKind[ExpressionKind["TwoWayBindingSet"] = 25] = "TwoWayBindingSet";
|
|
8349
8368
|
})(ExpressionKind || (ExpressionKind = {}));
|
|
8350
8369
|
var VariableFlags;
|
|
8351
8370
|
(function (VariableFlags) {
|
|
@@ -8566,11 +8585,8 @@ const TRAIT_CONSUMES_VARS = {
|
|
|
8566
8585
|
function hasConsumesSlotTrait(op) {
|
|
8567
8586
|
return op[ConsumesSlot] === true;
|
|
8568
8587
|
}
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
*/
|
|
8572
|
-
function hasDependsOnSlotContextTrait(op) {
|
|
8573
|
-
return op[DependsOnSlotContext] === true;
|
|
8588
|
+
function hasDependsOnSlotContextTrait(value) {
|
|
8589
|
+
return value[DependsOnSlotContext] === true;
|
|
8574
8590
|
}
|
|
8575
8591
|
function hasConsumesVarsTrait(value) {
|
|
8576
8592
|
return value[ConsumesVarsTrait] === true;
|
|
@@ -8868,8 +8884,23 @@ function createI18nApplyOp(owner, handle, sourceSpan) {
|
|
|
8868
8884
|
...NEW_OP,
|
|
8869
8885
|
};
|
|
8870
8886
|
}
|
|
8887
|
+
/**
|
|
8888
|
+
* Creates a `StoreLetOp`.
|
|
8889
|
+
*/
|
|
8890
|
+
function createStoreLetOp(target, declaredName, value, sourceSpan) {
|
|
8891
|
+
return {
|
|
8892
|
+
kind: OpKind.StoreLet,
|
|
8893
|
+
target,
|
|
8894
|
+
declaredName,
|
|
8895
|
+
value,
|
|
8896
|
+
sourceSpan,
|
|
8897
|
+
...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
|
|
8898
|
+
...TRAIT_CONSUMES_VARS,
|
|
8899
|
+
...NEW_OP,
|
|
8900
|
+
};
|
|
8901
|
+
}
|
|
8871
8902
|
|
|
8872
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8903
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8873
8904
|
/**
|
|
8874
8905
|
* Check whether a given `o.Expression` is a logical IR expression type.
|
|
8875
8906
|
*/
|
|
@@ -8931,6 +8962,50 @@ class ReferenceExpr extends ExpressionBase {
|
|
|
8931
8962
|
return new ReferenceExpr(this.target, this.targetSlot, this.offset);
|
|
8932
8963
|
}
|
|
8933
8964
|
}
|
|
8965
|
+
class StoreLetExpr extends ExpressionBase {
|
|
8966
|
+
static { _a = ConsumesVarsTrait, _b = DependsOnSlotContext; }
|
|
8967
|
+
constructor(target, value, sourceSpan) {
|
|
8968
|
+
super();
|
|
8969
|
+
this.target = target;
|
|
8970
|
+
this.value = value;
|
|
8971
|
+
this.sourceSpan = sourceSpan;
|
|
8972
|
+
this.kind = ExpressionKind.StoreLet;
|
|
8973
|
+
this[_a] = true;
|
|
8974
|
+
this[_b] = true;
|
|
8975
|
+
}
|
|
8976
|
+
visitExpression() { }
|
|
8977
|
+
isEquivalent(e) {
|
|
8978
|
+
return (e instanceof StoreLetExpr && e.target === this.target && e.value.isEquivalent(this.value));
|
|
8979
|
+
}
|
|
8980
|
+
isConstant() {
|
|
8981
|
+
return false;
|
|
8982
|
+
}
|
|
8983
|
+
transformInternalExpressions(transform, flags) {
|
|
8984
|
+
this.value = transformExpressionsInExpression(this.value, transform, flags);
|
|
8985
|
+
}
|
|
8986
|
+
clone() {
|
|
8987
|
+
return new StoreLetExpr(this.target, this.value, this.sourceSpan);
|
|
8988
|
+
}
|
|
8989
|
+
}
|
|
8990
|
+
class ContextLetReferenceExpr extends ExpressionBase {
|
|
8991
|
+
constructor(target, targetSlot) {
|
|
8992
|
+
super();
|
|
8993
|
+
this.target = target;
|
|
8994
|
+
this.targetSlot = targetSlot;
|
|
8995
|
+
this.kind = ExpressionKind.ContextLetReference;
|
|
8996
|
+
}
|
|
8997
|
+
visitExpression() { }
|
|
8998
|
+
isEquivalent(e) {
|
|
8999
|
+
return e instanceof ContextLetReferenceExpr && e.target === this.target;
|
|
9000
|
+
}
|
|
9001
|
+
isConstant() {
|
|
9002
|
+
return false;
|
|
9003
|
+
}
|
|
9004
|
+
transformInternalExpressions() { }
|
|
9005
|
+
clone() {
|
|
9006
|
+
return new ContextLetReferenceExpr(this.target, this.targetSlot);
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
8934
9009
|
/**
|
|
8935
9010
|
* A reference to the current view context (usually the `ctx` variable in a template function).
|
|
8936
9011
|
*/
|
|
@@ -9131,12 +9206,12 @@ class ReadVariableExpr extends ExpressionBase {
|
|
|
9131
9206
|
}
|
|
9132
9207
|
}
|
|
9133
9208
|
class PureFunctionExpr extends ExpressionBase {
|
|
9134
|
-
static {
|
|
9209
|
+
static { _c = ConsumesVarsTrait, _d = UsesVarOffset; }
|
|
9135
9210
|
constructor(expression, args) {
|
|
9136
9211
|
super();
|
|
9137
9212
|
this.kind = ExpressionKind.PureFunctionExpr;
|
|
9138
|
-
this[
|
|
9139
|
-
this[
|
|
9213
|
+
this[_c] = true;
|
|
9214
|
+
this[_d] = true;
|
|
9140
9215
|
this.varOffset = null;
|
|
9141
9216
|
/**
|
|
9142
9217
|
* Once extracted to the `ConstantPool`, a reference to the function which defines the computation
|
|
@@ -9202,7 +9277,7 @@ class PureFunctionParameterExpr extends ExpressionBase {
|
|
|
9202
9277
|
}
|
|
9203
9278
|
}
|
|
9204
9279
|
class PipeBindingExpr extends ExpressionBase {
|
|
9205
|
-
static {
|
|
9280
|
+
static { _e = ConsumesVarsTrait, _f = UsesVarOffset; }
|
|
9206
9281
|
constructor(target, targetSlot, name, args) {
|
|
9207
9282
|
super();
|
|
9208
9283
|
this.target = target;
|
|
@@ -9210,8 +9285,8 @@ class PipeBindingExpr extends ExpressionBase {
|
|
|
9210
9285
|
this.name = name;
|
|
9211
9286
|
this.args = args;
|
|
9212
9287
|
this.kind = ExpressionKind.PipeBinding;
|
|
9213
|
-
this[
|
|
9214
|
-
this[
|
|
9288
|
+
this[_e] = true;
|
|
9289
|
+
this[_f] = true;
|
|
9215
9290
|
this.varOffset = null;
|
|
9216
9291
|
}
|
|
9217
9292
|
visitExpression(visitor, context) {
|
|
@@ -9237,7 +9312,7 @@ class PipeBindingExpr extends ExpressionBase {
|
|
|
9237
9312
|
}
|
|
9238
9313
|
}
|
|
9239
9314
|
class PipeBindingVariadicExpr extends ExpressionBase {
|
|
9240
|
-
static {
|
|
9315
|
+
static { _g = ConsumesVarsTrait, _h = UsesVarOffset; }
|
|
9241
9316
|
constructor(target, targetSlot, name, args, numArgs) {
|
|
9242
9317
|
super();
|
|
9243
9318
|
this.target = target;
|
|
@@ -9246,8 +9321,8 @@ class PipeBindingVariadicExpr extends ExpressionBase {
|
|
|
9246
9321
|
this.args = args;
|
|
9247
9322
|
this.numArgs = numArgs;
|
|
9248
9323
|
this.kind = ExpressionKind.PipeBindingVariadic;
|
|
9249
|
-
this[
|
|
9250
|
-
this[
|
|
9324
|
+
this[_g] = true;
|
|
9325
|
+
this[_h] = true;
|
|
9251
9326
|
this.varOffset = null;
|
|
9252
9327
|
}
|
|
9253
9328
|
visitExpression(visitor, context) {
|
|
@@ -9641,6 +9716,9 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
9641
9716
|
case OpKind.DeferWhen:
|
|
9642
9717
|
op.expr = transformExpressionsInExpression(op.expr, transform, flags);
|
|
9643
9718
|
break;
|
|
9719
|
+
case OpKind.StoreLet:
|
|
9720
|
+
op.value = transformExpressionsInExpression(op.value, transform, flags);
|
|
9721
|
+
break;
|
|
9644
9722
|
case OpKind.Advance:
|
|
9645
9723
|
case OpKind.Container:
|
|
9646
9724
|
case OpKind.ContainerEnd:
|
|
@@ -9666,6 +9744,7 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
9666
9744
|
case OpKind.Text:
|
|
9667
9745
|
case OpKind.I18nAttributes:
|
|
9668
9746
|
case OpKind.IcuPlaceholder:
|
|
9747
|
+
case OpKind.DeclareLet:
|
|
9669
9748
|
// These operations contain no expressions.
|
|
9670
9749
|
break;
|
|
9671
9750
|
default:
|
|
@@ -10329,6 +10408,20 @@ function createDeferOnOp(defer, trigger, prefetch, sourceSpan) {
|
|
|
10329
10408
|
...NEW_OP,
|
|
10330
10409
|
};
|
|
10331
10410
|
}
|
|
10411
|
+
/**
|
|
10412
|
+
* Creates a `DeclareLetOp`.
|
|
10413
|
+
*/
|
|
10414
|
+
function createDeclareLetOp(xref, declaredName, sourceSpan) {
|
|
10415
|
+
return {
|
|
10416
|
+
kind: OpKind.DeclareLet,
|
|
10417
|
+
xref,
|
|
10418
|
+
declaredName,
|
|
10419
|
+
sourceSpan,
|
|
10420
|
+
handle: new SlotHandle(),
|
|
10421
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10422
|
+
...NEW_OP,
|
|
10423
|
+
};
|
|
10424
|
+
}
|
|
10332
10425
|
/**
|
|
10333
10426
|
* Create an `ExtractedMessageOp`.
|
|
10334
10427
|
*/
|
|
@@ -11022,6 +11115,7 @@ const CHAINABLE = new Set([
|
|
|
11022
11115
|
Identifiers.templateCreate,
|
|
11023
11116
|
Identifiers.twoWayProperty,
|
|
11024
11117
|
Identifiers.twoWayListener,
|
|
11118
|
+
Identifiers.declareLet,
|
|
11025
11119
|
]);
|
|
11026
11120
|
/**
|
|
11027
11121
|
* Post-process a reified view compilation and convert sequential calls to chainable instructions
|
|
@@ -12187,16 +12281,26 @@ function generateAdvance(job) {
|
|
|
12187
12281
|
// To do that, we track what the runtime's slot counter will be through the update operations.
|
|
12188
12282
|
let slotContext = 0;
|
|
12189
12283
|
for (const op of unit.update) {
|
|
12190
|
-
|
|
12191
|
-
|
|
12284
|
+
let consumer = null;
|
|
12285
|
+
if (hasDependsOnSlotContextTrait(op)) {
|
|
12286
|
+
consumer = op;
|
|
12287
|
+
}
|
|
12288
|
+
else {
|
|
12289
|
+
visitExpressionsInOp(op, (expr) => {
|
|
12290
|
+
if (consumer === null && hasDependsOnSlotContextTrait(expr)) {
|
|
12291
|
+
consumer = expr;
|
|
12292
|
+
}
|
|
12293
|
+
});
|
|
12294
|
+
}
|
|
12295
|
+
if (consumer === null) {
|
|
12192
12296
|
continue;
|
|
12193
12297
|
}
|
|
12194
|
-
|
|
12298
|
+
if (!slotMap.has(consumer.target)) {
|
|
12195
12299
|
// We expect ops that _do_ depend on the slot counter to point at declarations that exist in
|
|
12196
12300
|
// the `slotMap`.
|
|
12197
|
-
throw new Error(`AssertionError: reference to unknown slot for target ${
|
|
12301
|
+
throw new Error(`AssertionError: reference to unknown slot for target ${consumer.target}`);
|
|
12198
12302
|
}
|
|
12199
|
-
const slot = slotMap.get(
|
|
12303
|
+
const slot = slotMap.get(consumer.target);
|
|
12200
12304
|
// Does the slot counter need to be adjusted?
|
|
12201
12305
|
if (slotContext !== slot) {
|
|
12202
12306
|
// If so, generate an `ir.AdvanceOp` to advance the counter.
|
|
@@ -12204,7 +12308,7 @@ function generateAdvance(job) {
|
|
|
12204
12308
|
if (delta < 0) {
|
|
12205
12309
|
throw new Error(`AssertionError: slot counter should never need to move backwards`);
|
|
12206
12310
|
}
|
|
12207
|
-
OpList.insertBefore(createAdvanceOp(delta,
|
|
12311
|
+
OpList.insertBefore(createAdvanceOp(delta, consumer.sourceSpan), op);
|
|
12208
12312
|
slotContext = slot;
|
|
12209
12313
|
}
|
|
12210
12314
|
}
|
|
@@ -12295,13 +12399,11 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
12295
12399
|
case OpKind.Listener:
|
|
12296
12400
|
case OpKind.TwoWayListener:
|
|
12297
12401
|
// Prepend variables to listener handler functions.
|
|
12298
|
-
op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
|
|
12402
|
+
op.handlerOps.prepend(generateVariablesInScopeForView(view, scope, true));
|
|
12299
12403
|
break;
|
|
12300
12404
|
}
|
|
12301
12405
|
}
|
|
12302
|
-
|
|
12303
|
-
const preambleOps = generateVariablesInScopeForView(view, scope);
|
|
12304
|
-
view.update.prepend(preambleOps);
|
|
12406
|
+
view.update.prepend(generateVariablesInScopeForView(view, scope, false));
|
|
12305
12407
|
}
|
|
12306
12408
|
/**
|
|
12307
12409
|
* Process a view and generate a `Scope` representing the variables available for reference within
|
|
@@ -12318,6 +12420,7 @@ function getScopeForView(view, parent) {
|
|
|
12318
12420
|
contextVariables: new Map(),
|
|
12319
12421
|
aliases: view.aliases,
|
|
12320
12422
|
references: [],
|
|
12423
|
+
letDeclarations: [],
|
|
12321
12424
|
parent,
|
|
12322
12425
|
};
|
|
12323
12426
|
for (const identifier of view.contextVariables.keys()) {
|
|
@@ -12349,6 +12452,17 @@ function getScopeForView(view, parent) {
|
|
|
12349
12452
|
});
|
|
12350
12453
|
}
|
|
12351
12454
|
break;
|
|
12455
|
+
case OpKind.DeclareLet:
|
|
12456
|
+
scope.letDeclarations.push({
|
|
12457
|
+
targetId: op.xref,
|
|
12458
|
+
targetSlot: op.handle,
|
|
12459
|
+
variable: {
|
|
12460
|
+
kind: SemanticVariableKind.Identifier,
|
|
12461
|
+
name: null,
|
|
12462
|
+
identifier: op.declaredName,
|
|
12463
|
+
},
|
|
12464
|
+
});
|
|
12465
|
+
break;
|
|
12352
12466
|
}
|
|
12353
12467
|
}
|
|
12354
12468
|
return scope;
|
|
@@ -12359,7 +12473,7 @@ function getScopeForView(view, parent) {
|
|
|
12359
12473
|
* This is a recursive process, as views inherit variables available from their parent view, which
|
|
12360
12474
|
* itself may have inherited variables, etc.
|
|
12361
12475
|
*/
|
|
12362
|
-
function generateVariablesInScopeForView(view, scope) {
|
|
12476
|
+
function generateVariablesInScopeForView(view, scope, isListener) {
|
|
12363
12477
|
const newOps = [];
|
|
12364
12478
|
if (scope.view !== view.xref) {
|
|
12365
12479
|
// Before generating variables for a parent view, we need to switch to the context of the parent
|
|
@@ -12383,9 +12497,14 @@ function generateVariablesInScopeForView(view, scope) {
|
|
|
12383
12497
|
for (const ref of scope.references) {
|
|
12384
12498
|
newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.targetSlot, ref.offset), VariableFlags.None));
|
|
12385
12499
|
}
|
|
12500
|
+
if (scope.view !== view.xref || isListener) {
|
|
12501
|
+
for (const decl of scope.letDeclarations) {
|
|
12502
|
+
newOps.push(createVariableOp(view.job.allocateXrefId(), decl.variable, new ContextLetReferenceExpr(decl.targetId, decl.targetSlot), VariableFlags.None));
|
|
12503
|
+
}
|
|
12504
|
+
}
|
|
12386
12505
|
if (scope.parent !== null) {
|
|
12387
12506
|
// Recursively add variables from the parent scope.
|
|
12388
|
-
newOps.push(...generateVariablesInScopeForView(view, scope.parent));
|
|
12507
|
+
newOps.push(...generateVariablesInScopeForView(view, scope.parent, false));
|
|
12389
12508
|
}
|
|
12390
12509
|
return newOps;
|
|
12391
12510
|
}
|
|
@@ -13743,7 +13862,8 @@ class _ParseAST {
|
|
|
13743
13862
|
const keyStart = this.inputIndex;
|
|
13744
13863
|
const quoted = this.next.isString();
|
|
13745
13864
|
const key = this.expectIdentifierOrKeywordOrString();
|
|
13746
|
-
|
|
13865
|
+
const literalMapKey = { key, quoted };
|
|
13866
|
+
keys.push(literalMapKey);
|
|
13747
13867
|
// Properties with quoted keys can't use the shorthand syntax.
|
|
13748
13868
|
if (quoted) {
|
|
13749
13869
|
this.expectCharacter($COLON);
|
|
@@ -13753,6 +13873,7 @@ class _ParseAST {
|
|
|
13753
13873
|
values.push(this.parsePipe());
|
|
13754
13874
|
}
|
|
13755
13875
|
else {
|
|
13876
|
+
literalMapKey.isShorthandInitialized = true;
|
|
13756
13877
|
const span = this.span(keyStart);
|
|
13757
13878
|
const sourceSpan = this.sourceSpan(keyStart);
|
|
13758
13879
|
values.push(new PropertyRead(span, sourceSpan, sourceSpan, new ImplicitReceiver(span, sourceSpan), key));
|
|
@@ -20517,6 +20638,7 @@ function mergeNextContextsInOps(ops) {
|
|
|
20517
20638
|
break;
|
|
20518
20639
|
case ExpressionKind.GetCurrentView:
|
|
20519
20640
|
case ExpressionKind.Reference:
|
|
20641
|
+
case ExpressionKind.ContextLetReference:
|
|
20520
20642
|
// Can't merge past a dependency on the context.
|
|
20521
20643
|
tryToMerge = false;
|
|
20522
20644
|
break;
|
|
@@ -21242,6 +21364,15 @@ function repeater(collection, sourceSpan) {
|
|
|
21242
21364
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
21243
21365
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
21244
21366
|
}
|
|
21367
|
+
function declareLet(slot, sourceSpan) {
|
|
21368
|
+
return call(Identifiers.declareLet, [literal(slot)], sourceSpan);
|
|
21369
|
+
}
|
|
21370
|
+
function storeLet(value, sourceSpan) {
|
|
21371
|
+
return importExpr(Identifiers.storeLet).callFn([value], sourceSpan);
|
|
21372
|
+
}
|
|
21373
|
+
function readContextLet(slot) {
|
|
21374
|
+
return importExpr(Identifiers.readContextLet).callFn([literal(slot)]);
|
|
21375
|
+
}
|
|
21245
21376
|
function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
21246
21377
|
const args = [literal(slot), literal(constIndex)];
|
|
21247
21378
|
if (subTemplateIndex) {
|
|
@@ -21653,6 +21784,9 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21653
21784
|
case OpKind.Pipe:
|
|
21654
21785
|
OpList.replace(op, pipe(op.handle.slot, op.name));
|
|
21655
21786
|
break;
|
|
21787
|
+
case OpKind.DeclareLet:
|
|
21788
|
+
OpList.replace(op, declareLet(op.handle.slot, op.sourceSpan));
|
|
21789
|
+
break;
|
|
21656
21790
|
case OpKind.Listener:
|
|
21657
21791
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
21658
21792
|
const eventTargetResolver = op.eventTarget
|
|
@@ -21872,6 +22006,8 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21872
22006
|
case OpKind.DeferWhen:
|
|
21873
22007
|
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
21874
22008
|
break;
|
|
22009
|
+
case OpKind.StoreLet:
|
|
22010
|
+
throw new Error(`AssertionError: unexpected storeLet ${op.declaredName}`);
|
|
21875
22011
|
case OpKind.Statement:
|
|
21876
22012
|
// Pass statement operations directly through.
|
|
21877
22013
|
break;
|
|
@@ -21930,6 +22066,10 @@ function reifyIrExpression(expr) {
|
|
|
21930
22066
|
return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
21931
22067
|
case ExpressionKind.SlotLiteralExpr:
|
|
21932
22068
|
return literal(expr.slot.slot);
|
|
22069
|
+
case ExpressionKind.ContextLetReference:
|
|
22070
|
+
return readContextLet(expr.targetSlot.slot);
|
|
22071
|
+
case ExpressionKind.StoreLet:
|
|
22072
|
+
return storeLet(expr.value, expr.sourceSpan);
|
|
21933
22073
|
default:
|
|
21934
22074
|
throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
|
|
21935
22075
|
}
|
|
@@ -22688,7 +22828,7 @@ function saveAndRestoreView(job) {
|
|
|
22688
22828
|
if (!needsRestoreView) {
|
|
22689
22829
|
for (const handlerOp of op.handlerOps) {
|
|
22690
22830
|
visitExpressionsInOp(handlerOp, (expr) => {
|
|
22691
|
-
if (expr instanceof ReferenceExpr) {
|
|
22831
|
+
if (expr instanceof ReferenceExpr || expr instanceof ContextLetReferenceExpr) {
|
|
22692
22832
|
// Listeners that reference() a local ref need the save/restore view operation.
|
|
22693
22833
|
needsRestoreView = true;
|
|
22694
22834
|
}
|
|
@@ -23143,6 +23283,7 @@ function varsUsedByOp(op) {
|
|
|
23143
23283
|
case OpKind.I18nExpression:
|
|
23144
23284
|
case OpKind.Conditional:
|
|
23145
23285
|
case OpKind.DeferWhen:
|
|
23286
|
+
case OpKind.StoreLet:
|
|
23146
23287
|
return 1;
|
|
23147
23288
|
case OpKind.RepeaterCreate:
|
|
23148
23289
|
// Repeaters may require an extra variable binding slot, if they have an empty view, for the
|
|
@@ -23162,6 +23303,8 @@ function varsUsedByIrExpression(expr) {
|
|
|
23162
23303
|
return 1 + expr.args.length;
|
|
23163
23304
|
case ExpressionKind.PipeBindingVariadic:
|
|
23164
23305
|
return 1 + expr.numArgs;
|
|
23306
|
+
case ExpressionKind.StoreLet:
|
|
23307
|
+
return 1;
|
|
23165
23308
|
default:
|
|
23166
23309
|
throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
|
|
23167
23310
|
}
|
|
@@ -23418,7 +23561,10 @@ function fencesForIrExpression(expr) {
|
|
|
23418
23561
|
return Fence.ViewContextRead | Fence.ViewContextWrite;
|
|
23419
23562
|
case ExpressionKind.RestoreView:
|
|
23420
23563
|
return Fence.ViewContextRead | Fence.ViewContextWrite | Fence.SideEffectful;
|
|
23564
|
+
case ExpressionKind.StoreLet:
|
|
23565
|
+
return Fence.SideEffectful;
|
|
23421
23566
|
case ExpressionKind.Reference:
|
|
23567
|
+
case ExpressionKind.ContextLetReference:
|
|
23422
23568
|
return Fence.ViewContextRead;
|
|
23423
23569
|
default:
|
|
23424
23570
|
return Fence.None;
|
|
@@ -23620,6 +23766,87 @@ function wrapI18nIcus(job) {
|
|
|
23620
23766
|
}
|
|
23621
23767
|
}
|
|
23622
23768
|
|
|
23769
|
+
/*!
|
|
23770
|
+
* @license
|
|
23771
|
+
* Copyright Google LLC All Rights Reserved.
|
|
23772
|
+
*
|
|
23773
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
23774
|
+
* found in the LICENSE file at https://angular.io/license
|
|
23775
|
+
*/
|
|
23776
|
+
/**
|
|
23777
|
+
* Removes any `storeLet` calls that aren't referenced outside of the current view.
|
|
23778
|
+
*/
|
|
23779
|
+
function optimizeStoreLet(job) {
|
|
23780
|
+
const letUsedExternally = new Set();
|
|
23781
|
+
// Since `@let` declarations can be referenced in child views, both in
|
|
23782
|
+
// the creation block (via listeners) and in the update block, we have
|
|
23783
|
+
// to look through all the ops to find the references.
|
|
23784
|
+
for (const unit of job.units) {
|
|
23785
|
+
for (const op of unit.ops()) {
|
|
23786
|
+
visitExpressionsInOp(op, (expr) => {
|
|
23787
|
+
if (expr instanceof ContextLetReferenceExpr) {
|
|
23788
|
+
letUsedExternally.add(expr.target);
|
|
23789
|
+
}
|
|
23790
|
+
});
|
|
23791
|
+
}
|
|
23792
|
+
}
|
|
23793
|
+
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
23794
|
+
for (const unit of job.units) {
|
|
23795
|
+
for (const op of unit.update) {
|
|
23796
|
+
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
|
|
23797
|
+
? expression.value
|
|
23798
|
+
: expression, VisitorContextFlag.None);
|
|
23799
|
+
}
|
|
23800
|
+
}
|
|
23801
|
+
}
|
|
23802
|
+
|
|
23803
|
+
/**
|
|
23804
|
+
* It's not allowed to access a `@let` declaration before it has been defined. This is enforced
|
|
23805
|
+
* already via template type checking, however it can trip some of the assertions in the pipeline.
|
|
23806
|
+
* E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
|
|
23807
|
+
* exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
|
|
23808
|
+
* confusing errors to users in the case where template type checking isn't running (e.g. in JIT
|
|
23809
|
+
* mode) this phase detects illegal forward references and replaces them with `undefined`.
|
|
23810
|
+
* Eventually users will see the proper error from the template type checker.
|
|
23811
|
+
*/
|
|
23812
|
+
function removeIllegalLetReferences(job) {
|
|
23813
|
+
for (const unit of job.units) {
|
|
23814
|
+
for (const op of unit.update) {
|
|
23815
|
+
if (op.kind !== OpKind.Variable ||
|
|
23816
|
+
op.variable.kind !== SemanticVariableKind.Identifier ||
|
|
23817
|
+
!(op.initializer instanceof StoreLetExpr)) {
|
|
23818
|
+
continue;
|
|
23819
|
+
}
|
|
23820
|
+
const name = op.variable.identifier;
|
|
23821
|
+
let current = op;
|
|
23822
|
+
while (current && current.kind !== OpKind.ListEnd) {
|
|
23823
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
23824
|
+
current = current.prev;
|
|
23825
|
+
}
|
|
23826
|
+
}
|
|
23827
|
+
}
|
|
23828
|
+
}
|
|
23829
|
+
|
|
23830
|
+
/**
|
|
23831
|
+
* Replaces the `storeLet` ops with variables that can be
|
|
23832
|
+
* used to reference the value within the same view.
|
|
23833
|
+
*/
|
|
23834
|
+
function generateLocalLetReferences(job) {
|
|
23835
|
+
for (const unit of job.units) {
|
|
23836
|
+
for (const op of unit.update) {
|
|
23837
|
+
if (op.kind !== OpKind.StoreLet) {
|
|
23838
|
+
continue;
|
|
23839
|
+
}
|
|
23840
|
+
const variable = {
|
|
23841
|
+
kind: SemanticVariableKind.Identifier,
|
|
23842
|
+
name: null,
|
|
23843
|
+
identifier: op.declaredName,
|
|
23844
|
+
};
|
|
23845
|
+
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
23846
|
+
}
|
|
23847
|
+
}
|
|
23848
|
+
}
|
|
23849
|
+
|
|
23623
23850
|
/**
|
|
23624
23851
|
*
|
|
23625
23852
|
* @license
|
|
@@ -23654,11 +23881,13 @@ const phases = [
|
|
|
23654
23881
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
23655
23882
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
23656
23883
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
23884
|
+
{ kind: CompilationJobKind.Tmpl, fn: generateLocalLetReferences },
|
|
23657
23885
|
{ kind: CompilationJobKind.Tmpl, fn: generateVariables },
|
|
23658
23886
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
23659
23887
|
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
23660
23888
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
23661
23889
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
23890
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeIllegalLetReferences },
|
|
23662
23891
|
{ kind: CompilationJobKind.Both, fn: resolveNames },
|
|
23663
23892
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
23664
23893
|
{ kind: CompilationJobKind.Tmpl, fn: transformTwoWayBindingSet },
|
|
@@ -23670,6 +23899,7 @@ const phases = [
|
|
|
23670
23899
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
23671
23900
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
23672
23901
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
23902
|
+
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
23673
23903
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
23674
23904
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
23675
23905
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
@@ -23906,7 +24136,9 @@ function ingestNodes(unit, template) {
|
|
|
23906
24136
|
else if (node instanceof ForLoopBlock) {
|
|
23907
24137
|
ingestForBlock(unit, node);
|
|
23908
24138
|
}
|
|
23909
|
-
else if (node instanceof LetDeclaration$1)
|
|
24139
|
+
else if (node instanceof LetDeclaration$1) {
|
|
24140
|
+
ingestLetDeclaration(unit, node);
|
|
24141
|
+
}
|
|
23910
24142
|
else {
|
|
23911
24143
|
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
23912
24144
|
}
|
|
@@ -24321,6 +24553,11 @@ function getComputedForLoopVariableExpression(variable, indexName, countName) {
|
|
|
24321
24553
|
throw new Error(`AssertionError: unknown @for loop variable ${variable.value}`);
|
|
24322
24554
|
}
|
|
24323
24555
|
}
|
|
24556
|
+
function ingestLetDeclaration(unit, node) {
|
|
24557
|
+
const target = unit.job.allocateXrefId();
|
|
24558
|
+
unit.create.push(createDeclareLetOp(target, node.name, node.sourceSpan));
|
|
24559
|
+
unit.update.push(createStoreLetOp(target, node.name, convertAst(node.value, unit.job, node.valueSpan), node.sourceSpan));
|
|
24560
|
+
}
|
|
24324
24561
|
/**
|
|
24325
24562
|
* Convert a template AST expression into an output AST expression.
|
|
24326
24563
|
*/
|
|
@@ -24346,7 +24583,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
24346
24583
|
// The whole point of the explicit `this` was to access the class property, but TDB and the
|
|
24347
24584
|
// current TCB treat the read as implicit, and give you the context property instead!
|
|
24348
24585
|
//
|
|
24349
|
-
// For now, we emulate this old
|
|
24586
|
+
// For now, we emulate this old behavior by aggressively converting explicit reads to to
|
|
24350
24587
|
// implicit reads, except for the special cases that TDB and the current TCB protect. However,
|
|
24351
24588
|
// it would be an improvement to fix this.
|
|
24352
24589
|
//
|
|
@@ -28476,6 +28713,7 @@ function extractScopedNodeEntities(rootScope) {
|
|
|
28476
28713
|
class ResourceLoader {
|
|
28477
28714
|
}
|
|
28478
28715
|
|
|
28716
|
+
let enableLetSyntax = false;
|
|
28479
28717
|
class CompilerFacadeImpl {
|
|
28480
28718
|
constructor(jitEvaluator = new JitEvaluator()) {
|
|
28481
28719
|
this.jitEvaluator = jitEvaluator;
|
|
@@ -28884,7 +29122,11 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
28884
29122
|
? InterpolationConfig.fromArray(interpolation)
|
|
28885
29123
|
: DEFAULT_INTERPOLATION_CONFIG;
|
|
28886
29124
|
// Parse the template and check for errors.
|
|
28887
|
-
const parsed = parseTemplate(template, sourceMapUrl, {
|
|
29125
|
+
const parsed = parseTemplate(template, sourceMapUrl, {
|
|
29126
|
+
preserveWhitespaces,
|
|
29127
|
+
interpolationConfig,
|
|
29128
|
+
enableLetSyntax,
|
|
29129
|
+
});
|
|
28888
29130
|
if (parsed.errors !== null) {
|
|
28889
29131
|
const errors = parsed.errors.map((err) => err.toString()).join(', ');
|
|
28890
29132
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
@@ -29113,7 +29355,7 @@ function publishFacade(global) {
|
|
|
29113
29355
|
* @description
|
|
29114
29356
|
* Entry point for all public APIs of the compiler package.
|
|
29115
29357
|
*/
|
|
29116
|
-
const VERSION = new Version('18.0.
|
|
29358
|
+
const VERSION = new Version('18.0.5');
|
|
29117
29359
|
|
|
29118
29360
|
class CompilerConfig {
|
|
29119
29361
|
constructor({ defaultEncapsulation = exports.ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters, } = {}) {
|
|
@@ -30751,7 +30993,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
30751
30993
|
function compileDeclareClassMetadata(metadata) {
|
|
30752
30994
|
const definitionMap = new DefinitionMap();
|
|
30753
30995
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
30754
|
-
definitionMap.set('version', literal('18.0.
|
|
30996
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
30755
30997
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30756
30998
|
definitionMap.set('type', metadata.type);
|
|
30757
30999
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -30769,7 +31011,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
30769
31011
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
30770
31012
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
30771
31013
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
30772
|
-
definitionMap.set('version', literal('18.0.
|
|
31014
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
30773
31015
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30774
31016
|
definitionMap.set('type', metadata.type);
|
|
30775
31017
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -30864,7 +31106,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
30864
31106
|
const definitionMap = new DefinitionMap();
|
|
30865
31107
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
30866
31108
|
definitionMap.set('minVersion', literal(minVersion));
|
|
30867
|
-
definitionMap.set('version', literal('18.0.
|
|
31109
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
30868
31110
|
// e.g. `type: MyDirective`
|
|
30869
31111
|
definitionMap.set('type', meta.type.value);
|
|
30870
31112
|
if (meta.isStandalone) {
|
|
@@ -31283,7 +31525,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
31283
31525
|
function compileDeclareFactoryFunction(meta) {
|
|
31284
31526
|
const definitionMap = new DefinitionMap();
|
|
31285
31527
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
31286
|
-
definitionMap.set('version', literal('18.0.
|
|
31528
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
31287
31529
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31288
31530
|
definitionMap.set('type', meta.type.value);
|
|
31289
31531
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -31318,7 +31560,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
31318
31560
|
function createInjectableDefinitionMap(meta) {
|
|
31319
31561
|
const definitionMap = new DefinitionMap();
|
|
31320
31562
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
31321
|
-
definitionMap.set('version', literal('18.0.
|
|
31563
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
31322
31564
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31323
31565
|
definitionMap.set('type', meta.type.value);
|
|
31324
31566
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -31369,7 +31611,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
31369
31611
|
function createInjectorDefinitionMap(meta) {
|
|
31370
31612
|
const definitionMap = new DefinitionMap();
|
|
31371
31613
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
31372
|
-
definitionMap.set('version', literal('18.0.
|
|
31614
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
31373
31615
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31374
31616
|
definitionMap.set('type', meta.type.value);
|
|
31375
31617
|
definitionMap.set('providers', meta.providers);
|
|
@@ -31402,7 +31644,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
31402
31644
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
31403
31645
|
}
|
|
31404
31646
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
31405
|
-
definitionMap.set('version', literal('18.0.
|
|
31647
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
31406
31648
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31407
31649
|
definitionMap.set('type', meta.type.value);
|
|
31408
31650
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -31453,7 +31695,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
31453
31695
|
function createPipeDefinitionMap(meta) {
|
|
31454
31696
|
const definitionMap = new DefinitionMap();
|
|
31455
31697
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
31456
|
-
definitionMap.set('version', literal('18.0.
|
|
31698
|
+
definitionMap.set('version', literal('18.0.5'));
|
|
31457
31699
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31458
31700
|
// e.g. `type: MyPipe`
|
|
31459
31701
|
definitionMap.set('type', meta.type.value);
|