@angular/compiler-cli 14.0.0-next.3 → 14.0.0-next.6
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/bundles/{chunk-7C3Q5ZSV.js → chunk-26T3CJIJ.js} +80 -61
- package/bundles/chunk-26T3CJIJ.js.map +6 -0
- package/bundles/{chunk-A5PL3TE6.js → chunk-3MNDX4LL.js} +31 -31
- package/bundles/chunk-3MNDX4LL.js.map +6 -0
- package/bundles/{chunk-QMGQEVL2.js → chunk-5RC6M6GX.js} +67 -61
- package/bundles/chunk-5RC6M6GX.js.map +6 -0
- package/bundles/{chunk-YG7H35RB.js → chunk-7GYYYAZG.js} +3 -3
- package/bundles/{chunk-YG7H35RB.js.map → chunk-7GYYYAZG.js.map} +0 -0
- package/bundles/{chunk-7PY7XEFH.js → chunk-AR265E4B.js} +2 -2
- package/bundles/chunk-AR265E4B.js.map +6 -0
- package/bundles/{chunk-2N3G5KYJ.js → chunk-KMCI52ED.js} +145 -139
- package/bundles/chunk-KMCI52ED.js.map +6 -0
- package/bundles/{chunk-QYWK7GNC.js → chunk-NYXF6G67.js} +9 -9
- package/bundles/{chunk-QYWK7GNC.js.map → chunk-NYXF6G67.js.map} +1 -1
- package/bundles/{chunk-TYUIAZWZ.js → chunk-OOJDZK5W.js} +4 -4
- package/bundles/{chunk-TYUIAZWZ.js.map → chunk-OOJDZK5W.js.map} +0 -0
- package/bundles/{chunk-JKIKUGPN.js → chunk-U5ES6WUL.js} +2 -2
- package/bundles/{chunk-JKIKUGPN.js.map → chunk-U5ES6WUL.js.map} +0 -0
- package/bundles/index.js +6 -6
- package/bundles/linker/babel/index.js +8 -8
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/ngcc/index.js +6 -6
- package/bundles/ngcc/main-ngcc.js +6 -6
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +5 -5
- package/bundles/private/migrations.js +3 -3
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +5 -5
- package/bundles/src/bin/ngc.js +5 -5
- package/bundles_metadata.json +1 -1
- package/linker/babel/src/babel_core.d.ts +1 -0
- package/linker/babel/src/babel_declaration_scope.d.ts +1 -1
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/package.json +6 -6
- package/private/babel.d.ts +42 -0
- package/src/ngtsc/annotations/component/src/util.d.ts +3 -1
- package/src/ngtsc/translator/src/typescript_ast_factory.d.ts +1 -4
- package/src/ngtsc/typecheck/src/diagnostics.d.ts +6 -5
- package/bundles/chunk-2N3G5KYJ.js.map +0 -6
- package/bundles/chunk-7C3Q5ZSV.js.map +0 -6
- package/bundles/chunk-7PY7XEFH.js.map +0 -6
- package/bundles/chunk-A5PL3TE6.js.map +0 -6
- package/bundles/chunk-QMGQEVL2.js.map +0 -6
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
ivyTransformFactory,
|
|
35
35
|
retagAllTsFiles,
|
|
36
36
|
untagAllTsFiles
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-26T3CJIJ.js";
|
|
38
38
|
import {
|
|
39
39
|
TypeScriptReflectionHost,
|
|
40
40
|
isNamedClassDeclaration
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-AR265E4B.js";
|
|
42
42
|
import {
|
|
43
43
|
AbsoluteModuleStrategy,
|
|
44
44
|
AliasStrategy,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
toUnredirectedSourceFile,
|
|
80
80
|
translateExpression,
|
|
81
81
|
translateType
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-5RC6M6GX.js";
|
|
83
83
|
import {
|
|
84
84
|
LogicalFileSystem,
|
|
85
85
|
absoluteFrom,
|
|
@@ -255,7 +255,7 @@ function compareVersions(v1, v2) {
|
|
|
255
255
|
|
|
256
256
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
257
257
|
var MIN_TS_VERSION = "4.4.2";
|
|
258
|
-
var MAX_TS_VERSION = "4.
|
|
258
|
+
var MAX_TS_VERSION = "4.7.0";
|
|
259
259
|
var tsVersion = ts2.version;
|
|
260
260
|
function checkVersion(version, minVersion, maxVersion) {
|
|
261
261
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
@@ -2390,28 +2390,28 @@ var SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
|
|
|
2390
2390
|
]);
|
|
2391
2391
|
function tsCastToAny(expr) {
|
|
2392
2392
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
2393
|
-
expr = ts14.
|
|
2393
|
+
expr = ts14.factory.createParenthesizedExpression(expr);
|
|
2394
2394
|
}
|
|
2395
|
-
return ts14.
|
|
2395
|
+
return ts14.factory.createParenthesizedExpression(ts14.factory.createAsExpression(expr, ts14.factory.createKeywordTypeNode(ts14.SyntaxKind.AnyKeyword)));
|
|
2396
2396
|
}
|
|
2397
2397
|
function tsCreateElement(tagName) {
|
|
2398
|
-
const createElement = ts14.
|
|
2399
|
-
return ts14.
|
|
2398
|
+
const createElement = ts14.factory.createPropertyAccessExpression(ts14.factory.createIdentifier("document"), "createElement");
|
|
2399
|
+
return ts14.factory.createCallExpression(createElement, void 0, [ts14.factory.createStringLiteral(tagName)]);
|
|
2400
2400
|
}
|
|
2401
2401
|
function tsDeclareVariable(id, type) {
|
|
2402
|
-
const decl = ts14.createVariableDeclaration(id, type, ts14.createNonNullExpression(ts14.createNull()));
|
|
2403
|
-
return ts14.createVariableStatement(void 0, [decl]);
|
|
2402
|
+
const decl = ts14.factory.createVariableDeclaration(id, void 0, type, ts14.factory.createNonNullExpression(ts14.factory.createNull()));
|
|
2403
|
+
return ts14.factory.createVariableStatement(void 0, [decl]);
|
|
2404
2404
|
}
|
|
2405
2405
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
2406
|
-
return ts14.createTypeQueryNode(ts14.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2406
|
+
return ts14.factory.createTypeQueryNode(ts14.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
2407
2407
|
}
|
|
2408
2408
|
function tsCreateVariable(id, initializer) {
|
|
2409
|
-
const decl = ts14.createVariableDeclaration(id, void 0, initializer);
|
|
2410
|
-
return ts14.createVariableStatement(void 0, [decl]);
|
|
2409
|
+
const decl = ts14.factory.createVariableDeclaration(id, void 0, void 0, initializer);
|
|
2410
|
+
return ts14.factory.createVariableStatement(void 0, [decl]);
|
|
2411
2411
|
}
|
|
2412
2412
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
2413
|
-
const methodAccess = ts14.
|
|
2414
|
-
return ts14.
|
|
2413
|
+
const methodAccess = ts14.factory.createPropertyAccessExpression(receiver, methodName);
|
|
2414
|
+
return ts14.factory.createCallExpression(methodAccess, void 0, args);
|
|
2415
2415
|
}
|
|
2416
2416
|
function checkIfClassIsExported(node) {
|
|
2417
2417
|
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts14.SyntaxKind.ExportKeyword)) {
|
|
@@ -2504,9 +2504,9 @@ var TypeEmitter = class {
|
|
|
2504
2504
|
}
|
|
2505
2505
|
let typeArguments = void 0;
|
|
2506
2506
|
if (type.typeArguments !== void 0) {
|
|
2507
|
-
typeArguments = ts15.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2507
|
+
typeArguments = ts15.factory.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
2508
2508
|
}
|
|
2509
|
-
return ts15.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2509
|
+
return ts15.factory.updateTypeReferenceNode(type, translatedType.typeName, typeArguments);
|
|
2510
2510
|
}
|
|
2511
2511
|
};
|
|
2512
2512
|
|
|
@@ -2547,7 +2547,7 @@ var TypeParameterEmitter = class {
|
|
|
2547
2547
|
return this.typeParameters.map((typeParam) => {
|
|
2548
2548
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
2549
2549
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
2550
|
-
return ts16.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2550
|
+
return ts16.factory.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
2551
2551
|
});
|
|
2552
2552
|
}
|
|
2553
2553
|
resolveTypeReference(type) {
|
|
@@ -2670,29 +2670,29 @@ function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
|
2670
2670
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
2671
2671
|
function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams) {
|
|
2672
2672
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
2673
|
-
const rawType = ts18.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2673
|
+
const rawType = ts18.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
2674
2674
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2675
2675
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
2676
2676
|
if (meta.body) {
|
|
2677
|
-
const fnType = ts18.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2678
|
-
const decl = ts18.createVariableDeclaration(meta.fnName, fnType, ts18.createNonNullExpression(ts18.createNull()));
|
|
2679
|
-
const declList = ts18.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2680
|
-
return ts18.createVariableStatement(void 0, declList);
|
|
2677
|
+
const fnType = ts18.factory.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
2678
|
+
const decl = ts18.factory.createVariableDeclaration(meta.fnName, void 0, fnType, ts18.factory.createNonNullExpression(ts18.factory.createNull()));
|
|
2679
|
+
const declList = ts18.factory.createVariableDeclarationList([decl], ts18.NodeFlags.Const);
|
|
2680
|
+
return ts18.factory.createVariableStatement(void 0, declList);
|
|
2681
2681
|
} else {
|
|
2682
|
-
return ts18.createFunctionDeclaration(void 0, [ts18.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
2682
|
+
return ts18.factory.createFunctionDeclaration(void 0, [ts18.factory.createModifier(ts18.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
2683
2683
|
}
|
|
2684
2684
|
}
|
|
2685
2685
|
function generateInlineTypeCtor(node, meta) {
|
|
2686
2686
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
2687
|
-
const rawType = ts18.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2687
|
+
const rawType = ts18.factory.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
2688
2688
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
2689
2689
|
let body = void 0;
|
|
2690
2690
|
if (meta.body) {
|
|
2691
|
-
body = ts18.createBlock([
|
|
2692
|
-
ts18.
|
|
2691
|
+
body = ts18.factory.createBlock([
|
|
2692
|
+
ts18.factory.createReturnStatement(ts18.factory.createNonNullExpression(ts18.factory.createNull()))
|
|
2693
2693
|
]);
|
|
2694
2694
|
}
|
|
2695
|
-
return ts18.
|
|
2695
|
+
return ts18.factory.createMethodDeclaration(void 0, [ts18.factory.createModifier(ts18.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
2696
2696
|
}
|
|
2697
2697
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
2698
2698
|
let initType = null;
|
|
@@ -2701,26 +2701,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
2701
2701
|
const coercedKeys = [];
|
|
2702
2702
|
for (const key of keys) {
|
|
2703
2703
|
if (!meta.coercedInputFields.has(key)) {
|
|
2704
|
-
plainKeys.push(ts18.createLiteralTypeNode(ts18.createStringLiteral(key)));
|
|
2704
|
+
plainKeys.push(ts18.factory.createLiteralTypeNode(ts18.factory.createStringLiteral(key)));
|
|
2705
2705
|
} else {
|
|
2706
|
-
coercedKeys.push(ts18.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key)
|
|
2706
|
+
coercedKeys.push(ts18.factory.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key)));
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
2709
|
if (plainKeys.length > 0) {
|
|
2710
|
-
const keyTypeUnion = ts18.createUnionTypeNode(plainKeys);
|
|
2711
|
-
initType = ts18.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2710
|
+
const keyTypeUnion = ts18.factory.createUnionTypeNode(plainKeys);
|
|
2711
|
+
initType = ts18.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
2712
2712
|
}
|
|
2713
2713
|
if (coercedKeys.length > 0) {
|
|
2714
|
-
const coercedLiteral = ts18.createTypeLiteralNode(coercedKeys);
|
|
2715
|
-
initType = initType !== null ? ts18.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2714
|
+
const coercedLiteral = ts18.factory.createTypeLiteralNode(coercedKeys);
|
|
2715
|
+
initType = initType !== null ? ts18.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
2716
2716
|
}
|
|
2717
2717
|
if (initType === null) {
|
|
2718
|
-
initType = ts18.createTypeLiteralNode([]);
|
|
2718
|
+
initType = ts18.factory.createTypeLiteralNode([]);
|
|
2719
2719
|
}
|
|
2720
|
-
return ts18.
|
|
2720
|
+
return ts18.factory.createParameterDeclaration(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
2721
2721
|
}
|
|
2722
2722
|
function generateGenericArgs(params) {
|
|
2723
|
-
return params.map((param) => ts18.createTypeReferenceNode(param.name, void 0));
|
|
2723
|
+
return params.map((param) => ts18.factory.createTypeReferenceNode(param.name, void 0));
|
|
2724
2724
|
}
|
|
2725
2725
|
function requiresInlineTypeCtor(node, host, env) {
|
|
2726
2726
|
return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
|
|
@@ -2731,7 +2731,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
return params.map((param) => {
|
|
2733
2733
|
if (param.default === void 0) {
|
|
2734
|
-
return ts18.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
2734
|
+
return ts18.factory.updateTypeParameterDeclaration(param, param.name, param.constraint, ts18.factory.createKeywordTypeNode(ts18.SyntaxKind.AnyKeyword));
|
|
2735
2735
|
} else {
|
|
2736
2736
|
return param;
|
|
2737
2737
|
}
|
|
@@ -2763,7 +2763,7 @@ var Environment = class {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
if (requiresInlineTypeCtor(node, this.reflector, this)) {
|
|
2765
2765
|
const ref = this.reference(dirRef);
|
|
2766
|
-
const typeCtorExpr = ts19.
|
|
2766
|
+
const typeCtorExpr = ts19.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
|
|
2767
2767
|
this.typeCtors.set(node, typeCtorExpr);
|
|
2768
2768
|
return typeCtorExpr;
|
|
2769
2769
|
} else {
|
|
@@ -2785,7 +2785,7 @@ var Environment = class {
|
|
|
2785
2785
|
const typeParams = this.emitTypeParameters(node);
|
|
2786
2786
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams);
|
|
2787
2787
|
this.typeCtorStatements.push(typeCtor);
|
|
2788
|
-
const fnId = ts19.createIdentifier(fnName);
|
|
2788
|
+
const fnId = ts19.factory.createIdentifier(fnName);
|
|
2789
2789
|
this.typeCtors.set(node, fnId);
|
|
2790
2790
|
return fnId;
|
|
2791
2791
|
}
|
|
@@ -2795,7 +2795,7 @@ var Environment = class {
|
|
|
2795
2795
|
return this.pipeInsts.get(ref.node);
|
|
2796
2796
|
}
|
|
2797
2797
|
const pipeType = this.referenceType(ref);
|
|
2798
|
-
const pipeInstId = ts19.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2798
|
+
const pipeInstId = ts19.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
2799
2799
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
2800
2800
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
2801
2801
|
return pipeInstId;
|
|
@@ -2988,10 +2988,10 @@ import ts24 from "typescript";
|
|
|
2988
2988
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
2989
2989
|
import ts22 from "typescript";
|
|
2990
2990
|
function wrapForDiagnostics(expr) {
|
|
2991
|
-
return ts22.
|
|
2991
|
+
return ts22.factory.createParenthesizedExpression(expr);
|
|
2992
2992
|
}
|
|
2993
2993
|
function wrapForTypeChecker(expr) {
|
|
2994
|
-
return ts22.
|
|
2994
|
+
return ts22.factory.createParenthesizedExpression(expr);
|
|
2995
2995
|
}
|
|
2996
2996
|
function addParseSpanInfo(node, span) {
|
|
2997
2997
|
let commentText;
|
|
@@ -3033,8 +3033,8 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
3033
3033
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
3034
3034
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
3035
3035
|
import ts23 from "typescript";
|
|
3036
|
-
var NULL_AS_ANY = ts23.createAsExpression(ts23.createNull(), ts23.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3037
|
-
var UNDEFINED = ts23.createIdentifier("undefined");
|
|
3036
|
+
var NULL_AS_ANY = ts23.factory.createAsExpression(ts23.factory.createNull(), ts23.factory.createKeywordTypeNode(ts23.SyntaxKind.AnyKeyword));
|
|
3037
|
+
var UNDEFINED = ts23.factory.createIdentifier("undefined");
|
|
3038
3038
|
var UNARY_OPS = /* @__PURE__ */ new Map([
|
|
3039
3039
|
["+", ts23.SyntaxKind.PlusToken],
|
|
3040
3040
|
["-", ts23.SyntaxKind.MinusToken]
|
|
@@ -3089,7 +3089,7 @@ var AstTranslator = class {
|
|
|
3089
3089
|
if (op === void 0) {
|
|
3090
3090
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
3091
3091
|
}
|
|
3092
|
-
const node = wrapForDiagnostics(ts23.
|
|
3092
|
+
const node = wrapForDiagnostics(ts23.factory.createPrefixUnaryExpression(op, expr));
|
|
3093
3093
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3094
3094
|
return node;
|
|
3095
3095
|
}
|
|
@@ -3100,13 +3100,13 @@ var AstTranslator = class {
|
|
|
3100
3100
|
if (op === void 0) {
|
|
3101
3101
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
3102
3102
|
}
|
|
3103
|
-
const node = ts23.
|
|
3103
|
+
const node = ts23.factory.createBinaryExpression(lhs, op, rhs);
|
|
3104
3104
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3105
3105
|
return node;
|
|
3106
3106
|
}
|
|
3107
3107
|
visitChain(ast) {
|
|
3108
3108
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3109
|
-
const node = wrapForDiagnostics(ts23.
|
|
3109
|
+
const node = wrapForDiagnostics(ts23.factory.createCommaListExpression(elements));
|
|
3110
3110
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3111
3111
|
return node;
|
|
3112
3112
|
}
|
|
@@ -3114,7 +3114,7 @@ var AstTranslator = class {
|
|
|
3114
3114
|
const condExpr = this.translate(ast.condition);
|
|
3115
3115
|
const trueExpr = this.translate(ast.trueExp);
|
|
3116
3116
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
3117
|
-
const node = ts23.
|
|
3117
|
+
const node = ts23.factory.createParenthesizedExpression(ts23.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
|
|
3118
3118
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3119
3119
|
return node;
|
|
3120
3120
|
}
|
|
@@ -3125,26 +3125,26 @@ var AstTranslator = class {
|
|
|
3125
3125
|
throw new Error("Method not implemented.");
|
|
3126
3126
|
}
|
|
3127
3127
|
visitInterpolation(ast) {
|
|
3128
|
-
return ast.expressions.reduce((lhs, ast2) => ts23.
|
|
3128
|
+
return ast.expressions.reduce((lhs, ast2) => ts23.factory.createBinaryExpression(lhs, ts23.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts23.factory.createStringLiteral(""));
|
|
3129
3129
|
}
|
|
3130
3130
|
visitKeyedRead(ast) {
|
|
3131
3131
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3132
3132
|
const key = this.translate(ast.key);
|
|
3133
|
-
const node = ts23.
|
|
3133
|
+
const node = ts23.factory.createElementAccessExpression(receiver, key);
|
|
3134
3134
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3135
3135
|
return node;
|
|
3136
3136
|
}
|
|
3137
3137
|
visitKeyedWrite(ast) {
|
|
3138
3138
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3139
|
-
const left = ts23.
|
|
3139
|
+
const left = ts23.factory.createElementAccessExpression(receiver, this.translate(ast.key));
|
|
3140
3140
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3141
|
-
const node = wrapForDiagnostics(ts23.
|
|
3141
|
+
const node = wrapForDiagnostics(ts23.factory.createBinaryExpression(left, ts23.SyntaxKind.EqualsToken, right));
|
|
3142
3142
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3143
3143
|
return node;
|
|
3144
3144
|
}
|
|
3145
3145
|
visitLiteralArray(ast) {
|
|
3146
3146
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
3147
|
-
const literal = ts23.
|
|
3147
|
+
const literal = ts23.factory.createArrayLiteralExpression(elements);
|
|
3148
3148
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3149
3149
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3150
3150
|
return node;
|
|
@@ -3152,9 +3152,9 @@ var AstTranslator = class {
|
|
|
3152
3152
|
visitLiteralMap(ast) {
|
|
3153
3153
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
3154
3154
|
const value = this.translate(ast.values[idx]);
|
|
3155
|
-
return ts23.createPropertyAssignment(ts23.createStringLiteral(key), value);
|
|
3155
|
+
return ts23.factory.createPropertyAssignment(ts23.factory.createStringLiteral(key), value);
|
|
3156
3156
|
});
|
|
3157
|
-
const literal = ts23.
|
|
3157
|
+
const literal = ts23.factory.createObjectLiteralExpression(properties, true);
|
|
3158
3158
|
const node = this.config.strictLiteralTypes ? literal : tsCastToAny(literal);
|
|
3159
3159
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3160
3160
|
return node;
|
|
@@ -3162,18 +3162,24 @@ var AstTranslator = class {
|
|
|
3162
3162
|
visitLiteralPrimitive(ast) {
|
|
3163
3163
|
let node;
|
|
3164
3164
|
if (ast.value === void 0) {
|
|
3165
|
-
node = ts23.createIdentifier("undefined");
|
|
3165
|
+
node = ts23.factory.createIdentifier("undefined");
|
|
3166
3166
|
} else if (ast.value === null) {
|
|
3167
|
-
node = ts23.createNull();
|
|
3167
|
+
node = ts23.factory.createNull();
|
|
3168
|
+
} else if (typeof ast.value === "string") {
|
|
3169
|
+
node = ts23.factory.createStringLiteral(ast.value);
|
|
3170
|
+
} else if (typeof ast.value === "number") {
|
|
3171
|
+
node = ts23.factory.createNumericLiteral(ast.value);
|
|
3172
|
+
} else if (typeof ast.value === "boolean") {
|
|
3173
|
+
node = ast.value ? ts23.factory.createTrue() : ts23.factory.createFalse();
|
|
3168
3174
|
} else {
|
|
3169
|
-
|
|
3175
|
+
throw Error(`Unsupported AST value of type ${typeof ast.value}`);
|
|
3170
3176
|
}
|
|
3171
3177
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3172
3178
|
return node;
|
|
3173
3179
|
}
|
|
3174
3180
|
visitNonNullAssert(ast) {
|
|
3175
3181
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
3176
|
-
const node = ts23.createNonNullExpression(expr);
|
|
3182
|
+
const node = ts23.factory.createNonNullExpression(expr);
|
|
3177
3183
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3178
3184
|
return node;
|
|
3179
3185
|
}
|
|
@@ -3182,13 +3188,13 @@ var AstTranslator = class {
|
|
|
3182
3188
|
}
|
|
3183
3189
|
visitPrefixNot(ast) {
|
|
3184
3190
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
3185
|
-
const node = ts23.createLogicalNot(expression);
|
|
3191
|
+
const node = ts23.factory.createLogicalNot(expression);
|
|
3186
3192
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3187
3193
|
return node;
|
|
3188
3194
|
}
|
|
3189
3195
|
visitPropertyRead(ast) {
|
|
3190
3196
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3191
|
-
const name = ts23.
|
|
3197
|
+
const name = ts23.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3192
3198
|
addParseSpanInfo(name, ast.nameSpan);
|
|
3193
3199
|
const node = wrapForDiagnostics(name);
|
|
3194
3200
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -3196,12 +3202,12 @@ var AstTranslator = class {
|
|
|
3196
3202
|
}
|
|
3197
3203
|
visitPropertyWrite(ast) {
|
|
3198
3204
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3199
|
-
const left = ts23.
|
|
3205
|
+
const left = ts23.factory.createPropertyAccessExpression(receiver, ast.name);
|
|
3200
3206
|
addParseSpanInfo(left, ast.nameSpan);
|
|
3201
3207
|
const leftWithPath = wrapForDiagnostics(left);
|
|
3202
3208
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
3203
3209
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
3204
|
-
const node = wrapForDiagnostics(ts23.
|
|
3210
|
+
const node = wrapForDiagnostics(ts23.factory.createBinaryExpression(leftWithPath, ts23.SyntaxKind.EqualsToken, right));
|
|
3205
3211
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3206
3212
|
return node;
|
|
3207
3213
|
}
|
|
@@ -3209,13 +3215,13 @@ var AstTranslator = class {
|
|
|
3209
3215
|
let node;
|
|
3210
3216
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
3211
3217
|
if (this.config.strictSafeNavigationTypes) {
|
|
3212
|
-
const expr = ts23.
|
|
3218
|
+
const expr = ts23.factory.createPropertyAccessExpression(ts23.factory.createNonNullExpression(receiver), ast.name);
|
|
3213
3219
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3214
|
-
node = ts23.
|
|
3220
|
+
node = ts23.factory.createParenthesizedExpression(ts23.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3215
3221
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3216
|
-
node = ts23.
|
|
3222
|
+
node = ts23.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
|
|
3217
3223
|
} else {
|
|
3218
|
-
const expr = ts23.
|
|
3224
|
+
const expr = ts23.factory.createPropertyAccessExpression(ts23.factory.createNonNullExpression(receiver), ast.name);
|
|
3219
3225
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
3220
3226
|
node = tsCastToAny(expr);
|
|
3221
3227
|
}
|
|
@@ -3227,13 +3233,13 @@ var AstTranslator = class {
|
|
|
3227
3233
|
const key = this.translate(ast.key);
|
|
3228
3234
|
let node;
|
|
3229
3235
|
if (this.config.strictSafeNavigationTypes) {
|
|
3230
|
-
const expr = ts23.
|
|
3236
|
+
const expr = ts23.factory.createElementAccessExpression(ts23.factory.createNonNullExpression(receiver), key);
|
|
3231
3237
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3232
|
-
node = ts23.
|
|
3238
|
+
node = ts23.factory.createParenthesizedExpression(ts23.factory.createConditionalExpression(NULL_AS_ANY, void 0, expr, void 0, UNDEFINED));
|
|
3233
3239
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3234
|
-
node = ts23.
|
|
3240
|
+
node = ts23.factory.createElementAccessExpression(tsCastToAny(receiver), key);
|
|
3235
3241
|
} else {
|
|
3236
|
-
const expr = ts23.
|
|
3242
|
+
const expr = ts23.factory.createElementAccessExpression(ts23.factory.createNonNullExpression(receiver), key);
|
|
3237
3243
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
3238
3244
|
node = tsCastToAny(expr);
|
|
3239
3245
|
}
|
|
@@ -3250,7 +3256,7 @@ var AstTranslator = class {
|
|
|
3250
3256
|
expr = resolved;
|
|
3251
3257
|
} else {
|
|
3252
3258
|
const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
|
|
3253
|
-
expr = ts23.
|
|
3259
|
+
expr = ts23.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
|
|
3254
3260
|
addParseSpanInfo(expr, receiver.nameSpan);
|
|
3255
3261
|
}
|
|
3256
3262
|
} else {
|
|
@@ -3260,7 +3266,7 @@ var AstTranslator = class {
|
|
|
3260
3266
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
3261
3267
|
node = this.convertToSafeCall(ast, expr, args);
|
|
3262
3268
|
} else {
|
|
3263
|
-
node = ts23.
|
|
3269
|
+
node = ts23.factory.createCallExpression(expr, void 0, args);
|
|
3264
3270
|
}
|
|
3265
3271
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
3266
3272
|
return node;
|
|
@@ -3274,13 +3280,13 @@ var AstTranslator = class {
|
|
|
3274
3280
|
}
|
|
3275
3281
|
convertToSafeCall(ast, expr, args) {
|
|
3276
3282
|
if (this.config.strictSafeNavigationTypes) {
|
|
3277
|
-
const call = ts23.
|
|
3278
|
-
return ts23.
|
|
3283
|
+
const call = ts23.factory.createCallExpression(ts23.factory.createNonNullExpression(expr), void 0, args);
|
|
3284
|
+
return ts23.factory.createParenthesizedExpression(ts23.factory.createConditionalExpression(NULL_AS_ANY, void 0, call, void 0, UNDEFINED));
|
|
3279
3285
|
}
|
|
3280
3286
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
3281
|
-
return ts23.
|
|
3287
|
+
return ts23.factory.createCallExpression(tsCastToAny(expr), void 0, args);
|
|
3282
3288
|
}
|
|
3283
|
-
return tsCastToAny(ts23.
|
|
3289
|
+
return tsCastToAny(ts23.factory.createCallExpression(ts23.factory.createNonNullExpression(expr), void 0, args));
|
|
3284
3290
|
}
|
|
3285
3291
|
};
|
|
3286
3292
|
var VeSafeLhsInferenceBugDetector = class {
|
|
@@ -3414,12 +3420,12 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
3414
3420
|
}
|
|
3415
3421
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
3416
3422
|
const scopeStatements = scope.render();
|
|
3417
|
-
const innerBody = ts24.createBlock([
|
|
3423
|
+
const innerBody = ts24.factory.createBlock([
|
|
3418
3424
|
...env.getPreludeStatements(),
|
|
3419
3425
|
...scopeStatements
|
|
3420
3426
|
]);
|
|
3421
|
-
const body = ts24.createBlock([ts24.
|
|
3422
|
-
const fnDecl = ts24.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3427
|
+
const body = ts24.factory.createBlock([ts24.factory.createIfStatement(ts24.factory.createTrue(), innerBody, void 0)]);
|
|
3428
|
+
const fnDecl = ts24.factory.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
3423
3429
|
addTemplateId(fnDecl, meta.id);
|
|
3424
3430
|
return fnDecl;
|
|
3425
3431
|
}
|
|
@@ -3460,7 +3466,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
3460
3466
|
execute() {
|
|
3461
3467
|
const ctx = this.scope.resolve(this.template);
|
|
3462
3468
|
const id = this.tcb.allocateId();
|
|
3463
|
-
const initializer = ts24.
|
|
3469
|
+
const initializer = ts24.factory.createPropertyAccessExpression(ctx, this.variable.value || "$implicit");
|
|
3464
3470
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
3465
3471
|
let variable;
|
|
3466
3472
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -3483,7 +3489,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
3483
3489
|
}
|
|
3484
3490
|
execute() {
|
|
3485
3491
|
const ctx = this.tcb.allocateId();
|
|
3486
|
-
const type = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3492
|
+
const type = ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
3487
3493
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
3488
3494
|
return ctx;
|
|
3489
3495
|
}
|
|
@@ -3536,16 +3542,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
3536
3542
|
}
|
|
3537
3543
|
let guard = null;
|
|
3538
3544
|
if (directiveGuards.length > 0) {
|
|
3539
|
-
guard = directiveGuards.reduce((expr, dirGuard) => ts24.
|
|
3545
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts24.factory.createBinaryExpression(expr, ts24.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
3540
3546
|
}
|
|
3541
3547
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
3542
3548
|
const statements = tmplScope.render();
|
|
3543
3549
|
if (statements.length === 0) {
|
|
3544
3550
|
return null;
|
|
3545
3551
|
}
|
|
3546
|
-
let tmplBlock = ts24.createBlock(statements);
|
|
3552
|
+
let tmplBlock = ts24.factory.createBlock(statements);
|
|
3547
3553
|
if (guard !== null) {
|
|
3548
|
-
tmplBlock = ts24.
|
|
3554
|
+
tmplBlock = ts24.factory.createIfStatement(guard, tmplBlock);
|
|
3549
3555
|
}
|
|
3550
3556
|
this.scope.addStatement(tmplBlock);
|
|
3551
3557
|
return null;
|
|
@@ -3563,7 +3569,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
3563
3569
|
}
|
|
3564
3570
|
execute() {
|
|
3565
3571
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
3566
|
-
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3572
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(expr));
|
|
3567
3573
|
return null;
|
|
3568
3574
|
}
|
|
3569
3575
|
};
|
|
@@ -3630,11 +3636,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
3630
3636
|
const id = this.tcb.allocateId();
|
|
3631
3637
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
3632
3638
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
3633
|
-
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3639
|
+
initializer = ts24.factory.createAsExpression(initializer, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3634
3640
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
3635
|
-
initializer = ts24.createAsExpression(initializer, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3636
|
-
initializer = ts24.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3637
|
-
initializer = ts24.
|
|
3641
|
+
initializer = ts24.factory.createAsExpression(initializer, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
3642
|
+
initializer = ts24.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
3643
|
+
initializer = ts24.factory.createParenthesizedExpression(initializer);
|
|
3638
3644
|
}
|
|
3639
3645
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
3640
3646
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -3742,7 +3748,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3742
3748
|
if (!ts24.isTypeReferenceNode(dirTypeRef)) {
|
|
3743
3749
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
3744
3750
|
}
|
|
3745
|
-
const type = ts24.createIndexedAccessTypeNode(ts24.createTypeQueryNode(dirId), ts24.createLiteralTypeNode(ts24.createStringLiteral(fieldName)));
|
|
3751
|
+
const type = ts24.factory.createIndexedAccessTypeNode(ts24.factory.createTypeQueryNode(dirId), ts24.factory.createLiteralTypeNode(ts24.factory.createStringLiteral(fieldName)));
|
|
3746
3752
|
const temp = tsDeclareVariable(id, type);
|
|
3747
3753
|
this.scope.addStatement(temp);
|
|
3748
3754
|
target = id;
|
|
@@ -3750,18 +3756,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
3750
3756
|
if (dirId === null) {
|
|
3751
3757
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3752
3758
|
}
|
|
3753
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.
|
|
3759
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts24.factory.createElementAccessExpression(dirId, ts24.factory.createStringLiteral(fieldName)) : ts24.factory.createPropertyAccessExpression(dirId, ts24.factory.createIdentifier(fieldName));
|
|
3754
3760
|
}
|
|
3755
3761
|
if (input.attribute.keySpan !== void 0) {
|
|
3756
3762
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
3757
3763
|
}
|
|
3758
|
-
assignment = ts24.
|
|
3764
|
+
assignment = ts24.factory.createBinaryExpression(target, ts24.SyntaxKind.EqualsToken, assignment);
|
|
3759
3765
|
}
|
|
3760
3766
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
3761
3767
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
3762
3768
|
markIgnoreDiagnostics(assignment);
|
|
3763
3769
|
}
|
|
3764
|
-
this.scope.addStatement(ts24.createExpressionStatement(assignment));
|
|
3770
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(assignment));
|
|
3765
3771
|
}
|
|
3766
3772
|
return null;
|
|
3767
3773
|
}
|
|
@@ -3780,7 +3786,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
3780
3786
|
execute() {
|
|
3781
3787
|
const id = this.tcb.allocateId();
|
|
3782
3788
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
3783
|
-
const circularPlaceholder = ts24.
|
|
3789
|
+
const circularPlaceholder = ts24.factory.createCallExpression(typeCtor, void 0, [ts24.factory.createNonNullExpression(ts24.factory.createNull())]);
|
|
3784
3790
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
3785
3791
|
return id;
|
|
3786
3792
|
}
|
|
@@ -3846,15 +3852,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
3846
3852
|
elId = this.scope.resolve(this.element);
|
|
3847
3853
|
}
|
|
3848
3854
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
3849
|
-
const prop = ts24.
|
|
3850
|
-
const stmt = ts24.
|
|
3855
|
+
const prop = ts24.factory.createElementAccessExpression(elId, ts24.factory.createStringLiteral(propertyName));
|
|
3856
|
+
const stmt = ts24.factory.createBinaryExpression(prop, ts24.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
3851
3857
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
3852
|
-
this.scope.addStatement(ts24.createExpressionStatement(stmt));
|
|
3858
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(stmt));
|
|
3853
3859
|
} else {
|
|
3854
|
-
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3860
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(expr));
|
|
3855
3861
|
}
|
|
3856
3862
|
} else {
|
|
3857
|
-
this.scope.addStatement(ts24.createExpressionStatement(expr));
|
|
3863
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(expr));
|
|
3858
3864
|
}
|
|
3859
3865
|
}
|
|
3860
3866
|
return null;
|
|
@@ -3886,18 +3892,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
3886
3892
|
if (dirId === null) {
|
|
3887
3893
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
3888
3894
|
}
|
|
3889
|
-
const outputField = ts24.
|
|
3895
|
+
const outputField = ts24.factory.createElementAccessExpression(dirId, ts24.factory.createStringLiteral(field));
|
|
3890
3896
|
addParseSpanInfo(outputField, output.keySpan);
|
|
3891
3897
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
3892
3898
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3893
|
-
const subscribeFn = ts24.
|
|
3894
|
-
const call = ts24.
|
|
3899
|
+
const subscribeFn = ts24.factory.createPropertyAccessExpression(outputField, "subscribe");
|
|
3900
|
+
const call = ts24.factory.createCallExpression(subscribeFn, void 0, [handler]);
|
|
3895
3901
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3896
|
-
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
3902
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(call));
|
|
3897
3903
|
} else {
|
|
3898
|
-
this.scope.addStatement(ts24.createExpressionStatement(outputField));
|
|
3904
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(outputField));
|
|
3899
3905
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3900
|
-
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
3906
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(handler));
|
|
3901
3907
|
}
|
|
3902
3908
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3903
3909
|
}
|
|
@@ -3930,20 +3936,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
3930
3936
|
if (output.type === 1) {
|
|
3931
3937
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
3932
3938
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
3933
|
-
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
3939
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(handler));
|
|
3934
3940
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
3935
3941
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
3936
3942
|
if (elId === null) {
|
|
3937
3943
|
elId = this.scope.resolve(this.element);
|
|
3938
3944
|
}
|
|
3939
|
-
const propertyAccess = ts24.
|
|
3945
|
+
const propertyAccess = ts24.factory.createPropertyAccessExpression(elId, "addEventListener");
|
|
3940
3946
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
3941
|
-
const call = ts24.
|
|
3947
|
+
const call = ts24.factory.createCallExpression(propertyAccess, void 0, [ts24.factory.createStringLiteral(output.name), handler]);
|
|
3942
3948
|
addParseSpanInfo(call, output.sourceSpan);
|
|
3943
|
-
this.scope.addStatement(ts24.createExpressionStatement(call));
|
|
3949
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(call));
|
|
3944
3950
|
} else {
|
|
3945
3951
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
3946
|
-
this.scope.addStatement(ts24.createExpressionStatement(handler));
|
|
3952
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(handler));
|
|
3947
3953
|
}
|
|
3948
3954
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
3949
3955
|
}
|
|
@@ -3957,15 +3963,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
3957
3963
|
this.optional = false;
|
|
3958
3964
|
}
|
|
3959
3965
|
execute() {
|
|
3960
|
-
const ctx = ts24.createIdentifier("ctx");
|
|
3961
|
-
const ctxDot = ts24.
|
|
3966
|
+
const ctx = ts24.factory.createIdentifier("ctx");
|
|
3967
|
+
const ctxDot = ts24.factory.createPropertyAccessExpression(ctx, "");
|
|
3962
3968
|
markIgnoreDiagnostics(ctxDot);
|
|
3963
3969
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
3964
|
-
this.scope.addStatement(ts24.createExpressionStatement(ctxDot));
|
|
3970
|
+
this.scope.addStatement(ts24.factory.createExpressionStatement(ctxDot));
|
|
3965
3971
|
return null;
|
|
3966
3972
|
}
|
|
3967
3973
|
};
|
|
3968
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.createNonNullExpression(ts24.createNull());
|
|
3974
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts24.factory.createNonNullExpression(ts24.factory.createNull());
|
|
3969
3975
|
var Context = class {
|
|
3970
3976
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
3971
3977
|
this.env = env;
|
|
@@ -3978,7 +3984,7 @@ var Context = class {
|
|
|
3978
3984
|
this.nextId = 1;
|
|
3979
3985
|
}
|
|
3980
3986
|
allocateId() {
|
|
3981
|
-
return ts24.createIdentifier(`_t${this.nextId++}`);
|
|
3987
|
+
return ts24.factory.createIdentifier(`_t${this.nextId++}`);
|
|
3982
3988
|
}
|
|
3983
3989
|
getPipeByName(name) {
|
|
3984
3990
|
if (!this.pipes.has(name)) {
|
|
@@ -4059,7 +4065,7 @@ var Scope = class {
|
|
|
4059
4065
|
} else if (parentGuards === null) {
|
|
4060
4066
|
return this.guard;
|
|
4061
4067
|
} else {
|
|
4062
|
-
return ts24.
|
|
4068
|
+
return ts24.factory.createBinaryExpression(parentGuards, ts24.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
4063
4069
|
}
|
|
4064
4070
|
}
|
|
4065
4071
|
resolveLocal(ref, directive) {
|
|
@@ -4263,11 +4269,11 @@ var TcbExpressionTranslator = class {
|
|
|
4263
4269
|
return null;
|
|
4264
4270
|
}
|
|
4265
4271
|
const expr = this.translate(ast.value);
|
|
4266
|
-
const result = ts24.
|
|
4272
|
+
const result = ts24.factory.createParenthesizedExpression(ts24.factory.createBinaryExpression(target, ts24.SyntaxKind.EqualsToken, expr));
|
|
4267
4273
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4268
4274
|
return result;
|
|
4269
4275
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
4270
|
-
return ts24.createIdentifier("ctx");
|
|
4276
|
+
return ts24.factory.createIdentifier("ctx");
|
|
4271
4277
|
} else if (ast instanceof BindingPipe) {
|
|
4272
4278
|
const expr = this.translate(ast.exp);
|
|
4273
4279
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -4284,14 +4290,14 @@ var TcbExpressionTranslator = class {
|
|
|
4284
4290
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
4285
4291
|
methodAccess = ts24.factory.createAsExpression(methodAccess, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4286
4292
|
}
|
|
4287
|
-
const result = ts24.
|
|
4293
|
+
const result = ts24.factory.createCallExpression(methodAccess, void 0, [expr, ...args]);
|
|
4288
4294
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4289
4295
|
return result;
|
|
4290
4296
|
} else if ((ast instanceof Call2 || ast instanceof SafeCall) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
|
|
4291
4297
|
if (ast.receiver.receiver instanceof ImplicitReceiver4 && !(ast.receiver.receiver instanceof ThisReceiver) && ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
4292
4298
|
const expr = this.translate(ast.args[0]);
|
|
4293
|
-
const exprAsAny = ts24.createAsExpression(expr, ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4294
|
-
const result = ts24.
|
|
4299
|
+
const exprAsAny = ts24.factory.createAsExpression(expr, ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword));
|
|
4300
|
+
const result = ts24.factory.createParenthesizedExpression(exprAsAny);
|
|
4295
4301
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
4296
4302
|
return result;
|
|
4297
4303
|
}
|
|
@@ -4302,7 +4308,7 @@ var TcbExpressionTranslator = class {
|
|
|
4302
4308
|
const method = wrapForDiagnostics(receiver);
|
|
4303
4309
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
4304
4310
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
4305
|
-
const node = ts24.
|
|
4311
|
+
const node = ts24.factory.createCallExpression(method, void 0, args);
|
|
4306
4312
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
4307
4313
|
return node;
|
|
4308
4314
|
} else {
|
|
@@ -4322,17 +4328,17 @@ var TcbExpressionTranslator = class {
|
|
|
4322
4328
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
4323
4329
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
4324
4330
|
const members = inputs.map((input) => {
|
|
4325
|
-
const propertyName = ts24.createStringLiteral(input.field);
|
|
4331
|
+
const propertyName = ts24.factory.createStringLiteral(input.field);
|
|
4326
4332
|
if (input.type === "binding") {
|
|
4327
4333
|
const expr = widenBinding(input.expression, tcb);
|
|
4328
|
-
const assignment = ts24.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4334
|
+
const assignment = ts24.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
4329
4335
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
4330
4336
|
return assignment;
|
|
4331
4337
|
} else {
|
|
4332
|
-
return ts24.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4338
|
+
return ts24.factory.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
4333
4339
|
}
|
|
4334
4340
|
});
|
|
4335
|
-
return ts24.
|
|
4341
|
+
return ts24.factory.createCallExpression(typeCtor, void 0, [ts24.factory.createObjectLiteralExpression(members)]);
|
|
4336
4342
|
}
|
|
4337
4343
|
function getBoundInputs(directive, node, tcb) {
|
|
4338
4344
|
const boundInputs = [];
|
|
@@ -4358,7 +4364,7 @@ function translateInput(attr, tcb, scope) {
|
|
|
4358
4364
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
4359
4365
|
return tcbExpression(attr.value, tcb, scope);
|
|
4360
4366
|
} else {
|
|
4361
|
-
return ts24.createStringLiteral(attr.value);
|
|
4367
|
+
return ts24.factory.createStringLiteral(attr.value);
|
|
4362
4368
|
}
|
|
4363
4369
|
}
|
|
4364
4370
|
function widenBinding(expr, tcb) {
|
|
@@ -4368,7 +4374,7 @@ function widenBinding(expr, tcb) {
|
|
|
4368
4374
|
if (ts24.isObjectLiteralExpression(expr) || ts24.isArrayLiteralExpression(expr)) {
|
|
4369
4375
|
return expr;
|
|
4370
4376
|
} else {
|
|
4371
|
-
return ts24.createNonNullExpression(expr);
|
|
4377
|
+
return ts24.factory.createNonNullExpression(expr);
|
|
4372
4378
|
}
|
|
4373
4379
|
} else {
|
|
4374
4380
|
return expr;
|
|
@@ -4381,18 +4387,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
4381
4387
|
if (eventType === 0) {
|
|
4382
4388
|
eventParamType = void 0;
|
|
4383
4389
|
} else if (eventType === 1) {
|
|
4384
|
-
eventParamType = ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4390
|
+
eventParamType = ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword);
|
|
4385
4391
|
} else {
|
|
4386
4392
|
eventParamType = eventType;
|
|
4387
4393
|
}
|
|
4388
4394
|
const guards = scope.guards();
|
|
4389
|
-
let body = ts24.createExpressionStatement(handler);
|
|
4395
|
+
let body = ts24.factory.createExpressionStatement(handler);
|
|
4390
4396
|
if (guards !== null) {
|
|
4391
|
-
body = ts24.
|
|
4397
|
+
body = ts24.factory.createIfStatement(guards, body);
|
|
4392
4398
|
}
|
|
4393
|
-
const eventParam = ts24.
|
|
4399
|
+
const eventParam = ts24.factory.createParameterDeclaration(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
4394
4400
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
4395
|
-
return ts24.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.createBlock([body]));
|
|
4401
|
+
return ts24.factory.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts24.factory.createKeywordTypeNode(ts24.SyntaxKind.AnyKeyword), ts24.factory.createBlock([body]));
|
|
4396
4402
|
}
|
|
4397
4403
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
4398
4404
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -4420,7 +4426,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
4420
4426
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
4421
4427
|
resolve(ast) {
|
|
4422
4428
|
if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
4423
|
-
const event = ts24.createIdentifier(EVENT_PARAMETER);
|
|
4429
|
+
const event = ts24.factory.createIdentifier(EVENT_PARAMETER);
|
|
4424
4430
|
addParseSpanInfo(event, ast.nameSpan);
|
|
4425
4431
|
return event;
|
|
4426
4432
|
}
|
|
@@ -4438,7 +4444,7 @@ var TypeCheckFile = class extends Environment {
|
|
|
4438
4444
|
this.tcbStatements = [];
|
|
4439
4445
|
}
|
|
4440
4446
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
4441
|
-
const fnId = ts25.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4447
|
+
const fnId = ts25.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
4442
4448
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
4443
4449
|
this.tcbStatements.push(fn);
|
|
4444
4450
|
}
|
|
@@ -4661,7 +4667,7 @@ var InlineTcbOp = class {
|
|
|
4661
4667
|
}
|
|
4662
4668
|
execute(im, sf, refEmitter, printer) {
|
|
4663
4669
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
4664
|
-
const fnName = ts26.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4670
|
+
const fnName = ts26.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
4665
4671
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
4666
4672
|
return printer.printNode(ts26.EmitHint.Unspecified, fn, sf);
|
|
4667
4673
|
}
|
|
@@ -7225,4 +7231,4 @@ export {
|
|
|
7225
7231
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7226
7232
|
* found in the LICENSE file at https://angular.io/license
|
|
7227
7233
|
*/
|
|
7228
|
-
//# sourceMappingURL=chunk-
|
|
7234
|
+
//# sourceMappingURL=chunk-KMCI52ED.js.map
|