@angular/compiler 22.0.0-next.3 → 22.0.0-next.5
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/fesm2022/compiler.mjs +386 -265
- package/fesm2022/compiler.mjs.map +1 -1
- package/package.json +1 -1
- package/types/compiler.d.ts +88 -37
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v22.0.0-next.
|
|
2
|
+
* @license Angular v22.0.0-next.5
|
|
3
3
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -536,7 +536,7 @@ function fingerprint(str) {
|
|
|
536
536
|
let lo = hash32(view, utf8.length, 102072);
|
|
537
537
|
if (hi == 0 && (lo == 0 || lo == 1)) {
|
|
538
538
|
hi = hi ^ 0x130f9bef;
|
|
539
|
-
lo = lo ^ -
|
|
539
|
+
lo = lo ^ -1801410264;
|
|
540
540
|
}
|
|
541
541
|
return BigInt.asUintN(32, BigInt(hi)) << BigInt(32) | BigInt.asUintN(32, BigInt(lo));
|
|
542
542
|
}
|
|
@@ -818,9 +818,11 @@ function areAllEquivalent(base, other) {
|
|
|
818
818
|
return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));
|
|
819
819
|
}
|
|
820
820
|
class Expression {
|
|
821
|
+
leadingComments;
|
|
821
822
|
type;
|
|
822
823
|
sourceSpan;
|
|
823
|
-
constructor(type, sourceSpan) {
|
|
824
|
+
constructor(type, sourceSpan, leadingComments) {
|
|
825
|
+
this.leadingComments = leadingComments;
|
|
824
826
|
this.type = type || null;
|
|
825
827
|
this.sourceSpan = sourceSpan || null;
|
|
826
828
|
}
|
|
@@ -830,13 +832,13 @@ class Expression {
|
|
|
830
832
|
key(index, type, sourceSpan) {
|
|
831
833
|
return new ReadKeyExpr(this, index, type, sourceSpan);
|
|
832
834
|
}
|
|
833
|
-
callFn(params, sourceSpan, pure) {
|
|
834
|
-
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
|
|
835
|
+
callFn(params, sourceSpan, pure, leadingComments) {
|
|
836
|
+
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure, leadingComments);
|
|
835
837
|
}
|
|
836
|
-
instantiate(params, type, sourceSpan) {
|
|
838
|
+
instantiate(params, type, sourceSpan, leadingComments) {
|
|
837
839
|
return new InstantiateExpr(this, params, type, sourceSpan);
|
|
838
840
|
}
|
|
839
|
-
conditional(trueCase, falseCase = null, sourceSpan) {
|
|
841
|
+
conditional(trueCase, falseCase = null, sourceSpan, leadingComments) {
|
|
840
842
|
return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
|
|
841
843
|
}
|
|
842
844
|
equals(rhs, sourceSpan) {
|
|
@@ -899,14 +901,14 @@ class Expression {
|
|
|
899
901
|
nullishCoalesce(rhs, sourceSpan) {
|
|
900
902
|
return new BinaryOperatorExpr(BinaryOperator.NullishCoalesce, this, rhs, null, sourceSpan);
|
|
901
903
|
}
|
|
902
|
-
toStmt() {
|
|
903
|
-
return new ExpressionStatement(this, null);
|
|
904
|
+
toStmt(leadingComments) {
|
|
905
|
+
return new ExpressionStatement(this, null, leadingComments);
|
|
904
906
|
}
|
|
905
907
|
}
|
|
906
908
|
class ReadVarExpr extends Expression {
|
|
907
909
|
name;
|
|
908
|
-
constructor(name, type, sourceSpan) {
|
|
909
|
-
super(type, sourceSpan);
|
|
910
|
+
constructor(name, type, sourceSpan, leadingComments) {
|
|
911
|
+
super(type, sourceSpan, leadingComments);
|
|
910
912
|
this.name = name;
|
|
911
913
|
}
|
|
912
914
|
isEquivalent(e) {
|
|
@@ -927,8 +929,8 @@ class ReadVarExpr extends Expression {
|
|
|
927
929
|
}
|
|
928
930
|
class TypeofExpr extends Expression {
|
|
929
931
|
expr;
|
|
930
|
-
constructor(expr, type, sourceSpan) {
|
|
931
|
-
super(type, sourceSpan);
|
|
932
|
+
constructor(expr, type, sourceSpan, leadingComments) {
|
|
933
|
+
super(type, sourceSpan, leadingComments);
|
|
932
934
|
this.expr = expr;
|
|
933
935
|
}
|
|
934
936
|
visitExpression(visitor, context) {
|
|
@@ -946,8 +948,8 @@ class TypeofExpr extends Expression {
|
|
|
946
948
|
}
|
|
947
949
|
class VoidExpr extends Expression {
|
|
948
950
|
expr;
|
|
949
|
-
constructor(expr, type, sourceSpan) {
|
|
950
|
-
super(type, sourceSpan);
|
|
951
|
+
constructor(expr, type, sourceSpan, leadingComments) {
|
|
952
|
+
super(type, sourceSpan, leadingComments);
|
|
951
953
|
this.expr = expr;
|
|
952
954
|
}
|
|
953
955
|
visitExpression(visitor, context) {
|
|
@@ -965,8 +967,8 @@ class VoidExpr extends Expression {
|
|
|
965
967
|
}
|
|
966
968
|
class WrappedNodeExpr extends Expression {
|
|
967
969
|
node;
|
|
968
|
-
constructor(node, type, sourceSpan) {
|
|
969
|
-
super(type, sourceSpan);
|
|
970
|
+
constructor(node, type, sourceSpan, leadingComments) {
|
|
971
|
+
super(type, sourceSpan, leadingComments);
|
|
970
972
|
this.node = node;
|
|
971
973
|
}
|
|
972
974
|
isEquivalent(e) {
|
|
@@ -986,8 +988,8 @@ class InvokeFunctionExpr extends Expression {
|
|
|
986
988
|
fn;
|
|
987
989
|
args;
|
|
988
990
|
pure;
|
|
989
|
-
constructor(fn, args, type, sourceSpan, pure = false) {
|
|
990
|
-
super(type, sourceSpan);
|
|
991
|
+
constructor(fn, args, type, sourceSpan, pure = false, leadingComments) {
|
|
992
|
+
super(type, sourceSpan, leadingComments);
|
|
991
993
|
this.fn = fn;
|
|
992
994
|
this.args = args;
|
|
993
995
|
this.pure = pure;
|
|
@@ -1011,8 +1013,8 @@ class InvokeFunctionExpr extends Expression {
|
|
|
1011
1013
|
class TaggedTemplateLiteralExpr extends Expression {
|
|
1012
1014
|
tag;
|
|
1013
1015
|
template;
|
|
1014
|
-
constructor(tag, template, type, sourceSpan) {
|
|
1015
|
-
super(type, sourceSpan);
|
|
1016
|
+
constructor(tag, template, type, sourceSpan, leadingComments) {
|
|
1017
|
+
super(type, sourceSpan, leadingComments);
|
|
1016
1018
|
this.tag = tag;
|
|
1017
1019
|
this.template = template;
|
|
1018
1020
|
}
|
|
@@ -1032,8 +1034,8 @@ class TaggedTemplateLiteralExpr extends Expression {
|
|
|
1032
1034
|
class InstantiateExpr extends Expression {
|
|
1033
1035
|
classExpr;
|
|
1034
1036
|
args;
|
|
1035
|
-
constructor(classExpr, args, type, sourceSpan) {
|
|
1036
|
-
super(type, sourceSpan);
|
|
1037
|
+
constructor(classExpr, args, type, sourceSpan, leadingComments) {
|
|
1038
|
+
super(type, sourceSpan, leadingComments);
|
|
1037
1039
|
this.classExpr = classExpr;
|
|
1038
1040
|
this.args = args;
|
|
1039
1041
|
}
|
|
@@ -1053,8 +1055,8 @@ class InstantiateExpr extends Expression {
|
|
|
1053
1055
|
class RegularExpressionLiteralExpr extends Expression {
|
|
1054
1056
|
body;
|
|
1055
1057
|
flags;
|
|
1056
|
-
constructor(body, flags, sourceSpan) {
|
|
1057
|
-
super(null, sourceSpan);
|
|
1058
|
+
constructor(body, flags, sourceSpan, leadingComments) {
|
|
1059
|
+
super(null, sourceSpan, leadingComments);
|
|
1058
1060
|
this.body = body;
|
|
1059
1061
|
this.flags = flags;
|
|
1060
1062
|
}
|
|
@@ -1073,8 +1075,8 @@ class RegularExpressionLiteralExpr extends Expression {
|
|
|
1073
1075
|
}
|
|
1074
1076
|
class LiteralExpr extends Expression {
|
|
1075
1077
|
value;
|
|
1076
|
-
constructor(value, type, sourceSpan) {
|
|
1077
|
-
super(type, sourceSpan);
|
|
1078
|
+
constructor(value, type, sourceSpan, leadingComments) {
|
|
1079
|
+
super(type, sourceSpan, leadingComments);
|
|
1078
1080
|
this.value = value;
|
|
1079
1081
|
}
|
|
1080
1082
|
isEquivalent(e) {
|
|
@@ -1093,8 +1095,8 @@ class LiteralExpr extends Expression {
|
|
|
1093
1095
|
class TemplateLiteralExpr extends Expression {
|
|
1094
1096
|
elements;
|
|
1095
1097
|
expressions;
|
|
1096
|
-
constructor(elements, expressions, sourceSpan) {
|
|
1097
|
-
super(null, sourceSpan);
|
|
1098
|
+
constructor(elements, expressions, sourceSpan, leadingComments) {
|
|
1099
|
+
super(null, sourceSpan, leadingComments);
|
|
1098
1100
|
this.elements = elements;
|
|
1099
1101
|
this.expressions = expressions;
|
|
1100
1102
|
}
|
|
@@ -1114,8 +1116,8 @@ class TemplateLiteralExpr extends Expression {
|
|
|
1114
1116
|
class TemplateLiteralElementExpr extends Expression {
|
|
1115
1117
|
text;
|
|
1116
1118
|
rawText;
|
|
1117
|
-
constructor(text, sourceSpan, rawText) {
|
|
1118
|
-
super(STRING_TYPE, sourceSpan);
|
|
1119
|
+
constructor(text, sourceSpan, rawText, leadingComments) {
|
|
1120
|
+
super(STRING_TYPE, sourceSpan, leadingComments);
|
|
1119
1121
|
this.text = text;
|
|
1120
1122
|
this.rawText = rawText ?? escapeForTemplateLiteral(escapeSlashes(text));
|
|
1121
1123
|
}
|
|
@@ -1158,8 +1160,8 @@ class LocalizedString extends Expression {
|
|
|
1158
1160
|
messageParts;
|
|
1159
1161
|
placeHolderNames;
|
|
1160
1162
|
expressions;
|
|
1161
|
-
constructor(metaBlock, messageParts, placeHolderNames, expressions, sourceSpan) {
|
|
1162
|
-
super(STRING_TYPE, sourceSpan);
|
|
1163
|
+
constructor(metaBlock, messageParts, placeHolderNames, expressions, sourceSpan, leadingComments) {
|
|
1164
|
+
super(STRING_TYPE, sourceSpan, leadingComments);
|
|
1163
1165
|
this.metaBlock = metaBlock;
|
|
1164
1166
|
this.messageParts = messageParts;
|
|
1165
1167
|
this.placeHolderNames = placeHolderNames;
|
|
@@ -1230,8 +1232,8 @@ function createCookedRawString(metaBlock, messagePart, range) {
|
|
|
1230
1232
|
class ExternalExpr extends Expression {
|
|
1231
1233
|
value;
|
|
1232
1234
|
typeParams;
|
|
1233
|
-
constructor(value, type, typeParams = null, sourceSpan) {
|
|
1234
|
-
super(type, sourceSpan);
|
|
1235
|
+
constructor(value, type, typeParams = null, sourceSpan, leadingComments) {
|
|
1236
|
+
super(type, sourceSpan, leadingComments);
|
|
1235
1237
|
this.value = value;
|
|
1236
1238
|
this.typeParams = typeParams;
|
|
1237
1239
|
}
|
|
@@ -1260,8 +1262,8 @@ class ConditionalExpr extends Expression {
|
|
|
1260
1262
|
condition;
|
|
1261
1263
|
falseCase;
|
|
1262
1264
|
trueCase;
|
|
1263
|
-
constructor(condition, trueCase, falseCase = null, type, sourceSpan) {
|
|
1264
|
-
super(type || trueCase.type, sourceSpan);
|
|
1265
|
+
constructor(condition, trueCase, falseCase = null, type, sourceSpan, leadingComments) {
|
|
1266
|
+
super(type || trueCase.type, sourceSpan, leadingComments);
|
|
1265
1267
|
this.condition = condition;
|
|
1266
1268
|
this.falseCase = falseCase;
|
|
1267
1269
|
this.trueCase = trueCase;
|
|
@@ -1282,8 +1284,8 @@ class ConditionalExpr extends Expression {
|
|
|
1282
1284
|
class DynamicImportExpr extends Expression {
|
|
1283
1285
|
url;
|
|
1284
1286
|
urlComment;
|
|
1285
|
-
constructor(url, sourceSpan, urlComment) {
|
|
1286
|
-
super(null, sourceSpan);
|
|
1287
|
+
constructor(url, sourceSpan, urlComment, leadingComments) {
|
|
1288
|
+
super(null, sourceSpan, leadingComments);
|
|
1287
1289
|
this.url = url;
|
|
1288
1290
|
this.urlComment = urlComment;
|
|
1289
1291
|
}
|
|
@@ -1302,8 +1304,8 @@ class DynamicImportExpr extends Expression {
|
|
|
1302
1304
|
}
|
|
1303
1305
|
class NotExpr extends Expression {
|
|
1304
1306
|
condition;
|
|
1305
|
-
constructor(condition, sourceSpan) {
|
|
1306
|
-
super(BOOL_TYPE, sourceSpan);
|
|
1307
|
+
constructor(condition, sourceSpan, leadingComments) {
|
|
1308
|
+
super(BOOL_TYPE, sourceSpan, leadingComments);
|
|
1307
1309
|
this.condition = condition;
|
|
1308
1310
|
}
|
|
1309
1311
|
isEquivalent(e) {
|
|
@@ -1337,8 +1339,8 @@ class FunctionExpr extends Expression {
|
|
|
1337
1339
|
params;
|
|
1338
1340
|
statements;
|
|
1339
1341
|
name;
|
|
1340
|
-
constructor(params, statements, type, sourceSpan, name) {
|
|
1341
|
-
super(type, sourceSpan);
|
|
1342
|
+
constructor(params, statements, type, sourceSpan, name, leadingComments) {
|
|
1343
|
+
super(type, sourceSpan, leadingComments);
|
|
1342
1344
|
this.params = params;
|
|
1343
1345
|
this.statements = statements;
|
|
1344
1346
|
this.name = name;
|
|
@@ -1362,8 +1364,8 @@ class FunctionExpr extends Expression {
|
|
|
1362
1364
|
let ArrowFunctionExpr$1 = class ArrowFunctionExpr extends Expression {
|
|
1363
1365
|
params;
|
|
1364
1366
|
body;
|
|
1365
|
-
constructor(params, body, type, sourceSpan) {
|
|
1366
|
-
super(type, sourceSpan);
|
|
1367
|
+
constructor(params, body, type, sourceSpan, leadingComments) {
|
|
1368
|
+
super(type, sourceSpan, leadingComments);
|
|
1367
1369
|
this.params = params;
|
|
1368
1370
|
this.body = body;
|
|
1369
1371
|
}
|
|
@@ -1396,8 +1398,8 @@ class UnaryOperatorExpr extends Expression {
|
|
|
1396
1398
|
operator;
|
|
1397
1399
|
expr;
|
|
1398
1400
|
parens;
|
|
1399
|
-
constructor(operator, expr, type, sourceSpan, parens = true) {
|
|
1400
|
-
super(type || NUMBER_TYPE, sourceSpan);
|
|
1401
|
+
constructor(operator, expr, type, sourceSpan, parens = true, leadingComments) {
|
|
1402
|
+
super(type || NUMBER_TYPE, sourceSpan, leadingComments);
|
|
1401
1403
|
this.operator = operator;
|
|
1402
1404
|
this.expr = expr;
|
|
1403
1405
|
this.parens = parens;
|
|
@@ -1417,8 +1419,8 @@ class UnaryOperatorExpr extends Expression {
|
|
|
1417
1419
|
}
|
|
1418
1420
|
class ParenthesizedExpr extends Expression {
|
|
1419
1421
|
expr;
|
|
1420
|
-
constructor(expr, type, sourceSpan) {
|
|
1421
|
-
super(type, sourceSpan);
|
|
1422
|
+
constructor(expr, type, sourceSpan, leadingComments) {
|
|
1423
|
+
super(type, sourceSpan, leadingComments);
|
|
1422
1424
|
this.expr = expr;
|
|
1423
1425
|
}
|
|
1424
1426
|
visitExpression(visitor, context) {
|
|
@@ -1438,8 +1440,8 @@ class BinaryOperatorExpr extends Expression {
|
|
|
1438
1440
|
operator;
|
|
1439
1441
|
rhs;
|
|
1440
1442
|
lhs;
|
|
1441
|
-
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
1442
|
-
super(type || lhs.type, sourceSpan);
|
|
1443
|
+
constructor(operator, lhs, rhs, type, sourceSpan, leadingComments) {
|
|
1444
|
+
super(type || lhs.type, sourceSpan, leadingComments);
|
|
1443
1445
|
this.operator = operator;
|
|
1444
1446
|
this.rhs = rhs;
|
|
1445
1447
|
this.lhs = lhs;
|
|
@@ -1464,8 +1466,8 @@ class BinaryOperatorExpr extends Expression {
|
|
|
1464
1466
|
class ReadPropExpr extends Expression {
|
|
1465
1467
|
receiver;
|
|
1466
1468
|
name;
|
|
1467
|
-
constructor(receiver, name, type, sourceSpan) {
|
|
1468
|
-
super(type, sourceSpan);
|
|
1469
|
+
constructor(receiver, name, type, sourceSpan, leadingComments) {
|
|
1470
|
+
super(type, sourceSpan, leadingComments);
|
|
1469
1471
|
this.receiver = receiver;
|
|
1470
1472
|
this.name = name;
|
|
1471
1473
|
}
|
|
@@ -1491,8 +1493,8 @@ class ReadPropExpr extends Expression {
|
|
|
1491
1493
|
class ReadKeyExpr extends Expression {
|
|
1492
1494
|
receiver;
|
|
1493
1495
|
index;
|
|
1494
|
-
constructor(receiver, index, type, sourceSpan) {
|
|
1495
|
-
super(type, sourceSpan);
|
|
1496
|
+
constructor(receiver, index, type, sourceSpan, leadingComments) {
|
|
1497
|
+
super(type, sourceSpan, leadingComments);
|
|
1496
1498
|
this.receiver = receiver;
|
|
1497
1499
|
this.index = index;
|
|
1498
1500
|
}
|
|
@@ -1514,8 +1516,8 @@ class ReadKeyExpr extends Expression {
|
|
|
1514
1516
|
}
|
|
1515
1517
|
class LiteralArrayExpr extends Expression {
|
|
1516
1518
|
entries;
|
|
1517
|
-
constructor(entries, type, sourceSpan) {
|
|
1518
|
-
super(type, sourceSpan);
|
|
1519
|
+
constructor(entries, type, sourceSpan, leadingComments) {
|
|
1520
|
+
super(type, sourceSpan, leadingComments);
|
|
1519
1521
|
this.entries = entries;
|
|
1520
1522
|
}
|
|
1521
1523
|
isConstant() {
|
|
@@ -1568,8 +1570,8 @@ class LiteralMapSpreadAssignment {
|
|
|
1568
1570
|
class LiteralMapExpr extends Expression {
|
|
1569
1571
|
entries;
|
|
1570
1572
|
valueType = null;
|
|
1571
|
-
constructor(entries, type, sourceSpan) {
|
|
1572
|
-
super(type, sourceSpan);
|
|
1573
|
+
constructor(entries, type, sourceSpan, leadingComments) {
|
|
1574
|
+
super(type, sourceSpan, leadingComments);
|
|
1573
1575
|
this.entries = entries;
|
|
1574
1576
|
if (type) {
|
|
1575
1577
|
this.valueType = type.valueType;
|
|
@@ -1591,8 +1593,8 @@ class LiteralMapExpr extends Expression {
|
|
|
1591
1593
|
}
|
|
1592
1594
|
class CommaExpr extends Expression {
|
|
1593
1595
|
parts;
|
|
1594
|
-
constructor(parts, sourceSpan) {
|
|
1595
|
-
super(parts[parts.length - 1].type, sourceSpan);
|
|
1596
|
+
constructor(parts, sourceSpan, leadingComments) {
|
|
1597
|
+
super(parts[parts.length - 1].type, sourceSpan, leadingComments);
|
|
1596
1598
|
this.parts = parts;
|
|
1597
1599
|
}
|
|
1598
1600
|
isEquivalent(e) {
|
|
@@ -1610,8 +1612,8 @@ class CommaExpr extends Expression {
|
|
|
1610
1612
|
}
|
|
1611
1613
|
class SpreadElementExpr extends Expression {
|
|
1612
1614
|
expression;
|
|
1613
|
-
constructor(expression, sourceSpan) {
|
|
1614
|
-
super(null, sourceSpan);
|
|
1615
|
+
constructor(expression, sourceSpan, leadingComments) {
|
|
1616
|
+
super(null, sourceSpan, leadingComments);
|
|
1615
1617
|
this.expression = expression;
|
|
1616
1618
|
}
|
|
1617
1619
|
isEquivalent(e) {
|
|
@@ -1949,8 +1951,8 @@ function leadingComment(text, multiline = false, trailingNewline = true) {
|
|
|
1949
1951
|
function jsDocComment(tags = []) {
|
|
1950
1952
|
return new JSDocComment(tags);
|
|
1951
1953
|
}
|
|
1952
|
-
function variable(name, type, sourceSpan) {
|
|
1953
|
-
return new ReadVarExpr(name, type, sourceSpan);
|
|
1954
|
+
function variable(name, type, sourceSpan, leadingComments) {
|
|
1955
|
+
return new ReadVarExpr(name, type, sourceSpan, leadingComments);
|
|
1954
1956
|
}
|
|
1955
1957
|
function importExpr(id, typeParams = null, sourceSpan) {
|
|
1956
1958
|
return new ExternalExpr(id, null, typeParams, sourceSpan);
|
|
@@ -3339,10 +3341,10 @@ function toBase64Digit(value) {
|
|
|
3339
3341
|
return B64_DIGITS[value];
|
|
3340
3342
|
}
|
|
3341
3343
|
|
|
3342
|
-
const
|
|
3343
|
-
const
|
|
3344
|
-
const
|
|
3345
|
-
class
|
|
3344
|
+
const SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
|
|
3345
|
+
const LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
|
|
3346
|
+
const INDENT_WITH = ' ';
|
|
3347
|
+
class EmittedLine {
|
|
3346
3348
|
indent;
|
|
3347
3349
|
partsLength = 0;
|
|
3348
3350
|
parts = [];
|
|
@@ -3360,7 +3362,7 @@ class EmitterVisitorContext {
|
|
|
3360
3362
|
_lines;
|
|
3361
3363
|
constructor(_indent) {
|
|
3362
3364
|
this._indent = _indent;
|
|
3363
|
-
this._lines = [new
|
|
3365
|
+
this._lines = [new EmittedLine(_indent)];
|
|
3364
3366
|
}
|
|
3365
3367
|
get _currentLine() {
|
|
3366
3368
|
return this._lines[this._lines.length - 1];
|
|
@@ -3372,7 +3374,7 @@ class EmitterVisitorContext {
|
|
|
3372
3374
|
return this._currentLine.parts.length === 0;
|
|
3373
3375
|
}
|
|
3374
3376
|
lineLength() {
|
|
3375
|
-
return this._currentLine.indent *
|
|
3377
|
+
return this._currentLine.indent * INDENT_WITH.length + this._currentLine.partsLength;
|
|
3376
3378
|
}
|
|
3377
3379
|
print(from, part, newLine = false) {
|
|
3378
3380
|
if (part.length > 0) {
|
|
@@ -3381,7 +3383,7 @@ class EmitterVisitorContext {
|
|
|
3381
3383
|
this._currentLine.srcSpans.push(from && from.sourceSpan || null);
|
|
3382
3384
|
}
|
|
3383
3385
|
if (newLine) {
|
|
3384
|
-
this._lines.push(new
|
|
3386
|
+
this._lines.push(new EmittedLine(this._indent));
|
|
3385
3387
|
}
|
|
3386
3388
|
}
|
|
3387
3389
|
removeEmptyLastLine() {
|
|
@@ -3402,7 +3404,7 @@ class EmitterVisitorContext {
|
|
|
3402
3404
|
}
|
|
3403
3405
|
}
|
|
3404
3406
|
toSource() {
|
|
3405
|
-
return this.sourceLines.map(l => l.parts.length > 0 ?
|
|
3407
|
+
return this.sourceLines.map(l => l.parts.length > 0 ? INDENT_WITH.repeat(l.indent) + l.parts.join('') : '').join('\n');
|
|
3406
3408
|
}
|
|
3407
3409
|
toSourceMapGenerator(genFilePath, startsAtLine = 0) {
|
|
3408
3410
|
const map = new SourceMapGenerator(genFilePath);
|
|
@@ -3421,7 +3423,7 @@ class EmitterVisitorContext {
|
|
|
3421
3423
|
map.addLine();
|
|
3422
3424
|
const spans = line.srcSpans;
|
|
3423
3425
|
const parts = line.parts;
|
|
3424
|
-
let col0 = line.indent *
|
|
3426
|
+
let col0 = line.indent * INDENT_WITH.length;
|
|
3425
3427
|
let spanIdx = 0;
|
|
3426
3428
|
while (spanIdx < spans.length && !spans[spanIdx]) {
|
|
3427
3429
|
col0 += parts[spanIdx].length;
|
|
@@ -3451,7 +3453,7 @@ class EmitterVisitorContext {
|
|
|
3451
3453
|
spanOf(line, column) {
|
|
3452
3454
|
const emittedLine = this._lines[line];
|
|
3453
3455
|
if (emittedLine) {
|
|
3454
|
-
let columnsLeft = column -
|
|
3456
|
+
let columnsLeft = column - INDENT_WITH.repeat(emittedLine.indent).length;
|
|
3455
3457
|
for (let partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
|
|
3456
3458
|
const part = emittedLine.parts[partIndex];
|
|
3457
3459
|
if (part.length > columnsLeft) {
|
|
@@ -3470,41 +3472,23 @@ class EmitterVisitorContext {
|
|
|
3470
3472
|
}
|
|
3471
3473
|
}
|
|
3472
3474
|
class AbstractEmitterVisitor {
|
|
3473
|
-
|
|
3475
|
+
printComments;
|
|
3476
|
+
printTypes;
|
|
3474
3477
|
lastIfCondition = null;
|
|
3475
|
-
constructor(
|
|
3476
|
-
this.
|
|
3477
|
-
|
|
3478
|
-
printLeadingComments(stmt, ctx) {
|
|
3479
|
-
if (stmt.leadingComments === undefined) {
|
|
3480
|
-
return;
|
|
3481
|
-
}
|
|
3482
|
-
for (const comment of stmt.leadingComments) {
|
|
3483
|
-
if (comment instanceof JSDocComment) {
|
|
3484
|
-
ctx.print(stmt, `/*${comment.toString()}*/`, comment.trailingNewline);
|
|
3485
|
-
} else {
|
|
3486
|
-
if (comment.multiline) {
|
|
3487
|
-
ctx.print(stmt, `/* ${comment.text} */`, comment.trailingNewline);
|
|
3488
|
-
} else {
|
|
3489
|
-
comment.text.split('\n').forEach(line => {
|
|
3490
|
-
ctx.println(stmt, `// ${line}`);
|
|
3491
|
-
});
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3478
|
+
constructor(printComments, printTypes) {
|
|
3479
|
+
this.printComments = printComments;
|
|
3480
|
+
this.printTypes = printTypes;
|
|
3495
3481
|
}
|
|
3496
3482
|
visitExpressionStmt(stmt, ctx) {
|
|
3497
3483
|
this.printLeadingComments(stmt, ctx);
|
|
3498
3484
|
stmt.expr.visitExpression(this, ctx);
|
|
3499
3485
|
ctx.println(stmt, ';');
|
|
3500
|
-
return null;
|
|
3501
3486
|
}
|
|
3502
3487
|
visitReturnStmt(stmt, ctx) {
|
|
3503
3488
|
this.printLeadingComments(stmt, ctx);
|
|
3504
3489
|
ctx.print(stmt, `return `);
|
|
3505
3490
|
stmt.value.visitExpression(this, ctx);
|
|
3506
3491
|
ctx.println(stmt, ';');
|
|
3507
|
-
return null;
|
|
3508
3492
|
}
|
|
3509
3493
|
visitIfStmt(stmt, ctx) {
|
|
3510
3494
|
this.printLeadingComments(stmt, ctx);
|
|
@@ -3532,10 +3516,21 @@ class AbstractEmitterVisitor {
|
|
|
3532
3516
|
}
|
|
3533
3517
|
}
|
|
3534
3518
|
ctx.println(stmt, `}`);
|
|
3535
|
-
|
|
3519
|
+
}
|
|
3520
|
+
visitDeclareVarStmt(stmt, ctx) {
|
|
3521
|
+
const varKind = stmt.hasModifier(StmtModifier.Final) ? 'const' : 'let';
|
|
3522
|
+
this.printLeadingComments(stmt, ctx);
|
|
3523
|
+
ctx.print(stmt, `${varKind} ${stmt.name}`);
|
|
3524
|
+
stmt.type?.visitType(this, ctx);
|
|
3525
|
+
if (stmt.value) {
|
|
3526
|
+
ctx.print(stmt, ' = ');
|
|
3527
|
+
stmt.value.visitExpression(this, ctx);
|
|
3528
|
+
}
|
|
3529
|
+
ctx.println(stmt, `;`);
|
|
3536
3530
|
}
|
|
3537
3531
|
visitInvokeFunctionExpr(expr, ctx) {
|
|
3538
|
-
|
|
3532
|
+
this.printLeadingComments(expr, ctx);
|
|
3533
|
+
const shouldParenthesize = this.shouldParenthesize(expr.fn, expr);
|
|
3539
3534
|
if (shouldParenthesize) {
|
|
3540
3535
|
ctx.print(expr.fn, '(');
|
|
3541
3536
|
}
|
|
@@ -3546,14 +3541,14 @@ class AbstractEmitterVisitor {
|
|
|
3546
3541
|
ctx.print(expr, `(`);
|
|
3547
3542
|
this.visitAllExpressions(expr.args, ctx, ',');
|
|
3548
3543
|
ctx.print(expr, `)`);
|
|
3549
|
-
return null;
|
|
3550
3544
|
}
|
|
3551
3545
|
visitTaggedTemplateLiteralExpr(expr, ctx) {
|
|
3546
|
+
this.printLeadingComments(expr, ctx);
|
|
3552
3547
|
expr.tag.visitExpression(this, ctx);
|
|
3553
3548
|
expr.template.visitExpression(this, ctx);
|
|
3554
|
-
return null;
|
|
3555
3549
|
}
|
|
3556
3550
|
visitTemplateLiteralExpr(expr, ctx) {
|
|
3551
|
+
this.printLeadingComments(expr, ctx);
|
|
3557
3552
|
ctx.print(expr, '`');
|
|
3558
3553
|
for (let i = 0; i < expr.elements.length; i++) {
|
|
3559
3554
|
expr.elements[i].visitExpression(this, ctx);
|
|
@@ -3567,45 +3562,46 @@ class AbstractEmitterVisitor {
|
|
|
3567
3562
|
ctx.print(expr, '`');
|
|
3568
3563
|
}
|
|
3569
3564
|
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
3565
|
+
this.printLeadingComments(expr, ctx);
|
|
3570
3566
|
ctx.print(expr, expr.rawText);
|
|
3571
3567
|
}
|
|
3572
|
-
visitWrappedNodeExpr(ast, ctx) {
|
|
3573
|
-
throw new Error('Abstract emitter cannot visit WrappedNodeExpr.');
|
|
3574
|
-
}
|
|
3575
3568
|
visitTypeofExpr(expr, ctx) {
|
|
3569
|
+
this.printLeadingComments(expr, ctx);
|
|
3576
3570
|
ctx.print(expr, 'typeof ');
|
|
3577
3571
|
expr.expr.visitExpression(this, ctx);
|
|
3578
3572
|
}
|
|
3579
3573
|
visitVoidExpr(expr, ctx) {
|
|
3574
|
+
this.printLeadingComments(expr, ctx);
|
|
3580
3575
|
ctx.print(expr, 'void ');
|
|
3581
3576
|
expr.expr.visitExpression(this, ctx);
|
|
3582
3577
|
}
|
|
3583
3578
|
visitReadVarExpr(ast, ctx) {
|
|
3579
|
+
this.printLeadingComments(ast, ctx);
|
|
3584
3580
|
ctx.print(ast, ast.name);
|
|
3585
|
-
return null;
|
|
3586
3581
|
}
|
|
3587
3582
|
visitInstantiateExpr(ast, ctx) {
|
|
3583
|
+
this.printLeadingComments(ast, ctx);
|
|
3588
3584
|
ctx.print(ast, `new `);
|
|
3589
3585
|
ast.classExpr.visitExpression(this, ctx);
|
|
3590
3586
|
ctx.print(ast, `(`);
|
|
3591
3587
|
this.visitAllExpressions(ast.args, ctx, ',');
|
|
3592
3588
|
ctx.print(ast, `)`);
|
|
3593
|
-
return null;
|
|
3594
3589
|
}
|
|
3595
3590
|
visitLiteralExpr(ast, ctx) {
|
|
3591
|
+
this.printLeadingComments(ast, ctx);
|
|
3596
3592
|
const value = ast.value;
|
|
3597
3593
|
if (typeof value === 'string') {
|
|
3598
|
-
ctx.print(ast, escapeIdentifier(value
|
|
3594
|
+
ctx.print(ast, escapeIdentifier(value));
|
|
3599
3595
|
} else {
|
|
3600
3596
|
ctx.print(ast, `${value}`);
|
|
3601
3597
|
}
|
|
3602
|
-
return null;
|
|
3603
3598
|
}
|
|
3604
3599
|
visitRegularExpressionLiteral(ast, ctx) {
|
|
3600
|
+
this.printLeadingComments(ast, ctx);
|
|
3605
3601
|
ctx.print(ast, `/${ast.body}/${ast.flags || ''}`);
|
|
3606
|
-
return null;
|
|
3607
3602
|
}
|
|
3608
3603
|
visitLocalizedString(ast, ctx) {
|
|
3604
|
+
this.printLeadingComments(ast, ctx);
|
|
3609
3605
|
const head = ast.serializeI18nHead();
|
|
3610
3606
|
ctx.print(ast, '$localize `' + head.raw);
|
|
3611
3607
|
for (let i = 1; i < ast.messageParts.length; i++) {
|
|
@@ -3614,27 +3610,85 @@ class AbstractEmitterVisitor {
|
|
|
3614
3610
|
ctx.print(ast, `}${ast.serializeI18nTemplatePart(i).raw}`);
|
|
3615
3611
|
}
|
|
3616
3612
|
ctx.print(ast, '`');
|
|
3617
|
-
return null;
|
|
3618
3613
|
}
|
|
3619
3614
|
visitConditionalExpr(ast, ctx) {
|
|
3615
|
+
this.printLeadingComments(ast, ctx);
|
|
3620
3616
|
ctx.print(ast, `(`);
|
|
3621
3617
|
ast.condition.visitExpression(this, ctx);
|
|
3622
|
-
ctx.print(ast, '? ');
|
|
3618
|
+
ctx.print(ast, ' ? ');
|
|
3623
3619
|
ast.trueCase.visitExpression(this, ctx);
|
|
3624
|
-
ctx.print(ast, ': ');
|
|
3625
|
-
ast.falseCase
|
|
3620
|
+
ctx.print(ast, ' : ');
|
|
3621
|
+
ast.falseCase?.visitExpression(this, ctx);
|
|
3626
3622
|
ctx.print(ast, `)`);
|
|
3627
|
-
return null;
|
|
3628
3623
|
}
|
|
3629
3624
|
visitDynamicImportExpr(ast, ctx) {
|
|
3630
|
-
|
|
3625
|
+
this.printLeadingComments(ast, ctx);
|
|
3626
|
+
ctx.print(ast, `import(`);
|
|
3627
|
+
if (typeof ast.url === 'string') {
|
|
3628
|
+
ctx.print(ast, escapeIdentifier(ast.url, true));
|
|
3629
|
+
} else {
|
|
3630
|
+
ast.url.visitExpression(this, ctx);
|
|
3631
|
+
}
|
|
3632
|
+
ctx.print(ast, `)`);
|
|
3631
3633
|
}
|
|
3632
3634
|
visitNotExpr(ast, ctx) {
|
|
3635
|
+
this.printLeadingComments(ast, ctx);
|
|
3633
3636
|
ctx.print(ast, '!');
|
|
3634
3637
|
ast.condition.visitExpression(this, ctx);
|
|
3635
|
-
|
|
3638
|
+
}
|
|
3639
|
+
visitFunctionExpr(ast, ctx) {
|
|
3640
|
+
this.printLeadingComments(ast, ctx);
|
|
3641
|
+
ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);
|
|
3642
|
+
this.visitParams(ast.params, ctx);
|
|
3643
|
+
ctx.print(ast, `)`);
|
|
3644
|
+
ast.type?.visitType(this, ctx);
|
|
3645
|
+
ctx.print(ast, ` {`);
|
|
3646
|
+
ctx.println(ast);
|
|
3647
|
+
ctx.incIndent();
|
|
3648
|
+
this.visitAllStatements(ast.statements, ctx);
|
|
3649
|
+
ctx.decIndent();
|
|
3650
|
+
ctx.println(ast, `}`);
|
|
3651
|
+
}
|
|
3652
|
+
visitArrowFunctionExpr(ast, ctx) {
|
|
3653
|
+
this.printLeadingComments(ast, ctx);
|
|
3654
|
+
ctx.print(ast, '(');
|
|
3655
|
+
this.visitParams(ast.params, ctx);
|
|
3656
|
+
ctx.print(ast, ')');
|
|
3657
|
+
ast.type?.visitType(this, ctx);
|
|
3658
|
+
ctx.print(ast, ' => ');
|
|
3659
|
+
if (Array.isArray(ast.body)) {
|
|
3660
|
+
ctx.print(ast, `{`);
|
|
3661
|
+
ctx.println(ast);
|
|
3662
|
+
ctx.incIndent();
|
|
3663
|
+
this.visitAllStatements(ast.body, ctx);
|
|
3664
|
+
ctx.decIndent();
|
|
3665
|
+
ctx.println(ast, `}`);
|
|
3666
|
+
} else {
|
|
3667
|
+
const shouldParenthesize = this.shouldParenthesize(ast.body, ast);
|
|
3668
|
+
if (shouldParenthesize) {
|
|
3669
|
+
ctx.print(ast, '(');
|
|
3670
|
+
}
|
|
3671
|
+
ast.body.visitExpression(this, ctx);
|
|
3672
|
+
if (shouldParenthesize) {
|
|
3673
|
+
ctx.print(ast, ')');
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
visitDeclareFunctionStmt(stmt, ctx) {
|
|
3678
|
+
this.printLeadingComments(stmt, ctx);
|
|
3679
|
+
ctx.print(stmt, `function ${stmt.name}(`);
|
|
3680
|
+
this.visitParams(stmt.params, ctx);
|
|
3681
|
+
ctx.print(stmt, `)`);
|
|
3682
|
+
stmt.type?.visitType(this, ctx);
|
|
3683
|
+
ctx.print(stmt, ` {`);
|
|
3684
|
+
ctx.println(stmt);
|
|
3685
|
+
ctx.incIndent();
|
|
3686
|
+
this.visitAllStatements(stmt.statements, ctx);
|
|
3687
|
+
ctx.decIndent();
|
|
3688
|
+
ctx.println(stmt, `}`);
|
|
3636
3689
|
}
|
|
3637
3690
|
visitUnaryOperatorExpr(ast, ctx) {
|
|
3691
|
+
this.printLeadingComments(ast, ctx);
|
|
3638
3692
|
let opStr;
|
|
3639
3693
|
switch (ast.operator) {
|
|
3640
3694
|
case UnaryOperator.Plus:
|
|
@@ -3651,9 +3705,9 @@ class AbstractEmitterVisitor {
|
|
|
3651
3705
|
ctx.print(ast, opStr);
|
|
3652
3706
|
ast.expr.visitExpression(this, ctx);
|
|
3653
3707
|
if (parens) ctx.print(ast, `)`);
|
|
3654
|
-
return null;
|
|
3655
3708
|
}
|
|
3656
3709
|
visitBinaryOperatorExpr(ast, ctx) {
|
|
3710
|
+
this.printLeadingComments(ast, ctx);
|
|
3657
3711
|
const operator = BINARY_OPERATORS$1.get(ast.operator);
|
|
3658
3712
|
if (!operator) {
|
|
3659
3713
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
@@ -3664,54 +3718,121 @@ class AbstractEmitterVisitor {
|
|
|
3664
3718
|
ctx.print(ast, ` ${operator} `);
|
|
3665
3719
|
ast.rhs.visitExpression(this, ctx);
|
|
3666
3720
|
if (parens) ctx.print(ast, `)`);
|
|
3667
|
-
return null;
|
|
3668
3721
|
}
|
|
3669
3722
|
visitReadPropExpr(ast, ctx) {
|
|
3723
|
+
this.printLeadingComments(ast, ctx);
|
|
3670
3724
|
ast.receiver.visitExpression(this, ctx);
|
|
3671
3725
|
ctx.print(ast, `.`);
|
|
3672
3726
|
ctx.print(ast, ast.name);
|
|
3673
|
-
return null;
|
|
3674
3727
|
}
|
|
3675
3728
|
visitReadKeyExpr(ast, ctx) {
|
|
3729
|
+
this.printLeadingComments(ast, ctx);
|
|
3676
3730
|
ast.receiver.visitExpression(this, ctx);
|
|
3677
3731
|
ctx.print(ast, `[`);
|
|
3678
3732
|
ast.index.visitExpression(this, ctx);
|
|
3679
3733
|
ctx.print(ast, `]`);
|
|
3680
|
-
return null;
|
|
3681
3734
|
}
|
|
3682
3735
|
visitLiteralArrayExpr(ast, ctx) {
|
|
3736
|
+
this.printLeadingComments(ast, ctx);
|
|
3683
3737
|
ctx.print(ast, `[`);
|
|
3684
|
-
this.visitAllExpressions(ast.entries, ctx, ',');
|
|
3738
|
+
this.visitAllExpressions(ast.entries, ctx, ', ');
|
|
3685
3739
|
ctx.print(ast, `]`);
|
|
3686
|
-
return null;
|
|
3687
3740
|
}
|
|
3688
3741
|
visitLiteralMapExpr(ast, ctx) {
|
|
3742
|
+
this.printLeadingComments(ast, ctx);
|
|
3689
3743
|
ctx.print(ast, `{`);
|
|
3690
3744
|
this.visitAllObjects(entry => {
|
|
3691
3745
|
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
3692
3746
|
ctx.print(ast, '...');
|
|
3693
3747
|
entry.expression.visitExpression(this, ctx);
|
|
3694
3748
|
} else {
|
|
3695
|
-
ctx.print(ast, `${escapeIdentifier(entry.key,
|
|
3749
|
+
ctx.print(ast, `${escapeIdentifier(entry.key, entry.quoted)}: `);
|
|
3696
3750
|
entry.value.visitExpression(this, ctx);
|
|
3697
3751
|
}
|
|
3698
|
-
}, ast.entries, ctx, ',');
|
|
3752
|
+
}, ast.entries, ctx, ', ');
|
|
3699
3753
|
ctx.print(ast, `}`);
|
|
3700
|
-
return null;
|
|
3701
3754
|
}
|
|
3702
3755
|
visitCommaExpr(ast, ctx) {
|
|
3756
|
+
this.printLeadingComments(ast, ctx);
|
|
3703
3757
|
ctx.print(ast, '(');
|
|
3704
|
-
this.visitAllExpressions(ast.parts, ctx, ',');
|
|
3758
|
+
this.visitAllExpressions(ast.parts, ctx, ', ');
|
|
3705
3759
|
ctx.print(ast, ')');
|
|
3706
|
-
return null;
|
|
3707
3760
|
}
|
|
3708
3761
|
visitParenthesizedExpr(ast, ctx) {
|
|
3762
|
+
this.printLeadingComments(ast, ctx);
|
|
3709
3763
|
ast.expr.visitExpression(this, ctx);
|
|
3710
3764
|
}
|
|
3711
3765
|
visitSpreadElementExpr(ast, ctx) {
|
|
3766
|
+
this.printLeadingComments(ast, ctx);
|
|
3712
3767
|
ctx.print(ast, '...');
|
|
3713
3768
|
ast.expression.visitExpression(this, ctx);
|
|
3714
3769
|
}
|
|
3770
|
+
visitBuiltinType(type, ctx) {
|
|
3771
|
+
if (!this.printTypes) {
|
|
3772
|
+
return;
|
|
3773
|
+
}
|
|
3774
|
+
switch (type.name) {
|
|
3775
|
+
case BuiltinTypeName.Bool:
|
|
3776
|
+
ctx.print(null, ': boolean');
|
|
3777
|
+
break;
|
|
3778
|
+
case BuiltinTypeName.Dynamic:
|
|
3779
|
+
ctx.print(null, ': any');
|
|
3780
|
+
break;
|
|
3781
|
+
case BuiltinTypeName.Int:
|
|
3782
|
+
case BuiltinTypeName.Number:
|
|
3783
|
+
ctx.print(null, ': number');
|
|
3784
|
+
break;
|
|
3785
|
+
case BuiltinTypeName.String:
|
|
3786
|
+
ctx.print(null, ': string');
|
|
3787
|
+
break;
|
|
3788
|
+
case BuiltinTypeName.None:
|
|
3789
|
+
ctx.print(null, ': void');
|
|
3790
|
+
break;
|
|
3791
|
+
case BuiltinTypeName.Inferred:
|
|
3792
|
+
break;
|
|
3793
|
+
case BuiltinTypeName.Function:
|
|
3794
|
+
ctx.print(null, ': Function');
|
|
3795
|
+
break;
|
|
3796
|
+
default:
|
|
3797
|
+
ctx.print(null, ': any');
|
|
3798
|
+
break;
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
visitExpressionType(type, ctx) {
|
|
3802
|
+
if (!this.printTypes) {
|
|
3803
|
+
return;
|
|
3804
|
+
}
|
|
3805
|
+
ctx.print(null, ': ');
|
|
3806
|
+
type.value.visitExpression(this, ctx);
|
|
3807
|
+
if (type.typeParams && type.typeParams.length > 0) {
|
|
3808
|
+
ctx.print(null, '<');
|
|
3809
|
+
this.visitAllObjects(param => param.visitType(this, ctx), type.typeParams, ctx, ',');
|
|
3810
|
+
ctx.print(null, '>');
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
visitArrayType(type, ctx) {
|
|
3814
|
+
if (!this.printTypes) {
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3817
|
+
ctx.print(null, ': ');
|
|
3818
|
+
type.of.visitType(this, ctx);
|
|
3819
|
+
ctx.print(null, '[]');
|
|
3820
|
+
}
|
|
3821
|
+
visitMapType(type, ctx) {
|
|
3822
|
+
if (!this.printTypes) {
|
|
3823
|
+
return;
|
|
3824
|
+
}
|
|
3825
|
+
ctx.print(null, ': { [key: string]: ');
|
|
3826
|
+
if (type.valueType) {
|
|
3827
|
+
type.valueType.visitType(this, ctx);
|
|
3828
|
+
} else {
|
|
3829
|
+
ctx.print(null, 'any');
|
|
3830
|
+
}
|
|
3831
|
+
ctx.print(null, '}');
|
|
3832
|
+
}
|
|
3833
|
+
visitTransplantedType(type, ctx) {
|
|
3834
|
+
throw new Error('TransplantedType nodes are not supported');
|
|
3835
|
+
}
|
|
3715
3836
|
visitAllExpressions(expressions, ctx, separator) {
|
|
3716
3837
|
this.visitAllObjects(expr => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
3717
3838
|
}
|
|
@@ -3740,15 +3861,39 @@ class AbstractEmitterVisitor {
|
|
|
3740
3861
|
visitAllStatements(statements, ctx) {
|
|
3741
3862
|
statements.forEach(stmt => stmt.visitStatement(this, ctx));
|
|
3742
3863
|
}
|
|
3864
|
+
visitParams(params, ctx) {
|
|
3865
|
+
this.visitAllObjects(param => {
|
|
3866
|
+
ctx.print(null, param.name);
|
|
3867
|
+
param.type?.visitType(this, ctx);
|
|
3868
|
+
}, params, ctx, ', ');
|
|
3869
|
+
}
|
|
3870
|
+
shouldParenthesize(expression, containingExpression) {
|
|
3871
|
+
return ((expression instanceof ArrowFunctionExpr$1 || expression instanceof FunctionExpr) && containingExpression instanceof InvokeFunctionExpr || expression instanceof LiteralMapExpr && containingExpression instanceof ArrowFunctionExpr$1
|
|
3872
|
+
);
|
|
3873
|
+
}
|
|
3874
|
+
printLeadingComments(node, ctx) {
|
|
3875
|
+
if (!this.printComments || node.leadingComments === undefined) {
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3878
|
+
for (const comment of node.leadingComments) {
|
|
3879
|
+
if (comment instanceof JSDocComment) {
|
|
3880
|
+
ctx.print(node, `/*${comment.toString()}*/`, comment.trailingNewline);
|
|
3881
|
+
} else {
|
|
3882
|
+
if (comment.multiline) {
|
|
3883
|
+
ctx.print(node, `/* ${comment.text} */`, comment.trailingNewline);
|
|
3884
|
+
} else {
|
|
3885
|
+
comment.text.split('\n').forEach(line => ctx.println(node, `// ${line}`));
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3743
3890
|
}
|
|
3744
|
-
function escapeIdentifier(input,
|
|
3891
|
+
function escapeIdentifier(input, alwaysQuote = true) {
|
|
3745
3892
|
if (input == null) {
|
|
3746
3893
|
return null;
|
|
3747
3894
|
}
|
|
3748
|
-
const body = input.replace(
|
|
3749
|
-
if (match[0] == '
|
|
3750
|
-
return escapeDollar ? '\\$' : '$';
|
|
3751
|
-
} else if (match[0] == '\n') {
|
|
3895
|
+
const body = input.replace(SINGLE_QUOTE_ESCAPE_STRING_RE, (...match) => {
|
|
3896
|
+
if (match[0] == '\n') {
|
|
3752
3897
|
return '\\n';
|
|
3753
3898
|
} else if (match[0] == '\r') {
|
|
3754
3899
|
return '\\r';
|
|
@@ -3756,16 +3901,9 @@ function escapeIdentifier(input, escapeDollar, alwaysQuote = true) {
|
|
|
3756
3901
|
return `\\${match[0]}`;
|
|
3757
3902
|
}
|
|
3758
3903
|
});
|
|
3759
|
-
const requiresQuotes = alwaysQuote || !
|
|
3904
|
+
const requiresQuotes = alwaysQuote || !LEGAL_IDENTIFIER_RE.test(body);
|
|
3760
3905
|
return requiresQuotes ? `'${body}'` : body;
|
|
3761
3906
|
}
|
|
3762
|
-
function _createIndent(count) {
|
|
3763
|
-
let res = '';
|
|
3764
|
-
for (let i = 0; i < count; i++) {
|
|
3765
|
-
res += _INDENT_WITH;
|
|
3766
|
-
}
|
|
3767
|
-
return res;
|
|
3768
|
-
}
|
|
3769
3907
|
|
|
3770
3908
|
function typeWithParameters(type, numParams) {
|
|
3771
3909
|
if (numParams === 0) {
|
|
@@ -3778,7 +3916,7 @@ function typeWithParameters(type, numParams) {
|
|
|
3778
3916
|
return expressionType(type, undefined, params);
|
|
3779
3917
|
}
|
|
3780
3918
|
function getSafePropertyAccessString(accessor, name) {
|
|
3781
|
-
const escapedName = escapeIdentifier(name, false
|
|
3919
|
+
const escapedName = escapeIdentifier(name, false);
|
|
3782
3920
|
return escapedName !== name ? `${accessor}[${escapedName}]` : `${accessor}.${name}`;
|
|
3783
3921
|
}
|
|
3784
3922
|
function jitOnlyGuardedExpression(expr) {
|
|
@@ -3807,6 +3945,9 @@ function refsToArray(refs, shouldForwardDeclare) {
|
|
|
3807
3945
|
const values = literalArr(refs.map(ref => ref.value));
|
|
3808
3946
|
return shouldForwardDeclare ? arrowFn([], values) : values;
|
|
3809
3947
|
}
|
|
3948
|
+
function tsIgnoreComment() {
|
|
3949
|
+
return leadingComment('@ts-ignore', true, true);
|
|
3950
|
+
}
|
|
3810
3951
|
function createMayBeForwardRefExpression(expression, forwardRef) {
|
|
3811
3952
|
return {
|
|
3812
3953
|
expression,
|
|
@@ -3839,6 +3980,7 @@ function compileFactoryFunction(meta) {
|
|
|
3839
3980
|
let baseFactoryVar = null;
|
|
3840
3981
|
const typeForCtor = !isDelegatedFactoryMetadata(meta) ? new BinaryOperatorExpr(BinaryOperator.Or, t, meta.type.value) : t;
|
|
3841
3982
|
let ctorExpr = null;
|
|
3983
|
+
const factoryComments = meta.deps !== null && meta.deps !== 'invalid' && meta.deps.length > 0 ? [tsIgnoreComment()] : undefined;
|
|
3842
3984
|
if (meta.deps !== null) {
|
|
3843
3985
|
if (meta.deps !== 'invalid') {
|
|
3844
3986
|
ctorExpr = new InstantiateExpr(typeForCtor, injectDependencies(meta.deps, meta.target));
|
|
@@ -3851,9 +3993,9 @@ function compileFactoryFunction(meta) {
|
|
|
3851
3993
|
let retExpr = null;
|
|
3852
3994
|
function makeConditionalFactory(nonCtorExpr) {
|
|
3853
3995
|
const r = variable('__ngConditionalFactory__');
|
|
3854
|
-
body.push(new DeclareVarStmt(r.name, NULL_EXPR,
|
|
3855
|
-
const ctorStmt = ctorExpr !== null ? r.set(ctorExpr).toStmt() : importExpr(Identifiers.invalidFactory).callFn([]).toStmt();
|
|
3856
|
-
body.push(ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt()]));
|
|
3996
|
+
body.push(new DeclareVarStmt(r.name, NULL_EXPR, DYNAMIC_TYPE));
|
|
3997
|
+
const ctorStmt = ctorExpr !== null ? r.set(ctorExpr).toStmt(factoryComments) : importExpr(Identifiers.invalidFactory).callFn([]).toStmt();
|
|
3998
|
+
body.push(ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt([tsIgnoreComment()])]));
|
|
3857
3999
|
return r;
|
|
3858
4000
|
}
|
|
3859
4001
|
if (isDelegatedFactoryMetadata(meta)) {
|
|
@@ -3872,11 +4014,11 @@ function compileFactoryFunction(meta) {
|
|
|
3872
4014
|
const baseFactory = new BinaryOperatorExpr(BinaryOperator.Or, baseFactoryVar, baseFactoryVar.set(getInheritedFactoryCall));
|
|
3873
4015
|
body.push(new ReturnStatement(baseFactory.callFn([typeForCtor])));
|
|
3874
4016
|
} else {
|
|
3875
|
-
body.push(new ReturnStatement(retExpr));
|
|
4017
|
+
body.push(new ReturnStatement(retExpr, null, factoryComments));
|
|
3876
4018
|
}
|
|
3877
4019
|
let factoryFn = fn([new FnParam(t.name, DYNAMIC_TYPE)], body, INFERRED_TYPE, undefined, `${meta.name}_Factory`);
|
|
3878
4020
|
if (baseFactoryVar !== null) {
|
|
3879
|
-
factoryFn = arrowFn([], [new DeclareVarStmt(baseFactoryVar.name), new ReturnStatement(factoryFn)]).callFn([], undefined, true);
|
|
4021
|
+
factoryFn = arrowFn([], [new DeclareVarStmt(baseFactoryVar.name, undefined, DYNAMIC_TYPE), new ReturnStatement(factoryFn)]).callFn([], undefined, true);
|
|
3880
4022
|
}
|
|
3881
4023
|
return {
|
|
3882
4024
|
expression: factoryFn,
|
|
@@ -4996,8 +5138,10 @@ class SwitchBlockCaseGroup extends BlockNode {
|
|
|
4996
5138
|
}
|
|
4997
5139
|
}
|
|
4998
5140
|
class SwitchExhaustiveCheck extends BlockNode {
|
|
4999
|
-
|
|
5141
|
+
expression;
|
|
5142
|
+
constructor(expression, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
5000
5143
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
5144
|
+
this.expression = expression;
|
|
5001
5145
|
}
|
|
5002
5146
|
visit(visitor) {
|
|
5003
5147
|
return visitor.visitSwitchExhaustiveCheck(this);
|
|
@@ -6412,7 +6556,7 @@ function sanitizeIdentifier(name) {
|
|
|
6412
6556
|
const makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})';
|
|
6413
6557
|
class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
6414
6558
|
constructor() {
|
|
6415
|
-
super(false);
|
|
6559
|
+
super(false, false);
|
|
6416
6560
|
}
|
|
6417
6561
|
visitWrappedNodeExpr(ast, ctx) {
|
|
6418
6562
|
throw new Error('Cannot emit a WrappedNodeExpr in Javascript.');
|
|
@@ -6424,20 +6568,18 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
6424
6568
|
stmt.value.visitExpression(this, ctx);
|
|
6425
6569
|
}
|
|
6426
6570
|
ctx.println(stmt, `;`);
|
|
6427
|
-
return null;
|
|
6428
6571
|
}
|
|
6429
6572
|
visitTaggedTemplateLiteralExpr(ast, ctx) {
|
|
6430
6573
|
const elements = ast.template.elements;
|
|
6431
6574
|
ast.tag.visitExpression(this, ctx);
|
|
6432
6575
|
ctx.print(ast, `(${makeTemplateObjectPolyfill}(`);
|
|
6433
|
-
ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.text
|
|
6434
|
-
ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.rawText
|
|
6576
|
+
ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.text)).join(', ')}], `);
|
|
6577
|
+
ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.rawText)).join(', ')}])`);
|
|
6435
6578
|
ast.template.expressions.forEach(expression => {
|
|
6436
6579
|
ctx.print(ast, ', ');
|
|
6437
6580
|
expression.visitExpression(this, ctx);
|
|
6438
6581
|
});
|
|
6439
6582
|
ctx.print(ast, ')');
|
|
6440
|
-
return null;
|
|
6441
6583
|
}
|
|
6442
6584
|
visitTemplateLiteralExpr(expr, ctx) {
|
|
6443
6585
|
ctx.print(expr, '`');
|
|
@@ -6454,49 +6596,6 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
6454
6596
|
}
|
|
6455
6597
|
visitTemplateLiteralElementExpr(expr, ctx) {
|
|
6456
6598
|
ctx.print(expr, expr.rawText);
|
|
6457
|
-
return null;
|
|
6458
|
-
}
|
|
6459
|
-
visitFunctionExpr(ast, ctx) {
|
|
6460
|
-
ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);
|
|
6461
|
-
this._visitParams(ast.params, ctx);
|
|
6462
|
-
ctx.println(ast, `) {`);
|
|
6463
|
-
ctx.incIndent();
|
|
6464
|
-
this.visitAllStatements(ast.statements, ctx);
|
|
6465
|
-
ctx.decIndent();
|
|
6466
|
-
ctx.print(ast, `}`);
|
|
6467
|
-
return null;
|
|
6468
|
-
}
|
|
6469
|
-
visitArrowFunctionExpr(ast, ctx) {
|
|
6470
|
-
ctx.print(ast, '(');
|
|
6471
|
-
this._visitParams(ast.params, ctx);
|
|
6472
|
-
ctx.print(ast, ') =>');
|
|
6473
|
-
if (Array.isArray(ast.body)) {
|
|
6474
|
-
ctx.println(ast, `{`);
|
|
6475
|
-
ctx.incIndent();
|
|
6476
|
-
this.visitAllStatements(ast.body, ctx);
|
|
6477
|
-
ctx.decIndent();
|
|
6478
|
-
ctx.print(ast, `}`);
|
|
6479
|
-
} else {
|
|
6480
|
-
const isObjectLiteral = ast.body instanceof LiteralMapExpr;
|
|
6481
|
-
if (isObjectLiteral) {
|
|
6482
|
-
ctx.print(ast, '(');
|
|
6483
|
-
}
|
|
6484
|
-
ast.body.visitExpression(this, ctx);
|
|
6485
|
-
if (isObjectLiteral) {
|
|
6486
|
-
ctx.print(ast, ')');
|
|
6487
|
-
}
|
|
6488
|
-
}
|
|
6489
|
-
return null;
|
|
6490
|
-
}
|
|
6491
|
-
visitDeclareFunctionStmt(stmt, ctx) {
|
|
6492
|
-
ctx.print(stmt, `function ${stmt.name}(`);
|
|
6493
|
-
this._visitParams(stmt.params, ctx);
|
|
6494
|
-
ctx.println(stmt, `) {`);
|
|
6495
|
-
ctx.incIndent();
|
|
6496
|
-
this.visitAllStatements(stmt.statements, ctx);
|
|
6497
|
-
ctx.decIndent();
|
|
6498
|
-
ctx.println(stmt, `}`);
|
|
6499
|
-
return null;
|
|
6500
6599
|
}
|
|
6501
6600
|
visitLocalizedString(ast, ctx) {
|
|
6502
6601
|
ctx.print(ast, `$localize(${makeTemplateObjectPolyfill}(`);
|
|
@@ -6504,17 +6603,13 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
6504
6603
|
for (let i = 1; i < ast.messageParts.length; i++) {
|
|
6505
6604
|
parts.push(ast.serializeI18nTemplatePart(i));
|
|
6506
6605
|
}
|
|
6507
|
-
ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.cooked
|
|
6508
|
-
ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.raw
|
|
6606
|
+
ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.cooked)).join(', ')}], `);
|
|
6607
|
+
ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.raw)).join(', ')}])`);
|
|
6509
6608
|
ast.expressions.forEach(expression => {
|
|
6510
6609
|
ctx.print(ast, ', ');
|
|
6511
6610
|
expression.visitExpression(this, ctx);
|
|
6512
6611
|
});
|
|
6513
6612
|
ctx.print(ast, ')');
|
|
6514
|
-
return null;
|
|
6515
|
-
}
|
|
6516
|
-
_visitParams(params, ctx) {
|
|
6517
|
-
this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');
|
|
6518
6613
|
}
|
|
6519
6614
|
}
|
|
6520
6615
|
|
|
@@ -6756,12 +6851,12 @@ function createNgModuleType(meta) {
|
|
|
6756
6851
|
const {
|
|
6757
6852
|
type: moduleType,
|
|
6758
6853
|
declarations,
|
|
6759
|
-
exports,
|
|
6854
|
+
exports: exports$1,
|
|
6760
6855
|
imports,
|
|
6761
6856
|
includeImportTypes,
|
|
6762
6857
|
publicDeclarationTypes
|
|
6763
6858
|
} = meta;
|
|
6764
|
-
return new ExpressionType(importExpr(Identifiers.NgModuleDeclaration, [new ExpressionType(moduleType.type), publicDeclarationTypes === null ? tupleTypeOf(declarations) : tupleOfTypes(publicDeclarationTypes), includeImportTypes ? tupleTypeOf(imports) : NONE_TYPE, tupleTypeOf(exports)]));
|
|
6859
|
+
return new ExpressionType(importExpr(Identifiers.NgModuleDeclaration, [new ExpressionType(moduleType.type), publicDeclarationTypes === null ? tupleTypeOf(declarations) : tupleOfTypes(publicDeclarationTypes), includeImportTypes ? tupleTypeOf(imports) : NONE_TYPE, tupleTypeOf(exports$1)]));
|
|
6765
6860
|
}
|
|
6766
6861
|
function generateSetNgModuleScopeCall(meta) {
|
|
6767
6862
|
const scopeMap = new DefinitionMap();
|
|
@@ -6866,7 +6961,7 @@ class ShadowCss {
|
|
|
6866
6961
|
comments.push(m);
|
|
6867
6962
|
} else {
|
|
6868
6963
|
const newLinesMatches = m.match(_newLinesRe);
|
|
6869
|
-
comments.push(
|
|
6964
|
+
comments.push(newLinesMatches?.join('') ?? '');
|
|
6870
6965
|
}
|
|
6871
6966
|
return COMMENT_PLACEHOLDER;
|
|
6872
6967
|
});
|
|
@@ -13663,13 +13758,6 @@ class _Tokenizer {
|
|
|
13663
13758
|
this._requireCharCode($AT);
|
|
13664
13759
|
this._beginToken(24, start);
|
|
13665
13760
|
const startToken = this._endToken([this._getBlockName()]);
|
|
13666
|
-
if (startToken.parts[0] === 'default never' && this._attemptCharCode($SEMICOLON)) {
|
|
13667
|
-
this._beginToken(25);
|
|
13668
|
-
this._endToken([]);
|
|
13669
|
-
this._beginToken(26);
|
|
13670
|
-
this._endToken([]);
|
|
13671
|
-
return;
|
|
13672
|
-
}
|
|
13673
13761
|
if (this._cursor.peek() === $LPAREN) {
|
|
13674
13762
|
this._cursor.advance();
|
|
13675
13763
|
this._consumeBlockParameters();
|
|
@@ -13681,6 +13769,13 @@ class _Tokenizer {
|
|
|
13681
13769
|
return;
|
|
13682
13770
|
}
|
|
13683
13771
|
}
|
|
13772
|
+
if (startToken.parts[0] === 'default never' && this._attemptCharCode($SEMICOLON)) {
|
|
13773
|
+
this._beginToken(25);
|
|
13774
|
+
this._endToken([]);
|
|
13775
|
+
this._beginToken(26);
|
|
13776
|
+
this._endToken([]);
|
|
13777
|
+
return;
|
|
13778
|
+
}
|
|
13684
13779
|
if (this._attemptCharCode($LBRACE)) {
|
|
13685
13780
|
this._beginToken(25);
|
|
13686
13781
|
this._endToken([]);
|
|
@@ -14044,6 +14139,26 @@ class _Tokenizer {
|
|
|
14044
14139
|
const name = this._cursor.getChars(nameStart);
|
|
14045
14140
|
return [prefix, name];
|
|
14046
14141
|
}
|
|
14142
|
+
_consumeSingleLineComment() {
|
|
14143
|
+
this._attemptCharCodeUntilFn(code => isNewLine(code) || code === $EOF);
|
|
14144
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14145
|
+
}
|
|
14146
|
+
_consumeMultiLineComment() {
|
|
14147
|
+
this._attemptCharCodeUntilFn(code => {
|
|
14148
|
+
if (code === $EOF) {
|
|
14149
|
+
return true;
|
|
14150
|
+
}
|
|
14151
|
+
if (code === $STAR) {
|
|
14152
|
+
const next = this._cursor.clone();
|
|
14153
|
+
next.advance();
|
|
14154
|
+
return next.peek() === $SLASH;
|
|
14155
|
+
}
|
|
14156
|
+
return false;
|
|
14157
|
+
});
|
|
14158
|
+
if (this._attemptStr('*/')) {
|
|
14159
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14047
14162
|
_consumeTagOpen(start) {
|
|
14048
14163
|
let tagName;
|
|
14049
14164
|
let prefix;
|
|
@@ -14069,7 +14184,18 @@ class _Tokenizer {
|
|
|
14069
14184
|
tagName = closingTagName = openToken.parts[1];
|
|
14070
14185
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14071
14186
|
}
|
|
14072
|
-
while (
|
|
14187
|
+
while (true) {
|
|
14188
|
+
if (this._attemptStr('//')) {
|
|
14189
|
+
this._consumeSingleLineComment();
|
|
14190
|
+
continue;
|
|
14191
|
+
}
|
|
14192
|
+
if (this._attemptStr('/*')) {
|
|
14193
|
+
this._consumeMultiLineComment();
|
|
14194
|
+
continue;
|
|
14195
|
+
}
|
|
14196
|
+
if (isAttributeTerminator(this._cursor.peek())) {
|
|
14197
|
+
break;
|
|
14198
|
+
}
|
|
14073
14199
|
if (this._selectorlessEnabled && this._cursor.peek() === $AT) {
|
|
14074
14200
|
const start = this._cursor.clone();
|
|
14075
14201
|
const nameStart = start.clone();
|
|
@@ -14451,7 +14577,7 @@ function isDigitEntityEnd(code) {
|
|
|
14451
14577
|
return code === $SEMICOLON || code === $EOF || !isAsciiHexDigit(code);
|
|
14452
14578
|
}
|
|
14453
14579
|
function isNamedEntityEnd(code) {
|
|
14454
|
-
return code === $SEMICOLON || code === $EOF || !isAsciiLetter(code);
|
|
14580
|
+
return code === $SEMICOLON || code === $EOF || !(isAsciiLetter(code) || isDigit(code));
|
|
14455
14581
|
}
|
|
14456
14582
|
function isExpansionCaseStart(peek) {
|
|
14457
14583
|
return peek !== $RBRACE;
|
|
@@ -18347,7 +18473,6 @@ function i18nMetaToJSDoc(meta) {
|
|
|
18347
18473
|
return jsDocComment(tags);
|
|
18348
18474
|
}
|
|
18349
18475
|
|
|
18350
|
-
const GOOG_GET_MSG = 'goog.getMsg';
|
|
18351
18476
|
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
18352
18477
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
18353
18478
|
const args = [literal(messageString)];
|
|
@@ -18361,7 +18486,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, placehold
|
|
|
18361
18486
|
})))
|
|
18362
18487
|
}));
|
|
18363
18488
|
}
|
|
18364
|
-
const googGetMsgStmt = new DeclareVarStmt(closureVar.name, variable(
|
|
18489
|
+
const googGetMsgStmt = new DeclareVarStmt(closureVar.name, variable('goog').prop('getMsg').callFn(args, null, undefined, [tsIgnoreComment()]), INFERRED_TYPE, StmtModifier.Final);
|
|
18365
18490
|
googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
|
|
18366
18491
|
const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
|
|
18367
18492
|
return [googGetMsgStmt, i18nAssignmentStmt];
|
|
@@ -18406,7 +18531,7 @@ function createLocalizeStatements(variable, message, params) {
|
|
|
18406
18531
|
const expressions = placeHolders.map(ph => params[ph.text]);
|
|
18407
18532
|
const localizedString$1 = localizedString(message, messageParts, placeHolders, expressions, sourceSpan);
|
|
18408
18533
|
const variableInitialization = variable.set(localizedString$1);
|
|
18409
|
-
return [new ExpressionStatement(variableInitialization)];
|
|
18534
|
+
return [new ExpressionStatement(variableInitialization, null, [tsIgnoreComment()])];
|
|
18410
18535
|
}
|
|
18411
18536
|
class LocalizeSerializerVisitor {
|
|
18412
18537
|
placeholderToMessage;
|
|
@@ -18609,7 +18734,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
18609
18734
|
}
|
|
18610
18735
|
addSubMessageParams(messageOp, subMessagePlaceholders);
|
|
18611
18736
|
messageOp.params = new Map([...messageOp.params.entries()].sort());
|
|
18612
|
-
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
|
|
18737
|
+
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX), DYNAMIC_TYPE);
|
|
18613
18738
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
18614
18739
|
let transformFn = undefined;
|
|
18615
18740
|
if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
|
|
@@ -19389,7 +19514,7 @@ class PureFunctionConstant extends GenericKeyFn {
|
|
|
19389
19514
|
toSharedConstantDeclaration(declName, keyExpr) {
|
|
19390
19515
|
const fnParams = [];
|
|
19391
19516
|
for (let idx = 0; idx < this.numArgs; idx++) {
|
|
19392
|
-
fnParams.push(new FnParam('a' + idx));
|
|
19517
|
+
fnParams.push(new FnParam('a' + idx, DYNAMIC_TYPE));
|
|
19393
19518
|
}
|
|
19394
19519
|
const returnExpr = transformExpressionsInExpression(keyExpr, expr => {
|
|
19395
19520
|
if (!(expr instanceof PureFunctionParameterExpr)) {
|
|
@@ -20052,7 +20177,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
20052
20177
|
if (op.variable.name === null) {
|
|
20053
20178
|
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
20054
20179
|
}
|
|
20055
|
-
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer,
|
|
20180
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, DYNAMIC_TYPE, StmtModifier.Final)));
|
|
20056
20181
|
break;
|
|
20057
20182
|
case OpKind.Namespace:
|
|
20058
20183
|
switch (op.active) {
|
|
@@ -20270,7 +20395,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
20270
20395
|
if (op.variable.name === null) {
|
|
20271
20396
|
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
20272
20397
|
}
|
|
20273
|
-
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer,
|
|
20398
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, DYNAMIC_TYPE, StmtModifier.Final)));
|
|
20274
20399
|
break;
|
|
20275
20400
|
case OpKind.Conditional:
|
|
20276
20401
|
if (op.processed === null) {
|
|
@@ -20378,7 +20503,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
|
|
|
20378
20503
|
}
|
|
20379
20504
|
const params = [];
|
|
20380
20505
|
if (consumesDollarEvent) {
|
|
20381
|
-
params.push(new FnParam('$event'));
|
|
20506
|
+
params.push(new FnParam('$event', DYNAMIC_TYPE));
|
|
20382
20507
|
}
|
|
20383
20508
|
return fn(params, handlerStmts, undefined, undefined, name);
|
|
20384
20509
|
}
|
|
@@ -20386,7 +20511,7 @@ function reifyTrackBy(unit, op) {
|
|
|
20386
20511
|
if (op.trackByFn !== null) {
|
|
20387
20512
|
return op.trackByFn;
|
|
20388
20513
|
}
|
|
20389
|
-
const params = [new FnParam('$index'), new FnParam('$item')];
|
|
20514
|
+
const params = [new FnParam('$index', NUMBER_TYPE), new FnParam('$item', DYNAMIC_TYPE)];
|
|
20390
20515
|
let fn$1;
|
|
20391
20516
|
if (op.trackByOps === null) {
|
|
20392
20517
|
fn$1 = op.usesComponentInstance ? fn(params, [new ReturnStatement(op.track)]) : arrowFn(params, op.track);
|
|
@@ -20414,7 +20539,7 @@ function getArrowFunctionFactory(unit, expr) {
|
|
|
20414
20539
|
statements.push(op.statement);
|
|
20415
20540
|
}
|
|
20416
20541
|
const body = statements.length === 1 && statements[0] instanceof ReturnStatement ? statements[0].value : statements;
|
|
20417
|
-
return arrowFn([new FnParam(expr.contextName), new FnParam(expr.currentViewName)], arrowFn(expr.parameters, body));
|
|
20542
|
+
return arrowFn([new FnParam(expr.contextName, DYNAMIC_TYPE), new FnParam(expr.currentViewName, DYNAMIC_TYPE)], arrowFn(expr.parameters, body));
|
|
20418
20543
|
}
|
|
20419
20544
|
|
|
20420
20545
|
function removeEmptyBindings(job) {
|
|
@@ -21259,7 +21384,7 @@ function optimizeTrackFns(job) {
|
|
|
21259
21384
|
return expr;
|
|
21260
21385
|
}, VisitorContextFlag.None);
|
|
21261
21386
|
const trackOpList = new OpList();
|
|
21262
|
-
trackOpList.push(createStatementOp(new ReturnStatement(op.track, op.track.sourceSpan)));
|
|
21387
|
+
trackOpList.push(createStatementOp(new ReturnStatement(op.track, op.track.sourceSpan, [tsIgnoreComment()])));
|
|
21263
21388
|
op.trackByOps = trackOpList;
|
|
21264
21389
|
}
|
|
21265
21390
|
}
|
|
@@ -21785,7 +21910,7 @@ function addArrowFunctions(unit, op) {
|
|
|
21785
21910
|
}, VisitorContextFlag.None);
|
|
21786
21911
|
}
|
|
21787
21912
|
|
|
21788
|
-
const ELIGIBLE_CONTROL_PROPERTIES = new
|
|
21913
|
+
const ELIGIBLE_CONTROL_PROPERTIES = new Map([['formField', new Set([OpKind.Property])], ['formControl', new Set([OpKind.Property])], ['formControlName', new Set([OpKind.Property, OpKind.Attribute])], ['ngModel', new Set([OpKind.Attribute, OpKind.Property, OpKind.TwoWayProperty])]]);
|
|
21789
21914
|
function specializeControlProperties(job) {
|
|
21790
21915
|
for (const unit of job.units) {
|
|
21791
21916
|
processView(unit);
|
|
@@ -21793,10 +21918,11 @@ function specializeControlProperties(job) {
|
|
|
21793
21918
|
}
|
|
21794
21919
|
function processView(view) {
|
|
21795
21920
|
for (const op of view.update) {
|
|
21796
|
-
if (op.kind !== OpKind.Property) {
|
|
21921
|
+
if (op.kind !== OpKind.Property && op.kind !== OpKind.TwoWayProperty && op.kind !== OpKind.Attribute) {
|
|
21797
21922
|
continue;
|
|
21798
21923
|
}
|
|
21799
|
-
|
|
21924
|
+
const eligibleOps = ELIGIBLE_CONTROL_PROPERTIES.get(op.name);
|
|
21925
|
+
if (eligibleOps !== undefined && eligibleOps.has(op.kind)) {
|
|
21800
21926
|
addControlInstruction(view, op);
|
|
21801
21927
|
}
|
|
21802
21928
|
}
|
|
@@ -21818,7 +21944,7 @@ function findCreateInstruction(view, target) {
|
|
|
21818
21944
|
function addControlInstruction(view, propertyOp) {
|
|
21819
21945
|
const targetCreateOp = findCreateInstruction(view, propertyOp.target);
|
|
21820
21946
|
if (targetCreateOp === null) {
|
|
21821
|
-
|
|
21947
|
+
return;
|
|
21822
21948
|
}
|
|
21823
21949
|
const controlCreateOp = createControlCreateOp(propertyOp.sourceSpan);
|
|
21824
21950
|
OpList.insertAfter(controlCreateOp, targetCreateOp);
|
|
@@ -22080,7 +22206,7 @@ function emitView(view) {
|
|
|
22080
22206
|
}
|
|
22081
22207
|
const createCond = maybeGenerateRfBlock(1, createStatements);
|
|
22082
22208
|
const updateCond = maybeGenerateRfBlock(2, updateStatements);
|
|
22083
|
-
return fn([new FnParam(RENDER_FLAGS), new FnParam(CONTEXT_NAME)], [...createCond, ...updateCond], undefined, undefined, view.fnName);
|
|
22209
|
+
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, DYNAMIC_TYPE)], [...createCond, ...updateCond], undefined, undefined, view.fnName);
|
|
22084
22210
|
}
|
|
22085
22211
|
function maybeGenerateRfBlock(flag, statements) {
|
|
22086
22212
|
if (statements.length === 0) {
|
|
@@ -22111,7 +22237,7 @@ function emitHostBindingFunction(job) {
|
|
|
22111
22237
|
}
|
|
22112
22238
|
const createCond = maybeGenerateRfBlock(1, createStatements);
|
|
22113
22239
|
const updateCond = maybeGenerateRfBlock(2, updateStatements);
|
|
22114
|
-
return fn([new FnParam(RENDER_FLAGS), new FnParam(CONTEXT_NAME)], [...createCond, ...updateCond], undefined, undefined, job.root.fnName);
|
|
22240
|
+
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, DYNAMIC_TYPE)], [...createCond, ...updateCond], undefined, undefined, job.root.fnName);
|
|
22115
22241
|
}
|
|
22116
22242
|
|
|
22117
22243
|
const domSchema = new DomElementSchemaRegistry();
|
|
@@ -22658,7 +22784,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
22658
22784
|
} else if (ast instanceof SpreadElement) {
|
|
22659
22785
|
return new SpreadElementExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
22660
22786
|
} else if (ast instanceof ArrowFunction) {
|
|
22661
|
-
return updateParameterReferences(arrowFn(ast.parameters.map(arg => new FnParam(arg.name)), convertAst(ast.body, job, baseSourceSpan)));
|
|
22787
|
+
return updateParameterReferences(arrowFn(ast.parameters.map(arg => new FnParam(arg.name, DYNAMIC_TYPE)), convertAst(ast.body, job, baseSourceSpan)));
|
|
22662
22788
|
} else {
|
|
22663
22789
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
22664
22790
|
}
|
|
@@ -22996,7 +23122,7 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
|
|
|
22996
23122
|
createStatements.push(new ExpressionStatement(viewQueryCall));
|
|
22997
23123
|
}
|
|
22998
23124
|
const viewQueryFnName = name ? `${name}_Query` : null;
|
|
22999
|
-
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME,
|
|
23125
|
+
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, DYNAMIC_TYPE)], [renderFlagCheckIfStmt(1, createStatements), renderFlagCheckIfStmt(2, collapseAdvanceStatements(updateStatements))], INFERRED_TYPE, null, viewQueryFnName);
|
|
23000
23126
|
}
|
|
23001
23127
|
function createContentQueriesFunction(queries, constantPool, name) {
|
|
23002
23128
|
const createStatements = [];
|
|
@@ -23030,7 +23156,7 @@ function createContentQueriesFunction(queries, constantPool, name) {
|
|
|
23030
23156
|
createStatements.push(new ExpressionStatement(contentQueryCall));
|
|
23031
23157
|
}
|
|
23032
23158
|
const contentQueriesFnName = name ? `${name}_ContentQueries` : null;
|
|
23033
|
-
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME,
|
|
23159
|
+
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, DYNAMIC_TYPE), new FnParam('dirIndex', NUMBER_TYPE)], [renderFlagCheckIfStmt(1, createStatements), renderFlagCheckIfStmt(2, collapseAdvanceStatements(updateStatements))], INFERRED_TYPE, null, contentQueriesFnName);
|
|
23034
23160
|
}
|
|
23035
23161
|
|
|
23036
23162
|
class HtmlParser extends Parser$1 {
|
|
@@ -23602,13 +23728,16 @@ function createSwitchBlock(ast, visitor, bindingParser) {
|
|
|
23602
23728
|
if (isCase) {
|
|
23603
23729
|
expression = parseBlockParameterToBinding(node.parameters[0], bindingParser);
|
|
23604
23730
|
} else if (node.name === 'default never') {
|
|
23731
|
+
if (node.parameters.length > 0) {
|
|
23732
|
+
expression = parseBlockParameterToBinding(node.parameters[0], bindingParser);
|
|
23733
|
+
}
|
|
23605
23734
|
if (node.children.length > 0 || node.endSourceSpan !== null && node.endSourceSpan.start.offset !== node.endSourceSpan.end.offset) {
|
|
23606
23735
|
errors.push(new ParseError(node.sourceSpan, '@default block with "never" parameter cannot have a body'));
|
|
23607
23736
|
}
|
|
23608
23737
|
if (collectedCases.length > 0) {
|
|
23609
23738
|
errors.push(new ParseError(node.sourceSpan, 'A @case block with no body cannot be followed by a @default block with "never" parameter'));
|
|
23610
23739
|
}
|
|
23611
|
-
exhaustiveCheck = new SwitchExhaustiveCheck(node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
23740
|
+
exhaustiveCheck = new SwitchExhaustiveCheck(expression, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
23612
23741
|
continue;
|
|
23613
23742
|
}
|
|
23614
23743
|
const switchCase = new SwitchBlockCase(expression, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
@@ -25167,14 +25296,6 @@ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
|
|
|
25167
25296
|
function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
25168
25297
|
const definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
|
|
25169
25298
|
addFeatures(definitionMap, meta);
|
|
25170
|
-
const selector = meta.selector && CssSelector.parse(meta.selector);
|
|
25171
|
-
const firstSelector = selector && selector[0];
|
|
25172
|
-
if (firstSelector) {
|
|
25173
|
-
const selectorAttributes = firstSelector.getAttrs();
|
|
25174
|
-
if (selectorAttributes.length) {
|
|
25175
|
-
definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(value => value != null ? literal(value) : literal(undefined))), true));
|
|
25176
|
-
}
|
|
25177
|
-
}
|
|
25178
25299
|
const templateTypeName = meta.name;
|
|
25179
25300
|
let allDeferrableDepsFn = null;
|
|
25180
25301
|
if (meta.defer.mode === 1 && meta.defer.dependenciesFn !== null) {
|
|
@@ -25239,7 +25360,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
25239
25360
|
}]));
|
|
25240
25361
|
}
|
|
25241
25362
|
if (meta.changeDetection !== null) {
|
|
25242
|
-
if (typeof meta.changeDetection === 'number' && meta.changeDetection !== ChangeDetectionStrategy.
|
|
25363
|
+
if (typeof meta.changeDetection === 'number' && meta.changeDetection !== ChangeDetectionStrategy.OnPush) {
|
|
25243
25364
|
definitionMap.set('changeDetection', literal(meta.changeDetection));
|
|
25244
25365
|
} else if (typeof meta.changeDetection === 'object') {
|
|
25245
25366
|
definitionMap.set('changeDetection', meta.changeDetection);
|
|
@@ -25497,7 +25618,7 @@ function compileDeferResolverFunction(meta) {
|
|
|
25497
25618
|
for (const dep of meta.dependencies) {
|
|
25498
25619
|
if (dep.isDeferrable) {
|
|
25499
25620
|
const innerFn = arrowFn([new FnParam('m', DYNAMIC_TYPE)], variable('m').prop(dep.isDefaultImport ? 'default' : dep.symbolName));
|
|
25500
|
-
const importExpr = new DynamicImportExpr(dep.importPath).prop('then').callFn([innerFn]);
|
|
25621
|
+
const importExpr = new DynamicImportExpr(dep.importPath).prop('then').callFn([innerFn], undefined, undefined, [tsIgnoreComment()]);
|
|
25501
25622
|
depExpressions.push(importExpr);
|
|
25502
25623
|
} else {
|
|
25503
25624
|
depExpressions.push(dep.typeReference);
|
|
@@ -25510,7 +25631,7 @@ function compileDeferResolverFunction(meta) {
|
|
|
25510
25631
|
isDefaultImport
|
|
25511
25632
|
} of meta.dependencies) {
|
|
25512
25633
|
const innerFn = arrowFn([new FnParam('m', DYNAMIC_TYPE)], variable('m').prop(isDefaultImport ? 'default' : symbolName));
|
|
25513
|
-
const importExpr = new DynamicImportExpr(importPath).prop('then').callFn([innerFn]);
|
|
25634
|
+
const importExpr = new DynamicImportExpr(importPath).prop('then').callFn([innerFn], undefined, undefined, [tsIgnoreComment()]);
|
|
25514
25635
|
depExpressions.push(importExpr);
|
|
25515
25636
|
}
|
|
25516
25637
|
}
|
|
@@ -26146,7 +26267,9 @@ class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
|
26146
26267
|
block.cases.forEach(caseNode => caseNode.visit(this));
|
|
26147
26268
|
this.ingestScopedNode(block);
|
|
26148
26269
|
}
|
|
26149
|
-
visitSwitchExhaustiveCheck(block) {
|
|
26270
|
+
visitSwitchExhaustiveCheck(block) {
|
|
26271
|
+
block.expression?.visit(this);
|
|
26272
|
+
}
|
|
26150
26273
|
visitForLoopBlock(block) {
|
|
26151
26274
|
block.expression.visit(this);
|
|
26152
26275
|
this.ingestScopedNode(block);
|
|
@@ -26388,7 +26511,6 @@ class CompilerFacadeImpl {
|
|
|
26388
26511
|
name: facade.name,
|
|
26389
26512
|
type: wrapReference(facade.type),
|
|
26390
26513
|
typeArgumentCount: 0,
|
|
26391
|
-
deps: null,
|
|
26392
26514
|
pipeName: facade.pipeName,
|
|
26393
26515
|
pure: facade.pure,
|
|
26394
26516
|
isStandalone: facade.isStandalone
|
|
@@ -26437,7 +26559,6 @@ class CompilerFacadeImpl {
|
|
|
26437
26559
|
}
|
|
26438
26560
|
compileInjector(angularCoreEnv, sourceMapUrl, facade) {
|
|
26439
26561
|
const meta = {
|
|
26440
|
-
name: facade.name,
|
|
26441
26562
|
type: wrapReference(facade.type),
|
|
26442
26563
|
providers: facade.providers && facade.providers.length > 0 ? new WrappedNodeExpr(facade.providers) : null,
|
|
26443
26564
|
imports: facade.imports.map(i => new WrappedNodeExpr(i))
|
|
@@ -26727,7 +26848,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
26727
26848
|
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) : null,
|
|
26728
26849
|
animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
|
|
26729
26850
|
defer,
|
|
26730
|
-
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.
|
|
26851
|
+
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.OnPush,
|
|
26731
26852
|
encapsulation: decl.encapsulation ?? ViewEncapsulation$1.Emulated,
|
|
26732
26853
|
declarationListEmitMode: 2,
|
|
26733
26854
|
relativeContextFilePath: '',
|
|
@@ -28530,7 +28651,7 @@ function compileComponentMetadataAsyncResolver(dependencies) {
|
|
|
28530
28651
|
isDefaultImport
|
|
28531
28652
|
}) => {
|
|
28532
28653
|
const innerFn = arrowFn([new FnParam('m', DYNAMIC_TYPE)], variable('m').prop(isDefaultImport ? 'default' : symbolName));
|
|
28533
|
-
return new DynamicImportExpr(importPath).prop('then').callFn([innerFn]);
|
|
28654
|
+
return new DynamicImportExpr(importPath).prop('then').callFn([innerFn], undefined, undefined, [tsIgnoreComment()]);
|
|
28534
28655
|
});
|
|
28535
28656
|
return arrowFn([], literalArr(dynamicImports));
|
|
28536
28657
|
}
|
|
@@ -28540,7 +28661,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
28540
28661
|
function compileDeclareClassMetadata(metadata) {
|
|
28541
28662
|
const definitionMap = new DefinitionMap();
|
|
28542
28663
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
28543
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28664
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28544
28665
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28545
28666
|
definitionMap.set('type', metadata.type);
|
|
28546
28667
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -28558,7 +28679,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
28558
28679
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
28559
28680
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
28560
28681
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
28561
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28682
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28562
28683
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28563
28684
|
definitionMap.set('type', metadata.type);
|
|
28564
28685
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -28631,7 +28752,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
28631
28752
|
const definitionMap = new DefinitionMap();
|
|
28632
28753
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
28633
28754
|
definitionMap.set('minVersion', literal(minVersion));
|
|
28634
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28755
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28635
28756
|
definitionMap.set('type', meta.type.value);
|
|
28636
28757
|
if (meta.isStandalone !== undefined) {
|
|
28637
28758
|
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
@@ -28973,7 +29094,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
28973
29094
|
function compileDeclareFactoryFunction(meta) {
|
|
28974
29095
|
const definitionMap = new DefinitionMap();
|
|
28975
29096
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
28976
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29097
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28977
29098
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28978
29099
|
definitionMap.set('type', meta.type.value);
|
|
28979
29100
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -28999,7 +29120,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
28999
29120
|
function createInjectableDefinitionMap(meta) {
|
|
29000
29121
|
const definitionMap = new DefinitionMap();
|
|
29001
29122
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
29002
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29123
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29003
29124
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29004
29125
|
definitionMap.set('type', meta.type.value);
|
|
29005
29126
|
if (meta.providedIn !== undefined) {
|
|
@@ -29040,7 +29161,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
29040
29161
|
function createInjectorDefinitionMap(meta) {
|
|
29041
29162
|
const definitionMap = new DefinitionMap();
|
|
29042
29163
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
29043
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29164
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29044
29165
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29045
29166
|
definitionMap.set('type', meta.type.value);
|
|
29046
29167
|
definitionMap.set('providers', meta.providers);
|
|
@@ -29067,7 +29188,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
29067
29188
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
29068
29189
|
}
|
|
29069
29190
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
29070
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29191
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29071
29192
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29072
29193
|
definitionMap.set('type', meta.type.value);
|
|
29073
29194
|
if (meta.bootstrap.length > 0) {
|
|
@@ -29105,7 +29226,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
29105
29226
|
function createPipeDefinitionMap(meta) {
|
|
29106
29227
|
const definitionMap = new DefinitionMap();
|
|
29107
29228
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
29108
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29229
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29109
29230
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29110
29231
|
definitionMap.set('type', meta.type.value);
|
|
29111
29232
|
if (meta.isStandalone !== undefined) {
|
|
@@ -29148,10 +29269,10 @@ function compileHmrInitializer(meta) {
|
|
|
29148
29269
|
});
|
|
29149
29270
|
const defaultRead = variable(moduleName).prop('default');
|
|
29150
29271
|
const replaceCall = importExpr(Identifiers.replaceMetadata).callFn([meta.type, defaultRead, literalArr(namespaces), literalArr(meta.localDependencies.map(l => l.runtimeRepresentation)), variable('import').prop('meta'), variable(idName)]);
|
|
29151
|
-
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
29272
|
+
const replaceCallback = arrowFn([new FnParam(moduleName, DYNAMIC_TYPE)], defaultRead.and(replaceCall));
|
|
29152
29273
|
const url = importExpr(Identifiers.getReplaceMetadataURL).callFn([variable(idName), variable(timestampName), variable('import').prop('meta').prop('url')]);
|
|
29153
|
-
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [new DynamicImportExpr(url, null, '@vite-ignore').prop('then').callFn([replaceCallback]).toStmt()], null, StmtModifier.Final);
|
|
29154
|
-
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop('id').identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop('timestamp')])));
|
|
29274
|
+
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName, DYNAMIC_TYPE)], [new DynamicImportExpr(url, null, '@vite-ignore').prop('then').callFn([replaceCallback]).toStmt()], null, StmtModifier.Final);
|
|
29275
|
+
const updateCallback = arrowFn([new FnParam(dataName, DYNAMIC_TYPE)], variable(dataName).prop('id').identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop('timestamp')])));
|
|
29155
29276
|
const initialCall = variable(importCallbackName).callFn([variable('Date').prop('now').callFn([])]);
|
|
29156
29277
|
const hotRead = variable('import').prop('meta').prop('hot');
|
|
29157
29278
|
const hotListener = hotRead.clone().prop('on').callFn([literal('angular:component-update'), updateCallback]);
|
|
@@ -29162,7 +29283,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
29162
29283
|
const params = [meta.className, namespaces].map(name => new FnParam(name, DYNAMIC_TYPE));
|
|
29163
29284
|
const body = [];
|
|
29164
29285
|
for (const local of meta.localDependencies) {
|
|
29165
|
-
params.push(new FnParam(local.name));
|
|
29286
|
+
params.push(new FnParam(local.name, DYNAMIC_TYPE));
|
|
29166
29287
|
}
|
|
29167
29288
|
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
29168
29289
|
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
@@ -29179,9 +29300,9 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
29179
29300
|
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
29180
29301
|
}
|
|
29181
29302
|
|
|
29182
|
-
const VERSION = new Version('22.0.0-next.
|
|
29303
|
+
const VERSION = new Version('22.0.0-next.5');
|
|
29183
29304
|
|
|
29184
29305
|
publishFacade(_global);
|
|
29185
29306
|
|
|
29186
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunction, ArrowFunctionExpr$1 as ArrowFunctionExpr, ArrowFunctionIdentifierParameter, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingPipeType, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CombinedRecursiveAstVisitor, CommaExpr, Comment, CompilerConfig, CompilerFacadeImpl, Component, Conditional, ConditionalExpr, ConstantPool, CssSelector, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, Directive, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralMapPropertyAssignment, LiteralMapSpreadAssignment, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, PrefixNot, PropertyRead, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, RegularExpressionLiteral, RegularExpressionLiteralExpr, ResourceLoader, ReturnStatement, SCHEMA, SECURITY_SCHEMA, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, SelectorlessMatcher, Serializer, SplitInterpolation, SpreadElement, SpreadElementExpr, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Component$1 as TmplAstComponent, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Directive$1 as TmplAstDirective, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HostElement as TmplAstHostElement, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, SwitchBlockCaseGroup as TmplAstSwitchBlockCaseGroup, SwitchExhaustiveCheck as TmplAstSwitchExhaustiveCheck, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation$1 as ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ATTR_TO_PROP, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, escapeRegExp, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, setEnableTemplateSourceLocations, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
29307
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, AbstractEmitterVisitor, ArrayType, ArrowFunction, ArrowFunctionExpr$1 as ArrowFunctionExpr, ArrowFunctionIdentifierParameter, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingPipeType, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CombinedRecursiveAstVisitor, CommaExpr, Comment, CompilerConfig, CompilerFacadeImpl, Component, Conditional, ConditionalExpr, ConstantPool, CssSelector, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, Directive, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralMapPropertyAssignment, LiteralMapSpreadAssignment, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, PrefixNot, PropertyRead, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, RegularExpressionLiteral, RegularExpressionLiteralExpr, ResourceLoader, ReturnStatement, SCHEMA, SECURITY_SCHEMA, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, SelectorlessMatcher, Serializer, SplitInterpolation, SpreadElement, SpreadElementExpr, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Component$1 as TmplAstComponent, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Directive$1 as TmplAstDirective, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HostElement as TmplAstHostElement, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, SwitchBlockCaseGroup as TmplAstSwitchBlockCaseGroup, SwitchExhaustiveCheck as TmplAstSwitchExhaustiveCheck, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation$1 as ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ATTR_TO_PROP, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, escapeRegExp, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, setEnableTemplateSourceLocations, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
29187
29308
|
//# sourceMappingURL=compiler.mjs.map
|