@angular/core 20.0.6 → 20.1.0-next.1
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/{api.d.d.ts → api.d-Dwpmmn5j.d.ts} +2 -2
- package/{chrome_dev_tools_performance.d.d.ts → chrome_dev_tools_performance.d-Dk_7kdX9.d.ts} +7 -3
- package/{discovery.d.d.ts → discovery.d-AiW64LSq.d.ts} +5 -6
- package/{event_dispatcher.d.d.ts → event_dispatcher.d-BReQpZfC.d.ts} +1 -1
- package/fesm2022/{attribute.mjs → attribute-BWp59EjE.mjs} +2 -2
- package/fesm2022/attribute-BWp59EjE.mjs.map +1 -0
- package/fesm2022/core.mjs +22 -28
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{debug_node.mjs → debug_node-CGQXW8qF.mjs} +1479 -1466
- package/fesm2022/debug_node-CGQXW8qF.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -2
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -5
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/{resource.mjs → resource-CIODajJI.mjs} +8 -12
- package/fesm2022/resource-CIODajJI.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler.mjs → root_effect_scheduler-BvK6bnZD.mjs} +20 -27
- package/fesm2022/root_effect_scheduler-BvK6bnZD.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +5 -5
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{signal.mjs → signal-nCiHhWf6.mjs} +2 -2
- package/fesm2022/signal-nCiHhWf6.mjs.map +1 -0
- package/fesm2022/testing.mjs +72 -171
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/{untracked.mjs → untracked-DmD_2MlC.mjs} +3 -3
- package/fesm2022/untracked-DmD_2MlC.mjs.map +1 -0
- package/fesm2022/{weak_ref.mjs → weak_ref-BaIq-pgY.mjs} +2 -2
- package/fesm2022/weak_ref-BaIq-pgY.mjs.map +1 -0
- package/{graph.d.d.ts → graph.d-BcIOep_B.d.ts} +1 -1
- package/index.d.ts +23 -16
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +6 -6
- package/rxjs-interop/index.d.ts +5 -5
- package/schematics/bundles/{apply_import_manager-mlmcgZ0v.cjs → apply_import_manager-BsIRDO9W.cjs} +3 -3
- package/schematics/bundles/{checker-a0VNmSrQ.cjs → checker-CY7a8ko8.cjs} +771 -642
- package/schematics/bundles/cleanup-unused-imports.cjs +21 -35
- package/schematics/bundles/{compiler_host-CwrMDc6k.cjs → compiler_host-DNYQkH4l.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +3 -3
- package/schematics/bundles/document-core.cjs +5 -5
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-DAP9ZmeX.cjs → index-BJ3PYYwQ.cjs} +17 -16
- package/schematics/bundles/{index-jMQgXbRg.cjs → index-BUgQDm-J.cjs} +1018 -589
- package/schematics/bundles/inject-flags.cjs +5 -5
- package/schematics/bundles/inject-migration.cjs +4 -9
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-CX0snBqz.cjs → migrate_ts_type_references-MBd4NBjn.cjs} +26 -77
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{project_paths-C4WM31v5.cjs → project_paths-C5Df24y1.cjs} +3 -3
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/self-closing-tags-migration.cjs +7 -19
- package/schematics/bundles/signal-input-migration.cjs +28 -12
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +4 -4
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/bundles/test-bed-get.cjs +4 -4
- package/{signal.d.d.ts → signal.d-BcmOdASA.d.ts} +2 -2
- package/testing/index.d.ts +6 -73
- package/{weak_ref.d.d.ts → weak_ref.d-eGOEP9S1.d.ts} +1 -1
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/untracked.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.
|
|
3
|
+
* @license Angular v20.1.0-next.1
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -936,24 +936,25 @@ var BinaryOperator;
|
|
|
936
936
|
(function (BinaryOperator) {
|
|
937
937
|
BinaryOperator[BinaryOperator["Equals"] = 0] = "Equals";
|
|
938
938
|
BinaryOperator[BinaryOperator["NotEquals"] = 1] = "NotEquals";
|
|
939
|
-
BinaryOperator[BinaryOperator["
|
|
940
|
-
BinaryOperator[BinaryOperator["
|
|
941
|
-
BinaryOperator[BinaryOperator["
|
|
942
|
-
BinaryOperator[BinaryOperator["
|
|
943
|
-
BinaryOperator[BinaryOperator["
|
|
944
|
-
BinaryOperator[BinaryOperator["
|
|
945
|
-
BinaryOperator[BinaryOperator["
|
|
946
|
-
BinaryOperator[BinaryOperator["
|
|
947
|
-
BinaryOperator[BinaryOperator["
|
|
948
|
-
BinaryOperator[BinaryOperator["
|
|
949
|
-
BinaryOperator[BinaryOperator["
|
|
950
|
-
BinaryOperator[BinaryOperator["
|
|
951
|
-
BinaryOperator[BinaryOperator["
|
|
952
|
-
BinaryOperator[BinaryOperator["
|
|
953
|
-
BinaryOperator[BinaryOperator["
|
|
954
|
-
BinaryOperator[BinaryOperator["
|
|
955
|
-
BinaryOperator[BinaryOperator["
|
|
956
|
-
BinaryOperator[BinaryOperator["
|
|
939
|
+
BinaryOperator[BinaryOperator["Assign"] = 2] = "Assign";
|
|
940
|
+
BinaryOperator[BinaryOperator["Identical"] = 3] = "Identical";
|
|
941
|
+
BinaryOperator[BinaryOperator["NotIdentical"] = 4] = "NotIdentical";
|
|
942
|
+
BinaryOperator[BinaryOperator["Minus"] = 5] = "Minus";
|
|
943
|
+
BinaryOperator[BinaryOperator["Plus"] = 6] = "Plus";
|
|
944
|
+
BinaryOperator[BinaryOperator["Divide"] = 7] = "Divide";
|
|
945
|
+
BinaryOperator[BinaryOperator["Multiply"] = 8] = "Multiply";
|
|
946
|
+
BinaryOperator[BinaryOperator["Modulo"] = 9] = "Modulo";
|
|
947
|
+
BinaryOperator[BinaryOperator["And"] = 10] = "And";
|
|
948
|
+
BinaryOperator[BinaryOperator["Or"] = 11] = "Or";
|
|
949
|
+
BinaryOperator[BinaryOperator["BitwiseOr"] = 12] = "BitwiseOr";
|
|
950
|
+
BinaryOperator[BinaryOperator["BitwiseAnd"] = 13] = "BitwiseAnd";
|
|
951
|
+
BinaryOperator[BinaryOperator["Lower"] = 14] = "Lower";
|
|
952
|
+
BinaryOperator[BinaryOperator["LowerEquals"] = 15] = "LowerEquals";
|
|
953
|
+
BinaryOperator[BinaryOperator["Bigger"] = 16] = "Bigger";
|
|
954
|
+
BinaryOperator[BinaryOperator["BiggerEquals"] = 17] = "BiggerEquals";
|
|
955
|
+
BinaryOperator[BinaryOperator["NullishCoalesce"] = 18] = "NullishCoalesce";
|
|
956
|
+
BinaryOperator[BinaryOperator["Exponentiation"] = 19] = "Exponentiation";
|
|
957
|
+
BinaryOperator[BinaryOperator["In"] = 20] = "In";
|
|
957
958
|
})(BinaryOperator || (BinaryOperator = {}));
|
|
958
959
|
function nullSafeIsEquivalent(base, other) {
|
|
959
960
|
if (base == null || other == null) {
|
|
@@ -1083,7 +1084,7 @@ class ReadVarExpr extends Expression {
|
|
|
1083
1084
|
return new ReadVarExpr(this.name, this.type, this.sourceSpan);
|
|
1084
1085
|
}
|
|
1085
1086
|
set(value) {
|
|
1086
|
-
return new
|
|
1087
|
+
return new BinaryOperatorExpr(BinaryOperator.Assign, this, value, null, this.sourceSpan);
|
|
1087
1088
|
}
|
|
1088
1089
|
}
|
|
1089
1090
|
class TypeofExpr extends Expression {
|
|
@@ -1143,85 +1144,6 @@ class WrappedNodeExpr extends Expression {
|
|
|
1143
1144
|
return new WrappedNodeExpr(this.node, this.type, this.sourceSpan);
|
|
1144
1145
|
}
|
|
1145
1146
|
}
|
|
1146
|
-
class WriteVarExpr extends Expression {
|
|
1147
|
-
name;
|
|
1148
|
-
value;
|
|
1149
|
-
constructor(name, value, type, sourceSpan) {
|
|
1150
|
-
super(type || value.type, sourceSpan);
|
|
1151
|
-
this.name = name;
|
|
1152
|
-
this.value = value;
|
|
1153
|
-
}
|
|
1154
|
-
isEquivalent(e) {
|
|
1155
|
-
return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
|
|
1156
|
-
}
|
|
1157
|
-
isConstant() {
|
|
1158
|
-
return false;
|
|
1159
|
-
}
|
|
1160
|
-
visitExpression(visitor, context) {
|
|
1161
|
-
return visitor.visitWriteVarExpr(this, context);
|
|
1162
|
-
}
|
|
1163
|
-
clone() {
|
|
1164
|
-
return new WriteVarExpr(this.name, this.value.clone(), this.type, this.sourceSpan);
|
|
1165
|
-
}
|
|
1166
|
-
toDeclStmt(type, modifiers) {
|
|
1167
|
-
return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
|
|
1168
|
-
}
|
|
1169
|
-
toConstDecl() {
|
|
1170
|
-
return this.toDeclStmt(INFERRED_TYPE, exports.StmtModifier.Final);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
class WriteKeyExpr extends Expression {
|
|
1174
|
-
receiver;
|
|
1175
|
-
index;
|
|
1176
|
-
value;
|
|
1177
|
-
constructor(receiver, index, value, type, sourceSpan) {
|
|
1178
|
-
super(type || value.type, sourceSpan);
|
|
1179
|
-
this.receiver = receiver;
|
|
1180
|
-
this.index = index;
|
|
1181
|
-
this.value = value;
|
|
1182
|
-
}
|
|
1183
|
-
isEquivalent(e) {
|
|
1184
|
-
return (e instanceof WriteKeyExpr &&
|
|
1185
|
-
this.receiver.isEquivalent(e.receiver) &&
|
|
1186
|
-
this.index.isEquivalent(e.index) &&
|
|
1187
|
-
this.value.isEquivalent(e.value));
|
|
1188
|
-
}
|
|
1189
|
-
isConstant() {
|
|
1190
|
-
return false;
|
|
1191
|
-
}
|
|
1192
|
-
visitExpression(visitor, context) {
|
|
1193
|
-
return visitor.visitWriteKeyExpr(this, context);
|
|
1194
|
-
}
|
|
1195
|
-
clone() {
|
|
1196
|
-
return new WriteKeyExpr(this.receiver.clone(), this.index.clone(), this.value.clone(), this.type, this.sourceSpan);
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
class WritePropExpr extends Expression {
|
|
1200
|
-
receiver;
|
|
1201
|
-
name;
|
|
1202
|
-
value;
|
|
1203
|
-
constructor(receiver, name, value, type, sourceSpan) {
|
|
1204
|
-
super(type || value.type, sourceSpan);
|
|
1205
|
-
this.receiver = receiver;
|
|
1206
|
-
this.name = name;
|
|
1207
|
-
this.value = value;
|
|
1208
|
-
}
|
|
1209
|
-
isEquivalent(e) {
|
|
1210
|
-
return (e instanceof WritePropExpr &&
|
|
1211
|
-
this.receiver.isEquivalent(e.receiver) &&
|
|
1212
|
-
this.name === e.name &&
|
|
1213
|
-
this.value.isEquivalent(e.value));
|
|
1214
|
-
}
|
|
1215
|
-
isConstant() {
|
|
1216
|
-
return false;
|
|
1217
|
-
}
|
|
1218
|
-
visitExpression(visitor, context) {
|
|
1219
|
-
return visitor.visitWritePropExpr(this, context);
|
|
1220
|
-
}
|
|
1221
|
-
clone() {
|
|
1222
|
-
return new WritePropExpr(this.receiver.clone(), this.name, this.value.clone(), this.type, this.sourceSpan);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
1147
|
class InvokeFunctionExpr extends Expression {
|
|
1226
1148
|
fn;
|
|
1227
1149
|
args;
|
|
@@ -1775,7 +1697,7 @@ class ReadPropExpr extends Expression {
|
|
|
1775
1697
|
return visitor.visitReadPropExpr(this, context);
|
|
1776
1698
|
}
|
|
1777
1699
|
set(value) {
|
|
1778
|
-
return new
|
|
1700
|
+
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.prop(this.name), value, null, this.sourceSpan);
|
|
1779
1701
|
}
|
|
1780
1702
|
clone() {
|
|
1781
1703
|
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
|
|
@@ -1801,7 +1723,7 @@ class ReadKeyExpr extends Expression {
|
|
|
1801
1723
|
return visitor.visitReadKeyExpr(this, context);
|
|
1802
1724
|
}
|
|
1803
1725
|
set(value) {
|
|
1804
|
-
return new
|
|
1726
|
+
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.key(this.index), value, null, this.sourceSpan);
|
|
1805
1727
|
}
|
|
1806
1728
|
clone() {
|
|
1807
1729
|
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);
|
|
@@ -2038,21 +1960,6 @@ let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
2038
1960
|
visitReadVarExpr(ast, context) {
|
|
2039
1961
|
return this.visitExpression(ast, context);
|
|
2040
1962
|
}
|
|
2041
|
-
visitWriteVarExpr(ast, context) {
|
|
2042
|
-
ast.value.visitExpression(this, context);
|
|
2043
|
-
return this.visitExpression(ast, context);
|
|
2044
|
-
}
|
|
2045
|
-
visitWriteKeyExpr(ast, context) {
|
|
2046
|
-
ast.receiver.visitExpression(this, context);
|
|
2047
|
-
ast.index.visitExpression(this, context);
|
|
2048
|
-
ast.value.visitExpression(this, context);
|
|
2049
|
-
return this.visitExpression(ast, context);
|
|
2050
|
-
}
|
|
2051
|
-
visitWritePropExpr(ast, context) {
|
|
2052
|
-
ast.receiver.visitExpression(this, context);
|
|
2053
|
-
ast.value.visitExpression(this, context);
|
|
2054
|
-
return this.visitExpression(ast, context);
|
|
2055
|
-
}
|
|
2056
1963
|
visitDynamicImportExpr(ast, context) {
|
|
2057
1964
|
return this.visitExpression(ast, context);
|
|
2058
1965
|
}
|
|
@@ -2382,7 +2289,7 @@ class ConstantPool {
|
|
|
2382
2289
|
if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
|
|
2383
2290
|
// Replace the expression with a variable
|
|
2384
2291
|
const name = this.freshName();
|
|
2385
|
-
let
|
|
2292
|
+
let value;
|
|
2386
2293
|
let usage;
|
|
2387
2294
|
if (this.isClosureCompilerEnabled && isLongStringLiteral(literal)) {
|
|
2388
2295
|
// For string literals, Closure will **always** inline the string at
|
|
@@ -2398,20 +2305,20 @@ class ConstantPool {
|
|
|
2398
2305
|
// const myStr = function() { return "very very very long string"; };
|
|
2399
2306
|
// const usage1 = myStr();
|
|
2400
2307
|
// const usage2 = myStr();
|
|
2401
|
-
|
|
2308
|
+
value = new FunctionExpr([], // Params.
|
|
2402
2309
|
[
|
|
2403
2310
|
// Statements.
|
|
2404
2311
|
new ReturnStatement(literal),
|
|
2405
|
-
])
|
|
2312
|
+
]);
|
|
2406
2313
|
usage = variable(name).callFn([]);
|
|
2407
2314
|
}
|
|
2408
2315
|
else {
|
|
2409
2316
|
// Just declare and use the variable directly, without a function call
|
|
2410
2317
|
// indirection. This saves a few bytes and avoids an unnecessary call.
|
|
2411
|
-
|
|
2318
|
+
value = literal;
|
|
2412
2319
|
usage = variable(name);
|
|
2413
2320
|
}
|
|
2414
|
-
this.statements.push(
|
|
2321
|
+
this.statements.push(new DeclareVarStmt(name, value, INFERRED_TYPE, exports.StmtModifier.Final));
|
|
2415
2322
|
fixup.fixup(usage);
|
|
2416
2323
|
}
|
|
2417
2324
|
return fixup;
|
|
@@ -2482,9 +2389,7 @@ class ConstantPool {
|
|
|
2482
2389
|
.map((e) => new FnParam(e.name, DYNAMIC_TYPE));
|
|
2483
2390
|
const pureFunctionDeclaration = arrowFn(parameters, resultMap(resultExpressions), INFERRED_TYPE);
|
|
2484
2391
|
const name = this.freshName();
|
|
2485
|
-
this.statements.push(
|
|
2486
|
-
.set(pureFunctionDeclaration)
|
|
2487
|
-
.toDeclStmt(INFERRED_TYPE, exports.StmtModifier.Final));
|
|
2392
|
+
this.statements.push(new DeclareVarStmt(name, pureFunctionDeclaration, INFERRED_TYPE, exports.StmtModifier.Final));
|
|
2488
2393
|
literalFactory = variable(name);
|
|
2489
2394
|
this.literalFactories.set(key, literalFactory);
|
|
2490
2395
|
}
|
|
@@ -3381,46 +3286,6 @@ class AbstractEmitterVisitor {
|
|
|
3381
3286
|
ctx.println(stmt, `}`);
|
|
3382
3287
|
return null;
|
|
3383
3288
|
}
|
|
3384
|
-
visitWriteVarExpr(expr, ctx) {
|
|
3385
|
-
const lineWasEmpty = ctx.lineIsEmpty();
|
|
3386
|
-
if (!lineWasEmpty) {
|
|
3387
|
-
ctx.print(expr, '(');
|
|
3388
|
-
}
|
|
3389
|
-
ctx.print(expr, `${expr.name} = `);
|
|
3390
|
-
expr.value.visitExpression(this, ctx);
|
|
3391
|
-
if (!lineWasEmpty) {
|
|
3392
|
-
ctx.print(expr, ')');
|
|
3393
|
-
}
|
|
3394
|
-
return null;
|
|
3395
|
-
}
|
|
3396
|
-
visitWriteKeyExpr(expr, ctx) {
|
|
3397
|
-
const lineWasEmpty = ctx.lineIsEmpty();
|
|
3398
|
-
if (!lineWasEmpty) {
|
|
3399
|
-
ctx.print(expr, '(');
|
|
3400
|
-
}
|
|
3401
|
-
expr.receiver.visitExpression(this, ctx);
|
|
3402
|
-
ctx.print(expr, `[`);
|
|
3403
|
-
expr.index.visitExpression(this, ctx);
|
|
3404
|
-
ctx.print(expr, `] = `);
|
|
3405
|
-
expr.value.visitExpression(this, ctx);
|
|
3406
|
-
if (!lineWasEmpty) {
|
|
3407
|
-
ctx.print(expr, ')');
|
|
3408
|
-
}
|
|
3409
|
-
return null;
|
|
3410
|
-
}
|
|
3411
|
-
visitWritePropExpr(expr, ctx) {
|
|
3412
|
-
const lineWasEmpty = ctx.lineIsEmpty();
|
|
3413
|
-
if (!lineWasEmpty) {
|
|
3414
|
-
ctx.print(expr, '(');
|
|
3415
|
-
}
|
|
3416
|
-
expr.receiver.visitExpression(this, ctx);
|
|
3417
|
-
ctx.print(expr, `.${expr.name} = `);
|
|
3418
|
-
expr.value.visitExpression(this, ctx);
|
|
3419
|
-
if (!lineWasEmpty) {
|
|
3420
|
-
ctx.print(expr, ')');
|
|
3421
|
-
}
|
|
3422
|
-
return null;
|
|
3423
|
-
}
|
|
3424
3289
|
visitInvokeFunctionExpr(expr, ctx) {
|
|
3425
3290
|
const shouldParenthesize = expr.fn instanceof ArrowFunctionExpr;
|
|
3426
3291
|
if (shouldParenthesize) {
|
|
@@ -3542,6 +3407,9 @@ class AbstractEmitterVisitor {
|
|
|
3542
3407
|
visitBinaryOperatorExpr(ast, ctx) {
|
|
3543
3408
|
let opStr;
|
|
3544
3409
|
switch (ast.operator) {
|
|
3410
|
+
case BinaryOperator.Assign:
|
|
3411
|
+
opStr = '=';
|
|
3412
|
+
break;
|
|
3545
3413
|
case BinaryOperator.Equals:
|
|
3546
3414
|
opStr = '==';
|
|
3547
3415
|
break;
|
|
@@ -3821,7 +3689,7 @@ function compileFactoryFunction(meta) {
|
|
|
3821
3689
|
let retExpr = null;
|
|
3822
3690
|
function makeConditionalFactory(nonCtorExpr) {
|
|
3823
3691
|
const r = variable('__ngConditionalFactory__');
|
|
3824
|
-
body.push(r.
|
|
3692
|
+
body.push(new DeclareVarStmt(r.name, NULL_EXPR, INFERRED_TYPE));
|
|
3825
3693
|
const ctorStmt = ctorExpr !== null
|
|
3826
3694
|
? r.set(ctorExpr).toStmt()
|
|
3827
3695
|
: importExpr(Identifiers.invalidFactory).callFn([]).toStmt();
|
|
@@ -4081,20 +3949,6 @@ class PropertyRead extends ASTWithName {
|
|
|
4081
3949
|
return visitor.visitPropertyRead(this, context);
|
|
4082
3950
|
}
|
|
4083
3951
|
}
|
|
4084
|
-
class PropertyWrite extends ASTWithName {
|
|
4085
|
-
receiver;
|
|
4086
|
-
name;
|
|
4087
|
-
value;
|
|
4088
|
-
constructor(span, sourceSpan, nameSpan, receiver, name, value) {
|
|
4089
|
-
super(span, sourceSpan, nameSpan);
|
|
4090
|
-
this.receiver = receiver;
|
|
4091
|
-
this.name = name;
|
|
4092
|
-
this.value = value;
|
|
4093
|
-
}
|
|
4094
|
-
visit(visitor, context = null) {
|
|
4095
|
-
return visitor.visitPropertyWrite(this, context);
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
3952
|
class SafePropertyRead extends ASTWithName {
|
|
4099
3953
|
receiver;
|
|
4100
3954
|
name;
|
|
@@ -4131,29 +3985,31 @@ class SafeKeyedRead extends AST {
|
|
|
4131
3985
|
return visitor.visitSafeKeyedRead(this, context);
|
|
4132
3986
|
}
|
|
4133
3987
|
}
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
}
|
|
3988
|
+
/** Possible types for a pipe. */
|
|
3989
|
+
exports.BindingPipeType = void 0;
|
|
3990
|
+
(function (BindingPipeType) {
|
|
3991
|
+
/**
|
|
3992
|
+
* Pipe is being referenced by its name, for example:
|
|
3993
|
+
* `@Pipe({name: 'foo'}) class FooPipe` and `{{123 | foo}}`.
|
|
3994
|
+
*/
|
|
3995
|
+
BindingPipeType[BindingPipeType["ReferencedByName"] = 0] = "ReferencedByName";
|
|
3996
|
+
/**
|
|
3997
|
+
* Pipe is being referenced by its class name, for example:
|
|
3998
|
+
* `@Pipe() class FooPipe` and `{{123 | FooPipe}}`.
|
|
3999
|
+
*/
|
|
4000
|
+
BindingPipeType[BindingPipeType["ReferencedDirectly"] = 1] = "ReferencedDirectly";
|
|
4001
|
+
})(exports.BindingPipeType || (exports.BindingPipeType = {}));
|
|
4148
4002
|
class BindingPipe extends ASTWithName {
|
|
4149
4003
|
exp;
|
|
4150
4004
|
name;
|
|
4151
4005
|
args;
|
|
4152
|
-
|
|
4006
|
+
type;
|
|
4007
|
+
constructor(span, sourceSpan, exp, name, args, type, nameSpan) {
|
|
4153
4008
|
super(span, sourceSpan, nameSpan);
|
|
4154
4009
|
this.exp = exp;
|
|
4155
4010
|
this.name = name;
|
|
4156
4011
|
this.args = args;
|
|
4012
|
+
this.type = type;
|
|
4157
4013
|
}
|
|
4158
4014
|
visit(visitor, context = null) {
|
|
4159
4015
|
return visitor.visitPipe(this, context);
|
|
@@ -4474,11 +4330,6 @@ class RecursiveAstVisitor {
|
|
|
4474
4330
|
this.visit(ast.receiver, context);
|
|
4475
4331
|
this.visit(ast.key, context);
|
|
4476
4332
|
}
|
|
4477
|
-
visitKeyedWrite(ast, context) {
|
|
4478
|
-
this.visit(ast.receiver, context);
|
|
4479
|
-
this.visit(ast.key, context);
|
|
4480
|
-
this.visit(ast.value, context);
|
|
4481
|
-
}
|
|
4482
4333
|
visitLiteralArray(ast, context) {
|
|
4483
4334
|
this.visitAll(ast.expressions, context);
|
|
4484
4335
|
}
|
|
@@ -4501,10 +4352,6 @@ class RecursiveAstVisitor {
|
|
|
4501
4352
|
visitPropertyRead(ast, context) {
|
|
4502
4353
|
this.visit(ast.receiver, context);
|
|
4503
4354
|
}
|
|
4504
|
-
visitPropertyWrite(ast, context) {
|
|
4505
|
-
this.visit(ast.receiver, context);
|
|
4506
|
-
this.visit(ast.value, context);
|
|
4507
|
-
}
|
|
4508
4355
|
visitSafePropertyRead(ast, context) {
|
|
4509
4356
|
this.visit(ast.receiver, context);
|
|
4510
4357
|
}
|
|
@@ -4830,11 +4677,12 @@ let Element$1 = class Element {
|
|
|
4830
4677
|
directives;
|
|
4831
4678
|
children;
|
|
4832
4679
|
references;
|
|
4680
|
+
isSelfClosing;
|
|
4833
4681
|
sourceSpan;
|
|
4834
4682
|
startSourceSpan;
|
|
4835
4683
|
endSourceSpan;
|
|
4836
4684
|
i18n;
|
|
4837
|
-
constructor(name, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
4685
|
+
constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
4838
4686
|
this.name = name;
|
|
4839
4687
|
this.attributes = attributes;
|
|
4840
4688
|
this.inputs = inputs;
|
|
@@ -4842,6 +4690,7 @@ let Element$1 = class Element {
|
|
|
4842
4690
|
this.directives = directives;
|
|
4843
4691
|
this.children = children;
|
|
4844
4692
|
this.references = references;
|
|
4693
|
+
this.isSelfClosing = isSelfClosing;
|
|
4845
4694
|
this.sourceSpan = sourceSpan;
|
|
4846
4695
|
this.startSourceSpan = startSourceSpan;
|
|
4847
4696
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -5148,11 +4997,12 @@ let Component$1 = class Component {
|
|
|
5148
4997
|
directives;
|
|
5149
4998
|
children;
|
|
5150
4999
|
references;
|
|
5000
|
+
isSelfClosing;
|
|
5151
5001
|
sourceSpan;
|
|
5152
5002
|
startSourceSpan;
|
|
5153
5003
|
endSourceSpan;
|
|
5154
5004
|
i18n;
|
|
5155
|
-
constructor(componentName, tagName, fullName, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5005
|
+
constructor(componentName, tagName, fullName, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5156
5006
|
this.componentName = componentName;
|
|
5157
5007
|
this.tagName = tagName;
|
|
5158
5008
|
this.fullName = fullName;
|
|
@@ -5162,6 +5012,7 @@ let Component$1 = class Component {
|
|
|
5162
5012
|
this.directives = directives;
|
|
5163
5013
|
this.children = children;
|
|
5164
5014
|
this.references = references;
|
|
5015
|
+
this.isSelfClosing = isSelfClosing;
|
|
5165
5016
|
this.sourceSpan = sourceSpan;
|
|
5166
5017
|
this.startSourceSpan = startSourceSpan;
|
|
5167
5018
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -5206,6 +5057,7 @@ class Template {
|
|
|
5206
5057
|
children;
|
|
5207
5058
|
references;
|
|
5208
5059
|
variables;
|
|
5060
|
+
isSelfClosing;
|
|
5209
5061
|
sourceSpan;
|
|
5210
5062
|
startSourceSpan;
|
|
5211
5063
|
endSourceSpan;
|
|
@@ -5215,7 +5067,7 @@ class Template {
|
|
|
5215
5067
|
// `null` is a special case for when there is a structural directive on an `ng-template` so
|
|
5216
5068
|
// the renderer can differentiate between the synthetic template and the one written in the
|
|
5217
5069
|
// file.
|
|
5218
|
-
tagName, attributes, inputs, outputs, directives, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5070
|
+
tagName, attributes, inputs, outputs, directives, templateAttrs, children, references, variables, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5219
5071
|
this.tagName = tagName;
|
|
5220
5072
|
this.attributes = attributes;
|
|
5221
5073
|
this.inputs = inputs;
|
|
@@ -5225,6 +5077,7 @@ class Template {
|
|
|
5225
5077
|
this.children = children;
|
|
5226
5078
|
this.references = references;
|
|
5227
5079
|
this.variables = variables;
|
|
5080
|
+
this.isSelfClosing = isSelfClosing;
|
|
5228
5081
|
this.sourceSpan = sourceSpan;
|
|
5229
5082
|
this.startSourceSpan = startSourceSpan;
|
|
5230
5083
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -5238,15 +5091,17 @@ class Content {
|
|
|
5238
5091
|
selector;
|
|
5239
5092
|
attributes;
|
|
5240
5093
|
children;
|
|
5094
|
+
isSelfClosing;
|
|
5241
5095
|
sourceSpan;
|
|
5242
5096
|
startSourceSpan;
|
|
5243
5097
|
endSourceSpan;
|
|
5244
5098
|
i18n;
|
|
5245
5099
|
name = 'ng-content';
|
|
5246
|
-
constructor(selector, attributes, children, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5100
|
+
constructor(selector, attributes, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
5247
5101
|
this.selector = selector;
|
|
5248
5102
|
this.attributes = attributes;
|
|
5249
5103
|
this.children = children;
|
|
5104
|
+
this.isSelfClosing = isSelfClosing;
|
|
5250
5105
|
this.sourceSpan = sourceSpan;
|
|
5251
5106
|
this.startSourceSpan = startSourceSpan;
|
|
5252
5107
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -5412,7 +5267,7 @@ function visitAll$1(visitor, nodes) {
|
|
|
5412
5267
|
const result = [];
|
|
5413
5268
|
if (visitor.visit) {
|
|
5414
5269
|
for (const node of nodes) {
|
|
5415
|
-
visitor.visit(node)
|
|
5270
|
+
visitor.visit(node);
|
|
5416
5271
|
}
|
|
5417
5272
|
}
|
|
5418
5273
|
else {
|
|
@@ -7308,7 +7163,11 @@ function tupleOfTypes(types) {
|
|
|
7308
7163
|
function compilePipeFromMetadata(metadata) {
|
|
7309
7164
|
const definitionMapValues = [];
|
|
7310
7165
|
// e.g. `name: 'myPipe'`
|
|
7311
|
-
definitionMapValues.push({
|
|
7166
|
+
definitionMapValues.push({
|
|
7167
|
+
key: 'name',
|
|
7168
|
+
value: literal$1(metadata.pipeName ?? metadata.name),
|
|
7169
|
+
quoted: false,
|
|
7170
|
+
});
|
|
7312
7171
|
// e.g. `type: MyPipe`
|
|
7313
7172
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
7314
7173
|
// e.g. `pure: true`
|
|
@@ -10324,15 +10183,6 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10324
10183
|
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
|
10325
10184
|
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
|
10326
10185
|
}
|
|
10327
|
-
else if (expr instanceof WritePropExpr) {
|
|
10328
|
-
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
|
10329
|
-
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
|
10330
|
-
}
|
|
10331
|
-
else if (expr instanceof WriteKeyExpr) {
|
|
10332
|
-
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
|
10333
|
-
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
|
10334
|
-
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
|
10335
|
-
}
|
|
10336
10186
|
else if (expr instanceof InvokeFunctionExpr) {
|
|
10337
10187
|
expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);
|
|
10338
10188
|
for (let i = 0; i < expr.args.length; i++) {
|
|
@@ -10362,9 +10212,6 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10362
10212
|
else if (expr instanceof VoidExpr) {
|
|
10363
10213
|
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
10364
10214
|
}
|
|
10365
|
-
else if (expr instanceof WriteVarExpr) {
|
|
10366
|
-
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
|
10367
|
-
}
|
|
10368
10215
|
else if (expr instanceof LocalizedString) {
|
|
10369
10216
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
10370
10217
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
|
|
@@ -11947,6 +11794,7 @@ const BINARY_OPERATORS$3 = new Map([
|
|
|
11947
11794
|
['|', BinaryOperator.BitwiseOr],
|
|
11948
11795
|
['&', BinaryOperator.BitwiseAnd],
|
|
11949
11796
|
['/', BinaryOperator.Divide],
|
|
11797
|
+
['=', BinaryOperator.Assign],
|
|
11950
11798
|
['==', BinaryOperator.Equals],
|
|
11951
11799
|
['===', BinaryOperator.Identical],
|
|
11952
11800
|
['<', BinaryOperator.Lower],
|
|
@@ -13430,14 +13278,16 @@ class Element extends NodeWithI18n {
|
|
|
13430
13278
|
attrs;
|
|
13431
13279
|
directives;
|
|
13432
13280
|
children;
|
|
13281
|
+
isSelfClosing;
|
|
13433
13282
|
startSourceSpan;
|
|
13434
13283
|
endSourceSpan;
|
|
13435
|
-
constructor(name, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
|
|
13284
|
+
constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
|
|
13436
13285
|
super(sourceSpan, i18n);
|
|
13437
13286
|
this.name = name;
|
|
13438
13287
|
this.attrs = attrs;
|
|
13439
13288
|
this.directives = directives;
|
|
13440
13289
|
this.children = children;
|
|
13290
|
+
this.isSelfClosing = isSelfClosing;
|
|
13441
13291
|
this.startSourceSpan = startSourceSpan;
|
|
13442
13292
|
this.endSourceSpan = endSourceSpan;
|
|
13443
13293
|
}
|
|
@@ -13483,9 +13333,10 @@ class Component extends NodeWithI18n {
|
|
|
13483
13333
|
attrs;
|
|
13484
13334
|
directives;
|
|
13485
13335
|
children;
|
|
13336
|
+
isSelfClosing;
|
|
13486
13337
|
startSourceSpan;
|
|
13487
13338
|
endSourceSpan;
|
|
13488
|
-
constructor(componentName, tagName, fullName, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
|
|
13339
|
+
constructor(componentName, tagName, fullName, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
|
|
13489
13340
|
super(sourceSpan, i18n);
|
|
13490
13341
|
this.componentName = componentName;
|
|
13491
13342
|
this.tagName = tagName;
|
|
@@ -13493,6 +13344,7 @@ class Component extends NodeWithI18n {
|
|
|
13493
13344
|
this.attrs = attrs;
|
|
13494
13345
|
this.directives = directives;
|
|
13495
13346
|
this.children = children;
|
|
13347
|
+
this.isSelfClosing = isSelfClosing;
|
|
13496
13348
|
this.startSourceSpan = startSourceSpan;
|
|
13497
13349
|
this.endSourceSpan = endSourceSpan;
|
|
13498
13350
|
}
|
|
@@ -17404,7 +17256,7 @@ class _TreeBuilder {
|
|
|
17404
17256
|
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17405
17257
|
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
|
17406
17258
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17407
|
-
const el = new Element(fullName, attrs, directives, [], span, startSpan, undefined);
|
|
17259
|
+
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined);
|
|
17408
17260
|
const parent = this._getContainer();
|
|
17409
17261
|
const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
|
|
17410
17262
|
this._pushContainer(el, isClosedByChild);
|
|
@@ -17433,7 +17285,7 @@ class _TreeBuilder {
|
|
|
17433
17285
|
const end = this._peek.sourceSpan.fullStart;
|
|
17434
17286
|
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
17435
17287
|
const startSpan = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
17436
|
-
const node = new Component(componentName, tagName, fullName, attrs, directives, [], span, startSpan, undefined);
|
|
17288
|
+
const node = new Component(componentName, tagName, fullName, attrs, directives, [], selfClosing, span, startSpan, undefined);
|
|
17437
17289
|
const parent = this._getContainer();
|
|
17438
17290
|
const isClosedByChild = parent !== null &&
|
|
17439
17291
|
node.tagName !== null &&
|
|
@@ -17847,11 +17699,11 @@ class WhitespaceVisitor {
|
|
|
17847
17699
|
if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
|
|
17848
17700
|
// don't descent into elements where we need to preserve whitespaces
|
|
17849
17701
|
// but still visit all attributes to eliminate one used as a market to preserve WS
|
|
17850
|
-
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17702
|
+
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17851
17703
|
this.originalNodeMap?.set(newElement, element);
|
|
17852
17704
|
return newElement;
|
|
17853
17705
|
}
|
|
17854
|
-
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17706
|
+
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17855
17707
|
this.originalNodeMap?.set(newElement, element);
|
|
17856
17708
|
return newElement;
|
|
17857
17709
|
}
|
|
@@ -17930,11 +17782,11 @@ class WhitespaceVisitor {
|
|
|
17930
17782
|
hasPreserveWhitespacesAttr(node.attrs)) {
|
|
17931
17783
|
// don't descent into elements where we need to preserve whitespaces
|
|
17932
17784
|
// but still visit all attributes to eliminate one used as a market to preserve WS
|
|
17933
|
-
const newElement = new Component(node.componentName, node.tagName, node.fullName, visitAllWithSiblings(this, node.attrs), visitAllWithSiblings(this, node.directives), node.children, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
17785
|
+
const newElement = new Component(node.componentName, node.tagName, node.fullName, visitAllWithSiblings(this, node.attrs), visitAllWithSiblings(this, node.directives), node.children, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
17934
17786
|
this.originalNodeMap?.set(newElement, node);
|
|
17935
17787
|
return newElement;
|
|
17936
17788
|
}
|
|
17937
|
-
const newElement = new Component(node.componentName, node.tagName, node.fullName, node.attrs, node.directives, visitAllWithSiblings(this, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
17789
|
+
const newElement = new Component(node.componentName, node.tagName, node.fullName, node.attrs, node.directives, visitAllWithSiblings(this, node.children), node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
17938
17790
|
this.originalNodeMap?.set(newElement, node);
|
|
17939
17791
|
return newElement;
|
|
17940
17792
|
}
|
|
@@ -18534,20 +18386,23 @@ class TemplateBindingParseResult {
|
|
|
18534
18386
|
}
|
|
18535
18387
|
class Parser {
|
|
18536
18388
|
_lexer;
|
|
18537
|
-
|
|
18538
|
-
constructor(_lexer) {
|
|
18389
|
+
_supportsDirectPipeReferences;
|
|
18390
|
+
constructor(_lexer, _supportsDirectPipeReferences = false) {
|
|
18539
18391
|
this._lexer = _lexer;
|
|
18392
|
+
this._supportsDirectPipeReferences = _supportsDirectPipeReferences;
|
|
18540
18393
|
}
|
|
18541
18394
|
parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18542
|
-
|
|
18395
|
+
const errors = [];
|
|
18396
|
+
this._checkNoInterpolation(errors, input, location, interpolationConfig);
|
|
18543
18397
|
const sourceToLex = this._stripComments(input);
|
|
18544
18398
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18545
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 1 /* ParseFlags.Action */,
|
|
18546
|
-
return new ASTWithSource(ast, input, location, absoluteOffset,
|
|
18399
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18400
|
+
return new ASTWithSource(ast, input, location, absoluteOffset, errors);
|
|
18547
18401
|
}
|
|
18548
18402
|
parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18549
|
-
const
|
|
18550
|
-
|
|
18403
|
+
const errors = [];
|
|
18404
|
+
const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors);
|
|
18405
|
+
return new ASTWithSource(ast, input, location, absoluteOffset, errors);
|
|
18551
18406
|
}
|
|
18552
18407
|
checkSimpleExpression(ast) {
|
|
18553
18408
|
const checker = new SimpleExpressionChecker();
|
|
@@ -18556,21 +18411,19 @@ class Parser {
|
|
|
18556
18411
|
}
|
|
18557
18412
|
// Host bindings parsed here
|
|
18558
18413
|
parseSimpleBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18559
|
-
const
|
|
18560
|
-
const
|
|
18561
|
-
|
|
18562
|
-
|
|
18414
|
+
const errors = [];
|
|
18415
|
+
const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors);
|
|
18416
|
+
const simplExpressionErrors = this.checkSimpleExpression(ast);
|
|
18417
|
+
if (simplExpressionErrors.length > 0) {
|
|
18418
|
+
errors.push(new ParserError(`Host binding expression cannot contain ${simplExpressionErrors.join(' ')}`, input, location));
|
|
18563
18419
|
}
|
|
18564
|
-
return new ASTWithSource(ast, input, location, absoluteOffset,
|
|
18420
|
+
return new ASTWithSource(ast, input, location, absoluteOffset, errors);
|
|
18565
18421
|
}
|
|
18566
|
-
|
|
18567
|
-
this.errors
|
|
18568
|
-
}
|
|
18569
|
-
_parseBindingAst(input, location, absoluteOffset, interpolationConfig) {
|
|
18570
|
-
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
18422
|
+
_parseBindingAst(input, location, absoluteOffset, interpolationConfig, errors) {
|
|
18423
|
+
this._checkNoInterpolation(errors, input, location, interpolationConfig);
|
|
18571
18424
|
const sourceToLex = this._stripComments(input);
|
|
18572
18425
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18573
|
-
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */,
|
|
18426
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18574
18427
|
}
|
|
18575
18428
|
/**
|
|
18576
18429
|
* Parse microsyntax template expression and return a list of bindings or
|
|
@@ -18600,14 +18453,16 @@ class Parser {
|
|
|
18600
18453
|
*/
|
|
18601
18454
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
18602
18455
|
const tokens = this._lexer.tokenize(templateValue);
|
|
18603
|
-
const
|
|
18456
|
+
const errors = [];
|
|
18457
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, errors, 0 /* relative offset */, this._supportsDirectPipeReferences);
|
|
18604
18458
|
return parser.parseTemplateBindings({
|
|
18605
18459
|
source: templateKey,
|
|
18606
18460
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
18607
18461
|
});
|
|
18608
18462
|
}
|
|
18609
18463
|
parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18610
|
-
const
|
|
18464
|
+
const errors = [];
|
|
18465
|
+
const { strings, expressions, offsets } = this.splitInterpolation(input, location, errors, interpolatedTokens, interpolationConfig);
|
|
18611
18466
|
if (expressions.length === 0)
|
|
18612
18467
|
return null;
|
|
18613
18468
|
const expressionNodes = [];
|
|
@@ -18615,10 +18470,10 @@ class Parser {
|
|
|
18615
18470
|
const expressionText = expressions[i].text;
|
|
18616
18471
|
const sourceToLex = this._stripComments(expressionText);
|
|
18617
18472
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18618
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */,
|
|
18473
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18619
18474
|
expressionNodes.push(ast);
|
|
18620
18475
|
}
|
|
18621
|
-
return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, location, absoluteOffset);
|
|
18476
|
+
return this.createInterpolationAst(strings.map((s) => s.text), expressionNodes, input, location, absoluteOffset, errors);
|
|
18622
18477
|
}
|
|
18623
18478
|
/**
|
|
18624
18479
|
* Similar to `parseInterpolation`, but treats the provided string as a single expression
|
|
@@ -18628,14 +18483,15 @@ class Parser {
|
|
|
18628
18483
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
18629
18484
|
const sourceToLex = this._stripComments(expression);
|
|
18630
18485
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18631
|
-
const
|
|
18486
|
+
const errors = [];
|
|
18487
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18632
18488
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
18633
|
-
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
18489
|
+
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset, errors);
|
|
18634
18490
|
}
|
|
18635
|
-
createInterpolationAst(strings, expressions, input, location, absoluteOffset) {
|
|
18491
|
+
createInterpolationAst(strings, expressions, input, location, absoluteOffset, errors) {
|
|
18636
18492
|
const span = new ParseSpan(0, input.length);
|
|
18637
18493
|
const interpolation = new Interpolation$1(span, span.toAbsolute(absoluteOffset), strings, expressions);
|
|
18638
|
-
return new ASTWithSource(interpolation, input, location, absoluteOffset,
|
|
18494
|
+
return new ASTWithSource(interpolation, input, location, absoluteOffset, errors);
|
|
18639
18495
|
}
|
|
18640
18496
|
/**
|
|
18641
18497
|
* Splits a string of text into "raw" text segments and expressions present in interpolations in
|
|
@@ -18644,7 +18500,7 @@ class Parser {
|
|
|
18644
18500
|
* `SplitInterpolation` with splits that look like
|
|
18645
18501
|
* <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
|
|
18646
18502
|
*/
|
|
18647
|
-
splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18503
|
+
splitInterpolation(input, location, errors, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18648
18504
|
const strings = [];
|
|
18649
18505
|
const expressions = [];
|
|
18650
18506
|
const offsets = [];
|
|
@@ -18682,7 +18538,7 @@ class Parser {
|
|
|
18682
18538
|
const fullEnd = exprEnd + interpEnd.length;
|
|
18683
18539
|
const text = input.substring(exprStart, exprEnd);
|
|
18684
18540
|
if (text.trim().length === 0) {
|
|
18685
|
-
|
|
18541
|
+
errors.push(new ParserError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location));
|
|
18686
18542
|
}
|
|
18687
18543
|
expressions.push({ text, start: fullStart, end: fullEnd });
|
|
18688
18544
|
const startInOriginalTemplate = inputToTemplateIndexMap?.get(fullStart) ?? fullStart;
|
|
@@ -18707,7 +18563,7 @@ class Parser {
|
|
|
18707
18563
|
}
|
|
18708
18564
|
wrapLiteralPrimitive(input, location, absoluteOffset) {
|
|
18709
18565
|
const span = new ParseSpan(0, input == null ? 0 : input.length);
|
|
18710
|
-
return new ASTWithSource(new LiteralPrimitive(span, span.toAbsolute(absoluteOffset), input), input, location, absoluteOffset,
|
|
18566
|
+
return new ASTWithSource(new LiteralPrimitive(span, span.toAbsolute(absoluteOffset), input), input, location, absoluteOffset, []);
|
|
18711
18567
|
}
|
|
18712
18568
|
_stripComments(input) {
|
|
18713
18569
|
const i = this._commentStart(input);
|
|
@@ -18729,7 +18585,7 @@ class Parser {
|
|
|
18729
18585
|
}
|
|
18730
18586
|
return null;
|
|
18731
18587
|
}
|
|
18732
|
-
_checkNoInterpolation(input, location, { start, end }) {
|
|
18588
|
+
_checkNoInterpolation(errors, input, location, { start, end }) {
|
|
18733
18589
|
let startIndex = -1;
|
|
18734
18590
|
let endIndex = -1;
|
|
18735
18591
|
for (const charIndex of this._forEachUnquotedChar(input, 0)) {
|
|
@@ -18746,7 +18602,7 @@ class Parser {
|
|
|
18746
18602
|
}
|
|
18747
18603
|
}
|
|
18748
18604
|
if (startIndex > -1 && endIndex > -1) {
|
|
18749
|
-
|
|
18605
|
+
errors.push(new ParserError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, location));
|
|
18750
18606
|
}
|
|
18751
18607
|
}
|
|
18752
18608
|
/**
|
|
@@ -18811,6 +18667,7 @@ class _ParseAST {
|
|
|
18811
18667
|
parseFlags;
|
|
18812
18668
|
errors;
|
|
18813
18669
|
offset;
|
|
18670
|
+
supportsDirectPipeReferences;
|
|
18814
18671
|
rparensExpected = 0;
|
|
18815
18672
|
rbracketsExpected = 0;
|
|
18816
18673
|
rbracesExpected = 0;
|
|
@@ -18821,7 +18678,7 @@ class _ParseAST {
|
|
|
18821
18678
|
// and may change for subsequent expressions visited by the parser.
|
|
18822
18679
|
sourceSpanCache = new Map();
|
|
18823
18680
|
index = 0;
|
|
18824
|
-
constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {
|
|
18681
|
+
constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset, supportsDirectPipeReferences) {
|
|
18825
18682
|
this.input = input;
|
|
18826
18683
|
this.location = location;
|
|
18827
18684
|
this.absoluteOffset = absoluteOffset;
|
|
@@ -18829,6 +18686,7 @@ class _ParseAST {
|
|
|
18829
18686
|
this.parseFlags = parseFlags;
|
|
18830
18687
|
this.errors = errors;
|
|
18831
18688
|
this.offset = offset;
|
|
18689
|
+
this.supportsDirectPipeReferences = supportsDirectPipeReferences;
|
|
18832
18690
|
}
|
|
18833
18691
|
peek(offset) {
|
|
18834
18692
|
const i = this.index + offset;
|
|
@@ -19057,7 +18915,18 @@ class _ParseAST {
|
|
|
19057
18915
|
// If there are additional expressions beyond the name, then the artificial end for the
|
|
19058
18916
|
// name is no longer relevant.
|
|
19059
18917
|
}
|
|
19060
|
-
|
|
18918
|
+
let type;
|
|
18919
|
+
if (this.supportsDirectPipeReferences) {
|
|
18920
|
+
const charCode = nameId.charCodeAt(0);
|
|
18921
|
+
type =
|
|
18922
|
+
charCode === $_ || (charCode >= $A && charCode <= $Z)
|
|
18923
|
+
? exports.BindingPipeType.ReferencedDirectly
|
|
18924
|
+
: exports.BindingPipeType.ReferencedByName;
|
|
18925
|
+
}
|
|
18926
|
+
else {
|
|
18927
|
+
type = exports.BindingPipeType.ReferencedByName;
|
|
18928
|
+
}
|
|
18929
|
+
result = new BindingPipe(this.span(start), this.sourceSpan(start, fullSpanEnd), result, nameId, args, type, nameSpan);
|
|
19061
18930
|
} while (this.consumeOptionalOperator('|'));
|
|
19062
18931
|
}
|
|
19063
18932
|
return result;
|
|
@@ -19421,14 +19290,13 @@ class _ParseAST {
|
|
|
19421
19290
|
return id;
|
|
19422
19291
|
});
|
|
19423
19292
|
const nameSpan = this.sourceSpan(nameStart);
|
|
19424
|
-
let receiver;
|
|
19425
19293
|
if (isSafe) {
|
|
19426
19294
|
if (this.consumeOptionalOperator('=')) {
|
|
19427
19295
|
this.error("The '?.' operator cannot be used in the assignment");
|
|
19428
|
-
|
|
19296
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
19429
19297
|
}
|
|
19430
19298
|
else {
|
|
19431
|
-
|
|
19299
|
+
return new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
19432
19300
|
}
|
|
19433
19301
|
}
|
|
19434
19302
|
else {
|
|
@@ -19437,14 +19305,14 @@ class _ParseAST {
|
|
|
19437
19305
|
this.error('Bindings cannot contain assignments');
|
|
19438
19306
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
19439
19307
|
}
|
|
19308
|
+
const receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
19440
19309
|
const value = this.parseConditional();
|
|
19441
|
-
|
|
19310
|
+
return new Binary(this.span(start), this.sourceSpan(start), '=', receiver, value);
|
|
19442
19311
|
}
|
|
19443
19312
|
else {
|
|
19444
|
-
|
|
19313
|
+
return new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
19445
19314
|
}
|
|
19446
19315
|
}
|
|
19447
|
-
return receiver;
|
|
19448
19316
|
}
|
|
19449
19317
|
parseCall(receiver, start, isSafe) {
|
|
19450
19318
|
const argumentStart = this.inputIndex;
|
|
@@ -19559,8 +19427,9 @@ class _ParseAST {
|
|
|
19559
19427
|
this.error("The '?.' operator cannot be used in the assignment");
|
|
19560
19428
|
}
|
|
19561
19429
|
else {
|
|
19430
|
+
const binaryReceiver = new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
|
|
19562
19431
|
const value = this.parseConditional();
|
|
19563
|
-
return new
|
|
19432
|
+
return new Binary(this.span(start), this.sourceSpan(start), '=', binaryReceiver, value);
|
|
19564
19433
|
}
|
|
19565
19434
|
}
|
|
19566
19435
|
else {
|
|
@@ -19863,9 +19732,6 @@ class SerializeExpressionVisitor {
|
|
|
19863
19732
|
visitKeyedRead(ast, context) {
|
|
19864
19733
|
return `${ast.receiver.visit(this, context)}[${ast.key.visit(this, context)}]`;
|
|
19865
19734
|
}
|
|
19866
|
-
visitKeyedWrite(ast, context) {
|
|
19867
|
-
return `${ast.receiver.visit(this, context)}[${ast.key.visit(this, context)}] = ${ast.value.visit(this, context)}`;
|
|
19868
|
-
}
|
|
19869
19735
|
visitLiteralArray(ast, context) {
|
|
19870
19736
|
return `[${ast.expressions.map((e) => e.visit(this, context)).join(', ')}]`;
|
|
19871
19737
|
}
|
|
@@ -19906,14 +19772,6 @@ class SerializeExpressionVisitor {
|
|
|
19906
19772
|
return `${ast.receiver.visit(this, context)}.${ast.name}`;
|
|
19907
19773
|
}
|
|
19908
19774
|
}
|
|
19909
|
-
visitPropertyWrite(ast, context) {
|
|
19910
|
-
if (ast.receiver instanceof ImplicitReceiver) {
|
|
19911
|
-
return `${ast.name} = ${ast.value.visit(this, context)}`;
|
|
19912
|
-
}
|
|
19913
|
-
else {
|
|
19914
|
-
return `${ast.receiver.visit(this, context)}.${ast.name} = ${ast.value.visit(this, context)}`;
|
|
19915
|
-
}
|
|
19916
|
-
}
|
|
19917
19775
|
visitSafePropertyRead(ast, context) {
|
|
19918
19776
|
return `${ast.receiver.visit(this, context)}?.${ast.name}`;
|
|
19919
19777
|
}
|
|
@@ -21530,7 +21388,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, placehold
|
|
|
21530
21388
|
// */
|
|
21531
21389
|
// const MSG_... = goog.getMsg(..);
|
|
21532
21390
|
// I18N_X = MSG_...;
|
|
21533
|
-
const googGetMsgStmt = closureVar.
|
|
21391
|
+
const googGetMsgStmt = new DeclareVarStmt(closureVar.name, variable(GOOG_GET_MSG).callFn(args), INFERRED_TYPE, exports.StmtModifier.Final);
|
|
21534
21392
|
googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
|
|
21535
21393
|
const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
|
|
21536
21394
|
return [googGetMsgStmt, i18nAssignmentStmt];
|
|
@@ -26578,17 +26436,6 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26578
26436
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26579
26437
|
}
|
|
26580
26438
|
}
|
|
26581
|
-
else if (ast instanceof PropertyWrite) {
|
|
26582
|
-
if (ast.receiver instanceof ImplicitReceiver) {
|
|
26583
|
-
return new WritePropExpr(
|
|
26584
|
-
// TODO: Is it correct to always use the root context in place of the implicit receiver?
|
|
26585
|
-
new ContextExpr(job.root.xref), ast.name, convertAst(ast.value, job, baseSourceSpan), null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26586
|
-
}
|
|
26587
|
-
return new WritePropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, convertAst(ast.value, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26588
|
-
}
|
|
26589
|
-
else if (ast instanceof KeyedWrite) {
|
|
26590
|
-
return new WriteKeyExpr(convertAst(ast.receiver, job, baseSourceSpan), convertAst(ast.key, job, baseSourceSpan), convertAst(ast.value, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26591
|
-
}
|
|
26592
26439
|
else if (ast instanceof Call) {
|
|
26593
26440
|
if (ast.receiver instanceof ImplicitReceiver) {
|
|
26594
26441
|
throw new Error(`Unexpected ImplicitReceiver`);
|
|
@@ -28865,7 +28712,7 @@ class HtmlAstToIvyAst {
|
|
|
28865
28712
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
28866
28713
|
const selector = preparsedElement.selectAttr;
|
|
28867
28714
|
const attrs = element.attrs.map((attr) => this.visitAttribute(attr));
|
|
28868
|
-
parsedElement = new Content(selector, attrs, children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28715
|
+
parsedElement = new Content(selector, attrs, children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28869
28716
|
this.ngContentSelectors.push(selector);
|
|
28870
28717
|
}
|
|
28871
28718
|
else if (isTemplateElement) {
|
|
@@ -28873,11 +28720,11 @@ class HtmlAstToIvyAst {
|
|
|
28873
28720
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
28874
28721
|
parsedElement = new Template(element.name, attributes, attrs.bound, boundEvents, directives, [
|
|
28875
28722
|
/* no template attributes */
|
|
28876
|
-
], children, references, variables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28723
|
+
], children, references, variables, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28877
28724
|
}
|
|
28878
28725
|
else {
|
|
28879
28726
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
28880
|
-
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28727
|
+
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28881
28728
|
}
|
|
28882
28729
|
if (elementHasInlineTemplate) {
|
|
28883
28730
|
// If this node is an inline-template (e.g. has *ngFor) then we need to create a template
|
|
@@ -28972,7 +28819,7 @@ class HtmlAstToIvyAst {
|
|
|
28972
28819
|
children = visitAll(this, component.children, component.children);
|
|
28973
28820
|
}
|
|
28974
28821
|
const attrs = this.categorizePropertyAttributes(component.tagName, parsedProperties, i18nAttrsMeta);
|
|
28975
|
-
let node = new Component$1(component.componentName, component.tagName, component.fullName, attributes, attrs.bound, boundEvents, directives, children, references, component.sourceSpan, component.startSourceSpan, component.endSourceSpan, component.i18n);
|
|
28822
|
+
let node = new Component$1(component.componentName, component.tagName, component.fullName, attributes, attrs.bound, boundEvents, directives, children, references, component.isSelfClosing, component.sourceSpan, component.startSourceSpan, component.endSourceSpan, component.i18n);
|
|
28976
28823
|
if (elementHasInlineTemplate) {
|
|
28977
28824
|
node = this.wrapInTemplate(node, templateParsedProperties, templateVariables, i18nAttrsMeta, false, isI18nRootElement);
|
|
28978
28825
|
}
|
|
@@ -29312,7 +29159,7 @@ class HtmlAstToIvyAst {
|
|
|
29312
29159
|
// Do not copy over the directives.
|
|
29313
29160
|
], templateAttrs, [node], [
|
|
29314
29161
|
// Do not copy over the references.
|
|
29315
|
-
], templateVariables, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, i18n);
|
|
29162
|
+
], templateVariables, false, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, i18n);
|
|
29316
29163
|
}
|
|
29317
29164
|
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
|
|
29318
29165
|
const valueNoNgsp = replaceNgsp(value);
|
|
@@ -29383,7 +29230,7 @@ class NonBindableVisitor {
|
|
|
29383
29230
|
/* inputs */ [],
|
|
29384
29231
|
/* outputs */ [],
|
|
29385
29232
|
/* directives */ [], children,
|
|
29386
|
-
/* references */ [], ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29233
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29387
29234
|
}
|
|
29388
29235
|
visitComment(comment) {
|
|
29389
29236
|
return null;
|
|
@@ -29424,7 +29271,7 @@ class NonBindableVisitor {
|
|
|
29424
29271
|
/* inputs */ [],
|
|
29425
29272
|
/* outputs */ [],
|
|
29426
29273
|
/* directives */ [], children,
|
|
29427
|
-
/* references */ [], ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29274
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29428
29275
|
}
|
|
29429
29276
|
visitDirective(directive, context) {
|
|
29430
29277
|
return null;
|
|
@@ -29456,7 +29303,8 @@ const LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t'];
|
|
|
29456
29303
|
*/
|
|
29457
29304
|
function parseTemplate(template, templateUrl, options = {}) {
|
|
29458
29305
|
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
29459
|
-
const
|
|
29306
|
+
const selectorlessEnabled = options.enableSelectorless ?? false;
|
|
29307
|
+
const bindingParser = makeBindingParser(interpolationConfig, selectorlessEnabled);
|
|
29460
29308
|
const htmlParser = new HtmlParser();
|
|
29461
29309
|
const parseResult = htmlParser.parse(template, templateUrl, {
|
|
29462
29310
|
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
|
@@ -29464,7 +29312,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
29464
29312
|
tokenizeExpansionForms: true,
|
|
29465
29313
|
tokenizeBlocks: options.enableBlockSyntax ?? true,
|
|
29466
29314
|
tokenizeLet: options.enableLetSyntax ?? true,
|
|
29467
|
-
selectorlessEnabled
|
|
29315
|
+
selectorlessEnabled,
|
|
29468
29316
|
});
|
|
29469
29317
|
if (!options.alwaysAttemptHtmlToR3AstConversion &&
|
|
29470
29318
|
parseResult.errors &&
|
|
@@ -29563,8 +29411,8 @@ const elementRegistry = new DomElementSchemaRegistry();
|
|
|
29563
29411
|
/**
|
|
29564
29412
|
* Construct a `BindingParser` with a default configuration.
|
|
29565
29413
|
*/
|
|
29566
|
-
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
29567
|
-
return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []);
|
|
29414
|
+
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, selectorlessEnabled = false) {
|
|
29415
|
+
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled), interpolationConfig, elementRegistry, []);
|
|
29568
29416
|
}
|
|
29569
29417
|
|
|
29570
29418
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
@@ -30074,6 +29922,132 @@ function compileDeferResolverFunction(meta) {
|
|
|
30074
29922
|
return arrowFn([], literalArr(depExpressions));
|
|
30075
29923
|
}
|
|
30076
29924
|
|
|
29925
|
+
/*!
|
|
29926
|
+
* @license
|
|
29927
|
+
* Copyright Google LLC All Rights Reserved.
|
|
29928
|
+
*
|
|
29929
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
29930
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
29931
|
+
*/
|
|
29932
|
+
/**
|
|
29933
|
+
* Visitor that traverses all template and expression AST nodes in a template.
|
|
29934
|
+
* Useful for cases where every single node needs to be visited.
|
|
29935
|
+
*/
|
|
29936
|
+
class CombinedRecursiveAstVisitor extends RecursiveAstVisitor {
|
|
29937
|
+
visit(node) {
|
|
29938
|
+
if (node instanceof ASTWithSource) {
|
|
29939
|
+
this.visit(node.ast);
|
|
29940
|
+
}
|
|
29941
|
+
else {
|
|
29942
|
+
node.visit(this);
|
|
29943
|
+
}
|
|
29944
|
+
}
|
|
29945
|
+
visitElement(element) {
|
|
29946
|
+
this.visitAllTemplateNodes(element.attributes);
|
|
29947
|
+
this.visitAllTemplateNodes(element.inputs);
|
|
29948
|
+
this.visitAllTemplateNodes(element.outputs);
|
|
29949
|
+
this.visitAllTemplateNodes(element.directives);
|
|
29950
|
+
this.visitAllTemplateNodes(element.references);
|
|
29951
|
+
this.visitAllTemplateNodes(element.children);
|
|
29952
|
+
}
|
|
29953
|
+
visitTemplate(template) {
|
|
29954
|
+
this.visitAllTemplateNodes(template.attributes);
|
|
29955
|
+
this.visitAllTemplateNodes(template.inputs);
|
|
29956
|
+
this.visitAllTemplateNodes(template.outputs);
|
|
29957
|
+
this.visitAllTemplateNodes(template.directives);
|
|
29958
|
+
this.visitAllTemplateNodes(template.templateAttrs);
|
|
29959
|
+
this.visitAllTemplateNodes(template.variables);
|
|
29960
|
+
this.visitAllTemplateNodes(template.references);
|
|
29961
|
+
this.visitAllTemplateNodes(template.children);
|
|
29962
|
+
}
|
|
29963
|
+
visitContent(content) {
|
|
29964
|
+
this.visitAllTemplateNodes(content.children);
|
|
29965
|
+
}
|
|
29966
|
+
visitBoundAttribute(attribute) {
|
|
29967
|
+
this.visit(attribute.value);
|
|
29968
|
+
}
|
|
29969
|
+
visitBoundEvent(attribute) {
|
|
29970
|
+
this.visit(attribute.handler);
|
|
29971
|
+
}
|
|
29972
|
+
visitBoundText(text) {
|
|
29973
|
+
this.visit(text.value);
|
|
29974
|
+
}
|
|
29975
|
+
visitIcu(icu) {
|
|
29976
|
+
Object.keys(icu.vars).forEach((key) => this.visit(icu.vars[key]));
|
|
29977
|
+
Object.keys(icu.placeholders).forEach((key) => this.visit(icu.placeholders[key]));
|
|
29978
|
+
}
|
|
29979
|
+
visitDeferredBlock(deferred) {
|
|
29980
|
+
deferred.visitAll(this);
|
|
29981
|
+
}
|
|
29982
|
+
visitDeferredTrigger(trigger) {
|
|
29983
|
+
if (trigger instanceof BoundDeferredTrigger) {
|
|
29984
|
+
this.visit(trigger.value);
|
|
29985
|
+
}
|
|
29986
|
+
}
|
|
29987
|
+
visitDeferredBlockPlaceholder(block) {
|
|
29988
|
+
this.visitAllTemplateNodes(block.children);
|
|
29989
|
+
}
|
|
29990
|
+
visitDeferredBlockError(block) {
|
|
29991
|
+
this.visitAllTemplateNodes(block.children);
|
|
29992
|
+
}
|
|
29993
|
+
visitDeferredBlockLoading(block) {
|
|
29994
|
+
this.visitAllTemplateNodes(block.children);
|
|
29995
|
+
}
|
|
29996
|
+
visitSwitchBlock(block) {
|
|
29997
|
+
this.visit(block.expression);
|
|
29998
|
+
this.visitAllTemplateNodes(block.cases);
|
|
29999
|
+
}
|
|
30000
|
+
visitSwitchBlockCase(block) {
|
|
30001
|
+
block.expression && this.visit(block.expression);
|
|
30002
|
+
this.visitAllTemplateNodes(block.children);
|
|
30003
|
+
}
|
|
30004
|
+
visitForLoopBlock(block) {
|
|
30005
|
+
block.item.visit(this);
|
|
30006
|
+
this.visitAllTemplateNodes(block.contextVariables);
|
|
30007
|
+
this.visit(block.expression);
|
|
30008
|
+
this.visitAllTemplateNodes(block.children);
|
|
30009
|
+
block.empty?.visit(this);
|
|
30010
|
+
}
|
|
30011
|
+
visitForLoopBlockEmpty(block) {
|
|
30012
|
+
this.visitAllTemplateNodes(block.children);
|
|
30013
|
+
}
|
|
30014
|
+
visitIfBlock(block) {
|
|
30015
|
+
this.visitAllTemplateNodes(block.branches);
|
|
30016
|
+
}
|
|
30017
|
+
visitIfBlockBranch(block) {
|
|
30018
|
+
block.expression && this.visit(block.expression);
|
|
30019
|
+
block.expressionAlias?.visit(this);
|
|
30020
|
+
this.visitAllTemplateNodes(block.children);
|
|
30021
|
+
}
|
|
30022
|
+
visitLetDeclaration(decl) {
|
|
30023
|
+
this.visit(decl.value);
|
|
30024
|
+
}
|
|
30025
|
+
visitComponent(component) {
|
|
30026
|
+
this.visitAllTemplateNodes(component.attributes);
|
|
30027
|
+
this.visitAllTemplateNodes(component.inputs);
|
|
30028
|
+
this.visitAllTemplateNodes(component.outputs);
|
|
30029
|
+
this.visitAllTemplateNodes(component.directives);
|
|
30030
|
+
this.visitAllTemplateNodes(component.references);
|
|
30031
|
+
this.visitAllTemplateNodes(component.children);
|
|
30032
|
+
}
|
|
30033
|
+
visitDirective(directive) {
|
|
30034
|
+
this.visitAllTemplateNodes(directive.attributes);
|
|
30035
|
+
this.visitAllTemplateNodes(directive.inputs);
|
|
30036
|
+
this.visitAllTemplateNodes(directive.outputs);
|
|
30037
|
+
this.visitAllTemplateNodes(directive.references);
|
|
30038
|
+
}
|
|
30039
|
+
visitVariable(variable) { }
|
|
30040
|
+
visitReference(reference) { }
|
|
30041
|
+
visitTextAttribute(attribute) { }
|
|
30042
|
+
visitText(text) { }
|
|
30043
|
+
visitUnknownBlock(block) { }
|
|
30044
|
+
visitAllTemplateNodes(nodes) {
|
|
30045
|
+
for (const node of nodes) {
|
|
30046
|
+
this.visit(node);
|
|
30047
|
+
}
|
|
30048
|
+
}
|
|
30049
|
+
}
|
|
30050
|
+
|
|
30077
30051
|
/**
|
|
30078
30052
|
* Processes `Target`s with a given set of directives and performs a binding operation, which
|
|
30079
30053
|
* returns an object similar to TypeScript's `ts.TypeChecker` that contains knowledge about the
|
|
@@ -30115,9 +30089,7 @@ class R3TargetBinder {
|
|
|
30115
30089
|
// - bindings: Map of inputs, outputs, and attributes to the directive/element that claims
|
|
30116
30090
|
// them. TODO(alxhub): handle multiple directives claiming an input/output/etc.
|
|
30117
30091
|
// - references: Map of #references to their targets.
|
|
30118
|
-
|
|
30119
|
-
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
30120
|
-
}
|
|
30092
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
30121
30093
|
// Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
|
30122
30094
|
// template. This extracts all the metadata that doesn't depend on directive matching.
|
|
30123
30095
|
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
@@ -30451,6 +30423,13 @@ class DirectiveBinder {
|
|
|
30451
30423
|
this.directiveMatcher.match(cssSelector, (_, results) => directives.push(...results));
|
|
30452
30424
|
this.trackSelectorBasedBindingsAndDirectives(node, directives);
|
|
30453
30425
|
}
|
|
30426
|
+
else {
|
|
30427
|
+
node.references.forEach((ref) => {
|
|
30428
|
+
if (ref.value.trim() === '') {
|
|
30429
|
+
this.references.set(ref, node);
|
|
30430
|
+
}
|
|
30431
|
+
});
|
|
30432
|
+
}
|
|
30454
30433
|
node.directives.forEach((directive) => directive.visit(this));
|
|
30455
30434
|
node.children.forEach((child) => child.visit(this));
|
|
30456
30435
|
}
|
|
@@ -30553,7 +30532,7 @@ class DirectiveBinder {
|
|
|
30553
30532
|
* Expressions are visited by the superclass `RecursiveAstVisitor`, with custom logic provided
|
|
30554
30533
|
* by overridden methods from that visitor.
|
|
30555
30534
|
*/
|
|
30556
|
-
class TemplateBinder extends
|
|
30535
|
+
class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
30557
30536
|
bindings;
|
|
30558
30537
|
symbols;
|
|
30559
30538
|
usedPipes;
|
|
@@ -30563,7 +30542,7 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30563
30542
|
scope;
|
|
30564
30543
|
rootNode;
|
|
30565
30544
|
level;
|
|
30566
|
-
visitNode;
|
|
30545
|
+
visitNode = (node) => node.visit(this);
|
|
30567
30546
|
constructor(bindings, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, rootNode, level) {
|
|
30568
30547
|
super();
|
|
30569
30548
|
this.bindings = bindings;
|
|
@@ -30575,19 +30554,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30575
30554
|
this.scope = scope;
|
|
30576
30555
|
this.rootNode = rootNode;
|
|
30577
30556
|
this.level = level;
|
|
30578
|
-
// Save a bit of processing time by constructing this closure in advance.
|
|
30579
|
-
this.visitNode = (node) => node.visit(this);
|
|
30580
|
-
}
|
|
30581
|
-
// This method is defined to reconcile the type of TemplateBinder since both
|
|
30582
|
-
// RecursiveAstVisitor and Visitor define the visit() method in their
|
|
30583
|
-
// interfaces.
|
|
30584
|
-
visit(node, context) {
|
|
30585
|
-
if (node instanceof AST) {
|
|
30586
|
-
node.visit(this, context);
|
|
30587
|
-
}
|
|
30588
|
-
else {
|
|
30589
|
-
node.visit(this);
|
|
30590
|
-
}
|
|
30591
30557
|
}
|
|
30592
30558
|
/**
|
|
30593
30559
|
* Process a template and extract metadata about expressions and symbols within.
|
|
@@ -30656,14 +30622,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30656
30622
|
nodeOrNodes.forEach(this.visitNode);
|
|
30657
30623
|
}
|
|
30658
30624
|
}
|
|
30659
|
-
visitElement(element) {
|
|
30660
|
-
// Visit the inputs, outputs, and children of the element.
|
|
30661
|
-
element.inputs.forEach(this.visitNode);
|
|
30662
|
-
element.outputs.forEach(this.visitNode);
|
|
30663
|
-
element.directives.forEach(this.visitNode);
|
|
30664
|
-
element.children.forEach(this.visitNode);
|
|
30665
|
-
element.references.forEach(this.visitNode);
|
|
30666
|
-
}
|
|
30667
30625
|
visitTemplate(template) {
|
|
30668
30626
|
// First, visit inputs, outputs and template attributes of the template node.
|
|
30669
30627
|
template.inputs.forEach(this.visitNode);
|
|
@@ -30686,34 +30644,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30686
30644
|
this.symbols.set(reference, this.rootNode);
|
|
30687
30645
|
}
|
|
30688
30646
|
}
|
|
30689
|
-
visitComponent(component) {
|
|
30690
|
-
component.inputs.forEach(this.visitNode);
|
|
30691
|
-
component.outputs.forEach(this.visitNode);
|
|
30692
|
-
component.directives.forEach(this.visitNode);
|
|
30693
|
-
component.children.forEach(this.visitNode);
|
|
30694
|
-
component.references.forEach(this.visitNode);
|
|
30695
|
-
}
|
|
30696
|
-
visitDirective(directive) {
|
|
30697
|
-
directive.inputs.forEach(this.visitNode);
|
|
30698
|
-
directive.outputs.forEach(this.visitNode);
|
|
30699
|
-
directive.references.forEach(this.visitNode);
|
|
30700
|
-
}
|
|
30701
|
-
// Unused template visitors
|
|
30702
|
-
visitText(text) { }
|
|
30703
|
-
visitTextAttribute(attribute) { }
|
|
30704
|
-
visitUnknownBlock(block) { }
|
|
30705
|
-
visitDeferredTrigger() { }
|
|
30706
|
-
visitIcu(icu) {
|
|
30707
|
-
Object.keys(icu.vars).forEach((key) => icu.vars[key].visit(this));
|
|
30708
|
-
Object.keys(icu.placeholders).forEach((key) => icu.placeholders[key].visit(this));
|
|
30709
|
-
}
|
|
30710
|
-
// The remaining visitors are concerned with processing AST expressions within template bindings
|
|
30711
|
-
visitBoundAttribute(attribute) {
|
|
30712
|
-
attribute.value.visit(this);
|
|
30713
|
-
}
|
|
30714
|
-
visitBoundEvent(event) {
|
|
30715
|
-
event.handler.visit(this);
|
|
30716
|
-
}
|
|
30717
30647
|
visitDeferredBlock(deferred) {
|
|
30718
30648
|
this.ingestScopedNode(deferred);
|
|
30719
30649
|
deferred.triggers.when?.value.visit(this);
|
|
@@ -30733,10 +30663,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30733
30663
|
visitDeferredBlockLoading(block) {
|
|
30734
30664
|
this.ingestScopedNode(block);
|
|
30735
30665
|
}
|
|
30736
|
-
visitSwitchBlock(block) {
|
|
30737
|
-
block.expression.visit(this);
|
|
30738
|
-
block.cases.forEach(this.visitNode);
|
|
30739
|
-
}
|
|
30740
30666
|
visitSwitchBlockCase(block) {
|
|
30741
30667
|
block.expression?.visit(this);
|
|
30742
30668
|
this.ingestScopedNode(block);
|
|
@@ -30749,9 +30675,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30749
30675
|
visitForLoopBlockEmpty(block) {
|
|
30750
30676
|
this.ingestScopedNode(block);
|
|
30751
30677
|
}
|
|
30752
|
-
visitIfBlock(block) {
|
|
30753
|
-
block.branches.forEach((node) => node.visit(this));
|
|
30754
|
-
}
|
|
30755
30678
|
visitIfBlockBranch(block) {
|
|
30756
30679
|
block.expression?.visit(this);
|
|
30757
30680
|
this.ingestScopedNode(block);
|
|
@@ -30759,11 +30682,8 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30759
30682
|
visitContent(content) {
|
|
30760
30683
|
this.ingestScopedNode(content);
|
|
30761
30684
|
}
|
|
30762
|
-
visitBoundText(text) {
|
|
30763
|
-
text.value.visit(this);
|
|
30764
|
-
}
|
|
30765
30685
|
visitLetDeclaration(decl) {
|
|
30766
|
-
|
|
30686
|
+
super.visitLetDeclaration(decl);
|
|
30767
30687
|
if (this.rootNode !== null) {
|
|
30768
30688
|
this.symbols.set(decl, this.rootNode);
|
|
30769
30689
|
}
|
|
@@ -30785,10 +30705,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30785
30705
|
this.maybeMap(ast, ast.name);
|
|
30786
30706
|
return super.visitSafePropertyRead(ast, context);
|
|
30787
30707
|
}
|
|
30788
|
-
visitPropertyWrite(ast, context) {
|
|
30789
|
-
this.maybeMap(ast, ast.name);
|
|
30790
|
-
return super.visitPropertyWrite(ast, context);
|
|
30791
|
-
}
|
|
30792
30708
|
ingestScopedNode(node) {
|
|
30793
30709
|
const childScope = this.scope.getChildScope(node);
|
|
30794
30710
|
const binder = new TemplateBinder(this.bindings, this.symbols, this.usedPipes, this.eagerPipes, this.deferBlocks, this.nestingLevel, childScope, node, this.level + 1);
|
|
@@ -31757,7 +31673,7 @@ class _Visitor {
|
|
|
31757
31673
|
this._init(_VisitorMode.Merge, interpolationConfig);
|
|
31758
31674
|
this._translations = translations;
|
|
31759
31675
|
// Construct a single fake root element
|
|
31760
|
-
const wrapper = new Element('wrapper', [], [], nodes, undefined, undefined, undefined);
|
|
31676
|
+
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined);
|
|
31761
31677
|
const translatedNode = wrapper.visit(this, null);
|
|
31762
31678
|
if (this._inI18nBlock) {
|
|
31763
31679
|
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
|
|
@@ -31935,10 +31851,10 @@ class _Visitor {
|
|
|
31935
31851
|
this._inImplicitNode = wasInImplicitNode;
|
|
31936
31852
|
if (this._mode === _VisitorMode.Merge) {
|
|
31937
31853
|
if (node instanceof Element) {
|
|
31938
|
-
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
31854
|
+
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
31939
31855
|
}
|
|
31940
31856
|
else {
|
|
31941
|
-
return new Component(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
31857
|
+
return new Component(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
31942
31858
|
}
|
|
31943
31859
|
}
|
|
31944
31860
|
return null;
|
|
@@ -32166,7 +32082,7 @@ function isAttrNode(ast) {
|
|
|
32166
32082
|
* @description
|
|
32167
32083
|
* Entry point for all public APIs of the compiler package.
|
|
32168
32084
|
*/
|
|
32169
|
-
new Version('20.0.
|
|
32085
|
+
new Version('20.1.0-next.1');
|
|
32170
32086
|
|
|
32171
32087
|
//////////////////////////////////////
|
|
32172
32088
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
@@ -32329,6 +32245,10 @@ exports.ErrorCode = void 0;
|
|
|
32329
32245
|
* class used as a component).
|
|
32330
32246
|
*/
|
|
32331
32247
|
ErrorCode[ErrorCode["INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE"] = 2025] = "INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE";
|
|
32248
|
+
/**
|
|
32249
|
+
* Raised for `@Component` fields that aren't supported in a selectorless context.
|
|
32250
|
+
*/
|
|
32251
|
+
ErrorCode[ErrorCode["UNSUPPORTED_SELECTORLESS_COMPONENT_FIELD"] = 2026] = "UNSUPPORTED_SELECTORLESS_COMPONENT_FIELD";
|
|
32332
32252
|
ErrorCode[ErrorCode["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
|
|
32333
32253
|
/**
|
|
32334
32254
|
* Raised when a relationship between directives and/or pipes would cause a cyclic import to be
|
|
@@ -33182,7 +33102,7 @@ class NodeJSPathManipulation {
|
|
|
33182
33102
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
33183
33103
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
33184
33104
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
33185
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-
|
|
33105
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-CY7a8ko8.cjs', document.baseURI).href));
|
|
33186
33106
|
const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
|
|
33187
33107
|
/**
|
|
33188
33108
|
* A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
|
|
@@ -38319,24 +38239,6 @@ class ExpressionTranslatorVisitor {
|
|
|
38319
38239
|
this.setSourceMapRange(identifier, ast.sourceSpan);
|
|
38320
38240
|
return identifier;
|
|
38321
38241
|
}
|
|
38322
|
-
visitWriteVarExpr(expr, context) {
|
|
38323
|
-
const assignment = this.factory.createAssignment(this.setSourceMapRange(this.factory.createIdentifier(expr.name), expr.sourceSpan), expr.value.visitExpression(this, context));
|
|
38324
|
-
return context.isStatement
|
|
38325
|
-
? assignment
|
|
38326
|
-
: this.factory.createParenthesizedExpression(assignment);
|
|
38327
|
-
}
|
|
38328
|
-
visitWriteKeyExpr(expr, context) {
|
|
38329
|
-
const exprContext = context.withExpressionMode;
|
|
38330
|
-
const target = this.factory.createElementAccess(expr.receiver.visitExpression(this, exprContext), expr.index.visitExpression(this, exprContext));
|
|
38331
|
-
const assignment = this.factory.createAssignment(target, expr.value.visitExpression(this, exprContext));
|
|
38332
|
-
return context.isStatement
|
|
38333
|
-
? assignment
|
|
38334
|
-
: this.factory.createParenthesizedExpression(assignment);
|
|
38335
|
-
}
|
|
38336
|
-
visitWritePropExpr(expr, context) {
|
|
38337
|
-
const target = this.factory.createPropertyAccess(expr.receiver.visitExpression(this, context), expr.name);
|
|
38338
|
-
return this.factory.createAssignment(target, expr.value.visitExpression(this, context));
|
|
38339
|
-
}
|
|
38340
38242
|
visitInvokeFunctionExpr(ast, context) {
|
|
38341
38243
|
return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
|
|
38342
38244
|
}
|
|
@@ -38457,6 +38359,9 @@ class ExpressionTranslatorVisitor {
|
|
|
38457
38359
|
: ast.body.visitExpression(this, context));
|
|
38458
38360
|
}
|
|
38459
38361
|
visitBinaryOperatorExpr(ast, context) {
|
|
38362
|
+
if (ast.operator === BinaryOperator.Assign) {
|
|
38363
|
+
return this.factory.createAssignment(ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context));
|
|
38364
|
+
}
|
|
38460
38365
|
if (!BINARY_OPERATORS$1.has(ast.operator)) {
|
|
38461
38366
|
throw new Error(`Unknown binary operator: ${BinaryOperator[ast.operator]}`);
|
|
38462
38367
|
}
|
|
@@ -38789,15 +38694,6 @@ class TypeTranslatorVisitor {
|
|
|
38789
38694
|
}
|
|
38790
38695
|
return ts.factory.createTypeQueryNode(ts.factory.createIdentifier(ast.name));
|
|
38791
38696
|
}
|
|
38792
|
-
visitWriteVarExpr(expr, context) {
|
|
38793
|
-
throw new Error('Method not implemented.');
|
|
38794
|
-
}
|
|
38795
|
-
visitWriteKeyExpr(expr, context) {
|
|
38796
|
-
throw new Error('Method not implemented.');
|
|
38797
|
-
}
|
|
38798
|
-
visitWritePropExpr(expr, context) {
|
|
38799
|
-
throw new Error('Method not implemented.');
|
|
38800
|
-
}
|
|
38801
38697
|
visitInvokeFunctionExpr(ast, context) {
|
|
38802
38698
|
throw new Error('Method not implemented.');
|
|
38803
38699
|
}
|
|
@@ -39490,6 +39386,7 @@ exports.ComponentScopeKind = void 0;
|
|
|
39490
39386
|
(function (ComponentScopeKind) {
|
|
39491
39387
|
ComponentScopeKind[ComponentScopeKind["NgModule"] = 0] = "NgModule";
|
|
39492
39388
|
ComponentScopeKind[ComponentScopeKind["Standalone"] = 1] = "Standalone";
|
|
39389
|
+
ComponentScopeKind[ComponentScopeKind["Selectorless"] = 2] = "Selectorless";
|
|
39493
39390
|
})(exports.ComponentScopeKind || (exports.ComponentScopeKind = {}));
|
|
39494
39391
|
|
|
39495
39392
|
/**
|
|
@@ -39517,9 +39414,6 @@ function validateAccessOfInitializerApiMember({ api, call }, member) {
|
|
|
39517
39414
|
* @returns The parsed initializer API, or null if none was found.
|
|
39518
39415
|
*/
|
|
39519
39416
|
function tryParseInitializerApi(functions, expression, reflector, importTracker) {
|
|
39520
|
-
if (ts.isAsExpression(expression) || ts.isParenthesizedExpression(expression)) {
|
|
39521
|
-
return tryParseInitializerApi(functions, expression.expression, reflector, importTracker);
|
|
39522
|
-
}
|
|
39523
39417
|
if (!ts.isCallExpression(expression)) {
|
|
39524
39418
|
return null;
|
|
39525
39419
|
}
|
|
@@ -39915,7 +39809,7 @@ const QUERY_TYPES = new Set(queryDecoratorNames);
|
|
|
39915
39809
|
* appear in the declarations of an `NgModule` and additional verification is done when processing
|
|
39916
39810
|
* the module.
|
|
39917
39811
|
*/
|
|
39918
|
-
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, strictStandalone, implicitStandaloneValue) {
|
|
39812
|
+
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector, strictStandalone, implicitStandaloneValue, emitDeclarationOnly) {
|
|
39919
39813
|
let directive;
|
|
39920
39814
|
if (decorator.args === null || decorator.args.length === 0) {
|
|
39921
39815
|
directive = new Map();
|
|
@@ -39941,8 +39835,8 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
39941
39835
|
const coreModule = isCore ? undefined : '@angular/core';
|
|
39942
39836
|
// Construct the map of inputs both from the @Directive/@Component
|
|
39943
39837
|
// decorator, and the decorated fields.
|
|
39944
|
-
const inputsFromMeta = parseInputsArray(clazz, directive, evaluator, reflector, refEmitter, compilationMode);
|
|
39945
|
-
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromMeta, decorator);
|
|
39838
|
+
const inputsFromMeta = parseInputsArray(clazz, directive, evaluator, reflector, refEmitter, compilationMode, emitDeclarationOnly);
|
|
39839
|
+
const inputsFromFields = parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromMeta, decorator, emitDeclarationOnly);
|
|
39946
39840
|
const inputs = ClassPropertyMapping.fromMappedObject({ ...inputsFromMeta, ...inputsFromFields });
|
|
39947
39841
|
// And outputs.
|
|
39948
39842
|
const outputsFromMeta = parseOutputsArray(directive, evaluator);
|
|
@@ -40052,7 +39946,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
40052
39946
|
const rawHostDirectives = directive.get('hostDirectives') || null;
|
|
40053
39947
|
const hostDirectives = rawHostDirectives === null
|
|
40054
39948
|
? null
|
|
40055
|
-
: extractHostDirectives(rawHostDirectives, evaluator, compilationMode, createForwardRefResolver(isCore));
|
|
39949
|
+
: extractHostDirectives(rawHostDirectives, evaluator, reflector, compilationMode, createForwardRefResolver(isCore), emitDeclarationOnly);
|
|
40056
39950
|
if (compilationMode !== exports.CompilationMode.LOCAL && hostDirectives !== null) {
|
|
40057
39951
|
// In global compilation mode where we do type checking, the template type-checker will need to
|
|
40058
39952
|
// import host directive types, so add them as referenced by `clazz`. This will ensure that
|
|
@@ -40400,7 +40294,7 @@ function parseMappingString(value) {
|
|
|
40400
40294
|
return [bindingPropertyName ?? fieldName, fieldName];
|
|
40401
40295
|
}
|
|
40402
40296
|
/** Parses the `inputs` array of a directive/component decorator. */
|
|
40403
|
-
function parseInputsArray(clazz, decoratorMetadata, evaluator, reflector, refEmitter, compilationMode) {
|
|
40297
|
+
function parseInputsArray(clazz, decoratorMetadata, evaluator, reflector, refEmitter, compilationMode, emitDeclarationOnly) {
|
|
40404
40298
|
const inputsField = decoratorMetadata.get('inputs');
|
|
40405
40299
|
if (inputsField === undefined) {
|
|
40406
40300
|
return {};
|
|
@@ -40438,7 +40332,7 @@ function parseInputsArray(clazz, decoratorMetadata, evaluator, reflector, refEmi
|
|
|
40438
40332
|
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference)) {
|
|
40439
40333
|
throw createValueHasWrongTypeError(inputsField, transformValue, `Transform of value at position ${i} of @Directive.inputs array must be a function`);
|
|
40440
40334
|
}
|
|
40441
|
-
transform = parseDecoratorInputTransformFunction(clazz, name, transformValue, reflector, refEmitter, compilationMode);
|
|
40335
|
+
transform = parseDecoratorInputTransformFunction(clazz, name, transformValue, reflector, refEmitter, compilationMode, emitDeclarationOnly);
|
|
40442
40336
|
}
|
|
40443
40337
|
inputs[name] = {
|
|
40444
40338
|
classPropertyName: name,
|
|
@@ -40467,7 +40361,7 @@ function tryGetDecoratorOnMember(member, decoratorName, isCore) {
|
|
|
40467
40361
|
}
|
|
40468
40362
|
return null;
|
|
40469
40363
|
}
|
|
40470
|
-
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode) {
|
|
40364
|
+
function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode, emitDeclarationOnly) {
|
|
40471
40365
|
const classPropertyName = member.name;
|
|
40472
40366
|
const decorator = tryGetDecoratorOnMember(member, 'Input', isCore);
|
|
40473
40367
|
const signalInputMapping = tryParseSignalInputMapping(member, reflector, importTracker);
|
|
@@ -40505,7 +40399,7 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTr
|
|
|
40505
40399
|
if (!(transformValue instanceof DynamicValue) && !(transformValue instanceof Reference)) {
|
|
40506
40400
|
throw createValueHasWrongTypeError(optionsNode, transformValue, `Input transform must be a function`);
|
|
40507
40401
|
}
|
|
40508
|
-
transform = parseDecoratorInputTransformFunction(clazz, classPropertyName, transformValue, reflector, refEmitter, compilationMode);
|
|
40402
|
+
transform = parseDecoratorInputTransformFunction(clazz, classPropertyName, transformValue, reflector, refEmitter, compilationMode, emitDeclarationOnly);
|
|
40509
40403
|
}
|
|
40510
40404
|
return {
|
|
40511
40405
|
isSignal: false,
|
|
@@ -40525,11 +40419,11 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTr
|
|
|
40525
40419
|
return null;
|
|
40526
40420
|
}
|
|
40527
40421
|
/** Parses the class members that declare inputs (via decorator or initializer). */
|
|
40528
|
-
function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator) {
|
|
40422
|
+
function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator, emitDeclarationOnly) {
|
|
40529
40423
|
const inputs = {};
|
|
40530
40424
|
for (const member of members) {
|
|
40531
40425
|
const classPropertyName = member.name;
|
|
40532
|
-
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode);
|
|
40426
|
+
const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode, emitDeclarationOnly);
|
|
40533
40427
|
if (inputMapping === null) {
|
|
40534
40428
|
continue;
|
|
40535
40429
|
}
|
|
@@ -40555,7 +40449,22 @@ function parseInputFields(clazz, members, evaluator, reflector, importTracker, r
|
|
|
40555
40449
|
* automatically captured in the type of the `InputSignal`.
|
|
40556
40450
|
*
|
|
40557
40451
|
*/
|
|
40558
|
-
function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, reflector, refEmitter, compilationMode) {
|
|
40452
|
+
function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, reflector, refEmitter, compilationMode, emitDeclarationOnly) {
|
|
40453
|
+
if (emitDeclarationOnly) {
|
|
40454
|
+
const chain = {
|
|
40455
|
+
messageText: '@Input decorators with a transform function are not supported in experimental declaration-only emission mode',
|
|
40456
|
+
category: ts.DiagnosticCategory.Error,
|
|
40457
|
+
code: 0,
|
|
40458
|
+
next: [
|
|
40459
|
+
{
|
|
40460
|
+
messageText: `Consider converting '${clazz.name.text}.${classPropertyName}' to an input signal`,
|
|
40461
|
+
category: ts.DiagnosticCategory.Message,
|
|
40462
|
+
code: 0,
|
|
40463
|
+
},
|
|
40464
|
+
],
|
|
40465
|
+
};
|
|
40466
|
+
throw new FatalDiagnosticError(exports.ErrorCode.DECORATOR_UNEXPECTED, value.node, chain);
|
|
40467
|
+
}
|
|
40559
40468
|
// In local compilation mode we can skip type checking the function args. This is because usually
|
|
40560
40469
|
// the type check is done in a separate build which runs in full compilation mode. So here we skip
|
|
40561
40470
|
// all the diagnostics.
|
|
@@ -40833,7 +40742,7 @@ function getHostBindingErrorNode(error, hostExpr) {
|
|
|
40833
40742
|
* Extracts and prepares the host directives metadata from an array literal expression.
|
|
40834
40743
|
* @param rawHostDirectives Expression that defined the `hostDirectives`.
|
|
40835
40744
|
*/
|
|
40836
|
-
function extractHostDirectives(rawHostDirectives, evaluator, compilationMode, forwardRefResolver) {
|
|
40745
|
+
function extractHostDirectives(rawHostDirectives, evaluator, reflector, compilationMode, forwardRefResolver, emitDeclarationOnly) {
|
|
40837
40746
|
const resolved = evaluator.evaluate(rawHostDirectives, forwardRefResolver);
|
|
40838
40747
|
if (!Array.isArray(resolved)) {
|
|
40839
40748
|
throw createValueHasWrongTypeError(rawHostDirectives, resolved, 'hostDirectives must be an array');
|
|
@@ -40859,9 +40768,28 @@ function extractHostDirectives(rawHostDirectives, evaluator, compilationMode, fo
|
|
|
40859
40768
|
// forward ref for imported symbols?!)
|
|
40860
40769
|
if (!ts.isIdentifier(hostReference.node) &&
|
|
40861
40770
|
!ts.isPropertyAccessExpression(hostReference.node)) {
|
|
40862
|
-
|
|
40771
|
+
const compilationModeName = emitDeclarationOnly
|
|
40772
|
+
? 'experimental declaration-only emission'
|
|
40773
|
+
: 'local compilation';
|
|
40774
|
+
throw new FatalDiagnosticError(exports.ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION, hostReference.node, `In ${compilationModeName} mode, host directive cannot be an expression. Use an identifier instead`);
|
|
40775
|
+
}
|
|
40776
|
+
if (emitDeclarationOnly) {
|
|
40777
|
+
if (ts.isIdentifier(hostReference.node)) {
|
|
40778
|
+
const importInfo = reflector.getImportOfIdentifier(hostReference.node);
|
|
40779
|
+
if (importInfo) {
|
|
40780
|
+
directive = new ExternalReference(importInfo.from, importInfo.name);
|
|
40781
|
+
}
|
|
40782
|
+
else {
|
|
40783
|
+
throw new FatalDiagnosticError(exports.ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION, hostReference.node, `In experimental declaration-only emission mode, host directive cannot use indirect external indentifiers. Use a direct external identifier instead`);
|
|
40784
|
+
}
|
|
40785
|
+
}
|
|
40786
|
+
else {
|
|
40787
|
+
throw new FatalDiagnosticError(exports.ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION, hostReference.node, `In experimental declaration-only emission mode, host directive cannot be an expression. Use an identifier instead`);
|
|
40788
|
+
}
|
|
40789
|
+
}
|
|
40790
|
+
else {
|
|
40791
|
+
directive = new WrappedNodeExpr(hostReference.node);
|
|
40863
40792
|
}
|
|
40864
|
-
directive = new WrappedNodeExpr(hostReference.node);
|
|
40865
40793
|
}
|
|
40866
40794
|
else if (hostReference instanceof Reference) {
|
|
40867
40795
|
directive = hostReference;
|
|
@@ -40901,6 +40829,12 @@ function toHostDirectiveMetadata(hostDirective, context, refEmitter) {
|
|
|
40901
40829
|
if (hostDirective.directive instanceof Reference) {
|
|
40902
40830
|
directive = toR3Reference(hostDirective.directive.node, hostDirective.directive, context, refEmitter);
|
|
40903
40831
|
}
|
|
40832
|
+
else if (hostDirective.directive instanceof ExternalReference) {
|
|
40833
|
+
directive = {
|
|
40834
|
+
value: new ExternalExpr(hostDirective.directive),
|
|
40835
|
+
type: new ExternalExpr(hostDirective.directive),
|
|
40836
|
+
};
|
|
40837
|
+
}
|
|
40904
40838
|
else {
|
|
40905
40839
|
directive = {
|
|
40906
40840
|
value: hostDirective.directive,
|
|
@@ -41120,6 +41054,8 @@ exports.SymbolKind = void 0;
|
|
|
41120
41054
|
SymbolKind[SymbolKind["DomBinding"] = 9] = "DomBinding";
|
|
41121
41055
|
SymbolKind[SymbolKind["Pipe"] = 10] = "Pipe";
|
|
41122
41056
|
SymbolKind[SymbolKind["LetDeclaration"] = 11] = "LetDeclaration";
|
|
41057
|
+
SymbolKind[SymbolKind["SelectorlessComponent"] = 12] = "SelectorlessComponent";
|
|
41058
|
+
SymbolKind[SymbolKind["SelectorlessDirective"] = 13] = "SelectorlessDirective";
|
|
41123
41059
|
})(exports.SymbolKind || (exports.SymbolKind = {}));
|
|
41124
41060
|
|
|
41125
41061
|
/**
|
|
@@ -41417,6 +41353,10 @@ class CompletionEngine {
|
|
|
41417
41353
|
tcbPath;
|
|
41418
41354
|
tcbIsShim;
|
|
41419
41355
|
componentContext;
|
|
41356
|
+
/**
|
|
41357
|
+
* Get the `TcbLocation` for the global context, which is the location of the `this` variable.
|
|
41358
|
+
*/
|
|
41359
|
+
globalTsContext;
|
|
41420
41360
|
/**
|
|
41421
41361
|
* Cache of completions for various levels of the template, including the root template (`null`).
|
|
41422
41362
|
* Memoizes `getTemplateContextCompletions`.
|
|
@@ -41442,11 +41382,20 @@ class CompletionEngine {
|
|
|
41442
41382
|
// for the component context.
|
|
41443
41383
|
positionInFile: globalRead.name.getStart(),
|
|
41444
41384
|
};
|
|
41385
|
+
this.globalTsContext = {
|
|
41386
|
+
tcbPath: this.tcbPath,
|
|
41387
|
+
isShimFile: this.tcbIsShim,
|
|
41388
|
+
positionInFile: globalRead.name.getStart() - 1,
|
|
41389
|
+
};
|
|
41445
41390
|
}
|
|
41446
41391
|
else {
|
|
41447
41392
|
this.componentContext = null;
|
|
41393
|
+
this.globalTsContext = null;
|
|
41448
41394
|
}
|
|
41449
41395
|
}
|
|
41396
|
+
getGlobalTsContext() {
|
|
41397
|
+
return this.globalTsContext;
|
|
41398
|
+
}
|
|
41450
41399
|
/**
|
|
41451
41400
|
* Get global completions within the given template context and AST node.
|
|
41452
41401
|
*
|
|
@@ -41502,7 +41451,7 @@ class CompletionEngine {
|
|
|
41502
41451
|
}
|
|
41503
41452
|
// Completion works inside property reads and method calls.
|
|
41504
41453
|
let tsExpr = null;
|
|
41505
|
-
if (expr instanceof PropertyRead
|
|
41454
|
+
if (expr instanceof PropertyRead) {
|
|
41506
41455
|
// Non-safe navigation operations are trivial: `foo.bar` or `foo.bar()`
|
|
41507
41456
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
41508
41457
|
filter: ts.isPropertyAccessExpression,
|
|
@@ -41611,88 +41560,97 @@ class CompletionEngine {
|
|
|
41611
41560
|
}
|
|
41612
41561
|
}
|
|
41613
41562
|
|
|
41614
|
-
|
|
41615
|
-
|
|
41616
|
-
|
|
41617
|
-
|
|
41618
|
-
|
|
41619
|
-
var charToInt = new Uint8Array(128);
|
|
41563
|
+
const comma = ','.charCodeAt(0);
|
|
41564
|
+
const semicolon = ';'.charCodeAt(0);
|
|
41565
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
41566
|
+
const intToChar = new Uint8Array(64); // 64 possible chars.
|
|
41567
|
+
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
|
41620
41568
|
for (let i = 0; i < chars.length; i++) {
|
|
41621
|
-
|
|
41622
|
-
|
|
41623
|
-
|
|
41569
|
+
const c = chars.charCodeAt(i);
|
|
41570
|
+
intToChar[i] = c;
|
|
41571
|
+
charToInt[c] = i;
|
|
41624
41572
|
}
|
|
41625
41573
|
function encodeInteger(builder, num, relative) {
|
|
41626
|
-
|
|
41627
|
-
|
|
41628
|
-
|
|
41629
|
-
|
|
41630
|
-
|
|
41631
|
-
|
|
41632
|
-
|
|
41633
|
-
|
|
41634
|
-
|
|
41635
|
-
|
|
41636
|
-
|
|
41637
|
-
|
|
41638
|
-
|
|
41639
|
-
|
|
41640
|
-
|
|
41641
|
-
|
|
41642
|
-
|
|
41643
|
-
|
|
41644
|
-
|
|
41645
|
-
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41574
|
+
let delta = num - relative;
|
|
41575
|
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
|
41576
|
+
do {
|
|
41577
|
+
let clamped = delta & 0b011111;
|
|
41578
|
+
delta >>>= 5;
|
|
41579
|
+
if (delta > 0)
|
|
41580
|
+
clamped |= 0b100000;
|
|
41581
|
+
builder.write(intToChar[clamped]);
|
|
41582
|
+
} while (delta > 0);
|
|
41583
|
+
return num;
|
|
41584
|
+
}
|
|
41585
|
+
|
|
41586
|
+
const bufLength = 1024 * 16;
|
|
41587
|
+
// Provide a fallback for older environments.
|
|
41588
|
+
const td = typeof TextDecoder !== 'undefined'
|
|
41589
|
+
? /* #__PURE__ */ new TextDecoder()
|
|
41590
|
+
: typeof Buffer !== 'undefined'
|
|
41591
|
+
? {
|
|
41592
|
+
decode(buf) {
|
|
41593
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
41594
|
+
return out.toString();
|
|
41595
|
+
},
|
|
41596
|
+
}
|
|
41597
|
+
: {
|
|
41598
|
+
decode(buf) {
|
|
41599
|
+
let out = '';
|
|
41600
|
+
for (let i = 0; i < buf.length; i++) {
|
|
41601
|
+
out += String.fromCharCode(buf[i]);
|
|
41602
|
+
}
|
|
41603
|
+
return out;
|
|
41604
|
+
},
|
|
41605
|
+
};
|
|
41606
|
+
class StringWriter {
|
|
41607
|
+
constructor() {
|
|
41608
|
+
this.pos = 0;
|
|
41609
|
+
this.out = '';
|
|
41610
|
+
this.buffer = new Uint8Array(bufLength);
|
|
41649
41611
|
}
|
|
41650
|
-
|
|
41651
|
-
|
|
41652
|
-
|
|
41653
|
-
|
|
41654
|
-
|
|
41655
|
-
|
|
41656
|
-
|
|
41657
|
-
|
|
41658
|
-
|
|
41659
|
-
|
|
41660
|
-
|
|
41661
|
-
|
|
41662
|
-
|
|
41663
|
-
this.out += td.decode(buffer);
|
|
41664
|
-
this.pos = 0;
|
|
41665
|
-
}
|
|
41666
|
-
}
|
|
41667
|
-
flush() {
|
|
41668
|
-
const { buffer, out, pos } = this;
|
|
41669
|
-
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
41670
|
-
}
|
|
41671
|
-
};
|
|
41612
|
+
write(v) {
|
|
41613
|
+
const { buffer } = this;
|
|
41614
|
+
buffer[this.pos++] = v;
|
|
41615
|
+
if (this.pos === bufLength) {
|
|
41616
|
+
this.out += td.decode(buffer);
|
|
41617
|
+
this.pos = 0;
|
|
41618
|
+
}
|
|
41619
|
+
}
|
|
41620
|
+
flush() {
|
|
41621
|
+
const { buffer, out, pos } = this;
|
|
41622
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
41623
|
+
}
|
|
41624
|
+
}
|
|
41672
41625
|
function encode(decoded) {
|
|
41673
|
-
|
|
41674
|
-
|
|
41675
|
-
|
|
41676
|
-
|
|
41677
|
-
|
|
41678
|
-
|
|
41679
|
-
|
|
41680
|
-
|
|
41681
|
-
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
|
|
41685
|
-
|
|
41686
|
-
|
|
41687
|
-
|
|
41688
|
-
|
|
41689
|
-
|
|
41690
|
-
|
|
41691
|
-
|
|
41692
|
-
|
|
41693
|
-
|
|
41694
|
-
|
|
41695
|
-
|
|
41626
|
+
const writer = new StringWriter();
|
|
41627
|
+
let sourcesIndex = 0;
|
|
41628
|
+
let sourceLine = 0;
|
|
41629
|
+
let sourceColumn = 0;
|
|
41630
|
+
let namesIndex = 0;
|
|
41631
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
41632
|
+
const line = decoded[i];
|
|
41633
|
+
if (i > 0)
|
|
41634
|
+
writer.write(semicolon);
|
|
41635
|
+
if (line.length === 0)
|
|
41636
|
+
continue;
|
|
41637
|
+
let genColumn = 0;
|
|
41638
|
+
for (let j = 0; j < line.length; j++) {
|
|
41639
|
+
const segment = line[j];
|
|
41640
|
+
if (j > 0)
|
|
41641
|
+
writer.write(comma);
|
|
41642
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
41643
|
+
if (segment.length === 1)
|
|
41644
|
+
continue;
|
|
41645
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
41646
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
41647
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
41648
|
+
if (segment.length === 4)
|
|
41649
|
+
continue;
|
|
41650
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
41651
|
+
}
|
|
41652
|
+
}
|
|
41653
|
+
return writer.flush();
|
|
41696
41654
|
}
|
|
41697
41655
|
|
|
41698
41656
|
class BitSet {
|
|
@@ -44243,22 +44201,6 @@ class OutOfBandDiagnosticRecorderImpl {
|
|
|
44243
44201
|
* is ever produced per node.
|
|
44244
44202
|
*/
|
|
44245
44203
|
recordedPipes = new Set();
|
|
44246
|
-
/** Common pipes that can be suggested to users. */
|
|
44247
|
-
pipeSuggestions = new Map([
|
|
44248
|
-
['async', 'AsyncPipe'],
|
|
44249
|
-
['uppercase', 'UpperCasePipe'],
|
|
44250
|
-
['lowercase', 'LowerCasePipe'],
|
|
44251
|
-
['json', 'JsonPipe'],
|
|
44252
|
-
['slice', 'SlicePipe'],
|
|
44253
|
-
['number', 'DecimalPipe'],
|
|
44254
|
-
['percent', 'PercentPipe'],
|
|
44255
|
-
['titlecase', 'TitleCasePipe'],
|
|
44256
|
-
['currency', 'CurrencyPipe'],
|
|
44257
|
-
['date', 'DatePipe'],
|
|
44258
|
-
['i18nPlural', 'I18nPluralPipe'],
|
|
44259
|
-
['i18nSelect', 'I18nSelectPipe'],
|
|
44260
|
-
['keyvalue', 'KeyValuePipe'],
|
|
44261
|
-
]);
|
|
44262
44204
|
constructor(resolver) {
|
|
44263
44205
|
this.resolver = resolver;
|
|
44264
44206
|
}
|
|
@@ -44271,30 +44213,16 @@ class OutOfBandDiagnosticRecorderImpl {
|
|
|
44271
44213
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
44272
44214
|
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
44273
44215
|
}
|
|
44274
|
-
missingPipe(id, ast
|
|
44216
|
+
missingPipe(id, ast) {
|
|
44275
44217
|
if (this.recordedPipes.has(ast)) {
|
|
44276
44218
|
return;
|
|
44277
44219
|
}
|
|
44220
|
+
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
44221
|
+
const errorMsg = `No pipe found with name '${ast.name}'.`;
|
|
44278
44222
|
const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, ast.nameSpan);
|
|
44279
44223
|
if (sourceSpan === null) {
|
|
44280
44224
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
44281
44225
|
}
|
|
44282
|
-
const mapping = this.resolver.getTemplateSourceMapping(id);
|
|
44283
|
-
let errorMsg = `No pipe found with name '${ast.name}'.`;
|
|
44284
|
-
if (this.pipeSuggestions.has(ast.name)) {
|
|
44285
|
-
const suggestedClassName = this.pipeSuggestions.get(ast.name);
|
|
44286
|
-
const suggestedImport = '@angular/common';
|
|
44287
|
-
if (isStandalone) {
|
|
44288
|
-
errorMsg +=
|
|
44289
|
-
`\nTo fix this, import the "${suggestedClassName}" class from "${suggestedImport}"` +
|
|
44290
|
-
` and add it to the "imports" array of the component.`;
|
|
44291
|
-
}
|
|
44292
|
-
else {
|
|
44293
|
-
errorMsg +=
|
|
44294
|
-
`\nTo fix this, import the "${suggestedClassName}" class from "${suggestedImport}"` +
|
|
44295
|
-
` and add it to the "imports" array of the module declaring the component.`;
|
|
44296
|
-
}
|
|
44297
|
-
}
|
|
44298
44226
|
this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.MISSING_PIPE), errorMsg));
|
|
44299
44227
|
this.recordedPipes.add(ast);
|
|
44300
44228
|
}
|
|
@@ -44487,10 +44415,11 @@ class OutOfBandDiagnosticRecorderImpl {
|
|
|
44487
44415
|
missingNamedTemplateDependency(id, node) {
|
|
44488
44416
|
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.MISSING_NAMED_TEMPLATE_DEPENDENCY),
|
|
44489
44417
|
// Wording is meant to mimic the wording TS uses in their diagnostic for missing symbols.
|
|
44490
|
-
`Cannot find name "${node instanceof Directive$1 ? node.name : node.componentName}"
|
|
44418
|
+
`Cannot find name "${node instanceof Directive$1 ? node.name : node.componentName}". ` +
|
|
44419
|
+
`Selectorless references are only supported to classes or non-type import statements.`));
|
|
44491
44420
|
}
|
|
44492
44421
|
incorrectTemplateDependencyType(id, node) {
|
|
44493
|
-
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be
|
|
44422
|
+
this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(exports.ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof Component$1 ? '@Component' : '@Directive'}.`));
|
|
44494
44423
|
}
|
|
44495
44424
|
unclaimedDirectiveBinding(id, directive, node) {
|
|
44496
44425
|
const errorMsg = `Directive ${directive.name} does not have an ` +
|
|
@@ -44651,6 +44580,7 @@ const BINARY_OPS = new Map([
|
|
|
44651
44580
|
['>', ts.SyntaxKind.GreaterThanToken],
|
|
44652
44581
|
['<=', ts.SyntaxKind.LessThanEqualsToken],
|
|
44653
44582
|
['>=', ts.SyntaxKind.GreaterThanEqualsToken],
|
|
44583
|
+
['=', ts.SyntaxKind.EqualsToken],
|
|
44654
44584
|
['==', ts.SyntaxKind.EqualsEqualsToken],
|
|
44655
44585
|
['===', ts.SyntaxKind.EqualsEqualsEqualsToken],
|
|
44656
44586
|
['*', ts.SyntaxKind.AsteriskToken],
|
|
@@ -44761,16 +44691,6 @@ class AstTranslator {
|
|
|
44761
44691
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
44762
44692
|
return node;
|
|
44763
44693
|
}
|
|
44764
|
-
visitKeyedWrite(ast) {
|
|
44765
|
-
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
44766
|
-
const left = ts.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
44767
|
-
// TODO(joost): annotate `left` with the span of the element access, which is not currently
|
|
44768
|
-
// available on `ast`.
|
|
44769
|
-
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
44770
|
-
const node = wrapForDiagnostics(ts.factory.createBinaryExpression(left, ts.SyntaxKind.EqualsToken, right));
|
|
44771
|
-
addParseSpanInfo(node, ast.sourceSpan);
|
|
44772
|
-
return node;
|
|
44773
|
-
}
|
|
44774
44694
|
visitLiteralArray(ast) {
|
|
44775
44695
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
44776
44696
|
const literal = ts.factory.createArrayLiteralExpression(elements);
|
|
@@ -44850,27 +44770,6 @@ class AstTranslator {
|
|
|
44850
44770
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
44851
44771
|
return node;
|
|
44852
44772
|
}
|
|
44853
|
-
visitPropertyWrite(ast) {
|
|
44854
|
-
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
44855
|
-
const left = ts.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
44856
|
-
addParseSpanInfo(left, ast.nameSpan);
|
|
44857
|
-
// TypeScript reports assignment errors on the entire lvalue expression. Annotate the lvalue of
|
|
44858
|
-
// the assignment with the sourceSpan, which includes receivers, rather than nameSpan for
|
|
44859
|
-
// consistency of the diagnostic location.
|
|
44860
|
-
// a.b.c = 1
|
|
44861
|
-
// ^^^^^^^^^ sourceSpan
|
|
44862
|
-
// ^ nameSpan
|
|
44863
|
-
const leftWithPath = wrapForDiagnostics(left);
|
|
44864
|
-
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
44865
|
-
// The right needs to be wrapped in parens as well or we cannot accurately match its
|
|
44866
|
-
// span to just the RHS. For example, the span in `e = $event /*0,10*/` is ambiguous.
|
|
44867
|
-
// It could refer to either the whole binary expression or just the RHS.
|
|
44868
|
-
// We should instead generate `e = ($event /*0,10*/)` so we know the span 0,10 matches RHS.
|
|
44869
|
-
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
44870
|
-
const node = wrapForDiagnostics(ts.factory.createBinaryExpression(leftWithPath, ts.SyntaxKind.EqualsToken, right));
|
|
44871
|
-
addParseSpanInfo(node, ast.sourceSpan);
|
|
44872
|
-
return node;
|
|
44873
|
-
}
|
|
44874
44773
|
visitSafePropertyRead(ast) {
|
|
44875
44774
|
let node;
|
|
44876
44775
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
@@ -45060,9 +44959,6 @@ class VeSafeLhsInferenceBugDetector {
|
|
|
45060
44959
|
visitKeyedRead(ast) {
|
|
45061
44960
|
return false;
|
|
45062
44961
|
}
|
|
45063
|
-
visitKeyedWrite(ast) {
|
|
45064
|
-
return false;
|
|
45065
|
-
}
|
|
45066
44962
|
visitLiteralArray(ast) {
|
|
45067
44963
|
return true;
|
|
45068
44964
|
}
|
|
@@ -45090,9 +44986,6 @@ class VeSafeLhsInferenceBugDetector {
|
|
|
45090
44986
|
visitPropertyRead(ast) {
|
|
45091
44987
|
return false;
|
|
45092
44988
|
}
|
|
45093
|
-
visitPropertyWrite(ast) {
|
|
45094
|
-
return false;
|
|
45095
|
-
}
|
|
45096
44989
|
visitSafePropertyRead(ast) {
|
|
45097
44990
|
return false;
|
|
45098
44991
|
}
|
|
@@ -47353,7 +47246,7 @@ class Scope {
|
|
|
47353
47246
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(directive);
|
|
47354
47247
|
if (directives === null ||
|
|
47355
47248
|
directives.length === 0 ||
|
|
47356
|
-
directives.some((dir) => dir.isComponent)) {
|
|
47249
|
+
directives.some((dir) => dir.isComponent || !dir.isStandalone)) {
|
|
47357
47250
|
this.tcb.oobRecorder.incorrectTemplateDependencyType(this.tcb.id, directive);
|
|
47358
47251
|
continue;
|
|
47359
47252
|
}
|
|
@@ -47426,7 +47319,7 @@ class Scope {
|
|
|
47426
47319
|
const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
|
|
47427
47320
|
if (directives === null ||
|
|
47428
47321
|
directives.length === 0 ||
|
|
47429
|
-
directives.every((dir) => !dir.isComponent)) {
|
|
47322
|
+
directives.every((dir) => !dir.isComponent || !dir.isStandalone)) {
|
|
47430
47323
|
this.tcb.oobRecorder.incorrectTemplateDependencyType(this.tcb.id, node);
|
|
47431
47324
|
return;
|
|
47432
47325
|
}
|
|
@@ -47576,21 +47469,25 @@ class TcbExpressionTranslator {
|
|
|
47576
47469
|
}
|
|
47577
47470
|
return targetExpression;
|
|
47578
47471
|
}
|
|
47579
|
-
else if (ast instanceof
|
|
47580
|
-
|
|
47472
|
+
else if (ast instanceof Binary &&
|
|
47473
|
+
ast.operation === '=' &&
|
|
47474
|
+
ast.left instanceof PropertyRead &&
|
|
47475
|
+
ast.left.receiver instanceof ImplicitReceiver) {
|
|
47476
|
+
const read = ast.left;
|
|
47477
|
+
const target = this.tcb.boundTarget.getExpressionTarget(read);
|
|
47581
47478
|
if (target === null) {
|
|
47582
47479
|
return null;
|
|
47583
47480
|
}
|
|
47584
|
-
const targetExpression = this.getTargetNodeExpression(target,
|
|
47585
|
-
const expr = this.translate(ast.
|
|
47481
|
+
const targetExpression = this.getTargetNodeExpression(target, read);
|
|
47482
|
+
const expr = this.translate(ast.right);
|
|
47586
47483
|
const result = ts.factory.createParenthesizedExpression(ts.factory.createBinaryExpression(targetExpression, ts.SyntaxKind.EqualsToken, expr));
|
|
47587
|
-
addParseSpanInfo(result,
|
|
47484
|
+
addParseSpanInfo(result, read.sourceSpan);
|
|
47588
47485
|
// Ignore diagnostics from TS produced for writes to `@let` and re-report them using
|
|
47589
47486
|
// our own infrastructure. We can't rely on the TS reporting, because it includes
|
|
47590
47487
|
// the name of the auto-generated TCB variable name.
|
|
47591
47488
|
if (target instanceof LetDeclaration$1) {
|
|
47592
47489
|
markIgnoreDiagnostics(result);
|
|
47593
|
-
this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id,
|
|
47490
|
+
this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
|
|
47594
47491
|
}
|
|
47595
47492
|
return result;
|
|
47596
47493
|
}
|
|
@@ -47615,7 +47512,7 @@ class TcbExpressionTranslator {
|
|
|
47615
47512
|
let pipe;
|
|
47616
47513
|
if (pipeMeta === null) {
|
|
47617
47514
|
// No pipe by that name exists in scope. Record this as an error.
|
|
47618
|
-
this.tcb.oobRecorder.missingPipe(this.tcb.id, ast
|
|
47515
|
+
this.tcb.oobRecorder.missingPipe(this.tcb.id, ast);
|
|
47619
47516
|
// Use an 'any' value to at least allow the rest of the expression to be checked.
|
|
47620
47517
|
pipe = ANY_EXPRESSION;
|
|
47621
47518
|
}
|
|
@@ -48578,6 +48475,12 @@ class SymbolBuilder {
|
|
|
48578
48475
|
else if (node instanceof Element$1) {
|
|
48579
48476
|
symbol = this.getSymbolOfElement(node);
|
|
48580
48477
|
}
|
|
48478
|
+
else if (node instanceof Component$1) {
|
|
48479
|
+
symbol = this.getSymbolOfSelectorlessComponent(node);
|
|
48480
|
+
}
|
|
48481
|
+
else if (node instanceof Directive$1) {
|
|
48482
|
+
symbol = this.getSymbolOfSelectorlessDirective(node);
|
|
48483
|
+
}
|
|
48581
48484
|
else if (node instanceof Template) {
|
|
48582
48485
|
symbol = this.getSymbolOfAstTemplate(node);
|
|
48583
48486
|
}
|
|
@@ -48628,8 +48531,38 @@ class SymbolBuilder {
|
|
|
48628
48531
|
templateNode: element,
|
|
48629
48532
|
};
|
|
48630
48533
|
}
|
|
48631
|
-
|
|
48632
|
-
const
|
|
48534
|
+
getSymbolOfSelectorlessComponent(node) {
|
|
48535
|
+
const directives = this.getDirectivesOfNode(node);
|
|
48536
|
+
const primaryDirective = directives.find((dir) => !dir.isHostDirective && dir.isComponent) ?? null;
|
|
48537
|
+
if (primaryDirective === null) {
|
|
48538
|
+
return null;
|
|
48539
|
+
}
|
|
48540
|
+
return {
|
|
48541
|
+
tsType: primaryDirective.tsType,
|
|
48542
|
+
tsSymbol: primaryDirective.tsSymbol,
|
|
48543
|
+
tcbLocation: primaryDirective.tcbLocation,
|
|
48544
|
+
kind: exports.SymbolKind.SelectorlessComponent,
|
|
48545
|
+
directives,
|
|
48546
|
+
templateNode: node,
|
|
48547
|
+
};
|
|
48548
|
+
}
|
|
48549
|
+
getSymbolOfSelectorlessDirective(node) {
|
|
48550
|
+
const directives = this.getDirectivesOfNode(node);
|
|
48551
|
+
const primaryDirective = directives.find((dir) => !dir.isHostDirective && !dir.isComponent) ?? null;
|
|
48552
|
+
if (primaryDirective === null) {
|
|
48553
|
+
return null;
|
|
48554
|
+
}
|
|
48555
|
+
return {
|
|
48556
|
+
tsType: primaryDirective.tsType,
|
|
48557
|
+
tsSymbol: primaryDirective.tsSymbol,
|
|
48558
|
+
tcbLocation: primaryDirective.tcbLocation,
|
|
48559
|
+
kind: exports.SymbolKind.SelectorlessDirective,
|
|
48560
|
+
directives,
|
|
48561
|
+
templateNode: node,
|
|
48562
|
+
};
|
|
48563
|
+
}
|
|
48564
|
+
getDirectivesOfNode(templateNode) {
|
|
48565
|
+
const elementSourceSpan = templateNode.startSourceSpan ?? templateNode.sourceSpan;
|
|
48633
48566
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
48634
48567
|
// directives could be either:
|
|
48635
48568
|
// - var _t1: TestDir /*T:D*/ = null! as TestDir;
|
|
@@ -48642,6 +48575,7 @@ class SymbolBuilder {
|
|
|
48642
48575
|
filter: isDirectiveDeclaration,
|
|
48643
48576
|
});
|
|
48644
48577
|
const symbols = [];
|
|
48578
|
+
const seenDirectives = new Set();
|
|
48645
48579
|
for (const node of nodes) {
|
|
48646
48580
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
48647
48581
|
if (symbol === null ||
|
|
@@ -48649,11 +48583,14 @@ class SymbolBuilder {
|
|
|
48649
48583
|
!ts.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
48650
48584
|
continue;
|
|
48651
48585
|
}
|
|
48652
|
-
const
|
|
48653
|
-
|
|
48654
|
-
|
|
48586
|
+
const declaration = symbol.tsSymbol.valueDeclaration;
|
|
48587
|
+
const meta = this.getDirectiveMeta(templateNode, declaration);
|
|
48588
|
+
// Host directives will be added as identifiers with the same offset as the host
|
|
48589
|
+
// which means that they'll get added twice. De-duplicate them to avoid confusion.
|
|
48590
|
+
if (meta !== null && !seenDirectives.has(declaration)) {
|
|
48591
|
+
const ref = new Reference(declaration);
|
|
48655
48592
|
if (meta.hostDirectives !== null) {
|
|
48656
|
-
this.addHostDirectiveSymbols(
|
|
48593
|
+
this.addHostDirectiveSymbols(templateNode, meta.hostDirectives, symbols, seenDirectives);
|
|
48657
48594
|
}
|
|
48658
48595
|
const directiveSymbol = {
|
|
48659
48596
|
...symbol,
|
|
@@ -48661,30 +48598,33 @@ class SymbolBuilder {
|
|
|
48661
48598
|
tsSymbol: symbol.tsSymbol,
|
|
48662
48599
|
selector: meta.selector,
|
|
48663
48600
|
isComponent: meta.isComponent,
|
|
48664
|
-
ngModule: this.getDirectiveModule(
|
|
48601
|
+
ngModule: this.getDirectiveModule(declaration),
|
|
48665
48602
|
kind: exports.SymbolKind.Directive,
|
|
48666
48603
|
isStructural: meta.isStructural,
|
|
48667
48604
|
isInScope: true,
|
|
48668
48605
|
isHostDirective: false,
|
|
48606
|
+
tsCompletionEntryInfo: null,
|
|
48669
48607
|
};
|
|
48670
48608
|
symbols.push(directiveSymbol);
|
|
48609
|
+
seenDirectives.add(declaration);
|
|
48671
48610
|
}
|
|
48672
48611
|
}
|
|
48673
48612
|
return symbols;
|
|
48674
48613
|
}
|
|
48675
|
-
addHostDirectiveSymbols(host, hostDirectives, symbols) {
|
|
48614
|
+
addHostDirectiveSymbols(host, hostDirectives, symbols, seenDirectives) {
|
|
48676
48615
|
for (const current of hostDirectives) {
|
|
48677
48616
|
if (!isHostDirectiveMetaForGlobalMode(current)) {
|
|
48678
48617
|
throw new Error('Impossible state: typecheck code path in local compilation mode.');
|
|
48679
48618
|
}
|
|
48680
|
-
|
|
48619
|
+
const node = current.directive.node;
|
|
48620
|
+
if (!ts.isClassDeclaration(node) || seenDirectives.has(node)) {
|
|
48681
48621
|
continue;
|
|
48682
48622
|
}
|
|
48683
|
-
const symbol = this.getSymbolOfTsNode(
|
|
48684
|
-
const meta = this.getDirectiveMeta(host,
|
|
48623
|
+
const symbol = this.getSymbolOfTsNode(node);
|
|
48624
|
+
const meta = this.getDirectiveMeta(host, node);
|
|
48685
48625
|
if (meta !== null && symbol !== null && isSymbolWithValueDeclaration(symbol.tsSymbol)) {
|
|
48686
48626
|
if (meta.hostDirectives !== null) {
|
|
48687
|
-
this.addHostDirectiveSymbols(host, meta.hostDirectives, symbols);
|
|
48627
|
+
this.addHostDirectiveSymbols(host, meta.hostDirectives, symbols, seenDirectives);
|
|
48688
48628
|
}
|
|
48689
48629
|
const directiveSymbol = {
|
|
48690
48630
|
...symbol,
|
|
@@ -48695,12 +48635,14 @@ class SymbolBuilder {
|
|
|
48695
48635
|
exposedOutputs: current.outputs,
|
|
48696
48636
|
selector: meta.selector,
|
|
48697
48637
|
isComponent: meta.isComponent,
|
|
48698
|
-
ngModule: this.getDirectiveModule(
|
|
48638
|
+
ngModule: this.getDirectiveModule(node),
|
|
48699
48639
|
kind: exports.SymbolKind.Directive,
|
|
48700
48640
|
isStructural: meta.isStructural,
|
|
48701
48641
|
isInScope: true,
|
|
48642
|
+
tsCompletionEntryInfo: null,
|
|
48702
48643
|
};
|
|
48703
48644
|
symbols.push(directiveSymbol);
|
|
48645
|
+
seenDirectives.add(node);
|
|
48704
48646
|
}
|
|
48705
48647
|
}
|
|
48706
48648
|
}
|
|
@@ -48709,16 +48651,19 @@ class SymbolBuilder {
|
|
|
48709
48651
|
// `getDirectivesOfNode` will not return the directives intended for an element
|
|
48710
48652
|
// on a microsyntax template, for example `<div *ngFor="let user of users;" dir>`,
|
|
48711
48653
|
// the `dir` will be skipped, but it's needed in language service.
|
|
48712
|
-
|
|
48713
|
-
|
|
48714
|
-
|
|
48715
|
-
|
|
48716
|
-
|
|
48717
|
-
if (
|
|
48718
|
-
|
|
48719
|
-
|
|
48720
|
-
|
|
48721
|
-
|
|
48654
|
+
if (!(host instanceof Directive$1)) {
|
|
48655
|
+
const firstChild = host.children[0];
|
|
48656
|
+
if (firstChild instanceof Element$1) {
|
|
48657
|
+
const isMicrosyntaxTemplate = host instanceof Template &&
|
|
48658
|
+
sourceSpanEqual(firstChild.sourceSpan, host.sourceSpan);
|
|
48659
|
+
if (isMicrosyntaxTemplate) {
|
|
48660
|
+
const firstChildDirectives = this.typeCheckData.boundTarget.getDirectivesOfNode(firstChild);
|
|
48661
|
+
if (firstChildDirectives !== null && directives !== null) {
|
|
48662
|
+
directives = directives.concat(firstChildDirectives);
|
|
48663
|
+
}
|
|
48664
|
+
else {
|
|
48665
|
+
directives = directives ?? firstChildDirectives;
|
|
48666
|
+
}
|
|
48722
48667
|
}
|
|
48723
48668
|
}
|
|
48724
48669
|
}
|
|
@@ -48922,9 +48867,7 @@ class SymbolBuilder {
|
|
|
48922
48867
|
getDirectiveSymbolForAccessExpression(fieldAccessExpr, { isComponent, selector, isStructural }) {
|
|
48923
48868
|
// In all cases, `_t1["index"]` or `_t1.index`, `node.expression` is _t1.
|
|
48924
48869
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(fieldAccessExpr.expression);
|
|
48925
|
-
if (tsSymbol?.declarations === undefined ||
|
|
48926
|
-
tsSymbol.declarations.length === 0 ||
|
|
48927
|
-
selector === null) {
|
|
48870
|
+
if (tsSymbol?.declarations === undefined || tsSymbol.declarations.length === 0) {
|
|
48928
48871
|
return null;
|
|
48929
48872
|
}
|
|
48930
48873
|
const [declaration] = tsSymbol.declarations;
|
|
@@ -48955,6 +48898,7 @@ class SymbolBuilder {
|
|
|
48955
48898
|
ngModule,
|
|
48956
48899
|
isHostDirective: false,
|
|
48957
48900
|
isInScope: true, // TODO: this should always be in scope in this context, right?
|
|
48901
|
+
tsCompletionEntryInfo: null,
|
|
48958
48902
|
};
|
|
48959
48903
|
}
|
|
48960
48904
|
getSymbolOfVariable(variable) {
|
|
@@ -49111,11 +49055,15 @@ class SymbolBuilder {
|
|
|
49111
49055
|
return this.getSymbol(expressionTarget);
|
|
49112
49056
|
}
|
|
49113
49057
|
let withSpan = expression.sourceSpan;
|
|
49114
|
-
// The `name` part of a
|
|
49058
|
+
// The `name` part of a property write and `ASTWithName` do not have their own
|
|
49115
49059
|
// AST so there is no way to retrieve a `Symbol` for just the `name` via a specific node.
|
|
49116
49060
|
// Also skipping SafePropertyReads as it breaks nullish coalescing not nullable extended diagnostic
|
|
49117
|
-
if (expression instanceof
|
|
49118
|
-
|
|
49061
|
+
if (expression instanceof Binary &&
|
|
49062
|
+
expression.operation === '=' &&
|
|
49063
|
+
expression.left instanceof PropertyRead) {
|
|
49064
|
+
withSpan = expression.left.nameSpan;
|
|
49065
|
+
}
|
|
49066
|
+
else if (expression instanceof ASTWithName && !(expression instanceof SafePropertyRead)) {
|
|
49119
49067
|
withSpan = expression.nameSpan;
|
|
49120
49068
|
}
|
|
49121
49069
|
let node = null;
|
|
@@ -49727,37 +49675,44 @@ class TemplateTypeCheckerImpl {
|
|
|
49727
49675
|
this.symbolBuilderCache.set(component, builder);
|
|
49728
49676
|
return builder;
|
|
49729
49677
|
}
|
|
49730
|
-
|
|
49731
|
-
const
|
|
49732
|
-
|
|
49733
|
-
|
|
49734
|
-
// First, all in scope directives can be used.
|
|
49735
|
-
for (const d of inScopeDirectives) {
|
|
49736
|
-
resultingDirectives.set(d.ref.node, d);
|
|
49678
|
+
getGlobalTsContext(component) {
|
|
49679
|
+
const engine = this.getOrCreateCompletionEngine(component);
|
|
49680
|
+
if (engine === null) {
|
|
49681
|
+
return null;
|
|
49737
49682
|
}
|
|
49738
|
-
|
|
49739
|
-
|
|
49740
|
-
|
|
49741
|
-
|
|
49742
|
-
|
|
49743
|
-
|
|
49744
|
-
|
|
49745
|
-
|
|
49746
|
-
|
|
49747
|
-
|
|
49748
|
-
|
|
49683
|
+
return engine.getGlobalTsContext();
|
|
49684
|
+
}
|
|
49685
|
+
getPotentialTemplateDirectives(component, tsLs, options) {
|
|
49686
|
+
const scope = this.getComponentScope(component);
|
|
49687
|
+
// Don't resolve directives for selectorless components since they're already in the file.
|
|
49688
|
+
if (scope?.kind === exports.ComponentScopeKind.Selectorless) {
|
|
49689
|
+
return [];
|
|
49690
|
+
}
|
|
49691
|
+
const resultingDirectives = new Map();
|
|
49692
|
+
const directivesInScope = this.getTemplateDirectiveInScope(component);
|
|
49693
|
+
const directiveInGlobal = this.getElementsInGlobal(component, tsLs, options);
|
|
49694
|
+
for (const directive of [...directivesInScope, ...directiveInGlobal]) {
|
|
49695
|
+
if (resultingDirectives.has(directive.ref.node)) {
|
|
49749
49696
|
continue;
|
|
49750
|
-
|
|
49697
|
+
}
|
|
49698
|
+
resultingDirectives.set(directive.ref.node, directive);
|
|
49751
49699
|
}
|
|
49752
49700
|
return Array.from(resultingDirectives.values());
|
|
49753
49701
|
}
|
|
49754
49702
|
getPotentialPipes(component) {
|
|
49703
|
+
const scope = this.getComponentScope(component);
|
|
49704
|
+
// Don't resolve pipes for selectorless components since they're already in the file.
|
|
49705
|
+
if (scope?.kind === exports.ComponentScopeKind.Selectorless) {
|
|
49706
|
+
return [];
|
|
49707
|
+
}
|
|
49755
49708
|
// Very similar to the above `getPotentialTemplateDirectives`, but on pipes.
|
|
49756
49709
|
const typeChecker = this.programDriver.getProgram().getTypeChecker();
|
|
49757
|
-
const inScopePipes = this.getScopeData(component)?.pipes ?? [];
|
|
49758
49710
|
const resultingPipes = new Map();
|
|
49759
|
-
|
|
49760
|
-
|
|
49711
|
+
if (scope !== null) {
|
|
49712
|
+
const inScopePipes = this.getScopeData(component, scope)?.pipes ?? [];
|
|
49713
|
+
for (const p of inScopePipes) {
|
|
49714
|
+
resultingPipes.set(p.ref.node, p);
|
|
49715
|
+
}
|
|
49761
49716
|
}
|
|
49762
49717
|
for (const pipeClass of this.localMetaReader.getKnown(exports.MetaKind.Pipe)) {
|
|
49763
49718
|
const pipeMeta = this.metaReader.getPipeMetadata(new Reference(pipeClass));
|
|
@@ -49790,7 +49745,156 @@ class TemplateTypeCheckerImpl {
|
|
|
49790
49745
|
}
|
|
49791
49746
|
return this.metaReader.getPipeMetadata(new Reference(pipe));
|
|
49792
49747
|
}
|
|
49793
|
-
|
|
49748
|
+
getTemplateDirectiveInScope(component) {
|
|
49749
|
+
const resultingDirectives = new Map();
|
|
49750
|
+
const scope = this.getComponentScope(component);
|
|
49751
|
+
// Don't resolve directives for selectorless components since they're already in the file.
|
|
49752
|
+
if (scope?.kind === exports.ComponentScopeKind.Selectorless) {
|
|
49753
|
+
return [];
|
|
49754
|
+
}
|
|
49755
|
+
if (scope !== null) {
|
|
49756
|
+
const inScopeDirectives = this.getScopeData(component, scope)?.directives ?? [];
|
|
49757
|
+
// First, all in scope directives can be used.
|
|
49758
|
+
for (const d of inScopeDirectives) {
|
|
49759
|
+
resultingDirectives.set(d.ref.node, d);
|
|
49760
|
+
}
|
|
49761
|
+
}
|
|
49762
|
+
const typeChecker = this.programDriver.getProgram().getTypeChecker();
|
|
49763
|
+
const currentComponentFileName = component.getSourceFile().fileName;
|
|
49764
|
+
// Any additional directives found from the global registry can be used, only includes the directives includes in the current
|
|
49765
|
+
// component file.
|
|
49766
|
+
//
|
|
49767
|
+
// This means only the inputs in the decorator are needed to be updated, no need to update the import statement.
|
|
49768
|
+
for (const directiveClass of this.localMetaReader.getKnown(exports.MetaKind.Directive)) {
|
|
49769
|
+
if (directiveClass.getSourceFile().fileName !== currentComponentFileName) {
|
|
49770
|
+
continue;
|
|
49771
|
+
}
|
|
49772
|
+
const directiveMeta = this.metaReader.getDirectiveMetadata(new Reference(directiveClass));
|
|
49773
|
+
if (directiveMeta === null)
|
|
49774
|
+
continue;
|
|
49775
|
+
if (resultingDirectives.has(directiveClass))
|
|
49776
|
+
continue;
|
|
49777
|
+
const withScope = this.scopeDataOfDirectiveMeta(typeChecker, directiveMeta);
|
|
49778
|
+
if (withScope === null)
|
|
49779
|
+
continue;
|
|
49780
|
+
resultingDirectives.set(directiveClass, { ...withScope, isInScope: false });
|
|
49781
|
+
}
|
|
49782
|
+
return Array.from(resultingDirectives.values());
|
|
49783
|
+
}
|
|
49784
|
+
getDirectiveScopeData(component, isInScope, tsCompletionEntryInfo) {
|
|
49785
|
+
const typeChecker = this.programDriver.getProgram().getTypeChecker();
|
|
49786
|
+
if (!isNamedClassDeclaration(component)) {
|
|
49787
|
+
return null;
|
|
49788
|
+
}
|
|
49789
|
+
const directiveMeta = this.metaReader.getDirectiveMetadata(new Reference(component));
|
|
49790
|
+
if (directiveMeta === null) {
|
|
49791
|
+
return null;
|
|
49792
|
+
}
|
|
49793
|
+
const withScope = this.scopeDataOfDirectiveMeta(typeChecker, directiveMeta);
|
|
49794
|
+
if (withScope === null) {
|
|
49795
|
+
return null;
|
|
49796
|
+
}
|
|
49797
|
+
return {
|
|
49798
|
+
...withScope,
|
|
49799
|
+
isInScope,
|
|
49800
|
+
tsCompletionEntryInfo,
|
|
49801
|
+
};
|
|
49802
|
+
}
|
|
49803
|
+
getElementsInFileScope(component) {
|
|
49804
|
+
const tagMap = new Map();
|
|
49805
|
+
const potentialDirectives = this.getTemplateDirectiveInScope(component);
|
|
49806
|
+
for (const directive of potentialDirectives) {
|
|
49807
|
+
if (directive.selector === null) {
|
|
49808
|
+
continue;
|
|
49809
|
+
}
|
|
49810
|
+
for (const selector of CssSelector.parse(directive.selector)) {
|
|
49811
|
+
if (selector.element === null || tagMap.has(selector.element)) {
|
|
49812
|
+
// Skip this directive if it doesn't match an element tag, or if another directive has
|
|
49813
|
+
// already been included with the same element name.
|
|
49814
|
+
continue;
|
|
49815
|
+
}
|
|
49816
|
+
tagMap.set(selector.element, directive);
|
|
49817
|
+
}
|
|
49818
|
+
}
|
|
49819
|
+
return tagMap;
|
|
49820
|
+
}
|
|
49821
|
+
getElementsInGlobal(component, tsLs, options) {
|
|
49822
|
+
// Add the additional directives from the global registry, which are not in scope and in different file with the current
|
|
49823
|
+
// component file.
|
|
49824
|
+
//
|
|
49825
|
+
// This means the inputs and the import statement in the decorator are needed to be updated.
|
|
49826
|
+
const tsContext = this.getGlobalTsContext(component);
|
|
49827
|
+
if (tsContext === null) {
|
|
49828
|
+
return [];
|
|
49829
|
+
}
|
|
49830
|
+
if (!options.includeExternalModule) {
|
|
49831
|
+
return [];
|
|
49832
|
+
}
|
|
49833
|
+
const entries = tsLs.getCompletionsAtPosition(tsContext.tcbPath, tsContext.positionInFile, {
|
|
49834
|
+
includeSymbol: true,
|
|
49835
|
+
includeCompletionsForModuleExports: true,
|
|
49836
|
+
})?.entries;
|
|
49837
|
+
const typeChecker = this.programDriver.getProgram().getTypeChecker();
|
|
49838
|
+
const resultingDirectives = new Map();
|
|
49839
|
+
const currentComponentFileName = component.getSourceFile().fileName;
|
|
49840
|
+
for (const { symbol, data } of entries ?? []) {
|
|
49841
|
+
const symbolFileName = symbol?.declarations?.[0]?.getSourceFile().fileName;
|
|
49842
|
+
if (symbolFileName === undefined) {
|
|
49843
|
+
continue;
|
|
49844
|
+
}
|
|
49845
|
+
if (symbolFileName === currentComponentFileName) {
|
|
49846
|
+
continue;
|
|
49847
|
+
}
|
|
49848
|
+
const decl = getClassDeclFromSymbol(symbol, typeChecker);
|
|
49849
|
+
if (decl === null) {
|
|
49850
|
+
continue;
|
|
49851
|
+
}
|
|
49852
|
+
const directiveDecls = [];
|
|
49853
|
+
const ref = new Reference(decl);
|
|
49854
|
+
const directiveMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
49855
|
+
if (directiveMeta?.isStandalone) {
|
|
49856
|
+
directiveDecls.push({
|
|
49857
|
+
meta: directiveMeta,
|
|
49858
|
+
ref,
|
|
49859
|
+
});
|
|
49860
|
+
}
|
|
49861
|
+
else {
|
|
49862
|
+
const ngModuleMeta = this.metaReader.getNgModuleMetadata(ref);
|
|
49863
|
+
if (ngModuleMeta === null) {
|
|
49864
|
+
continue;
|
|
49865
|
+
}
|
|
49866
|
+
for (const moduleExports of ngModuleMeta.exports) {
|
|
49867
|
+
const directiveMeta = this.metaReader.getDirectiveMetadata(moduleExports);
|
|
49868
|
+
if (directiveMeta === null) {
|
|
49869
|
+
continue;
|
|
49870
|
+
}
|
|
49871
|
+
directiveDecls.push({
|
|
49872
|
+
meta: directiveMeta,
|
|
49873
|
+
ref: moduleExports,
|
|
49874
|
+
});
|
|
49875
|
+
}
|
|
49876
|
+
}
|
|
49877
|
+
for (const directiveDecl of directiveDecls) {
|
|
49878
|
+
if (resultingDirectives.has(directiveDecl.ref.node)) {
|
|
49879
|
+
continue;
|
|
49880
|
+
}
|
|
49881
|
+
const withScope = this.scopeDataOfDirectiveMeta(typeChecker, directiveDecl.meta);
|
|
49882
|
+
if (withScope === null) {
|
|
49883
|
+
continue;
|
|
49884
|
+
}
|
|
49885
|
+
resultingDirectives.set(directiveDecl.ref.node, {
|
|
49886
|
+
...withScope,
|
|
49887
|
+
isInScope: false,
|
|
49888
|
+
tsCompletionEntryInfo: {
|
|
49889
|
+
tsCompletionEntryData: data,
|
|
49890
|
+
tsCompletionEntrySymbolFileName: symbolFileName,
|
|
49891
|
+
},
|
|
49892
|
+
});
|
|
49893
|
+
}
|
|
49894
|
+
}
|
|
49895
|
+
return Array.from(resultingDirectives.values());
|
|
49896
|
+
}
|
|
49897
|
+
getPotentialElementTags(component, tsLs, options) {
|
|
49794
49898
|
if (this.elementTagCache.has(component)) {
|
|
49795
49899
|
return this.elementTagCache.get(component);
|
|
49796
49900
|
}
|
|
@@ -49798,7 +49902,7 @@ class TemplateTypeCheckerImpl {
|
|
|
49798
49902
|
for (const tag of REGISTRY.allKnownElementNames()) {
|
|
49799
49903
|
tagMap.set(tag, null);
|
|
49800
49904
|
}
|
|
49801
|
-
const potentialDirectives = this.getPotentialTemplateDirectives(component);
|
|
49905
|
+
const potentialDirectives = this.getPotentialTemplateDirectives(component, tsLs, options);
|
|
49802
49906
|
for (const directive of potentialDirectives) {
|
|
49803
49907
|
if (directive.selector === null) {
|
|
49804
49908
|
continue;
|
|
@@ -49921,16 +50025,15 @@ class TemplateTypeCheckerImpl {
|
|
|
49921
50025
|
}
|
|
49922
50026
|
return imports;
|
|
49923
50027
|
}
|
|
49924
|
-
|
|
49925
|
-
if (this.scopeCache.has(component)) {
|
|
49926
|
-
return this.scopeCache.get(component);
|
|
49927
|
-
}
|
|
50028
|
+
getComponentScope(component) {
|
|
49928
50029
|
if (!isNamedClassDeclaration(component)) {
|
|
49929
50030
|
throw new Error(`AssertionError: components must have names`);
|
|
49930
50031
|
}
|
|
49931
|
-
|
|
49932
|
-
|
|
49933
|
-
|
|
50032
|
+
return this.componentScopeReader.getScopeForComponent(component);
|
|
50033
|
+
}
|
|
50034
|
+
getScopeData(component, scope) {
|
|
50035
|
+
if (this.scopeCache.has(component)) {
|
|
50036
|
+
return this.scopeCache.get(component);
|
|
49934
50037
|
}
|
|
49935
50038
|
const dependencies = scope.kind === exports.ComponentScopeKind.NgModule
|
|
49936
50039
|
? scope.compilation.dependencies
|
|
@@ -49981,6 +50084,7 @@ class TemplateTypeCheckerImpl {
|
|
|
49981
50084
|
selector: dep.selector,
|
|
49982
50085
|
tsSymbol,
|
|
49983
50086
|
ngModule,
|
|
50087
|
+
tsCompletionEntryInfo: null,
|
|
49984
50088
|
};
|
|
49985
50089
|
}
|
|
49986
50090
|
scopeDataOfPipeMeta(typeChecker, dep) {
|
|
@@ -49992,6 +50096,7 @@ class TemplateTypeCheckerImpl {
|
|
|
49992
50096
|
ref: dep.ref,
|
|
49993
50097
|
name: dep.name,
|
|
49994
50098
|
tsSymbol,
|
|
50099
|
+
tsCompletionEntryInfo: null,
|
|
49995
50100
|
};
|
|
49996
50101
|
}
|
|
49997
50102
|
}
|
|
@@ -50106,15 +50211,37 @@ class SingleShimTypeCheckingHost extends SingleFileTypeCheckingHost {
|
|
|
50106
50211
|
return !this.fileData.shimData.has(shimPath);
|
|
50107
50212
|
}
|
|
50108
50213
|
}
|
|
50214
|
+
function getClassDeclFromSymbol(symbol, checker) {
|
|
50215
|
+
const tsDecl = symbol?.getDeclarations();
|
|
50216
|
+
if (tsDecl === undefined) {
|
|
50217
|
+
return null;
|
|
50218
|
+
}
|
|
50219
|
+
let decl = tsDecl.length > 0 ? tsDecl[0] : undefined;
|
|
50220
|
+
if (decl === undefined) {
|
|
50221
|
+
return null;
|
|
50222
|
+
}
|
|
50223
|
+
if (ts.isExportAssignment(decl)) {
|
|
50224
|
+
const symbol = checker.getTypeAtLocation(decl.expression).symbol;
|
|
50225
|
+
return getClassDeclFromSymbol(symbol, checker);
|
|
50226
|
+
}
|
|
50227
|
+
if (ts.isExportSpecifier(decl)) {
|
|
50228
|
+
const symbol = checker.getTypeAtLocation(decl).symbol;
|
|
50229
|
+
return getClassDeclFromSymbol(symbol, checker);
|
|
50230
|
+
}
|
|
50231
|
+
if (isNamedClassDeclaration(decl)) {
|
|
50232
|
+
return decl;
|
|
50233
|
+
}
|
|
50234
|
+
return null;
|
|
50235
|
+
}
|
|
50109
50236
|
|
|
50110
50237
|
exports.AST = AST;
|
|
50111
50238
|
exports.ASTWithSource = ASTWithSource;
|
|
50112
50239
|
exports.AbsoluteModuleStrategy = AbsoluteModuleStrategy;
|
|
50113
50240
|
exports.ArrowFunctionExpr = ArrowFunctionExpr;
|
|
50114
50241
|
exports.Binary = Binary;
|
|
50242
|
+
exports.BindingPipe = BindingPipe;
|
|
50115
50243
|
exports.BlockPlaceholder = BlockPlaceholder;
|
|
50116
50244
|
exports.BoundAttribute = BoundAttribute;
|
|
50117
|
-
exports.BoundDeferredTrigger = BoundDeferredTrigger;
|
|
50118
50245
|
exports.BoundEvent = BoundEvent;
|
|
50119
50246
|
exports.COMPILER_ERRORS_WITH_GUIDES = COMPILER_ERRORS_WITH_GUIDES;
|
|
50120
50247
|
exports.CR = CR;
|
|
@@ -50123,6 +50250,7 @@ exports.Call = Call;
|
|
|
50123
50250
|
exports.Chain = Chain;
|
|
50124
50251
|
exports.ClassPropertyMapping = ClassPropertyMapping;
|
|
50125
50252
|
exports.CloneVisitor = CloneVisitor;
|
|
50253
|
+
exports.CombinedRecursiveAstVisitor = CombinedRecursiveAstVisitor;
|
|
50126
50254
|
exports.Component = Component$1;
|
|
50127
50255
|
exports.CompoundMetadataReader = CompoundMetadataReader;
|
|
50128
50256
|
exports.Conditional = Conditional;
|
|
@@ -50177,8 +50305,8 @@ exports.ParseSourceFile = ParseSourceFile;
|
|
|
50177
50305
|
exports.ParseSourceSpan = ParseSourceSpan;
|
|
50178
50306
|
exports.Parser = Parser$1;
|
|
50179
50307
|
exports.Placeholder = Placeholder;
|
|
50308
|
+
exports.PrefixNot = PrefixNot;
|
|
50180
50309
|
exports.PropertyRead = PropertyRead;
|
|
50181
|
-
exports.PropertyWrite = PropertyWrite;
|
|
50182
50310
|
exports.QUERY_INITIALIZER_FNS = QUERY_INITIALIZER_FNS;
|
|
50183
50311
|
exports.R3TargetBinder = R3TargetBinder;
|
|
50184
50312
|
exports.ReadVarExpr = ReadVarExpr;
|
|
@@ -50195,6 +50323,7 @@ exports.SafeCall = SafeCall;
|
|
|
50195
50323
|
exports.SafeKeyedRead = SafeKeyedRead;
|
|
50196
50324
|
exports.SafePropertyRead = SafePropertyRead;
|
|
50197
50325
|
exports.SelectorMatcher = SelectorMatcher;
|
|
50326
|
+
exports.SelectorlessMatcher = SelectorlessMatcher;
|
|
50198
50327
|
exports.Serializer = Serializer;
|
|
50199
50328
|
exports.StaticInterpreter = StaticInterpreter;
|
|
50200
50329
|
exports.SyntheticValue = SyntheticValue;
|