@angular/compiler-cli 13.0.2 → 13.0.3
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/index.js +628 -673
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/linker/index.js.map +1 -1
- package/bundles/ngcc/index.js +886 -868
- package/bundles/ngcc/index.js.map +2 -2
- package/bundles/ngcc/main-ngcc.js +886 -868
- package/bundles/ngcc/main-ngcc.js.map +2 -2
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +518 -500
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +2 -2
- package/bundles/private/migrations.js +20 -0
- package/bundles/private/migrations.js.map +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/private/tooling.js.map +1 -1
- package/bundles/src/bin/ng_xi18n.js +638 -683
- package/bundles/src/bin/ng_xi18n.js.map +2 -2
- package/bundles/src/bin/ngc.js +638 -683
- package/bundles/src/bin/ngc.js.map +2 -2
- package/bundles_metadata.json +1 -1
- package/ngcc/src/host/delegating_host.d.ts +1 -2
- package/ngcc/src/host/esm2015_host.d.ts +1 -8
- package/ngcc/src/host/ngcc_host.d.ts +0 -13
- package/ngcc/src/host/umd_host.d.ts +3 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/esm_rendering_formatter.d.ts +1 -5
- package/ngcc/src/rendering/renderer.d.ts +2 -3
- package/ngcc/src/rendering/rendering_formatter.d.ts +0 -2
- package/ngcc/src/utils.d.ts +0 -7
- package/package.json +2 -2
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +5 -0
- package/ngcc/src/analysis/switch_marker_analyzer.d.ts +0 -35
- package/src/ngtsc/switch/index.d.ts +0 -9
- package/src/ngtsc/switch/src/switch.d.ts +0 -10
package/bundles/index.js
CHANGED
|
@@ -446,7 +446,7 @@ import { StaticReflector, StaticSymbol } from "@angular/compiler";
|
|
|
446
446
|
|
|
447
447
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
448
448
|
import { Version } from "@angular/compiler";
|
|
449
|
-
var VERSION = new Version("13.0.
|
|
449
|
+
var VERSION = new Version("13.0.3");
|
|
450
450
|
|
|
451
451
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/metadata/collector.mjs
|
|
452
452
|
import ts4 from "typescript";
|
|
@@ -3082,12 +3082,12 @@ import {
|
|
|
3082
3082
|
readFileSync as readFileSync2
|
|
3083
3083
|
} from "fs";
|
|
3084
3084
|
import * as path6 from "path";
|
|
3085
|
-
import
|
|
3085
|
+
import ts84 from "typescript";
|
|
3086
3086
|
|
|
3087
3087
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/translate_diagnostics.mjs
|
|
3088
3088
|
import ts9 from "typescript";
|
|
3089
3089
|
function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
3090
|
-
const
|
|
3090
|
+
const ts86 = [];
|
|
3091
3091
|
const ng2 = [];
|
|
3092
3092
|
untranslatedDiagnostics.forEach((diagnostic) => {
|
|
3093
3093
|
if (diagnostic.file && diagnostic.start && GENERATED_FILES.test(diagnostic.file.fileName)) {
|
|
@@ -3106,10 +3106,10 @@ function translateDiagnostics(host, untranslatedDiagnostics) {
|
|
|
3106
3106
|
});
|
|
3107
3107
|
}
|
|
3108
3108
|
} else {
|
|
3109
|
-
|
|
3109
|
+
ts86.push(diagnostic);
|
|
3110
3110
|
}
|
|
3111
3111
|
});
|
|
3112
|
-
return { ts:
|
|
3112
|
+
return { ts: ts86, ng: ng2 };
|
|
3113
3113
|
}
|
|
3114
3114
|
function sourceSpanOf(host, source, start) {
|
|
3115
3115
|
const { line, character } = ts9.getLineAndCharacterOfPosition(source, start);
|
|
@@ -3120,7 +3120,7 @@ function diagnosticMessageToString(message) {
|
|
|
3120
3120
|
}
|
|
3121
3121
|
|
|
3122
3122
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
3123
|
-
import
|
|
3123
|
+
import ts72 from "typescript";
|
|
3124
3124
|
|
|
3125
3125
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
|
|
3126
3126
|
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DomElementSchemaRegistry, ExternalExpr as ExternalExpr7, FactoryTarget as FactoryTarget3, InterpolationConfig, makeBindingParser as makeBindingParser2, ParseSourceFile as ParseSourceFile2, parseTemplate, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
|
|
@@ -5464,6 +5464,24 @@ var ArrayConcatBuiltinFn = class extends KnownFn {
|
|
|
5464
5464
|
return result;
|
|
5465
5465
|
}
|
|
5466
5466
|
};
|
|
5467
|
+
var StringConcatBuiltinFn = class extends KnownFn {
|
|
5468
|
+
constructor(lhs) {
|
|
5469
|
+
super();
|
|
5470
|
+
this.lhs = lhs;
|
|
5471
|
+
}
|
|
5472
|
+
evaluate(node, args) {
|
|
5473
|
+
let result = this.lhs;
|
|
5474
|
+
for (const arg of args) {
|
|
5475
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
5476
|
+
if (typeof resolved === "string" || typeof resolved === "number" || typeof resolved === "boolean" || resolved == null) {
|
|
5477
|
+
result = result.concat(resolved);
|
|
5478
|
+
} else {
|
|
5479
|
+
return DynamicValue.fromUnknown(node);
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
return result;
|
|
5483
|
+
}
|
|
5484
|
+
};
|
|
5467
5485
|
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
5468
5486
|
evaluate(node, args) {
|
|
5469
5487
|
if (args.length === 0) {
|
|
@@ -5853,6 +5871,8 @@ var StaticInterpreter = class {
|
|
|
5853
5871
|
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
5854
5872
|
}
|
|
5855
5873
|
return lhs[rhs];
|
|
5874
|
+
} else if (typeof lhs === "string" && rhs === "concat") {
|
|
5875
|
+
return new StringConcatBuiltinFn(lhs);
|
|
5856
5876
|
} else if (lhs instanceof Reference) {
|
|
5857
5877
|
const ref = lhs.node;
|
|
5858
5878
|
if (this.host.isClass(ref)) {
|
|
@@ -12738,70 +12758,6 @@ var TypeCheckScopeRegistry = class {
|
|
|
12738
12758
|
}
|
|
12739
12759
|
};
|
|
12740
12760
|
|
|
12741
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/switch/src/switch.mjs
|
|
12742
|
-
import ts52 from "typescript";
|
|
12743
|
-
var IVY_SWITCH_PRE_SUFFIX = "__PRE_R3__";
|
|
12744
|
-
var IVY_SWITCH_POST_SUFFIX = "__POST_R3__";
|
|
12745
|
-
function ivySwitchTransform(_) {
|
|
12746
|
-
return flipIvySwitchInFile;
|
|
12747
|
-
}
|
|
12748
|
-
function flipIvySwitchInFile(sf) {
|
|
12749
|
-
let newStatements = void 0;
|
|
12750
|
-
for (let i = 0; i < sf.statements.length; i++) {
|
|
12751
|
-
const statement = sf.statements[i];
|
|
12752
|
-
if (!ts52.isVariableStatement(statement) || !hasIvySwitches(statement)) {
|
|
12753
|
-
continue;
|
|
12754
|
-
}
|
|
12755
|
-
if (newStatements === void 0) {
|
|
12756
|
-
newStatements = [...sf.statements];
|
|
12757
|
-
}
|
|
12758
|
-
newStatements[i] = flipIvySwitchesInVariableStatement(statement, sf.statements);
|
|
12759
|
-
}
|
|
12760
|
-
if (newStatements !== void 0) {
|
|
12761
|
-
return ts52.updateSourceFileNode(sf, newStatements);
|
|
12762
|
-
}
|
|
12763
|
-
return sf;
|
|
12764
|
-
}
|
|
12765
|
-
function findPostSwitchIdentifier(statements, name) {
|
|
12766
|
-
for (const stmt of statements) {
|
|
12767
|
-
if (ts52.isVariableStatement(stmt)) {
|
|
12768
|
-
const decl = stmt.declarationList.declarations.find((decl2) => ts52.isIdentifier(decl2.name) && decl2.name.text === name);
|
|
12769
|
-
if (decl !== void 0) {
|
|
12770
|
-
return decl.name;
|
|
12771
|
-
}
|
|
12772
|
-
} else if (ts52.isFunctionDeclaration(stmt) || ts52.isClassDeclaration(stmt)) {
|
|
12773
|
-
if (stmt.name !== void 0 && ts52.isIdentifier(stmt.name) && stmt.name.text === name) {
|
|
12774
|
-
return stmt.name;
|
|
12775
|
-
}
|
|
12776
|
-
}
|
|
12777
|
-
}
|
|
12778
|
-
return null;
|
|
12779
|
-
}
|
|
12780
|
-
function flipIvySwitchesInVariableStatement(stmt, statements) {
|
|
12781
|
-
const newDeclarations = [...stmt.declarationList.declarations];
|
|
12782
|
-
for (let i = 0; i < newDeclarations.length; i++) {
|
|
12783
|
-
const decl = newDeclarations[i];
|
|
12784
|
-
if (decl.initializer === void 0 || !ts52.isIdentifier(decl.initializer)) {
|
|
12785
|
-
continue;
|
|
12786
|
-
}
|
|
12787
|
-
if (!decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX)) {
|
|
12788
|
-
continue;
|
|
12789
|
-
}
|
|
12790
|
-
const postSwitchName = decl.initializer.text.replace(IVY_SWITCH_PRE_SUFFIX, IVY_SWITCH_POST_SUFFIX);
|
|
12791
|
-
const newIdentifier = findPostSwitchIdentifier(statements, postSwitchName);
|
|
12792
|
-
if (newIdentifier === null) {
|
|
12793
|
-
throw new Error(`Unable to find identifier ${postSwitchName} in ${stmt.getSourceFile().fileName} for the Ivy switch.`);
|
|
12794
|
-
}
|
|
12795
|
-
newDeclarations[i] = ts52.updateVariableDeclaration(decl, decl.name, decl.type, newIdentifier);
|
|
12796
|
-
}
|
|
12797
|
-
const newDeclList = ts52.updateVariableDeclarationList(stmt.declarationList, newDeclarations);
|
|
12798
|
-
const newStmt = ts52.updateVariableStatement(stmt, stmt.modifiers, newDeclList);
|
|
12799
|
-
return newStmt;
|
|
12800
|
-
}
|
|
12801
|
-
function hasIvySwitches(stmt) {
|
|
12802
|
-
return stmt.declarationList.declarations.some((decl) => decl.initializer !== void 0 && ts52.isIdentifier(decl.initializer) && decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX));
|
|
12803
|
-
}
|
|
12804
|
-
|
|
12805
12761
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
12806
12762
|
import { CssSelector as CssSelector3, DomElementSchemaRegistry as DomElementSchemaRegistry3 } from "@angular/compiler";
|
|
12807
12763
|
|
|
@@ -12836,7 +12792,7 @@ var SymbolKind;
|
|
|
12836
12792
|
})(SymbolKind || (SymbolKind = {}));
|
|
12837
12793
|
|
|
12838
12794
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
12839
|
-
import
|
|
12795
|
+
import ts52 from "typescript";
|
|
12840
12796
|
function makeTemplateDiagnostic(templateId, mapping, span, category, code, messageText, relatedMessages) {
|
|
12841
12797
|
if (mapping.type === "direct") {
|
|
12842
12798
|
let relatedInformation = void 0;
|
|
@@ -12844,7 +12800,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12844
12800
|
relatedInformation = [];
|
|
12845
12801
|
for (const relatedMessage of relatedMessages) {
|
|
12846
12802
|
relatedInformation.push({
|
|
12847
|
-
category:
|
|
12803
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12848
12804
|
code: 0,
|
|
12849
12805
|
file: relatedMessage.sourceFile,
|
|
12850
12806
|
start: relatedMessage.start,
|
|
@@ -12869,12 +12825,12 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12869
12825
|
const componentSf = mapping.componentClass.getSourceFile();
|
|
12870
12826
|
const componentName = mapping.componentClass.name.text;
|
|
12871
12827
|
const fileName = mapping.type === "indirect" ? `${componentSf.fileName} (${componentName} template)` : mapping.templateUrl;
|
|
12872
|
-
const sf =
|
|
12828
|
+
const sf = ts52.createSourceFile(fileName, mapping.template, ts52.ScriptTarget.Latest, false, ts52.ScriptKind.JSX);
|
|
12873
12829
|
let relatedInformation = [];
|
|
12874
12830
|
if (relatedMessages !== void 0) {
|
|
12875
12831
|
for (const relatedMessage of relatedMessages) {
|
|
12876
12832
|
relatedInformation.push({
|
|
12877
|
-
category:
|
|
12833
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12878
12834
|
code: 0,
|
|
12879
12835
|
file: relatedMessage.sourceFile,
|
|
12880
12836
|
start: relatedMessage.start,
|
|
@@ -12884,7 +12840,7 @@ function makeTemplateDiagnostic(templateId, mapping, span, category, code, messa
|
|
|
12884
12840
|
}
|
|
12885
12841
|
}
|
|
12886
12842
|
relatedInformation.push({
|
|
12887
|
-
category:
|
|
12843
|
+
category: ts52.DiagnosticCategory.Message,
|
|
12888
12844
|
code: 0,
|
|
12889
12845
|
file: componentSf,
|
|
12890
12846
|
start: mapping.node.getStart(),
|
|
@@ -12927,15 +12883,15 @@ function allocateTemplateId(sf) {
|
|
|
12927
12883
|
|
|
12928
12884
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
12929
12885
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
12930
|
-
import
|
|
12886
|
+
import ts54 from "typescript";
|
|
12931
12887
|
|
|
12932
12888
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
12933
12889
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
12934
|
-
import
|
|
12890
|
+
import ts53 from "typescript";
|
|
12935
12891
|
var parseSpanComment = /^(\d+),(\d+)$/;
|
|
12936
12892
|
function readSpanComment(node, sourceFile = node.getSourceFile()) {
|
|
12937
|
-
return
|
|
12938
|
-
if (kind !==
|
|
12893
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12894
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12939
12895
|
return null;
|
|
12940
12896
|
}
|
|
12941
12897
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -12958,15 +12914,15 @@ var ExpressionIdentifier;
|
|
|
12958
12914
|
ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
|
|
12959
12915
|
})(ExpressionIdentifier || (ExpressionIdentifier = {}));
|
|
12960
12916
|
function addExpressionIdentifier(node, identifier) {
|
|
12961
|
-
|
|
12917
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`, false);
|
|
12962
12918
|
}
|
|
12963
12919
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
12964
12920
|
function markIgnoreDiagnostics(node) {
|
|
12965
|
-
|
|
12921
|
+
ts53.addSyntheticTrailingComment(node, ts53.SyntaxKind.MultiLineCommentTrivia, IGNORE_FOR_DIAGNOSTICS_MARKER, false);
|
|
12966
12922
|
}
|
|
12967
12923
|
function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
|
|
12968
|
-
return
|
|
12969
|
-
if (kind !==
|
|
12924
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
12925
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
12970
12926
|
return null;
|
|
12971
12927
|
}
|
|
12972
12928
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -13040,8 +12996,8 @@ function findAllMatchingNodes(tcb, opts) {
|
|
|
13040
12996
|
return results;
|
|
13041
12997
|
}
|
|
13042
12998
|
function hasExpressionIdentifier(sourceFile, node, identifier) {
|
|
13043
|
-
return
|
|
13044
|
-
if (kind !==
|
|
12999
|
+
return ts53.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
|
|
13000
|
+
if (kind !== ts53.SyntaxKind.MultiLineCommentTrivia) {
|
|
13045
13001
|
return false;
|
|
13046
13002
|
}
|
|
13047
13003
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -13058,7 +13014,7 @@ var CompletionEngine = class {
|
|
|
13058
13014
|
this.templateContextCache = new Map();
|
|
13059
13015
|
this.expressionCompletionCache = new Map();
|
|
13060
13016
|
const globalRead = findFirstMatchingNode(this.tcb, {
|
|
13061
|
-
filter:
|
|
13017
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13062
13018
|
withExpressionIdentifier: ExpressionIdentifier.COMPONENT_COMPLETION
|
|
13063
13019
|
});
|
|
13064
13020
|
if (globalRead !== null) {
|
|
@@ -13081,7 +13037,7 @@ var CompletionEngine = class {
|
|
|
13081
13037
|
let nodeContext = null;
|
|
13082
13038
|
if (node instanceof EmptyExpr) {
|
|
13083
13039
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
13084
|
-
filter:
|
|
13040
|
+
filter: ts54.isIdentifier,
|
|
13085
13041
|
withSpan: node.sourceSpan
|
|
13086
13042
|
});
|
|
13087
13043
|
if (nodeLocation !== null) {
|
|
@@ -13093,7 +13049,7 @@ var CompletionEngine = class {
|
|
|
13093
13049
|
}
|
|
13094
13050
|
if (node instanceof PropertyRead && node.receiver instanceof ImplicitReceiver2) {
|
|
13095
13051
|
const nodeLocation = findFirstMatchingNode(this.tcb, {
|
|
13096
|
-
filter:
|
|
13052
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13097
13053
|
withSpan: node.sourceSpan
|
|
13098
13054
|
});
|
|
13099
13055
|
if (nodeLocation) {
|
|
@@ -13116,21 +13072,21 @@ var CompletionEngine = class {
|
|
|
13116
13072
|
let tsExpr = null;
|
|
13117
13073
|
if (expr instanceof PropertyRead || expr instanceof PropertyWrite) {
|
|
13118
13074
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13119
|
-
filter:
|
|
13075
|
+
filter: ts54.isPropertyAccessExpression,
|
|
13120
13076
|
withSpan: expr.nameSpan
|
|
13121
13077
|
});
|
|
13122
13078
|
} else if (expr instanceof SafePropertyRead) {
|
|
13123
13079
|
const ternaryExpr = findFirstMatchingNode(this.tcb, {
|
|
13124
|
-
filter:
|
|
13080
|
+
filter: ts54.isParenthesizedExpression,
|
|
13125
13081
|
withSpan: expr.sourceSpan
|
|
13126
13082
|
});
|
|
13127
|
-
if (ternaryExpr === null || !
|
|
13083
|
+
if (ternaryExpr === null || !ts54.isConditionalExpression(ternaryExpr.expression)) {
|
|
13128
13084
|
return null;
|
|
13129
13085
|
}
|
|
13130
13086
|
const whenTrue = ternaryExpr.expression.whenTrue;
|
|
13131
|
-
if (
|
|
13087
|
+
if (ts54.isPropertyAccessExpression(whenTrue)) {
|
|
13132
13088
|
tsExpr = whenTrue;
|
|
13133
|
-
} else if (
|
|
13089
|
+
} else if (ts54.isCallExpression(whenTrue) && ts54.isPropertyAccessExpression(whenTrue.expression)) {
|
|
13134
13090
|
tsExpr = whenTrue.expression;
|
|
13135
13091
|
}
|
|
13136
13092
|
}
|
|
@@ -13151,15 +13107,15 @@ var CompletionEngine = class {
|
|
|
13151
13107
|
let tsExpr = null;
|
|
13152
13108
|
if (expr instanceof TmplAstTextAttribute) {
|
|
13153
13109
|
const strNode = findFirstMatchingNode(this.tcb, {
|
|
13154
|
-
filter:
|
|
13110
|
+
filter: ts54.isParenthesizedExpression,
|
|
13155
13111
|
withSpan: expr.sourceSpan
|
|
13156
13112
|
});
|
|
13157
|
-
if (strNode !== null &&
|
|
13113
|
+
if (strNode !== null && ts54.isStringLiteral(strNode.expression)) {
|
|
13158
13114
|
tsExpr = strNode.expression;
|
|
13159
13115
|
}
|
|
13160
13116
|
} else {
|
|
13161
13117
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
13162
|
-
filter: (n) =>
|
|
13118
|
+
filter: (n) => ts54.isStringLiteral(n) || ts54.isNumericLiteral(n),
|
|
13163
13119
|
withSpan: expr.sourceSpan
|
|
13164
13120
|
});
|
|
13165
13121
|
}
|
|
@@ -13167,7 +13123,7 @@ var CompletionEngine = class {
|
|
|
13167
13123
|
return null;
|
|
13168
13124
|
}
|
|
13169
13125
|
let positionInShimFile = tsExpr.getEnd();
|
|
13170
|
-
if (
|
|
13126
|
+
if (ts54.isStringLiteral(tsExpr)) {
|
|
13171
13127
|
positionInShimFile -= 1;
|
|
13172
13128
|
}
|
|
13173
13129
|
const res = {
|
|
@@ -13201,11 +13157,11 @@ var CompletionEngine = class {
|
|
|
13201
13157
|
};
|
|
13202
13158
|
|
|
13203
13159
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
13204
|
-
import
|
|
13160
|
+
import ts68 from "typescript";
|
|
13205
13161
|
|
|
13206
13162
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
13207
13163
|
import { DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
13208
|
-
import
|
|
13164
|
+
import ts55 from "typescript";
|
|
13209
13165
|
var REGISTRY = new DomElementSchemaRegistry2();
|
|
13210
13166
|
var REMOVE_XHTML_REGEX = /^:xhtml:/;
|
|
13211
13167
|
var RegistryDomSchemaChecker = class {
|
|
@@ -13229,7 +13185,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13229
13185
|
} else {
|
|
13230
13186
|
errorMsg += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13231
13187
|
}
|
|
13232
|
-
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan,
|
|
13188
|
+
const diag = makeTemplateDiagnostic(id, mapping, element.startSourceSpan, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ELEMENT), errorMsg);
|
|
13233
13189
|
this._diagnostics.push(diag);
|
|
13234
13190
|
}
|
|
13235
13191
|
}
|
|
@@ -13247,7 +13203,7 @@ var RegistryDomSchemaChecker = class {
|
|
|
13247
13203
|
2. If '${element.name}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
|
|
13248
13204
|
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.`;
|
|
13249
13205
|
}
|
|
13250
|
-
const diag = makeTemplateDiagnostic(id, mapping, span,
|
|
13206
|
+
const diag = makeTemplateDiagnostic(id, mapping, span, ts55.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SCHEMA_INVALID_ATTRIBUTE), errorMsg);
|
|
13251
13207
|
this._diagnostics.push(diag);
|
|
13252
13208
|
}
|
|
13253
13209
|
}
|
|
@@ -13255,62 +13211,62 @@ var RegistryDomSchemaChecker = class {
|
|
|
13255
13211
|
|
|
13256
13212
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
13257
13213
|
import { ExpressionType, ExternalExpr as ExternalExpr9 } from "@angular/compiler";
|
|
13258
|
-
import
|
|
13214
|
+
import ts61 from "typescript";
|
|
13259
13215
|
|
|
13260
13216
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
13261
|
-
import
|
|
13217
|
+
import ts56 from "typescript";
|
|
13262
13218
|
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13219
|
+
ts56.SyntaxKind.ParenthesizedExpression,
|
|
13220
|
+
ts56.SyntaxKind.Identifier,
|
|
13221
|
+
ts56.SyntaxKind.CallExpression,
|
|
13222
|
+
ts56.SyntaxKind.NonNullExpression,
|
|
13223
|
+
ts56.SyntaxKind.ElementAccessExpression,
|
|
13224
|
+
ts56.SyntaxKind.PropertyAccessExpression,
|
|
13225
|
+
ts56.SyntaxKind.ArrayLiteralExpression,
|
|
13226
|
+
ts56.SyntaxKind.ObjectLiteralExpression,
|
|
13227
|
+
ts56.SyntaxKind.StringLiteral,
|
|
13228
|
+
ts56.SyntaxKind.NumericLiteral,
|
|
13229
|
+
ts56.SyntaxKind.TrueKeyword,
|
|
13230
|
+
ts56.SyntaxKind.FalseKeyword,
|
|
13231
|
+
ts56.SyntaxKind.NullKeyword,
|
|
13232
|
+
ts56.SyntaxKind.UndefinedKeyword
|
|
13277
13233
|
]);
|
|
13278
13234
|
function tsCastToAny(expr) {
|
|
13279
13235
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
13280
|
-
expr =
|
|
13236
|
+
expr = ts56.createParen(expr);
|
|
13281
13237
|
}
|
|
13282
|
-
return
|
|
13238
|
+
return ts56.createParen(ts56.createAsExpression(expr, ts56.createKeywordTypeNode(ts56.SyntaxKind.AnyKeyword)));
|
|
13283
13239
|
}
|
|
13284
13240
|
function tsCreateElement(tagName) {
|
|
13285
|
-
const createElement =
|
|
13286
|
-
return
|
|
13241
|
+
const createElement = ts56.createPropertyAccess(ts56.createIdentifier("document"), "createElement");
|
|
13242
|
+
return ts56.createCall(createElement, void 0, [ts56.createLiteral(tagName)]);
|
|
13287
13243
|
}
|
|
13288
13244
|
function tsDeclareVariable(id, type) {
|
|
13289
|
-
const decl =
|
|
13290
|
-
return
|
|
13245
|
+
const decl = ts56.createVariableDeclaration(id, type, ts56.createNonNullExpression(ts56.createNull()));
|
|
13246
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13291
13247
|
}
|
|
13292
13248
|
function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
|
|
13293
|
-
return
|
|
13249
|
+
return ts56.createTypeQueryNode(ts56.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
|
|
13294
13250
|
}
|
|
13295
13251
|
function tsCreateVariable(id, initializer) {
|
|
13296
|
-
const decl =
|
|
13297
|
-
return
|
|
13252
|
+
const decl = ts56.createVariableDeclaration(id, void 0, initializer);
|
|
13253
|
+
return ts56.createVariableStatement(void 0, [decl]);
|
|
13298
13254
|
}
|
|
13299
13255
|
function tsCallMethod(receiver, methodName, args = []) {
|
|
13300
|
-
const methodAccess =
|
|
13301
|
-
return
|
|
13256
|
+
const methodAccess = ts56.createPropertyAccess(receiver, methodName);
|
|
13257
|
+
return ts56.createCall(methodAccess, void 0, args);
|
|
13302
13258
|
}
|
|
13303
13259
|
function checkIfClassIsExported(node) {
|
|
13304
|
-
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
13260
|
+
if (node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts56.SyntaxKind.ExportKeyword)) {
|
|
13305
13261
|
return true;
|
|
13306
|
-
} else if (node.parent !== void 0 &&
|
|
13262
|
+
} else if (node.parent !== void 0 && ts56.isSourceFile(node.parent) && checkIfFileHasExport(node.parent, node.name.text)) {
|
|
13307
13263
|
return true;
|
|
13308
13264
|
}
|
|
13309
13265
|
return false;
|
|
13310
13266
|
}
|
|
13311
13267
|
function checkIfFileHasExport(sf, name) {
|
|
13312
13268
|
for (const stmt of sf.statements) {
|
|
13313
|
-
if (
|
|
13269
|
+
if (ts56.isExportDeclaration(stmt) && stmt.exportClause !== void 0 && ts56.isNamedExports(stmt.exportClause)) {
|
|
13314
13270
|
for (const element of stmt.exportClause.elements) {
|
|
13315
13271
|
if (element.propertyName === void 0 && element.name.text === name) {
|
|
13316
13272
|
return true;
|
|
@@ -13323,20 +13279,20 @@ function checkIfFileHasExport(sf, name) {
|
|
|
13323
13279
|
return false;
|
|
13324
13280
|
}
|
|
13325
13281
|
function isAccessExpression(node) {
|
|
13326
|
-
return
|
|
13282
|
+
return ts56.isPropertyAccessExpression(node) || ts56.isElementAccessExpression(node);
|
|
13327
13283
|
}
|
|
13328
13284
|
|
|
13329
13285
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
13330
|
-
import
|
|
13286
|
+
import ts60 from "typescript";
|
|
13331
13287
|
|
|
13332
13288
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
13333
|
-
import
|
|
13289
|
+
import ts59 from "typescript";
|
|
13334
13290
|
|
|
13335
13291
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
13336
|
-
import
|
|
13292
|
+
import ts58 from "typescript";
|
|
13337
13293
|
|
|
13338
13294
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
13339
|
-
import
|
|
13295
|
+
import ts57 from "typescript";
|
|
13340
13296
|
var INELIGIBLE = {};
|
|
13341
13297
|
function canEmitType(type, resolver) {
|
|
13342
13298
|
return canEmitTypeWorker(type);
|
|
@@ -13344,13 +13300,13 @@ function canEmitType(type, resolver) {
|
|
|
13344
13300
|
return visitNode(type2) !== INELIGIBLE;
|
|
13345
13301
|
}
|
|
13346
13302
|
function visitNode(node) {
|
|
13347
|
-
if (
|
|
13303
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13348
13304
|
return INELIGIBLE;
|
|
13349
13305
|
}
|
|
13350
|
-
if (
|
|
13306
|
+
if (ts57.isTypeReferenceNode(node) && !canEmitTypeReference(node)) {
|
|
13351
13307
|
return INELIGIBLE;
|
|
13352
13308
|
} else {
|
|
13353
|
-
return
|
|
13309
|
+
return ts57.forEachChild(node, visitNode);
|
|
13354
13310
|
}
|
|
13355
13311
|
}
|
|
13356
13312
|
function canEmitTypeReference(type2) {
|
|
@@ -13372,22 +13328,22 @@ var TypeEmitter = class {
|
|
|
13372
13328
|
emitType(type) {
|
|
13373
13329
|
const typeReferenceTransformer = (context) => {
|
|
13374
13330
|
const visitNode = (node) => {
|
|
13375
|
-
if (
|
|
13331
|
+
if (ts57.isImportTypeNode(node)) {
|
|
13376
13332
|
throw new Error("Unable to emit import type");
|
|
13377
13333
|
}
|
|
13378
|
-
if (
|
|
13334
|
+
if (ts57.isTypeReferenceNode(node)) {
|
|
13379
13335
|
return this.emitTypeReference(node);
|
|
13380
|
-
} else if (
|
|
13381
|
-
const clone =
|
|
13382
|
-
|
|
13336
|
+
} else if (ts57.isLiteralExpression(node)) {
|
|
13337
|
+
const clone = ts57.getMutableClone(node);
|
|
13338
|
+
ts57.setTextRange(clone, { pos: -1, end: -1 });
|
|
13383
13339
|
return clone;
|
|
13384
13340
|
} else {
|
|
13385
|
-
return
|
|
13341
|
+
return ts57.visitEachChild(node, visitNode, context);
|
|
13386
13342
|
}
|
|
13387
13343
|
};
|
|
13388
|
-
return (node) =>
|
|
13344
|
+
return (node) => ts57.visitNode(node, visitNode);
|
|
13389
13345
|
};
|
|
13390
|
-
return
|
|
13346
|
+
return ts57.transform(type, [typeReferenceTransformer]).transformed[0];
|
|
13391
13347
|
}
|
|
13392
13348
|
emitTypeReference(type) {
|
|
13393
13349
|
const reference = this.resolver(type);
|
|
@@ -13396,17 +13352,17 @@ var TypeEmitter = class {
|
|
|
13396
13352
|
}
|
|
13397
13353
|
let typeArguments = void 0;
|
|
13398
13354
|
if (type.typeArguments !== void 0) {
|
|
13399
|
-
typeArguments =
|
|
13355
|
+
typeArguments = ts57.createNodeArray(type.typeArguments.map((typeArg) => this.emitType(typeArg)));
|
|
13400
13356
|
}
|
|
13401
13357
|
let typeName = type.typeName;
|
|
13402
13358
|
if (reference instanceof Reference) {
|
|
13403
13359
|
const emittedType = this.emitReference(reference);
|
|
13404
|
-
if (!
|
|
13405
|
-
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${
|
|
13360
|
+
if (!ts57.isTypeReferenceNode(emittedType)) {
|
|
13361
|
+
throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts57.SyntaxKind[emittedType.kind]}`);
|
|
13406
13362
|
}
|
|
13407
13363
|
typeName = emittedType.typeName;
|
|
13408
13364
|
}
|
|
13409
|
-
return
|
|
13365
|
+
return ts57.updateTypeReferenceNode(type, typeName, typeArguments);
|
|
13410
13366
|
}
|
|
13411
13367
|
};
|
|
13412
13368
|
|
|
@@ -13438,11 +13394,11 @@ var TypeParameterEmitter = class {
|
|
|
13438
13394
|
return this.typeParameters.map((typeParam) => {
|
|
13439
13395
|
const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
|
|
13440
13396
|
const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
|
|
13441
|
-
return
|
|
13397
|
+
return ts58.updateTypeParameterDeclaration(typeParam, typeParam.name, constraint, defaultType);
|
|
13442
13398
|
});
|
|
13443
13399
|
}
|
|
13444
13400
|
resolveTypeReference(type) {
|
|
13445
|
-
const target =
|
|
13401
|
+
const target = ts58.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
|
|
13446
13402
|
const declaration = this.reflector.getDeclarationOfIdentifier(target);
|
|
13447
13403
|
if (declaration === null || declaration.node === null) {
|
|
13448
13404
|
return null;
|
|
@@ -13463,7 +13419,7 @@ var TypeParameterEmitter = class {
|
|
|
13463
13419
|
return new Reference(declaration.node, owningModule2);
|
|
13464
13420
|
}
|
|
13465
13421
|
isTopLevelExport(decl) {
|
|
13466
|
-
if (decl.parent === void 0 || !
|
|
13422
|
+
if (decl.parent === void 0 || !ts58.isSourceFile(decl.parent)) {
|
|
13467
13423
|
return false;
|
|
13468
13424
|
}
|
|
13469
13425
|
return this.reflector.isStaticallyExported(decl);
|
|
@@ -13506,14 +13462,14 @@ function getTemplateMapping(shimSf, position, resolver, isDiagnosticRequest) {
|
|
|
13506
13462
|
}
|
|
13507
13463
|
function findTypeCheckBlock(file, id, isDiagnosticRequest) {
|
|
13508
13464
|
for (const stmt of file.statements) {
|
|
13509
|
-
if (
|
|
13465
|
+
if (ts59.isFunctionDeclaration(stmt) && getTemplateId2(stmt, file, isDiagnosticRequest) === id) {
|
|
13510
13466
|
return stmt;
|
|
13511
13467
|
}
|
|
13512
13468
|
}
|
|
13513
13469
|
return null;
|
|
13514
13470
|
}
|
|
13515
13471
|
function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
13516
|
-
while (node !== void 0 && !
|
|
13472
|
+
while (node !== void 0 && !ts59.isFunctionDeclaration(node)) {
|
|
13517
13473
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
|
|
13518
13474
|
return null;
|
|
13519
13475
|
}
|
|
@@ -13530,7 +13486,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
|
|
|
13530
13486
|
return null;
|
|
13531
13487
|
}
|
|
13532
13488
|
function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
13533
|
-
while (!
|
|
13489
|
+
while (!ts59.isFunctionDeclaration(node)) {
|
|
13534
13490
|
if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
|
|
13535
13491
|
return null;
|
|
13536
13492
|
}
|
|
@@ -13540,8 +13496,8 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
13540
13496
|
}
|
|
13541
13497
|
}
|
|
13542
13498
|
const start = node.getFullStart();
|
|
13543
|
-
return
|
|
13544
|
-
if (kind !==
|
|
13499
|
+
return ts59.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
|
|
13500
|
+
if (kind !== ts59.SyntaxKind.MultiLineCommentTrivia) {
|
|
13545
13501
|
return null;
|
|
13546
13502
|
}
|
|
13547
13503
|
const commentText = sourceFile.text.substring(pos + 2, end - 2);
|
|
@@ -13558,29 +13514,29 @@ function generateTypeCtorDeclarationFn(node, meta, nodeTypeRef, typeParams, refl
|
|
|
13558
13514
|
throw new Error(`${node.name.text} requires an inline type constructor`);
|
|
13559
13515
|
}
|
|
13560
13516
|
const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
|
|
13561
|
-
const rawType =
|
|
13517
|
+
const rawType = ts60.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
|
|
13562
13518
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13563
13519
|
const typeParameters = typeParametersWithDefaultTypes(typeParams);
|
|
13564
13520
|
if (meta.body) {
|
|
13565
|
-
const fnType =
|
|
13566
|
-
const decl =
|
|
13567
|
-
const declList =
|
|
13568
|
-
return
|
|
13521
|
+
const fnType = ts60.createFunctionTypeNode(typeParameters, [initParam], rawType);
|
|
13522
|
+
const decl = ts60.createVariableDeclaration(meta.fnName, fnType, ts60.createNonNullExpression(ts60.createNull()));
|
|
13523
|
+
const declList = ts60.createVariableDeclarationList([decl], ts60.NodeFlags.Const);
|
|
13524
|
+
return ts60.createVariableStatement(void 0, declList);
|
|
13569
13525
|
} else {
|
|
13570
|
-
return
|
|
13526
|
+
return ts60.createFunctionDeclaration(void 0, [ts60.createModifier(ts60.SyntaxKind.DeclareKeyword)], void 0, meta.fnName, typeParameters, [initParam], rawType, void 0);
|
|
13571
13527
|
}
|
|
13572
13528
|
}
|
|
13573
13529
|
function generateInlineTypeCtor(node, meta) {
|
|
13574
13530
|
const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
|
|
13575
|
-
const rawType =
|
|
13531
|
+
const rawType = ts60.createTypeReferenceNode(node.name, rawTypeArgs);
|
|
13576
13532
|
const initParam = constructTypeCtorParameter(node, meta, rawType);
|
|
13577
13533
|
let body = void 0;
|
|
13578
13534
|
if (meta.body) {
|
|
13579
|
-
body =
|
|
13580
|
-
|
|
13535
|
+
body = ts60.createBlock([
|
|
13536
|
+
ts60.createReturn(ts60.createNonNullExpression(ts60.createNull()))
|
|
13581
13537
|
]);
|
|
13582
13538
|
}
|
|
13583
|
-
return
|
|
13539
|
+
return ts60.createMethod(void 0, [ts60.createModifier(ts60.SyntaxKind.StaticKeyword)], void 0, meta.fnName, void 0, typeParametersWithDefaultTypes(node.typeParameters), [initParam], rawType, body);
|
|
13584
13540
|
}
|
|
13585
13541
|
function constructTypeCtorParameter(node, meta, rawType) {
|
|
13586
13542
|
let initType = null;
|
|
@@ -13589,26 +13545,26 @@ function constructTypeCtorParameter(node, meta, rawType) {
|
|
|
13589
13545
|
const coercedKeys = [];
|
|
13590
13546
|
for (const key of keys) {
|
|
13591
13547
|
if (!meta.coercedInputFields.has(key)) {
|
|
13592
|
-
plainKeys.push(
|
|
13548
|
+
plainKeys.push(ts60.createLiteralTypeNode(ts60.createStringLiteral(key)));
|
|
13593
13549
|
} else {
|
|
13594
|
-
coercedKeys.push(
|
|
13550
|
+
coercedKeys.push(ts60.createPropertySignature(void 0, key, void 0, tsCreateTypeQueryForCoercedInput(rawType.typeName, key), void 0));
|
|
13595
13551
|
}
|
|
13596
13552
|
}
|
|
13597
13553
|
if (plainKeys.length > 0) {
|
|
13598
|
-
const keyTypeUnion =
|
|
13599
|
-
initType =
|
|
13554
|
+
const keyTypeUnion = ts60.createUnionTypeNode(plainKeys);
|
|
13555
|
+
initType = ts60.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
|
|
13600
13556
|
}
|
|
13601
13557
|
if (coercedKeys.length > 0) {
|
|
13602
|
-
const coercedLiteral =
|
|
13603
|
-
initType = initType !== null ?
|
|
13558
|
+
const coercedLiteral = ts60.createTypeLiteralNode(coercedKeys);
|
|
13559
|
+
initType = initType !== null ? ts60.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
|
|
13604
13560
|
}
|
|
13605
13561
|
if (initType === null) {
|
|
13606
|
-
initType =
|
|
13562
|
+
initType = ts60.createTypeLiteralNode([]);
|
|
13607
13563
|
}
|
|
13608
|
-
return
|
|
13564
|
+
return ts60.createParameter(void 0, void 0, void 0, "init", void 0, initType, void 0);
|
|
13609
13565
|
}
|
|
13610
13566
|
function generateGenericArgs(params) {
|
|
13611
|
-
return params.map((param) =>
|
|
13567
|
+
return params.map((param) => ts60.createTypeReferenceNode(param.name, void 0));
|
|
13612
13568
|
}
|
|
13613
13569
|
function requiresInlineTypeCtor(node, host) {
|
|
13614
13570
|
return !checkIfGenericTypeBoundsAreContextFree(node, host);
|
|
@@ -13619,7 +13575,7 @@ function typeParametersWithDefaultTypes(params) {
|
|
|
13619
13575
|
}
|
|
13620
13576
|
return params.map((param) => {
|
|
13621
13577
|
if (param.default === void 0) {
|
|
13622
|
-
return
|
|
13578
|
+
return ts60.updateTypeParameterDeclaration(param, param.name, param.constraint, ts60.createKeywordTypeNode(ts60.SyntaxKind.AnyKeyword));
|
|
13623
13579
|
} else {
|
|
13624
13580
|
return param;
|
|
13625
13581
|
}
|
|
@@ -13651,13 +13607,13 @@ var Environment = class {
|
|
|
13651
13607
|
}
|
|
13652
13608
|
if (requiresInlineTypeCtor(node, this.reflector)) {
|
|
13653
13609
|
const ref = this.reference(dirRef);
|
|
13654
|
-
const typeCtorExpr =
|
|
13610
|
+
const typeCtorExpr = ts61.createPropertyAccess(ref, "ngTypeCtor");
|
|
13655
13611
|
this.typeCtors.set(node, typeCtorExpr);
|
|
13656
13612
|
return typeCtorExpr;
|
|
13657
13613
|
} else {
|
|
13658
13614
|
const fnName = `_ctor${this.nextIds.typeCtor++}`;
|
|
13659
13615
|
const nodeTypeRef = this.referenceType(dirRef);
|
|
13660
|
-
if (!
|
|
13616
|
+
if (!ts61.isTypeReferenceNode(nodeTypeRef)) {
|
|
13661
13617
|
throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
|
|
13662
13618
|
}
|
|
13663
13619
|
const meta = {
|
|
@@ -13673,7 +13629,7 @@ var Environment = class {
|
|
|
13673
13629
|
const typeParams = this.emitTypeParameters(node);
|
|
13674
13630
|
const typeCtor = generateTypeCtorDeclarationFn(node, meta, nodeTypeRef.typeName, typeParams, this.reflector);
|
|
13675
13631
|
this.typeCtorStatements.push(typeCtor);
|
|
13676
|
-
const fnId =
|
|
13632
|
+
const fnId = ts61.createIdentifier(fnName);
|
|
13677
13633
|
this.typeCtors.set(node, fnId);
|
|
13678
13634
|
return fnId;
|
|
13679
13635
|
}
|
|
@@ -13683,7 +13639,7 @@ var Environment = class {
|
|
|
13683
13639
|
return this.pipeInsts.get(ref.node);
|
|
13684
13640
|
}
|
|
13685
13641
|
const pipeType = this.referenceType(ref);
|
|
13686
|
-
const pipeInstId =
|
|
13642
|
+
const pipeInstId = ts61.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
|
|
13687
13643
|
this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
|
|
13688
13644
|
this.pipeInsts.set(ref.node, pipeInstId);
|
|
13689
13645
|
return pipeInstId;
|
|
@@ -13714,7 +13670,7 @@ var Environment = class {
|
|
|
13714
13670
|
|
|
13715
13671
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
13716
13672
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
13717
|
-
import
|
|
13673
|
+
import ts62 from "typescript";
|
|
13718
13674
|
var OutOfBandDiagnosticRecorderImpl = class {
|
|
13719
13675
|
constructor(resolver) {
|
|
13720
13676
|
this.resolver = resolver;
|
|
@@ -13728,7 +13684,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13728
13684
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13729
13685
|
const value = ref.value.trim();
|
|
13730
13686
|
const errorMsg = `No directive found with exportAs '${value}'.`;
|
|
13731
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan,
|
|
13687
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
|
|
13732
13688
|
}
|
|
13733
13689
|
missingPipe(templateId, ast) {
|
|
13734
13690
|
if (this.recordedPipes.has(ast)) {
|
|
@@ -13740,7 +13696,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13740
13696
|
if (sourceSpan === null) {
|
|
13741
13697
|
throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
|
|
13742
13698
|
}
|
|
13743
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13699
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
|
|
13744
13700
|
this.recordedPipes.add(ast);
|
|
13745
13701
|
}
|
|
13746
13702
|
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
@@ -13751,7 +13707,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13751
13707
|
if (sourceSpan === null) {
|
|
13752
13708
|
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
13753
13709
|
}
|
|
13754
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan,
|
|
13710
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
13755
13711
|
text: `The variable ${assignment.name} is declared here.`,
|
|
13756
13712
|
start: ((_a = target.valueSpan) == null ? void 0 : _a.start.offset) || target.sourceSpan.start.offset,
|
|
13757
13713
|
end: ((_b = target.valueSpan) == null ? void 0 : _b.end.offset) || target.sourceSpan.end.offset,
|
|
@@ -13761,7 +13717,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13761
13717
|
duplicateTemplateVar(templateId, variable, firstDecl) {
|
|
13762
13718
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
13763
13719
|
const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
|
|
13764
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan,
|
|
13720
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, variable.sourceSpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [{
|
|
13765
13721
|
text: `The variable '${firstDecl.name}' was first declared here.`,
|
|
13766
13722
|
start: firstDecl.sourceSpan.start.offset,
|
|
13767
13723
|
end: firstDecl.sourceSpan.end.offset,
|
|
@@ -13800,7 +13756,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
13800
13756
|
const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
|
|
13801
13757
|
|
|
13802
13758
|
Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
|
|
13803
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan,
|
|
13759
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, diagnosticVar.keySpan, ts62.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
|
|
13804
13760
|
}
|
|
13805
13761
|
splitTwoWayBinding(templateId, input, output, inputConsumer, outputConsumer) {
|
|
13806
13762
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
@@ -13834,7 +13790,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
13834
13790
|
sourceFile: outputConsumer.name.getSourceFile()
|
|
13835
13791
|
});
|
|
13836
13792
|
}
|
|
13837
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan,
|
|
13793
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts62.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
13838
13794
|
}
|
|
13839
13795
|
};
|
|
13840
13796
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
@@ -13845,7 +13801,7 @@ function makeInlineDiagnostic(templateId, code, node, messageText, relatedInform
|
|
|
13845
13801
|
}
|
|
13846
13802
|
|
|
13847
13803
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
13848
|
-
import
|
|
13804
|
+
import ts63 from "typescript";
|
|
13849
13805
|
var TypeCheckShimGenerator = class {
|
|
13850
13806
|
constructor() {
|
|
13851
13807
|
this.extensionPrefix = "ngtypecheck";
|
|
@@ -13855,7 +13811,7 @@ var TypeCheckShimGenerator = class {
|
|
|
13855
13811
|
if (priorShimSf !== null) {
|
|
13856
13812
|
return priorShimSf;
|
|
13857
13813
|
}
|
|
13858
|
-
return
|
|
13814
|
+
return ts63.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts63.ScriptTarget.Latest, true, ts63.ScriptKind.TS);
|
|
13859
13815
|
}
|
|
13860
13816
|
static shimFor(fileName) {
|
|
13861
13817
|
return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
|
|
@@ -13864,16 +13820,16 @@ var TypeCheckShimGenerator = class {
|
|
|
13864
13820
|
|
|
13865
13821
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
13866
13822
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
13867
|
-
import
|
|
13823
|
+
import ts66 from "typescript";
|
|
13868
13824
|
|
|
13869
13825
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
13870
13826
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
13871
|
-
import
|
|
13827
|
+
import ts64 from "typescript";
|
|
13872
13828
|
function wrapForDiagnostics(expr) {
|
|
13873
|
-
return
|
|
13829
|
+
return ts64.createParen(expr);
|
|
13874
13830
|
}
|
|
13875
13831
|
function wrapForTypeChecker(expr) {
|
|
13876
|
-
return
|
|
13832
|
+
return ts64.createParen(expr);
|
|
13877
13833
|
}
|
|
13878
13834
|
function addParseSpanInfo(node, span) {
|
|
13879
13835
|
let commentText;
|
|
@@ -13882,10 +13838,10 @@ function addParseSpanInfo(node, span) {
|
|
|
13882
13838
|
} else {
|
|
13883
13839
|
commentText = `${span.start.offset},${span.end.offset}`;
|
|
13884
13840
|
}
|
|
13885
|
-
|
|
13841
|
+
ts64.addSyntheticTrailingComment(node, ts64.SyntaxKind.MultiLineCommentTrivia, commentText, false);
|
|
13886
13842
|
}
|
|
13887
13843
|
function addTemplateId(tcb, id) {
|
|
13888
|
-
|
|
13844
|
+
ts64.addSyntheticLeadingComment(tcb, ts64.SyntaxKind.MultiLineCommentTrivia, id, true);
|
|
13889
13845
|
}
|
|
13890
13846
|
function shouldReportDiagnostic(diagnostic) {
|
|
13891
13847
|
const { code } = diagnostic;
|
|
@@ -13914,32 +13870,32 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
13914
13870
|
|
|
13915
13871
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
13916
13872
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
13917
|
-
import
|
|
13918
|
-
var NULL_AS_ANY =
|
|
13919
|
-
var UNDEFINED =
|
|
13873
|
+
import ts65 from "typescript";
|
|
13874
|
+
var NULL_AS_ANY = ts65.createAsExpression(ts65.createNull(), ts65.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword));
|
|
13875
|
+
var UNDEFINED = ts65.createIdentifier("undefined");
|
|
13920
13876
|
var UNARY_OPS = new Map([
|
|
13921
|
-
["+",
|
|
13922
|
-
["-",
|
|
13877
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13878
|
+
["-", ts65.SyntaxKind.MinusToken]
|
|
13923
13879
|
]);
|
|
13924
13880
|
var BINARY_OPS = new Map([
|
|
13925
|
-
["+",
|
|
13926
|
-
["-",
|
|
13927
|
-
["<",
|
|
13928
|
-
[">",
|
|
13929
|
-
["<=",
|
|
13930
|
-
[">=",
|
|
13931
|
-
["==",
|
|
13932
|
-
["===",
|
|
13933
|
-
["*",
|
|
13934
|
-
["/",
|
|
13935
|
-
["%",
|
|
13936
|
-
["!=",
|
|
13937
|
-
["!==",
|
|
13938
|
-
["||",
|
|
13939
|
-
["&&",
|
|
13940
|
-
["&",
|
|
13941
|
-
["|",
|
|
13942
|
-
["??",
|
|
13881
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
13882
|
+
["-", ts65.SyntaxKind.MinusToken],
|
|
13883
|
+
["<", ts65.SyntaxKind.LessThanToken],
|
|
13884
|
+
[">", ts65.SyntaxKind.GreaterThanToken],
|
|
13885
|
+
["<=", ts65.SyntaxKind.LessThanEqualsToken],
|
|
13886
|
+
[">=", ts65.SyntaxKind.GreaterThanEqualsToken],
|
|
13887
|
+
["==", ts65.SyntaxKind.EqualsEqualsToken],
|
|
13888
|
+
["===", ts65.SyntaxKind.EqualsEqualsEqualsToken],
|
|
13889
|
+
["*", ts65.SyntaxKind.AsteriskToken],
|
|
13890
|
+
["/", ts65.SyntaxKind.SlashToken],
|
|
13891
|
+
["%", ts65.SyntaxKind.PercentToken],
|
|
13892
|
+
["!=", ts65.SyntaxKind.ExclamationEqualsToken],
|
|
13893
|
+
["!==", ts65.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
13894
|
+
["||", ts65.SyntaxKind.BarBarToken],
|
|
13895
|
+
["&&", ts65.SyntaxKind.AmpersandAmpersandToken],
|
|
13896
|
+
["&", ts65.SyntaxKind.AmpersandToken],
|
|
13897
|
+
["|", ts65.SyntaxKind.BarToken],
|
|
13898
|
+
["??", ts65.SyntaxKind.QuestionQuestionToken]
|
|
13943
13899
|
]);
|
|
13944
13900
|
function astToTypescript(ast, maybeResolve, config) {
|
|
13945
13901
|
const translator = new AstTranslator(maybeResolve, config);
|
|
@@ -13955,7 +13911,7 @@ var AstTranslator = class {
|
|
|
13955
13911
|
ast = ast.ast;
|
|
13956
13912
|
}
|
|
13957
13913
|
if (ast instanceof EmptyExpr2) {
|
|
13958
|
-
const res =
|
|
13914
|
+
const res = ts65.factory.createIdentifier("undefined");
|
|
13959
13915
|
addParseSpanInfo(res, ast.sourceSpan);
|
|
13960
13916
|
return res;
|
|
13961
13917
|
}
|
|
@@ -13971,7 +13927,7 @@ var AstTranslator = class {
|
|
|
13971
13927
|
if (op === void 0) {
|
|
13972
13928
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
13973
13929
|
}
|
|
13974
|
-
const node = wrapForDiagnostics(
|
|
13930
|
+
const node = wrapForDiagnostics(ts65.createPrefix(op, expr));
|
|
13975
13931
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13976
13932
|
return node;
|
|
13977
13933
|
}
|
|
@@ -13982,13 +13938,13 @@ var AstTranslator = class {
|
|
|
13982
13938
|
if (op === void 0) {
|
|
13983
13939
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
13984
13940
|
}
|
|
13985
|
-
const node =
|
|
13941
|
+
const node = ts65.createBinary(lhs, op, rhs);
|
|
13986
13942
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13987
13943
|
return node;
|
|
13988
13944
|
}
|
|
13989
13945
|
visitChain(ast) {
|
|
13990
13946
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
13991
|
-
const node = wrapForDiagnostics(
|
|
13947
|
+
const node = wrapForDiagnostics(ts65.createCommaList(elements));
|
|
13992
13948
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
13993
13949
|
return node;
|
|
13994
13950
|
}
|
|
@@ -13996,7 +13952,7 @@ var AstTranslator = class {
|
|
|
13996
13952
|
const condExpr = this.translate(ast.condition);
|
|
13997
13953
|
const trueExpr = this.translate(ast.trueExp);
|
|
13998
13954
|
const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
|
|
13999
|
-
const node =
|
|
13955
|
+
const node = ts65.createParen(ts65.createConditional(condExpr, trueExpr, falseExpr));
|
|
14000
13956
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14001
13957
|
return node;
|
|
14002
13958
|
}
|
|
@@ -14007,26 +13963,26 @@ var AstTranslator = class {
|
|
|
14007
13963
|
throw new Error("Method not implemented.");
|
|
14008
13964
|
}
|
|
14009
13965
|
visitInterpolation(ast) {
|
|
14010
|
-
return ast.expressions.reduce((lhs, ast2) =>
|
|
13966
|
+
return ast.expressions.reduce((lhs, ast2) => ts65.createBinary(lhs, ts65.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts65.createLiteral(""));
|
|
14011
13967
|
}
|
|
14012
13968
|
visitKeyedRead(ast) {
|
|
14013
13969
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14014
13970
|
const key = this.translate(ast.key);
|
|
14015
|
-
const node =
|
|
13971
|
+
const node = ts65.createElementAccess(receiver, key);
|
|
14016
13972
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14017
13973
|
return node;
|
|
14018
13974
|
}
|
|
14019
13975
|
visitKeyedWrite(ast) {
|
|
14020
13976
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14021
|
-
const left =
|
|
13977
|
+
const left = ts65.createElementAccess(receiver, this.translate(ast.key));
|
|
14022
13978
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
14023
|
-
const node = wrapForDiagnostics(
|
|
13979
|
+
const node = wrapForDiagnostics(ts65.createBinary(left, ts65.SyntaxKind.EqualsToken, right));
|
|
14024
13980
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14025
13981
|
return node;
|
|
14026
13982
|
}
|
|
14027
13983
|
visitLiteralArray(ast) {
|
|
14028
13984
|
const elements = ast.expressions.map((expr) => this.translate(expr));
|
|
14029
|
-
const literal2 =
|
|
13985
|
+
const literal2 = ts65.createArrayLiteral(elements);
|
|
14030
13986
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
14031
13987
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14032
13988
|
return node;
|
|
@@ -14034,9 +13990,9 @@ var AstTranslator = class {
|
|
|
14034
13990
|
visitLiteralMap(ast) {
|
|
14035
13991
|
const properties = ast.keys.map(({ key }, idx) => {
|
|
14036
13992
|
const value = this.translate(ast.values[idx]);
|
|
14037
|
-
return
|
|
13993
|
+
return ts65.createPropertyAssignment(ts65.createStringLiteral(key), value);
|
|
14038
13994
|
});
|
|
14039
|
-
const literal2 =
|
|
13995
|
+
const literal2 = ts65.createObjectLiteral(properties, true);
|
|
14040
13996
|
const node = this.config.strictLiteralTypes ? literal2 : tsCastToAny(literal2);
|
|
14041
13997
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14042
13998
|
return node;
|
|
@@ -14044,18 +14000,18 @@ var AstTranslator = class {
|
|
|
14044
14000
|
visitLiteralPrimitive(ast) {
|
|
14045
14001
|
let node;
|
|
14046
14002
|
if (ast.value === void 0) {
|
|
14047
|
-
node =
|
|
14003
|
+
node = ts65.createIdentifier("undefined");
|
|
14048
14004
|
} else if (ast.value === null) {
|
|
14049
|
-
node =
|
|
14005
|
+
node = ts65.createNull();
|
|
14050
14006
|
} else {
|
|
14051
|
-
node =
|
|
14007
|
+
node = ts65.createLiteral(ast.value);
|
|
14052
14008
|
}
|
|
14053
14009
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14054
14010
|
return node;
|
|
14055
14011
|
}
|
|
14056
14012
|
visitNonNullAssert(ast) {
|
|
14057
14013
|
const expr = wrapForDiagnostics(this.translate(ast.expression));
|
|
14058
|
-
const node =
|
|
14014
|
+
const node = ts65.createNonNullExpression(expr);
|
|
14059
14015
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14060
14016
|
return node;
|
|
14061
14017
|
}
|
|
@@ -14064,13 +14020,13 @@ var AstTranslator = class {
|
|
|
14064
14020
|
}
|
|
14065
14021
|
visitPrefixNot(ast) {
|
|
14066
14022
|
const expression = wrapForDiagnostics(this.translate(ast.expression));
|
|
14067
|
-
const node =
|
|
14023
|
+
const node = ts65.createLogicalNot(expression);
|
|
14068
14024
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14069
14025
|
return node;
|
|
14070
14026
|
}
|
|
14071
14027
|
visitPropertyRead(ast) {
|
|
14072
14028
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14073
|
-
const name =
|
|
14029
|
+
const name = ts65.createPropertyAccess(receiver, ast.name);
|
|
14074
14030
|
addParseSpanInfo(name, ast.nameSpan);
|
|
14075
14031
|
const node = wrapForDiagnostics(name);
|
|
14076
14032
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
@@ -14078,12 +14034,12 @@ var AstTranslator = class {
|
|
|
14078
14034
|
}
|
|
14079
14035
|
visitPropertyWrite(ast) {
|
|
14080
14036
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14081
|
-
const left =
|
|
14037
|
+
const left = ts65.createPropertyAccess(receiver, ast.name);
|
|
14082
14038
|
addParseSpanInfo(left, ast.nameSpan);
|
|
14083
14039
|
const leftWithPath = wrapForDiagnostics(left);
|
|
14084
14040
|
addParseSpanInfo(leftWithPath, ast.sourceSpan);
|
|
14085
14041
|
const right = wrapForTypeChecker(this.translate(ast.value));
|
|
14086
|
-
const node = wrapForDiagnostics(
|
|
14042
|
+
const node = wrapForDiagnostics(ts65.createBinary(leftWithPath, ts65.SyntaxKind.EqualsToken, right));
|
|
14087
14043
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14088
14044
|
return node;
|
|
14089
14045
|
}
|
|
@@ -14094,13 +14050,13 @@ var AstTranslator = class {
|
|
|
14094
14050
|
let node;
|
|
14095
14051
|
const receiver = wrapForDiagnostics(this.translate(ast.receiver));
|
|
14096
14052
|
if (this.config.strictSafeNavigationTypes) {
|
|
14097
|
-
const expr =
|
|
14053
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
14098
14054
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
14099
|
-
node =
|
|
14055
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
14100
14056
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14101
|
-
node =
|
|
14057
|
+
node = ts65.createPropertyAccess(tsCastToAny(receiver), ast.name);
|
|
14102
14058
|
} else {
|
|
14103
|
-
const expr =
|
|
14059
|
+
const expr = ts65.createPropertyAccess(ts65.createNonNullExpression(receiver), ast.name);
|
|
14104
14060
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
14105
14061
|
node = tsCastToAny(expr);
|
|
14106
14062
|
}
|
|
@@ -14112,13 +14068,13 @@ var AstTranslator = class {
|
|
|
14112
14068
|
const key = this.translate(ast.key);
|
|
14113
14069
|
let node;
|
|
14114
14070
|
if (this.config.strictSafeNavigationTypes) {
|
|
14115
|
-
const expr =
|
|
14071
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14116
14072
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14117
|
-
node =
|
|
14073
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, expr, UNDEFINED));
|
|
14118
14074
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14119
|
-
node =
|
|
14075
|
+
node = ts65.createElementAccess(tsCastToAny(receiver), key);
|
|
14120
14076
|
} else {
|
|
14121
|
-
const expr =
|
|
14077
|
+
const expr = ts65.createElementAccess(ts65.createNonNullExpression(receiver), key);
|
|
14122
14078
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
14123
14079
|
node = tsCastToAny(expr);
|
|
14124
14080
|
}
|
|
@@ -14131,15 +14087,15 @@ var AstTranslator = class {
|
|
|
14131
14087
|
let node;
|
|
14132
14088
|
if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
|
|
14133
14089
|
if (this.config.strictSafeNavigationTypes) {
|
|
14134
|
-
const call =
|
|
14135
|
-
node =
|
|
14090
|
+
const call = ts65.createCall(ts65.createNonNullExpression(expr), void 0, args);
|
|
14091
|
+
node = ts65.createParen(ts65.createConditional(NULL_AS_ANY, call, UNDEFINED));
|
|
14136
14092
|
} else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
14137
|
-
node =
|
|
14093
|
+
node = ts65.createCall(tsCastToAny(expr), void 0, args);
|
|
14138
14094
|
} else {
|
|
14139
|
-
node = tsCastToAny(
|
|
14095
|
+
node = tsCastToAny(ts65.createCall(ts65.createNonNullExpression(expr), void 0, args));
|
|
14140
14096
|
}
|
|
14141
14097
|
} else {
|
|
14142
|
-
node =
|
|
14098
|
+
node = ts65.createCall(expr, void 0, args);
|
|
14143
14099
|
}
|
|
14144
14100
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
14145
14101
|
return node;
|
|
@@ -14251,7 +14207,7 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14251
14207
|
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas);
|
|
14252
14208
|
const scope = Scope.forNodes(tcb, null, tcb.boundTarget.target.template, null);
|
|
14253
14209
|
const ctxRawType = env.referenceType(ref);
|
|
14254
|
-
if (!
|
|
14210
|
+
if (!ts66.isTypeReferenceNode(ctxRawType)) {
|
|
14255
14211
|
throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
|
|
14256
14212
|
}
|
|
14257
14213
|
let typeParameters = void 0;
|
|
@@ -14263,25 +14219,25 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
|
|
|
14263
14219
|
switch (genericContextBehavior) {
|
|
14264
14220
|
case TcbGenericContextBehavior.UseEmitter:
|
|
14265
14221
|
typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
|
|
14266
|
-
typeArguments = typeParameters.map((param) =>
|
|
14222
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14267
14223
|
break;
|
|
14268
14224
|
case TcbGenericContextBehavior.CopyClassNodes:
|
|
14269
14225
|
typeParameters = [...ref.node.typeParameters];
|
|
14270
|
-
typeArguments = typeParameters.map((param) =>
|
|
14226
|
+
typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
|
|
14271
14227
|
break;
|
|
14272
14228
|
case TcbGenericContextBehavior.FallbackToAny:
|
|
14273
|
-
typeArguments = ref.node.typeParameters.map(() =>
|
|
14229
|
+
typeArguments = ref.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14274
14230
|
break;
|
|
14275
14231
|
}
|
|
14276
14232
|
}
|
|
14277
14233
|
const paramList = [tcbCtxParam(ref.node, ctxRawType.typeName, typeArguments)];
|
|
14278
14234
|
const scopeStatements = scope.render();
|
|
14279
|
-
const innerBody =
|
|
14235
|
+
const innerBody = ts66.createBlock([
|
|
14280
14236
|
...env.getPreludeStatements(),
|
|
14281
14237
|
...scopeStatements
|
|
14282
14238
|
]);
|
|
14283
|
-
const body =
|
|
14284
|
-
const fnDecl =
|
|
14239
|
+
const body = ts66.createBlock([ts66.createIf(ts66.createTrue(), innerBody, void 0)]);
|
|
14240
|
+
const fnDecl = ts66.createFunctionDeclaration(void 0, void 0, void 0, name, env.config.useContextGenericType ? typeParameters : void 0, paramList, void 0, body);
|
|
14285
14241
|
addTemplateId(fnDecl, meta.id);
|
|
14286
14242
|
return fnDecl;
|
|
14287
14243
|
}
|
|
@@ -14322,7 +14278,7 @@ var TcbVariableOp = class extends TcbOp {
|
|
|
14322
14278
|
execute() {
|
|
14323
14279
|
const ctx = this.scope.resolve(this.template);
|
|
14324
14280
|
const id = this.tcb.allocateId();
|
|
14325
|
-
const initializer =
|
|
14281
|
+
const initializer = ts66.createPropertyAccess(ctx, this.variable.value || "$implicit");
|
|
14326
14282
|
addParseSpanInfo(id, this.variable.keySpan);
|
|
14327
14283
|
let variable;
|
|
14328
14284
|
if (this.variable.valueSpan !== void 0) {
|
|
@@ -14345,7 +14301,7 @@ var TcbTemplateContextOp = class extends TcbOp {
|
|
|
14345
14301
|
}
|
|
14346
14302
|
execute() {
|
|
14347
14303
|
const ctx = this.tcb.allocateId();
|
|
14348
|
-
const type =
|
|
14304
|
+
const type = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
14349
14305
|
this.scope.addStatement(tsDeclareVariable(ctx, type));
|
|
14350
14306
|
return ctx;
|
|
14351
14307
|
}
|
|
@@ -14398,16 +14354,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
|
|
|
14398
14354
|
}
|
|
14399
14355
|
let guard = null;
|
|
14400
14356
|
if (directiveGuards.length > 0) {
|
|
14401
|
-
guard = directiveGuards.reduce((expr, dirGuard) =>
|
|
14357
|
+
guard = directiveGuards.reduce((expr, dirGuard) => ts66.createBinary(expr, ts66.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
|
|
14402
14358
|
}
|
|
14403
14359
|
const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, guard);
|
|
14404
14360
|
const statements = tmplScope.render();
|
|
14405
14361
|
if (statements.length === 0) {
|
|
14406
14362
|
return null;
|
|
14407
14363
|
}
|
|
14408
|
-
let tmplBlock =
|
|
14364
|
+
let tmplBlock = ts66.createBlock(statements);
|
|
14409
14365
|
if (guard !== null) {
|
|
14410
|
-
tmplBlock =
|
|
14366
|
+
tmplBlock = ts66.createIf(guard, tmplBlock);
|
|
14411
14367
|
}
|
|
14412
14368
|
this.scope.addStatement(tmplBlock);
|
|
14413
14369
|
return null;
|
|
@@ -14425,7 +14381,7 @@ var TcbTextInterpolationOp = class extends TcbOp {
|
|
|
14425
14381
|
}
|
|
14426
14382
|
execute() {
|
|
14427
14383
|
const expr = tcbExpression(this.binding.value, this.tcb, this.scope);
|
|
14428
|
-
this.scope.addStatement(
|
|
14384
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14429
14385
|
return null;
|
|
14430
14386
|
}
|
|
14431
14387
|
};
|
|
@@ -14447,11 +14403,11 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
|
|
|
14447
14403
|
if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
|
|
14448
14404
|
type = rawType;
|
|
14449
14405
|
} else {
|
|
14450
|
-
if (!
|
|
14406
|
+
if (!ts66.isTypeReferenceNode(rawType)) {
|
|
14451
14407
|
throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
|
|
14452
14408
|
}
|
|
14453
|
-
const typeArguments = dirRef.node.typeParameters.map(() =>
|
|
14454
|
-
type =
|
|
14409
|
+
const typeArguments = dirRef.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14410
|
+
type = ts66.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
|
|
14455
14411
|
}
|
|
14456
14412
|
const id = this.tcb.allocateId();
|
|
14457
14413
|
addExpressionIdentifier(type, ExpressionIdentifier.DIRECTIVE);
|
|
@@ -14492,11 +14448,11 @@ var TcbReferenceOp = class extends TcbOp {
|
|
|
14492
14448
|
const id = this.tcb.allocateId();
|
|
14493
14449
|
let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement3 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
|
|
14494
14450
|
if (this.target instanceof TmplAstElement3 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
|
|
14495
|
-
initializer =
|
|
14451
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14496
14452
|
} else if (this.target instanceof TmplAstTemplate2) {
|
|
14497
|
-
initializer =
|
|
14498
|
-
initializer =
|
|
14499
|
-
initializer =
|
|
14453
|
+
initializer = ts66.createAsExpression(initializer, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
14454
|
+
initializer = ts66.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
|
|
14455
|
+
initializer = ts66.createParen(initializer);
|
|
14500
14456
|
}
|
|
14501
14457
|
addParseSpanInfo(initializer, this.node.sourceSpan);
|
|
14502
14458
|
addParseSpanInfo(id, this.node.keySpan);
|
|
@@ -14586,7 +14542,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14586
14542
|
let target;
|
|
14587
14543
|
if (this.dir.coercedInputFields.has(fieldName)) {
|
|
14588
14544
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14589
|
-
if (!
|
|
14545
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14590
14546
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14591
14547
|
}
|
|
14592
14548
|
const id = this.tcb.allocateId();
|
|
@@ -14601,10 +14557,10 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14601
14557
|
}
|
|
14602
14558
|
const id = this.tcb.allocateId();
|
|
14603
14559
|
const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
|
|
14604
|
-
if (!
|
|
14560
|
+
if (!ts66.isTypeReferenceNode(dirTypeRef)) {
|
|
14605
14561
|
throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
|
|
14606
14562
|
}
|
|
14607
|
-
const type =
|
|
14563
|
+
const type = ts66.createIndexedAccessTypeNode(ts66.createTypeQueryNode(dirId), ts66.createLiteralTypeNode(ts66.createStringLiteral(fieldName)));
|
|
14608
14564
|
const temp = tsDeclareVariable(id, type);
|
|
14609
14565
|
this.scope.addStatement(temp);
|
|
14610
14566
|
target = id;
|
|
@@ -14612,18 +14568,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
14612
14568
|
if (dirId === null) {
|
|
14613
14569
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14614
14570
|
}
|
|
14615
|
-
target = this.dir.stringLiteralInputFields.has(fieldName) ?
|
|
14571
|
+
target = this.dir.stringLiteralInputFields.has(fieldName) ? ts66.createElementAccess(dirId, ts66.createStringLiteral(fieldName)) : ts66.createPropertyAccess(dirId, ts66.createIdentifier(fieldName));
|
|
14616
14572
|
}
|
|
14617
14573
|
if (input.attribute.keySpan !== void 0) {
|
|
14618
14574
|
addParseSpanInfo(target, input.attribute.keySpan);
|
|
14619
14575
|
}
|
|
14620
|
-
assignment =
|
|
14576
|
+
assignment = ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, assignment);
|
|
14621
14577
|
}
|
|
14622
14578
|
addParseSpanInfo(assignment, input.attribute.sourceSpan);
|
|
14623
14579
|
if (!this.tcb.env.config.checkTypeOfAttributes && input.attribute instanceof TmplAstTextAttribute2) {
|
|
14624
14580
|
markIgnoreDiagnostics(assignment);
|
|
14625
14581
|
}
|
|
14626
|
-
this.scope.addStatement(
|
|
14582
|
+
this.scope.addStatement(ts66.createExpressionStatement(assignment));
|
|
14627
14583
|
}
|
|
14628
14584
|
return null;
|
|
14629
14585
|
}
|
|
@@ -14642,7 +14598,7 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
|
|
|
14642
14598
|
execute() {
|
|
14643
14599
|
const id = this.tcb.allocateId();
|
|
14644
14600
|
const typeCtor = this.tcb.env.typeCtorFor(this.dir);
|
|
14645
|
-
const circularPlaceholder =
|
|
14601
|
+
const circularPlaceholder = ts66.createCall(typeCtor, void 0, [ts66.createNonNullExpression(ts66.createNull())]);
|
|
14646
14602
|
this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
|
|
14647
14603
|
return id;
|
|
14648
14604
|
}
|
|
@@ -14708,15 +14664,15 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
14708
14664
|
elId = this.scope.resolve(this.element);
|
|
14709
14665
|
}
|
|
14710
14666
|
const propertyName = ATTR_TO_PROP[binding.name] || binding.name;
|
|
14711
|
-
const prop =
|
|
14712
|
-
const stmt =
|
|
14667
|
+
const prop = ts66.createElementAccess(elId, ts66.createStringLiteral(propertyName));
|
|
14668
|
+
const stmt = ts66.createBinary(prop, ts66.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
|
|
14713
14669
|
addParseSpanInfo(stmt, binding.sourceSpan);
|
|
14714
|
-
this.scope.addStatement(
|
|
14670
|
+
this.scope.addStatement(ts66.createExpressionStatement(stmt));
|
|
14715
14671
|
} else {
|
|
14716
|
-
this.scope.addStatement(
|
|
14672
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14717
14673
|
}
|
|
14718
14674
|
} else {
|
|
14719
|
-
this.scope.addStatement(
|
|
14675
|
+
this.scope.addStatement(ts66.createExpressionStatement(expr));
|
|
14720
14676
|
}
|
|
14721
14677
|
}
|
|
14722
14678
|
return null;
|
|
@@ -14748,18 +14704,18 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
14748
14704
|
if (dirId === null) {
|
|
14749
14705
|
dirId = this.scope.resolve(this.node, this.dir);
|
|
14750
14706
|
}
|
|
14751
|
-
const outputField =
|
|
14707
|
+
const outputField = ts66.createElementAccess(dirId, ts66.createStringLiteral(field));
|
|
14752
14708
|
addParseSpanInfo(outputField, output.keySpan);
|
|
14753
14709
|
if (this.tcb.env.config.checkTypeOfOutputEvents) {
|
|
14754
14710
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14755
|
-
const subscribeFn =
|
|
14756
|
-
const call =
|
|
14711
|
+
const subscribeFn = ts66.createPropertyAccess(outputField, "subscribe");
|
|
14712
|
+
const call = ts66.createCall(subscribeFn, void 0, [handler]);
|
|
14757
14713
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14758
|
-
this.scope.addStatement(
|
|
14714
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14759
14715
|
} else {
|
|
14760
|
-
this.scope.addStatement(
|
|
14716
|
+
this.scope.addStatement(ts66.createExpressionStatement(outputField));
|
|
14761
14717
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14762
|
-
this.scope.addStatement(
|
|
14718
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14763
14719
|
}
|
|
14764
14720
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14765
14721
|
}
|
|
@@ -14792,20 +14748,20 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
14792
14748
|
if (output.type === 1) {
|
|
14793
14749
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
14794
14750
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
14795
|
-
this.scope.addStatement(
|
|
14751
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14796
14752
|
} else if (this.tcb.env.config.checkTypeOfDomEvents) {
|
|
14797
14753
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0);
|
|
14798
14754
|
if (elId === null) {
|
|
14799
14755
|
elId = this.scope.resolve(this.element);
|
|
14800
14756
|
}
|
|
14801
|
-
const propertyAccess =
|
|
14757
|
+
const propertyAccess = ts66.createPropertyAccess(elId, "addEventListener");
|
|
14802
14758
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
14803
|
-
const call =
|
|
14759
|
+
const call = ts66.createCall(propertyAccess, void 0, [ts66.createStringLiteral(output.name), handler]);
|
|
14804
14760
|
addParseSpanInfo(call, output.sourceSpan);
|
|
14805
|
-
this.scope.addStatement(
|
|
14761
|
+
this.scope.addStatement(ts66.createExpressionStatement(call));
|
|
14806
14762
|
} else {
|
|
14807
14763
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
14808
|
-
this.scope.addStatement(
|
|
14764
|
+
this.scope.addStatement(ts66.createExpressionStatement(handler));
|
|
14809
14765
|
}
|
|
14810
14766
|
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
14811
14767
|
}
|
|
@@ -14819,15 +14775,15 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
|
|
|
14819
14775
|
this.optional = false;
|
|
14820
14776
|
}
|
|
14821
14777
|
execute() {
|
|
14822
|
-
const ctx =
|
|
14823
|
-
const ctxDot =
|
|
14778
|
+
const ctx = ts66.createIdentifier("ctx");
|
|
14779
|
+
const ctxDot = ts66.createPropertyAccess(ctx, "");
|
|
14824
14780
|
markIgnoreDiagnostics(ctxDot);
|
|
14825
14781
|
addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
|
|
14826
|
-
this.scope.addStatement(
|
|
14782
|
+
this.scope.addStatement(ts66.createExpressionStatement(ctxDot));
|
|
14827
14783
|
return null;
|
|
14828
14784
|
}
|
|
14829
14785
|
};
|
|
14830
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
14786
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts66.createNonNullExpression(ts66.createNull());
|
|
14831
14787
|
var Context2 = class {
|
|
14832
14788
|
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas) {
|
|
14833
14789
|
this.env = env;
|
|
@@ -14840,7 +14796,7 @@ var Context2 = class {
|
|
|
14840
14796
|
this.nextId = 1;
|
|
14841
14797
|
}
|
|
14842
14798
|
allocateId() {
|
|
14843
|
-
return
|
|
14799
|
+
return ts66.createIdentifier(`_t${this.nextId++}`);
|
|
14844
14800
|
}
|
|
14845
14801
|
getPipeByName(name) {
|
|
14846
14802
|
if (!this.pipes.has(name)) {
|
|
@@ -14892,8 +14848,8 @@ var Scope = class {
|
|
|
14892
14848
|
resolve(node, directive) {
|
|
14893
14849
|
const res = this.resolveLocal(node, directive);
|
|
14894
14850
|
if (res !== null) {
|
|
14895
|
-
const clone =
|
|
14896
|
-
|
|
14851
|
+
const clone = ts66.getMutableClone(res);
|
|
14852
|
+
ts66.setSyntheticTrailingComments(clone, []);
|
|
14897
14853
|
return clone;
|
|
14898
14854
|
} else if (this.parent !== null) {
|
|
14899
14855
|
return this.parent.resolve(node, directive);
|
|
@@ -14921,7 +14877,7 @@ var Scope = class {
|
|
|
14921
14877
|
} else if (parentGuards === null) {
|
|
14922
14878
|
return this.guard;
|
|
14923
14879
|
} else {
|
|
14924
|
-
return
|
|
14880
|
+
return ts66.createBinary(parentGuards, ts66.SyntaxKind.AmpersandAmpersandToken, this.guard);
|
|
14925
14881
|
}
|
|
14926
14882
|
}
|
|
14927
14883
|
resolveLocal(ref, directive) {
|
|
@@ -15101,8 +15057,8 @@ var Scope = class {
|
|
|
15101
15057
|
}
|
|
15102
15058
|
};
|
|
15103
15059
|
function tcbCtxParam(node, name, typeArguments) {
|
|
15104
|
-
const type =
|
|
15105
|
-
return
|
|
15060
|
+
const type = ts66.factory.createTypeReferenceNode(name, typeArguments);
|
|
15061
|
+
return ts66.factory.createParameterDeclaration(void 0, void 0, void 0, "ctx", void 0, type, void 0);
|
|
15106
15062
|
}
|
|
15107
15063
|
function tcbExpression(ast, tcb, scope) {
|
|
15108
15064
|
const translator = new TcbExpressionTranslator(tcb, scope);
|
|
@@ -15125,11 +15081,11 @@ var TcbExpressionTranslator = class {
|
|
|
15125
15081
|
return null;
|
|
15126
15082
|
}
|
|
15127
15083
|
const expr = this.translate(ast.value);
|
|
15128
|
-
const result =
|
|
15084
|
+
const result = ts66.createParen(ts66.createBinary(target, ts66.SyntaxKind.EqualsToken, expr));
|
|
15129
15085
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15130
15086
|
return result;
|
|
15131
15087
|
} else if (ast instanceof ImplicitReceiver4) {
|
|
15132
|
-
return
|
|
15088
|
+
return ts66.createIdentifier("ctx");
|
|
15133
15089
|
} else if (ast instanceof BindingPipe) {
|
|
15134
15090
|
const expr = this.translate(ast.exp);
|
|
15135
15091
|
const pipeRef = this.tcb.getPipeByName(ast.name);
|
|
@@ -15141,19 +15097,19 @@ var TcbExpressionTranslator = class {
|
|
|
15141
15097
|
pipe = this.tcb.env.pipeInst(pipeRef);
|
|
15142
15098
|
}
|
|
15143
15099
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
15144
|
-
let methodAccess =
|
|
15100
|
+
let methodAccess = ts66.factory.createPropertyAccessExpression(pipe, "transform");
|
|
15145
15101
|
addParseSpanInfo(methodAccess, ast.nameSpan);
|
|
15146
15102
|
if (!this.tcb.env.config.checkTypeOfPipes) {
|
|
15147
|
-
methodAccess =
|
|
15103
|
+
methodAccess = ts66.factory.createAsExpression(methodAccess, ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15148
15104
|
}
|
|
15149
|
-
const result =
|
|
15105
|
+
const result = ts66.createCall(methodAccess, void 0, [expr, ...args]);
|
|
15150
15106
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15151
15107
|
return result;
|
|
15152
15108
|
} else if (ast instanceof Call2 && (ast.receiver instanceof PropertyRead2 || ast.receiver instanceof SafePropertyRead3) && !(ast.receiver.receiver instanceof ThisReceiver)) {
|
|
15153
15109
|
if (ast.receiver.name === "$any" && ast.args.length === 1) {
|
|
15154
15110
|
const expr = this.translate(ast.args[0]);
|
|
15155
|
-
const exprAsAny =
|
|
15156
|
-
const result =
|
|
15111
|
+
const exprAsAny = ts66.createAsExpression(expr, ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
|
|
15112
|
+
const result = ts66.createParen(exprAsAny);
|
|
15157
15113
|
addParseSpanInfo(result, ast.sourceSpan);
|
|
15158
15114
|
return result;
|
|
15159
15115
|
}
|
|
@@ -15164,7 +15120,7 @@ var TcbExpressionTranslator = class {
|
|
|
15164
15120
|
const method = wrapForDiagnostics(receiver);
|
|
15165
15121
|
addParseSpanInfo(method, ast.receiver.nameSpan);
|
|
15166
15122
|
const args = ast.args.map((arg) => this.translate(arg));
|
|
15167
|
-
const node =
|
|
15123
|
+
const node = ts66.createCall(method, void 0, args);
|
|
15168
15124
|
addParseSpanInfo(node, ast.sourceSpan);
|
|
15169
15125
|
return node;
|
|
15170
15126
|
} else {
|
|
@@ -15184,17 +15140,17 @@ var TcbExpressionTranslator = class {
|
|
|
15184
15140
|
function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
15185
15141
|
const typeCtor = tcb.env.typeCtorFor(dir);
|
|
15186
15142
|
const members = inputs.map((input) => {
|
|
15187
|
-
const propertyName =
|
|
15143
|
+
const propertyName = ts66.createStringLiteral(input.field);
|
|
15188
15144
|
if (input.type === "binding") {
|
|
15189
15145
|
const expr = widenBinding(input.expression, tcb);
|
|
15190
|
-
const assignment =
|
|
15146
|
+
const assignment = ts66.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
|
|
15191
15147
|
addParseSpanInfo(assignment, input.sourceSpan);
|
|
15192
15148
|
return assignment;
|
|
15193
15149
|
} else {
|
|
15194
|
-
return
|
|
15150
|
+
return ts66.createPropertyAssignment(propertyName, NULL_AS_ANY);
|
|
15195
15151
|
}
|
|
15196
15152
|
});
|
|
15197
|
-
return
|
|
15153
|
+
return ts66.createCall(typeCtor, void 0, [ts66.createObjectLiteral(members)]);
|
|
15198
15154
|
}
|
|
15199
15155
|
function getBoundInputs(directive, node, tcb) {
|
|
15200
15156
|
const boundInputs = [];
|
|
@@ -15220,17 +15176,17 @@ function translateInput(attr, tcb, scope) {
|
|
|
15220
15176
|
if (attr instanceof TmplAstBoundAttribute) {
|
|
15221
15177
|
return tcbExpression(attr.value, tcb, scope);
|
|
15222
15178
|
} else {
|
|
15223
|
-
return
|
|
15179
|
+
return ts66.createStringLiteral(attr.value);
|
|
15224
15180
|
}
|
|
15225
15181
|
}
|
|
15226
15182
|
function widenBinding(expr, tcb) {
|
|
15227
15183
|
if (!tcb.env.config.checkTypeOfInputBindings) {
|
|
15228
15184
|
return tsCastToAny(expr);
|
|
15229
15185
|
} else if (!tcb.env.config.strictNullInputBindings) {
|
|
15230
|
-
if (
|
|
15186
|
+
if (ts66.isObjectLiteralExpression(expr) || ts66.isArrayLiteralExpression(expr)) {
|
|
15231
15187
|
return expr;
|
|
15232
15188
|
} else {
|
|
15233
|
-
return
|
|
15189
|
+
return ts66.createNonNullExpression(expr);
|
|
15234
15190
|
}
|
|
15235
15191
|
} else {
|
|
15236
15192
|
return expr;
|
|
@@ -15243,18 +15199,18 @@ function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
|
15243
15199
|
if (eventType === 0) {
|
|
15244
15200
|
eventParamType = void 0;
|
|
15245
15201
|
} else if (eventType === 1) {
|
|
15246
|
-
eventParamType =
|
|
15202
|
+
eventParamType = ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword);
|
|
15247
15203
|
} else {
|
|
15248
15204
|
eventParamType = eventType;
|
|
15249
15205
|
}
|
|
15250
15206
|
const guards = scope.guards();
|
|
15251
|
-
let body =
|
|
15207
|
+
let body = ts66.createExpressionStatement(handler);
|
|
15252
15208
|
if (guards !== null) {
|
|
15253
|
-
body =
|
|
15209
|
+
body = ts66.createIf(guards, body);
|
|
15254
15210
|
}
|
|
15255
|
-
const eventParam =
|
|
15211
|
+
const eventParam = ts66.createParameter(void 0, void 0, void 0, EVENT_PARAMETER, void 0, eventParamType);
|
|
15256
15212
|
addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
|
|
15257
|
-
return
|
|
15213
|
+
return ts66.createFunctionExpression(void 0, void 0, void 0, void 0, [eventParam], ts66.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword), ts66.createBlock([body]));
|
|
15258
15214
|
}
|
|
15259
15215
|
function tcbEventHandlerExpression(ast, tcb, scope) {
|
|
15260
15216
|
const translator = new TcbEventHandlerTranslator(tcb, scope);
|
|
@@ -15282,7 +15238,7 @@ function isSplitTwoWayBinding(inputName, output, inputs, tcb) {
|
|
|
15282
15238
|
var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
15283
15239
|
resolve(ast) {
|
|
15284
15240
|
if (ast instanceof PropertyRead2 && ast.receiver instanceof ImplicitReceiver4 && !(ast.receiver instanceof ThisReceiver) && ast.name === EVENT_PARAMETER) {
|
|
15285
|
-
const event =
|
|
15241
|
+
const event = ts66.createIdentifier(EVENT_PARAMETER);
|
|
15286
15242
|
addParseSpanInfo(event, ast.nameSpan);
|
|
15287
15243
|
return event;
|
|
15288
15244
|
}
|
|
@@ -15291,32 +15247,32 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
|
|
|
15291
15247
|
};
|
|
15292
15248
|
|
|
15293
15249
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
15294
|
-
import
|
|
15250
|
+
import ts67 from "typescript";
|
|
15295
15251
|
var TypeCheckFile = class extends Environment {
|
|
15296
15252
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
15297
|
-
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector,
|
|
15253
|
+
super(config, new ImportManager(new NoopImportRewriter(), "i"), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
|
|
15298
15254
|
this.fileName = fileName;
|
|
15299
15255
|
this.nextTcbId = 1;
|
|
15300
15256
|
this.tcbStatements = [];
|
|
15301
15257
|
}
|
|
15302
15258
|
addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
15303
|
-
const fnId =
|
|
15259
|
+
const fnId = ts67.createIdentifier(`_tcb${this.nextTcbId++}`);
|
|
15304
15260
|
const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
|
|
15305
15261
|
this.tcbStatements.push(fn);
|
|
15306
15262
|
}
|
|
15307
15263
|
render(removeComments) {
|
|
15308
15264
|
let source = this.importManager.getAllImports(this.contextFile.fileName).map((i) => `import * as ${i.qualifier.text} from '${i.specifier}';`).join("\n") + "\n\n";
|
|
15309
|
-
const printer =
|
|
15265
|
+
const printer = ts67.createPrinter({ removeComments });
|
|
15310
15266
|
source += "\n";
|
|
15311
15267
|
for (const stmt of this.pipeInstStatements) {
|
|
15312
|
-
source += printer.printNode(
|
|
15268
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15313
15269
|
}
|
|
15314
15270
|
for (const stmt of this.typeCtorStatements) {
|
|
15315
|
-
source += printer.printNode(
|
|
15271
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15316
15272
|
}
|
|
15317
15273
|
source += "\n";
|
|
15318
15274
|
for (const stmt of this.tcbStatements) {
|
|
15319
|
-
source += printer.printNode(
|
|
15275
|
+
source += printer.printNode(ts67.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
15320
15276
|
}
|
|
15321
15277
|
source += "\nexport const IS_A_MODULE = true;\n";
|
|
15322
15278
|
return source;
|
|
@@ -15424,7 +15380,7 @@ var TypeCheckContextImpl = class {
|
|
|
15424
15380
|
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
15425
15381
|
const ops = this.opMap.get(sf).sort(orderOps);
|
|
15426
15382
|
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
15427
|
-
const printer =
|
|
15383
|
+
const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
|
|
15428
15384
|
let code = textParts[0];
|
|
15429
15385
|
ops.forEach((op, idx) => {
|
|
15430
15386
|
const text = op.execute(importManager, sf, this.refEmitter, printer);
|
|
@@ -15505,7 +15461,7 @@ var TypeCheckContextImpl = class {
|
|
|
15505
15461
|
if (span.start.offset === span.end.offset) {
|
|
15506
15462
|
span.end.offset++;
|
|
15507
15463
|
}
|
|
15508
|
-
return makeTemplateDiagnostic(templateId, sourceMapping, span,
|
|
15464
|
+
return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error2.msg);
|
|
15509
15465
|
});
|
|
15510
15466
|
}
|
|
15511
15467
|
};
|
|
@@ -15523,9 +15479,9 @@ var InlineTcbOp = class {
|
|
|
15523
15479
|
}
|
|
15524
15480
|
execute(im, sf, refEmitter, printer) {
|
|
15525
15481
|
const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
|
|
15526
|
-
const fnName =
|
|
15482
|
+
const fnName = ts68.createIdentifier(`_tcb_${this.ref.node.pos}`);
|
|
15527
15483
|
const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
|
|
15528
|
-
return printer.printNode(
|
|
15484
|
+
return printer.printNode(ts68.EmitHint.Unspecified, fn, sf);
|
|
15529
15485
|
}
|
|
15530
15486
|
};
|
|
15531
15487
|
var TypeCtorOp = class {
|
|
@@ -15538,7 +15494,7 @@ var TypeCtorOp = class {
|
|
|
15538
15494
|
}
|
|
15539
15495
|
execute(im, sf, refEmitter, printer) {
|
|
15540
15496
|
const tcb = generateInlineTypeCtor(this.ref.node, this.meta);
|
|
15541
|
-
return printer.printNode(
|
|
15497
|
+
return printer.printNode(ts68.EmitHint.Unspecified, tcb, sf);
|
|
15542
15498
|
}
|
|
15543
15499
|
};
|
|
15544
15500
|
function orderOps(op1, op2) {
|
|
@@ -15653,7 +15609,7 @@ var TemplateSourceManager = class {
|
|
|
15653
15609
|
|
|
15654
15610
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
15655
15611
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead3, PropertyWrite as PropertyWrite3, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
15656
|
-
import
|
|
15612
|
+
import ts69 from "typescript";
|
|
15657
15613
|
var SymbolBuilder = class {
|
|
15658
15614
|
constructor(shimPath, typeCheckBlock, templateData, componentScopeReader, getTypeChecker) {
|
|
15659
15615
|
this.shimPath = shimPath;
|
|
@@ -15696,7 +15652,7 @@ var SymbolBuilder = class {
|
|
|
15696
15652
|
getSymbolOfElement(element) {
|
|
15697
15653
|
var _a;
|
|
15698
15654
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15699
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter:
|
|
15655
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: ts69.isVariableDeclaration });
|
|
15700
15656
|
if (node === null) {
|
|
15701
15657
|
return null;
|
|
15702
15658
|
}
|
|
@@ -15715,12 +15671,12 @@ var SymbolBuilder = class {
|
|
|
15715
15671
|
var _a;
|
|
15716
15672
|
const elementSourceSpan = (_a = element.startSourceSpan) != null ? _a : element.sourceSpan;
|
|
15717
15673
|
const tcbSourceFile = this.typeCheckBlock.getSourceFile();
|
|
15718
|
-
const isDirectiveDeclaration = (node) => (
|
|
15674
|
+
const isDirectiveDeclaration = (node) => (ts69.isTypeNode(node) || ts69.isIdentifier(node)) && ts69.isVariableDeclaration(node.parent) && hasExpressionIdentifier(tcbSourceFile, node, ExpressionIdentifier.DIRECTIVE);
|
|
15719
15675
|
const nodes = findAllMatchingNodes(this.typeCheckBlock, { withSpan: elementSourceSpan, filter: isDirectiveDeclaration });
|
|
15720
15676
|
return nodes.map((node) => {
|
|
15721
15677
|
var _a2;
|
|
15722
15678
|
const symbol = this.getSymbolOfTsNode(node.parent);
|
|
15723
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15679
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15724
15680
|
return null;
|
|
15725
15681
|
}
|
|
15726
15682
|
const meta = this.getDirectiveMeta(element, symbol.tsSymbol.valueDeclaration);
|
|
@@ -15789,17 +15745,17 @@ var SymbolBuilder = class {
|
|
|
15789
15745
|
if (!isAccessExpression(n)) {
|
|
15790
15746
|
return false;
|
|
15791
15747
|
}
|
|
15792
|
-
if (
|
|
15748
|
+
if (ts69.isPropertyAccessExpression(n)) {
|
|
15793
15749
|
return n.name.getText() === expectedAccess;
|
|
15794
15750
|
} else {
|
|
15795
|
-
return
|
|
15751
|
+
return ts69.isStringLiteral(n.argumentExpression) && n.argumentExpression.text === expectedAccess;
|
|
15796
15752
|
}
|
|
15797
15753
|
}
|
|
15798
15754
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
15799
15755
|
const bindings = [];
|
|
15800
15756
|
for (const outputFieldAccess of outputFieldAccesses) {
|
|
15801
15757
|
if (consumer instanceof TmplAstTemplate3 || consumer instanceof TmplAstElement4) {
|
|
15802
|
-
if (!
|
|
15758
|
+
if (!ts69.isPropertyAccessExpression(outputFieldAccess)) {
|
|
15803
15759
|
continue;
|
|
15804
15760
|
}
|
|
15805
15761
|
const addEventListener = outputFieldAccess.name;
|
|
@@ -15818,7 +15774,7 @@ var SymbolBuilder = class {
|
|
|
15818
15774
|
shimLocation: { shimPath: this.shimPath, positionInShimFile }
|
|
15819
15775
|
});
|
|
15820
15776
|
} else {
|
|
15821
|
-
if (!
|
|
15777
|
+
if (!ts69.isElementAccessExpression(outputFieldAccess)) {
|
|
15822
15778
|
continue;
|
|
15823
15779
|
}
|
|
15824
15780
|
const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
|
|
@@ -15886,11 +15842,11 @@ var SymbolBuilder = class {
|
|
|
15886
15842
|
return null;
|
|
15887
15843
|
}
|
|
15888
15844
|
const [declaration] = tsSymbol.declarations;
|
|
15889
|
-
if (!
|
|
15845
|
+
if (!ts69.isVariableDeclaration(declaration) || !hasExpressionIdentifier(declaration.getSourceFile(), (_a = declaration.type) != null ? _a : declaration.name, ExpressionIdentifier.DIRECTIVE)) {
|
|
15890
15846
|
return null;
|
|
15891
15847
|
}
|
|
15892
15848
|
const symbol = this.getSymbolOfTsNode(declaration);
|
|
15893
|
-
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !
|
|
15849
|
+
if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts69.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
|
|
15894
15850
|
return null;
|
|
15895
15851
|
}
|
|
15896
15852
|
const ngModule = this.getDirectiveModule(symbol.tsSymbol.valueDeclaration);
|
|
@@ -15906,7 +15862,7 @@ var SymbolBuilder = class {
|
|
|
15906
15862
|
};
|
|
15907
15863
|
}
|
|
15908
15864
|
getSymbolOfVariable(variable) {
|
|
15909
|
-
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter:
|
|
15865
|
+
const node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: variable.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15910
15866
|
if (node === null || node.initializer === void 0) {
|
|
15911
15867
|
return null;
|
|
15912
15868
|
}
|
|
@@ -15928,11 +15884,11 @@ var SymbolBuilder = class {
|
|
|
15928
15884
|
}
|
|
15929
15885
|
getSymbolOfReference(ref) {
|
|
15930
15886
|
const target = this.templateData.boundTarget.getReferenceTarget(ref);
|
|
15931
|
-
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter:
|
|
15887
|
+
let node = findFirstMatchingNode(this.typeCheckBlock, { withSpan: ref.sourceSpan, filter: ts69.isVariableDeclaration });
|
|
15932
15888
|
if (node === null || target === null || node.initializer === void 0) {
|
|
15933
15889
|
return null;
|
|
15934
15890
|
}
|
|
15935
|
-
const originalDeclaration =
|
|
15891
|
+
const originalDeclaration = ts69.isParenthesizedExpression(node.initializer) && ts69.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
|
|
15936
15892
|
if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
|
|
15937
15893
|
return null;
|
|
15938
15894
|
}
|
|
@@ -15955,7 +15911,7 @@ var SymbolBuilder = class {
|
|
|
15955
15911
|
referenceVarLocation: referenceVarShimLocation
|
|
15956
15912
|
};
|
|
15957
15913
|
} else {
|
|
15958
|
-
if (!
|
|
15914
|
+
if (!ts69.isClassDeclaration(target.directive.ref.node)) {
|
|
15959
15915
|
return null;
|
|
15960
15916
|
}
|
|
15961
15917
|
return {
|
|
@@ -15970,7 +15926,7 @@ var SymbolBuilder = class {
|
|
|
15970
15926
|
}
|
|
15971
15927
|
}
|
|
15972
15928
|
getSymbolOfPipe(expression) {
|
|
15973
|
-
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter:
|
|
15929
|
+
const methodAccess = findFirstMatchingNode(this.typeCheckBlock, { withSpan: expression.nameSpan, filter: ts69.isPropertyAccessExpression });
|
|
15974
15930
|
if (methodAccess === null) {
|
|
15975
15931
|
return null;
|
|
15976
15932
|
}
|
|
@@ -16009,7 +15965,7 @@ var SymbolBuilder = class {
|
|
|
16009
15965
|
}
|
|
16010
15966
|
let node = null;
|
|
16011
15967
|
if (expression instanceof PropertyRead3) {
|
|
16012
|
-
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter:
|
|
15968
|
+
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: ts69.isPropertyAccessExpression });
|
|
16013
15969
|
}
|
|
16014
15970
|
if (node === null) {
|
|
16015
15971
|
node = findFirstMatchingNode(this.typeCheckBlock, { withSpan, filter: anyNodeFilter });
|
|
@@ -16017,10 +15973,10 @@ var SymbolBuilder = class {
|
|
|
16017
15973
|
if (node === null) {
|
|
16018
15974
|
return null;
|
|
16019
15975
|
}
|
|
16020
|
-
while (
|
|
15976
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
16021
15977
|
node = node.expression;
|
|
16022
15978
|
}
|
|
16023
|
-
if (expression instanceof SafePropertyRead4 &&
|
|
15979
|
+
if (expression instanceof SafePropertyRead4 && ts69.isConditionalExpression(node)) {
|
|
16024
15980
|
const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
|
|
16025
15981
|
if (whenTrueSymbol === null) {
|
|
16026
15982
|
return null;
|
|
@@ -16036,13 +15992,13 @@ var SymbolBuilder = class {
|
|
|
16036
15992
|
}
|
|
16037
15993
|
getSymbolOfTsNode(node) {
|
|
16038
15994
|
var _a;
|
|
16039
|
-
while (
|
|
15995
|
+
while (ts69.isParenthesizedExpression(node)) {
|
|
16040
15996
|
node = node.expression;
|
|
16041
15997
|
}
|
|
16042
15998
|
let tsSymbol;
|
|
16043
|
-
if (
|
|
15999
|
+
if (ts69.isPropertyAccessExpression(node)) {
|
|
16044
16000
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
|
|
16045
|
-
} else if (
|
|
16001
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
16046
16002
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.argumentExpression);
|
|
16047
16003
|
} else {
|
|
16048
16004
|
tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
|
|
@@ -16056,13 +16012,13 @@ var SymbolBuilder = class {
|
|
|
16056
16012
|
};
|
|
16057
16013
|
}
|
|
16058
16014
|
getShimPositionForNode(node) {
|
|
16059
|
-
if (
|
|
16015
|
+
if (ts69.isTypeReferenceNode(node)) {
|
|
16060
16016
|
return this.getShimPositionForNode(node.typeName);
|
|
16061
|
-
} else if (
|
|
16017
|
+
} else if (ts69.isQualifiedName(node)) {
|
|
16062
16018
|
return node.right.getStart();
|
|
16063
|
-
} else if (
|
|
16019
|
+
} else if (ts69.isPropertyAccessExpression(node)) {
|
|
16064
16020
|
return node.name.getStart();
|
|
16065
|
-
} else if (
|
|
16021
|
+
} else if (ts69.isElementAccessExpression(node)) {
|
|
16066
16022
|
return node.argumentExpression.getStart();
|
|
16067
16023
|
} else {
|
|
16068
16024
|
return node.getStart();
|
|
@@ -16613,7 +16569,7 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
16613
16569
|
|
|
16614
16570
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
16615
16571
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
16616
|
-
import
|
|
16572
|
+
import ts70 from "typescript";
|
|
16617
16573
|
|
|
16618
16574
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
16619
16575
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
@@ -16706,7 +16662,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16706
16662
|
return [];
|
|
16707
16663
|
const boundSyntax = node.sourceSpan.toString();
|
|
16708
16664
|
const expectedBoundSyntax = boundSyntax.replace(`(${name})`, `[(${name.slice(1, -1)})]`);
|
|
16709
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, node.sourceSpan,
|
|
16665
|
+
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, node.sourceSpan, ts70.DiagnosticCategory.Warning, ErrorCode.INVALID_BANANA_IN_BOX, `In the two-way binding syntax the parentheses should be inside the brackets, ex. '${expectedBoundSyntax}'.
|
|
16710
16666
|
Find more at https://angular.io/guide/two-way-binding`);
|
|
16711
16667
|
return [diagnostic];
|
|
16712
16668
|
}
|
|
@@ -16714,7 +16670,7 @@ var InvalidBananaInBoxCheck = class extends TemplateCheckWithVisitor {
|
|
|
16714
16670
|
|
|
16715
16671
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
16716
16672
|
import { Binary } from "@angular/compiler";
|
|
16717
|
-
import
|
|
16673
|
+
import ts71 from "typescript";
|
|
16718
16674
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
16719
16675
|
constructor() {
|
|
16720
16676
|
super(...arguments);
|
|
@@ -16735,7 +16691,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
16735
16691
|
return [];
|
|
16736
16692
|
}
|
|
16737
16693
|
const span = ctx.templateTypeChecker.getTemplateMappingAtShimLocation(symbol.shimLocation).span;
|
|
16738
|
-
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, span,
|
|
16694
|
+
const diagnostic = ctx.templateTypeChecker.makeTemplateDiagnostic(component, span, ts71.DiagnosticCategory.Warning, ErrorCode.NULLISH_COALESCING_NOT_NULLABLE, `The left side of this nullish coalescing operation does not include 'null' or 'undefined' in its type, therefore the '??' operator can be safely removed.`);
|
|
16739
16695
|
return [diagnostic];
|
|
16740
16696
|
}
|
|
16741
16697
|
};
|
|
@@ -16824,7 +16780,7 @@ var NgCompiler = class {
|
|
|
16824
16780
|
this.currentProgram = inputProgram;
|
|
16825
16781
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
16826
16782
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
16827
|
-
const moduleResolutionCache =
|
|
16783
|
+
const moduleResolutionCache = ts72.createModuleResolutionCache(this.adapter.getCurrentDirectory(), this.adapter.getCanonicalFileName.bind(this.adapter));
|
|
16828
16784
|
this.moduleResolver = new ModuleResolver(inputProgram, this.options, this.adapter, moduleResolutionCache);
|
|
16829
16785
|
this.resourceManager = new AdapterResourceLoader(adapter, this.options);
|
|
16830
16786
|
this.cycleAnalyzer = new CycleAnalyzer(new ImportGraph(inputProgram.getTypeChecker(), this.delegatingPerfRecorder));
|
|
@@ -16880,7 +16836,7 @@ var NgCompiler = class {
|
|
|
16880
16836
|
}
|
|
16881
16837
|
for (const clazz of classesToUpdate) {
|
|
16882
16838
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
16883
|
-
if (!
|
|
16839
|
+
if (!ts72.isClassDeclaration(clazz)) {
|
|
16884
16840
|
continue;
|
|
16885
16841
|
}
|
|
16886
16842
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -17019,7 +16975,6 @@ var NgCompiler = class {
|
|
|
17019
16975
|
if (this.adapter.factoryTracker !== null) {
|
|
17020
16976
|
before.push(generatedFactoryTransform(this.adapter.factoryTracker.sourceInfo, importRewriter));
|
|
17021
16977
|
}
|
|
17022
|
-
before.push(ivySwitchTransform);
|
|
17023
16978
|
return { transformers: { before, afterDeclarations } };
|
|
17024
16979
|
}
|
|
17025
16980
|
getIndexedComponents() {
|
|
@@ -17290,17 +17245,17 @@ function isAngularCorePackage(program) {
|
|
|
17290
17245
|
return false;
|
|
17291
17246
|
}
|
|
17292
17247
|
return r3Symbols.statements.some((stmt) => {
|
|
17293
|
-
if (!
|
|
17248
|
+
if (!ts72.isVariableStatement(stmt)) {
|
|
17294
17249
|
return false;
|
|
17295
17250
|
}
|
|
17296
|
-
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind ===
|
|
17251
|
+
if (stmt.modifiers === void 0 || !stmt.modifiers.some((mod) => mod.kind === ts72.SyntaxKind.ExportKeyword)) {
|
|
17297
17252
|
return false;
|
|
17298
17253
|
}
|
|
17299
17254
|
return stmt.declarationList.declarations.some((decl) => {
|
|
17300
|
-
if (!
|
|
17255
|
+
if (!ts72.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
17301
17256
|
return false;
|
|
17302
17257
|
}
|
|
17303
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
17258
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts72.SyntaxKind.TrueKeyword) {
|
|
17304
17259
|
return false;
|
|
17305
17260
|
}
|
|
17306
17261
|
return true;
|
|
@@ -17313,7 +17268,7 @@ function getR3SymbolsFile(program) {
|
|
|
17313
17268
|
function verifyCompatibleTypeCheckOptions(options) {
|
|
17314
17269
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
17315
17270
|
return {
|
|
17316
|
-
category:
|
|
17271
|
+
category: ts72.DiagnosticCategory.Error,
|
|
17317
17272
|
code: ngErrorCode(ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK),
|
|
17318
17273
|
file: void 0,
|
|
17319
17274
|
start: void 0,
|
|
@@ -17341,7 +17296,7 @@ var ReferenceGraphAdapter = class {
|
|
|
17341
17296
|
for (const { node } of references) {
|
|
17342
17297
|
let sourceFile = node.getSourceFile();
|
|
17343
17298
|
if (sourceFile === void 0) {
|
|
17344
|
-
sourceFile =
|
|
17299
|
+
sourceFile = ts72.getOriginalNode(node).getSourceFile();
|
|
17345
17300
|
}
|
|
17346
17301
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
17347
17302
|
this.graph.add(source, node);
|
|
@@ -17381,7 +17336,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
17381
17336
|
|
|
17382
17337
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
17383
17338
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
17384
|
-
import
|
|
17339
|
+
import ts75 from "typescript";
|
|
17385
17340
|
|
|
17386
17341
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
17387
17342
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -17439,7 +17394,7 @@ function getPathNormalizer(basePath) {
|
|
|
17439
17394
|
}
|
|
17440
17395
|
|
|
17441
17396
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17442
|
-
import
|
|
17397
|
+
import ts73 from "typescript";
|
|
17443
17398
|
|
|
17444
17399
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/typescript_version.mjs
|
|
17445
17400
|
function toNumbers(value) {
|
|
@@ -17479,7 +17434,7 @@ function compareVersions(v1, v2) {
|
|
|
17479
17434
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
17480
17435
|
var MIN_TS_VERSION = "4.4.2";
|
|
17481
17436
|
var MAX_TS_VERSION = "4.5.0";
|
|
17482
|
-
var tsVersion =
|
|
17437
|
+
var tsVersion = ts73.version;
|
|
17483
17438
|
function checkVersion(version, minVersion, maxVersion) {
|
|
17484
17439
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
17485
17440
|
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
@@ -17490,7 +17445,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
17490
17445
|
}
|
|
17491
17446
|
|
|
17492
17447
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
17493
|
-
import
|
|
17448
|
+
import ts74 from "typescript";
|
|
17494
17449
|
var DelegatingCompilerHost2 = class {
|
|
17495
17450
|
constructor(delegate) {
|
|
17496
17451
|
this.delegate = delegate;
|
|
@@ -17579,7 +17534,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17579
17534
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
17580
17535
|
if (entryPoint === null) {
|
|
17581
17536
|
diagnostics.push({
|
|
17582
|
-
category:
|
|
17537
|
+
category: ts74.DiagnosticCategory.Error,
|
|
17583
17538
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
17584
17539
|
file: void 0,
|
|
17585
17540
|
start: void 0,
|
|
@@ -17619,10 +17574,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
17619
17574
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
17620
17575
|
}
|
|
17621
17576
|
createCachedResolveModuleNamesFunction() {
|
|
17622
|
-
const moduleResolutionCache =
|
|
17577
|
+
const moduleResolutionCache = ts74.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
17623
17578
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
17624
17579
|
return moduleNames.map((moduleName) => {
|
|
17625
|
-
const module2 =
|
|
17580
|
+
const module2 = ts74.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
17626
17581
|
return module2.resolvedModule;
|
|
17627
17582
|
});
|
|
17628
17583
|
};
|
|
@@ -17643,7 +17598,7 @@ var NgtscProgram = class {
|
|
|
17643
17598
|
if (reuseProgram !== void 0) {
|
|
17644
17599
|
retagAllTsFiles(reuseProgram);
|
|
17645
17600
|
}
|
|
17646
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
17601
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts75.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
17647
17602
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
17648
17603
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
17649
17604
|
this.host.postProgramCreationCleanup();
|
|
@@ -17843,10 +17798,10 @@ function mergeEmitResults(emitResults) {
|
|
|
17843
17798
|
}
|
|
17844
17799
|
|
|
17845
17800
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
17846
|
-
import
|
|
17801
|
+
import ts77 from "typescript";
|
|
17847
17802
|
|
|
17848
17803
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
17849
|
-
import
|
|
17804
|
+
import ts76 from "typescript";
|
|
17850
17805
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
17851
17806
|
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
17852
17807
|
if (!isTransformationContextWithEmitResolver(context)) {
|
|
@@ -17871,7 +17826,7 @@ function loadIsReferencedAliasDeclarationPatch(context) {
|
|
|
17871
17826
|
return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
|
|
17872
17827
|
}
|
|
17873
17828
|
function isAliasImportDeclaration(node) {
|
|
17874
|
-
return
|
|
17829
|
+
return ts76.isImportSpecifier(node) || ts76.isNamespaceImport(node) || ts76.isImportClause(node);
|
|
17875
17830
|
}
|
|
17876
17831
|
function isTransformationContextWithEmitResolver(context) {
|
|
17877
17832
|
return context.getEmitResolver !== void 0;
|
|
@@ -17889,19 +17844,19 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17889
17844
|
const metadataProperties = [];
|
|
17890
17845
|
const expr = decorator.expression;
|
|
17891
17846
|
switch (expr.kind) {
|
|
17892
|
-
case
|
|
17893
|
-
metadataProperties.push(
|
|
17847
|
+
case ts77.SyntaxKind.Identifier:
|
|
17848
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", expr));
|
|
17894
17849
|
break;
|
|
17895
|
-
case
|
|
17850
|
+
case ts77.SyntaxKind.CallExpression:
|
|
17896
17851
|
const call = expr;
|
|
17897
|
-
metadataProperties.push(
|
|
17852
|
+
metadataProperties.push(ts77.createPropertyAssignment("type", call.expression));
|
|
17898
17853
|
if (call.arguments.length) {
|
|
17899
17854
|
const args = [];
|
|
17900
17855
|
for (const arg of call.arguments) {
|
|
17901
17856
|
args.push(arg);
|
|
17902
17857
|
}
|
|
17903
|
-
const argsArrayLiteral =
|
|
17904
|
-
metadataProperties.push(
|
|
17858
|
+
const argsArrayLiteral = ts77.createArrayLiteral(ts77.createNodeArray(args, true));
|
|
17859
|
+
metadataProperties.push(ts77.createPropertyAssignment("args", argsArrayLiteral));
|
|
17905
17860
|
}
|
|
17906
17861
|
break;
|
|
17907
17862
|
default:
|
|
@@ -17909,38 +17864,38 @@ function extractMetadataFromSingleDecorator(decorator, diagnostics) {
|
|
|
17909
17864
|
file: decorator.getSourceFile(),
|
|
17910
17865
|
start: decorator.getStart(),
|
|
17911
17866
|
length: decorator.getEnd() - decorator.getStart(),
|
|
17912
|
-
messageText: `${
|
|
17913
|
-
category:
|
|
17867
|
+
messageText: `${ts77.SyntaxKind[decorator.kind]} not implemented in gathering decorator metadata.`,
|
|
17868
|
+
category: ts77.DiagnosticCategory.Error,
|
|
17914
17869
|
code: 0
|
|
17915
17870
|
});
|
|
17916
17871
|
break;
|
|
17917
17872
|
}
|
|
17918
|
-
return
|
|
17873
|
+
return ts77.createObjectLiteral(metadataProperties);
|
|
17919
17874
|
}
|
|
17920
17875
|
function createCtorParametersClassProperty(diagnostics, entityNameToExpression, ctorParameters, isClosureCompilerEnabled) {
|
|
17921
17876
|
const params = [];
|
|
17922
17877
|
for (const ctorParam of ctorParameters) {
|
|
17923
17878
|
if (!ctorParam.type && ctorParam.decorators.length === 0) {
|
|
17924
|
-
params.push(
|
|
17879
|
+
params.push(ts77.createNull());
|
|
17925
17880
|
continue;
|
|
17926
17881
|
}
|
|
17927
17882
|
const paramType = ctorParam.type ? typeReferenceToExpression(entityNameToExpression, ctorParam.type) : void 0;
|
|
17928
|
-
const members = [
|
|
17883
|
+
const members = [ts77.createPropertyAssignment("type", paramType || ts77.createIdentifier("undefined"))];
|
|
17929
17884
|
const decorators = [];
|
|
17930
17885
|
for (const deco of ctorParam.decorators) {
|
|
17931
17886
|
decorators.push(extractMetadataFromSingleDecorator(deco, diagnostics));
|
|
17932
17887
|
}
|
|
17933
17888
|
if (decorators.length) {
|
|
17934
|
-
members.push(
|
|
17889
|
+
members.push(ts77.createPropertyAssignment("decorators", ts77.createArrayLiteral(decorators)));
|
|
17935
17890
|
}
|
|
17936
|
-
params.push(
|
|
17891
|
+
params.push(ts77.createObjectLiteral(members));
|
|
17937
17892
|
}
|
|
17938
|
-
const initializer =
|
|
17939
|
-
const ctorProp =
|
|
17893
|
+
const initializer = ts77.createArrowFunction(void 0, void 0, [], void 0, ts77.createToken(ts77.SyntaxKind.EqualsGreaterThanToken), ts77.createArrayLiteral(params, true));
|
|
17894
|
+
const ctorProp = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "ctorParameters", void 0, void 0, initializer);
|
|
17940
17895
|
if (isClosureCompilerEnabled) {
|
|
17941
|
-
|
|
17896
|
+
ts77.setSyntheticLeadingComments(ctorProp, [
|
|
17942
17897
|
{
|
|
17943
|
-
kind:
|
|
17898
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
17944
17899
|
text: [
|
|
17945
17900
|
`*`,
|
|
17946
17901
|
` * @type {function(): !Array<(null|{`,
|
|
@@ -17960,53 +17915,53 @@ function createCtorParametersClassProperty(diagnostics, entityNameToExpression,
|
|
|
17960
17915
|
}
|
|
17961
17916
|
function typeReferenceToExpression(entityNameToExpression, node) {
|
|
17962
17917
|
let kind = node.kind;
|
|
17963
|
-
if (
|
|
17918
|
+
if (ts77.isLiteralTypeNode(node)) {
|
|
17964
17919
|
kind = node.literal.kind;
|
|
17965
17920
|
}
|
|
17966
17921
|
switch (kind) {
|
|
17967
|
-
case
|
|
17968
|
-
case
|
|
17969
|
-
return
|
|
17970
|
-
case
|
|
17971
|
-
case
|
|
17972
|
-
return
|
|
17973
|
-
case
|
|
17974
|
-
case
|
|
17975
|
-
case
|
|
17976
|
-
case
|
|
17977
|
-
return
|
|
17978
|
-
case
|
|
17979
|
-
case
|
|
17980
|
-
return
|
|
17981
|
-
case
|
|
17982
|
-
return
|
|
17983
|
-
case
|
|
17984
|
-
case
|
|
17985
|
-
return
|
|
17986
|
-
case
|
|
17922
|
+
case ts77.SyntaxKind.FunctionType:
|
|
17923
|
+
case ts77.SyntaxKind.ConstructorType:
|
|
17924
|
+
return ts77.createIdentifier("Function");
|
|
17925
|
+
case ts77.SyntaxKind.ArrayType:
|
|
17926
|
+
case ts77.SyntaxKind.TupleType:
|
|
17927
|
+
return ts77.createIdentifier("Array");
|
|
17928
|
+
case ts77.SyntaxKind.TypePredicate:
|
|
17929
|
+
case ts77.SyntaxKind.TrueKeyword:
|
|
17930
|
+
case ts77.SyntaxKind.FalseKeyword:
|
|
17931
|
+
case ts77.SyntaxKind.BooleanKeyword:
|
|
17932
|
+
return ts77.createIdentifier("Boolean");
|
|
17933
|
+
case ts77.SyntaxKind.StringLiteral:
|
|
17934
|
+
case ts77.SyntaxKind.StringKeyword:
|
|
17935
|
+
return ts77.createIdentifier("String");
|
|
17936
|
+
case ts77.SyntaxKind.ObjectKeyword:
|
|
17937
|
+
return ts77.createIdentifier("Object");
|
|
17938
|
+
case ts77.SyntaxKind.NumberKeyword:
|
|
17939
|
+
case ts77.SyntaxKind.NumericLiteral:
|
|
17940
|
+
return ts77.createIdentifier("Number");
|
|
17941
|
+
case ts77.SyntaxKind.TypeReference:
|
|
17987
17942
|
const typeRef = node;
|
|
17988
17943
|
return entityNameToExpression(typeRef.typeName);
|
|
17989
|
-
case
|
|
17990
|
-
const childTypeNodes = node.types.filter((t) => !(
|
|
17944
|
+
case ts77.SyntaxKind.UnionType:
|
|
17945
|
+
const childTypeNodes = node.types.filter((t) => !(ts77.isLiteralTypeNode(t) && t.literal.kind === ts77.SyntaxKind.NullKeyword));
|
|
17991
17946
|
return childTypeNodes.length === 1 ? typeReferenceToExpression(entityNameToExpression, childTypeNodes[0]) : void 0;
|
|
17992
17947
|
default:
|
|
17993
17948
|
return void 0;
|
|
17994
17949
|
}
|
|
17995
17950
|
}
|
|
17996
17951
|
function symbolIsRuntimeValue(typeChecker, symbol) {
|
|
17997
|
-
if (symbol.flags &
|
|
17952
|
+
if (symbol.flags & ts77.SymbolFlags.Alias) {
|
|
17998
17953
|
symbol = typeChecker.getAliasedSymbol(symbol);
|
|
17999
17954
|
}
|
|
18000
|
-
return (symbol.flags &
|
|
17955
|
+
return (symbol.flags & ts77.SymbolFlags.Value & ts77.SymbolFlags.ConstEnumExcludes) !== 0;
|
|
18001
17956
|
}
|
|
18002
17957
|
function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore, isClosureCompilerEnabled, skipClassDecorators) {
|
|
18003
17958
|
function addJSDocTypeAnnotation(node, jsdocType) {
|
|
18004
17959
|
if (!isClosureCompilerEnabled) {
|
|
18005
17960
|
return;
|
|
18006
17961
|
}
|
|
18007
|
-
|
|
17962
|
+
ts77.setSyntheticLeadingComments(node, [
|
|
18008
17963
|
{
|
|
18009
|
-
kind:
|
|
17964
|
+
kind: ts77.SyntaxKind.MultiLineCommentTrivia,
|
|
18010
17965
|
text: `* @type {${jsdocType}} `,
|
|
18011
17966
|
pos: -1,
|
|
18012
17967
|
end: -1,
|
|
@@ -18015,19 +17970,19 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18015
17970
|
]);
|
|
18016
17971
|
}
|
|
18017
17972
|
function createDecoratorClassProperty(decoratorList) {
|
|
18018
|
-
const modifier =
|
|
18019
|
-
const initializer =
|
|
18020
|
-
const prop =
|
|
17973
|
+
const modifier = ts77.createToken(ts77.SyntaxKind.StaticKeyword);
|
|
17974
|
+
const initializer = ts77.createArrayLiteral(decoratorList, true);
|
|
17975
|
+
const prop = ts77.createProperty(void 0, [modifier], "decorators", void 0, void 0, initializer);
|
|
18021
17976
|
addJSDocTypeAnnotation(prop, DECORATOR_INVOCATION_JSDOC_TYPE);
|
|
18022
17977
|
return prop;
|
|
18023
17978
|
}
|
|
18024
17979
|
function createPropDecoratorsClassProperty(diagnostics2, properties) {
|
|
18025
17980
|
const entries = [];
|
|
18026
17981
|
for (const [name, decorators] of properties.entries()) {
|
|
18027
|
-
entries.push(
|
|
17982
|
+
entries.push(ts77.createPropertyAssignment(name, ts77.createArrayLiteral(decorators.map((deco) => extractMetadataFromSingleDecorator(deco, diagnostics2)))));
|
|
18028
17983
|
}
|
|
18029
|
-
const initializer =
|
|
18030
|
-
const prop =
|
|
17984
|
+
const initializer = ts77.createObjectLiteral(entries, true);
|
|
17985
|
+
const prop = ts77.createProperty(void 0, [ts77.createToken(ts77.SyntaxKind.StaticKeyword)], "propDecorators", void 0, void 0, initializer);
|
|
18031
17986
|
addJSDocTypeAnnotation(prop, `!Object<string, ${DECORATOR_INVOCATION_JSDOC_TYPE}>`);
|
|
18032
17987
|
return prop;
|
|
18033
17988
|
}
|
|
@@ -18038,24 +17993,24 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18038
17993
|
if (!symbol || !symbolIsRuntimeValue(typeChecker, symbol) || !symbol.declarations || symbol.declarations.length === 0) {
|
|
18039
17994
|
return void 0;
|
|
18040
17995
|
}
|
|
18041
|
-
if (
|
|
17996
|
+
if (ts77.isQualifiedName(name)) {
|
|
18042
17997
|
const containerExpr = entityNameToExpression(name.left);
|
|
18043
17998
|
if (containerExpr === void 0) {
|
|
18044
17999
|
return void 0;
|
|
18045
18000
|
}
|
|
18046
|
-
return
|
|
18001
|
+
return ts77.createPropertyAccess(containerExpr, name.right);
|
|
18047
18002
|
}
|
|
18048
18003
|
const decl = symbol.declarations[0];
|
|
18049
18004
|
if (isAliasImportDeclaration(decl)) {
|
|
18050
18005
|
referencedParameterTypes.add(decl);
|
|
18051
18006
|
if (decl.name !== void 0) {
|
|
18052
|
-
return
|
|
18007
|
+
return ts77.getMutableClone(decl.name);
|
|
18053
18008
|
}
|
|
18054
18009
|
}
|
|
18055
|
-
return
|
|
18010
|
+
return ts77.getMutableClone(name);
|
|
18056
18011
|
}
|
|
18057
18012
|
function transformClassElement(element) {
|
|
18058
|
-
element =
|
|
18013
|
+
element = ts77.visitEachChild(element, decoratorDownlevelVisitor, context);
|
|
18059
18014
|
const decoratorsToKeep = [];
|
|
18060
18015
|
const toLower = [];
|
|
18061
18016
|
const decorators = host.getDecoratorsOfDeclaration(element) || [];
|
|
@@ -18069,26 +18024,26 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18069
18024
|
}
|
|
18070
18025
|
if (!toLower.length)
|
|
18071
18026
|
return [void 0, element, []];
|
|
18072
|
-
if (!element.name || !
|
|
18027
|
+
if (!element.name || !ts77.isIdentifier(element.name)) {
|
|
18073
18028
|
diagnostics.push({
|
|
18074
18029
|
file: element.getSourceFile(),
|
|
18075
18030
|
start: element.getStart(),
|
|
18076
18031
|
length: element.getEnd() - element.getStart(),
|
|
18077
18032
|
messageText: `Cannot process decorators for class element with non-analyzable name.`,
|
|
18078
|
-
category:
|
|
18033
|
+
category: ts77.DiagnosticCategory.Error,
|
|
18079
18034
|
code: 0
|
|
18080
18035
|
});
|
|
18081
18036
|
return [void 0, element, []];
|
|
18082
18037
|
}
|
|
18083
18038
|
const name = element.name.text;
|
|
18084
|
-
const mutable =
|
|
18085
|
-
mutable.decorators = decoratorsToKeep.length ?
|
|
18039
|
+
const mutable = ts77.getMutableClone(element);
|
|
18040
|
+
mutable.decorators = decoratorsToKeep.length ? ts77.setTextRange(ts77.createNodeArray(decoratorsToKeep), mutable.decorators) : void 0;
|
|
18086
18041
|
return [name, mutable, toLower];
|
|
18087
18042
|
}
|
|
18088
18043
|
function transformConstructor(ctor) {
|
|
18089
|
-
ctor =
|
|
18044
|
+
ctor = ts77.visitEachChild(ctor, decoratorDownlevelVisitor, context);
|
|
18090
18045
|
const newParameters = [];
|
|
18091
|
-
const oldParameters =
|
|
18046
|
+
const oldParameters = ctor.parameters;
|
|
18092
18047
|
const parametersInfo = [];
|
|
18093
18048
|
for (const param of oldParameters) {
|
|
18094
18049
|
const decoratorsToKeep = [];
|
|
@@ -18106,30 +18061,30 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18106
18061
|
paramInfo.type = param.type;
|
|
18107
18062
|
}
|
|
18108
18063
|
parametersInfo.push(paramInfo);
|
|
18109
|
-
const newParam =
|
|
18064
|
+
const newParam = ts77.updateParameter(param, decoratorsToKeep.length ? decoratorsToKeep : void 0, param.modifiers, param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
18110
18065
|
newParameters.push(newParam);
|
|
18111
18066
|
}
|
|
18112
|
-
const updated =
|
|
18067
|
+
const updated = ts77.updateConstructor(ctor, ctor.decorators, ctor.modifiers, newParameters, ctor.body);
|
|
18113
18068
|
return [updated, parametersInfo];
|
|
18114
18069
|
}
|
|
18115
18070
|
function transformClassDeclaration(classDecl) {
|
|
18116
|
-
classDecl =
|
|
18071
|
+
classDecl = ts77.getMutableClone(classDecl);
|
|
18117
18072
|
const newMembers = [];
|
|
18118
18073
|
const decoratedProperties = new Map();
|
|
18119
18074
|
let classParameters = null;
|
|
18120
18075
|
for (const member of classDecl.members) {
|
|
18121
18076
|
switch (member.kind) {
|
|
18122
|
-
case
|
|
18123
|
-
case
|
|
18124
|
-
case
|
|
18125
|
-
case
|
|
18077
|
+
case ts77.SyntaxKind.PropertyDeclaration:
|
|
18078
|
+
case ts77.SyntaxKind.GetAccessor:
|
|
18079
|
+
case ts77.SyntaxKind.SetAccessor:
|
|
18080
|
+
case ts77.SyntaxKind.MethodDeclaration: {
|
|
18126
18081
|
const [name, newMember, decorators] = transformClassElement(member);
|
|
18127
18082
|
newMembers.push(newMember);
|
|
18128
18083
|
if (name)
|
|
18129
18084
|
decoratedProperties.set(name, decorators);
|
|
18130
18085
|
continue;
|
|
18131
18086
|
}
|
|
18132
|
-
case
|
|
18087
|
+
case ts77.SyntaxKind.Constructor: {
|
|
18133
18088
|
const ctor = member;
|
|
18134
18089
|
if (!ctor.body)
|
|
18135
18090
|
break;
|
|
@@ -18141,7 +18096,7 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18141
18096
|
default:
|
|
18142
18097
|
break;
|
|
18143
18098
|
}
|
|
18144
|
-
newMembers.push(
|
|
18099
|
+
newMembers.push(ts77.visitEachChild(member, decoratorDownlevelVisitor, context));
|
|
18145
18100
|
}
|
|
18146
18101
|
const decoratorsToKeep = new Set(classDecl.decorators);
|
|
18147
18102
|
const possibleAngularDecorators = host.getDecoratorsOfDeclaration(classDecl) || [];
|
|
@@ -18169,23 +18124,23 @@ function getDownlevelDecoratorsTransform(typeChecker, host, diagnostics, isCore,
|
|
|
18169
18124
|
if (decoratedProperties.size) {
|
|
18170
18125
|
newMembers.push(createPropDecoratorsClassProperty(diagnostics, decoratedProperties));
|
|
18171
18126
|
}
|
|
18172
|
-
const members =
|
|
18173
|
-
return
|
|
18127
|
+
const members = ts77.setTextRange(ts77.createNodeArray(newMembers, classDecl.members.hasTrailingComma), classDecl.members);
|
|
18128
|
+
return ts77.updateClassDeclaration(classDecl, decoratorsToKeep.size ? Array.from(decoratorsToKeep) : void 0, classDecl.modifiers, classDecl.name, classDecl.typeParameters, classDecl.heritageClauses, members);
|
|
18174
18129
|
}
|
|
18175
18130
|
function decoratorDownlevelVisitor(node) {
|
|
18176
|
-
if (
|
|
18131
|
+
if (ts77.isClassDeclaration(node)) {
|
|
18177
18132
|
return transformClassDeclaration(node);
|
|
18178
18133
|
}
|
|
18179
|
-
return
|
|
18134
|
+
return ts77.visitEachChild(node, decoratorDownlevelVisitor, context);
|
|
18180
18135
|
}
|
|
18181
18136
|
return (sf) => {
|
|
18182
|
-
return
|
|
18137
|
+
return ts77.visitEachChild(sf, decoratorDownlevelVisitor, context);
|
|
18183
18138
|
};
|
|
18184
18139
|
};
|
|
18185
18140
|
}
|
|
18186
18141
|
|
|
18187
18142
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/inline_resources.mjs
|
|
18188
|
-
import
|
|
18143
|
+
import ts78 from "typescript";
|
|
18189
18144
|
var PRECONDITIONS_TEXT = "angularCompilerOptions.enableResourceInlining requires all resources to be statically resolvable.";
|
|
18190
18145
|
function getResourceLoader(host, containingFileName) {
|
|
18191
18146
|
return {
|
|
@@ -18212,7 +18167,7 @@ var InlineResourcesMetadataTransformer = class {
|
|
|
18212
18167
|
start(sourceFile) {
|
|
18213
18168
|
const loader = getResourceLoader(this.host, sourceFile.fileName);
|
|
18214
18169
|
return (value, node) => {
|
|
18215
|
-
if (isClassMetadata(value) &&
|
|
18170
|
+
if (isClassMetadata(value) && ts78.isClassDeclaration(node) && value.decorators) {
|
|
18216
18171
|
value.decorators.forEach((d) => {
|
|
18217
18172
|
if (isMetadataSymbolicCallExpression(d) && isMetadataImportedSymbolReferenceExpression(d.expression) && d.expression.module === "@angular/core" && d.expression.name === "Component" && d.arguments) {
|
|
18218
18173
|
d.arguments = d.arguments.map(this.updateDecoratorMetadata.bind(this, loader));
|
|
@@ -18245,66 +18200,66 @@ function getInlineResourcesTransformFactory(program, host) {
|
|
|
18245
18200
|
return (context) => (sourceFile) => {
|
|
18246
18201
|
const loader = getResourceLoader(host, sourceFile.fileName);
|
|
18247
18202
|
const visitor = (node) => {
|
|
18248
|
-
if (!
|
|
18203
|
+
if (!ts78.isClassDeclaration(node)) {
|
|
18249
18204
|
return node;
|
|
18250
18205
|
}
|
|
18251
|
-
const newDecorators =
|
|
18252
|
-
if (
|
|
18206
|
+
const newDecorators = ts78.visitNodes(node.decorators, (node2) => {
|
|
18207
|
+
if (ts78.isDecorator(node2) && isComponentDecorator(node2, program.getTypeChecker())) {
|
|
18253
18208
|
return updateDecorator(node2, loader);
|
|
18254
18209
|
}
|
|
18255
18210
|
return node2;
|
|
18256
18211
|
});
|
|
18257
|
-
const newMembers =
|
|
18258
|
-
if (
|
|
18212
|
+
const newMembers = ts78.visitNodes(node.members, (node2) => {
|
|
18213
|
+
if (ts78.isClassElement(node2)) {
|
|
18259
18214
|
return updateAnnotations(node2, loader, program.getTypeChecker());
|
|
18260
18215
|
} else {
|
|
18261
18216
|
return node2;
|
|
18262
18217
|
}
|
|
18263
18218
|
});
|
|
18264
|
-
return
|
|
18219
|
+
return ts78.updateClassDeclaration(node, newDecorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], newMembers);
|
|
18265
18220
|
};
|
|
18266
|
-
return
|
|
18221
|
+
return ts78.visitEachChild(sourceFile, visitor, context);
|
|
18267
18222
|
};
|
|
18268
18223
|
}
|
|
18269
18224
|
function updateDecorator(node, loader) {
|
|
18270
|
-
if (!
|
|
18225
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18271
18226
|
return node;
|
|
18272
18227
|
}
|
|
18273
18228
|
const expr = node.expression;
|
|
18274
18229
|
const newArguments = updateComponentProperties(expr.arguments, loader);
|
|
18275
|
-
return
|
|
18230
|
+
return ts78.updateDecorator(node, ts78.updateCall(expr, expr.expression, expr.typeArguments, newArguments));
|
|
18276
18231
|
}
|
|
18277
18232
|
function updateAnnotations(node, loader, typeChecker) {
|
|
18278
|
-
if (!
|
|
18233
|
+
if (!ts78.isPropertyDeclaration(node) || !ts78.isIdentifier(node.name) || node.name.text !== "decorators" || !node.initializer || !ts78.isArrayLiteralExpression(node.initializer)) {
|
|
18279
18234
|
return node;
|
|
18280
18235
|
}
|
|
18281
18236
|
const newAnnotations = node.initializer.elements.map((annotation) => {
|
|
18282
|
-
if (!
|
|
18237
|
+
if (!ts78.isObjectLiteralExpression(annotation))
|
|
18283
18238
|
return annotation;
|
|
18284
18239
|
const decoratorType = annotation.properties.find((p2) => isIdentifierNamed(p2, "type"));
|
|
18285
|
-
if (!decoratorType || !
|
|
18240
|
+
if (!decoratorType || !ts78.isPropertyAssignment(decoratorType) || !ts78.isIdentifier(decoratorType.initializer) || !isComponentSymbol(decoratorType.initializer, typeChecker)) {
|
|
18286
18241
|
return annotation;
|
|
18287
18242
|
}
|
|
18288
18243
|
const newAnnotation = annotation.properties.map((prop) => {
|
|
18289
|
-
if (!isIdentifierNamed(prop, "args") || !
|
|
18244
|
+
if (!isIdentifierNamed(prop, "args") || !ts78.isPropertyAssignment(prop) || !ts78.isArrayLiteralExpression(prop.initializer))
|
|
18290
18245
|
return prop;
|
|
18291
|
-
const newDecoratorArgs =
|
|
18246
|
+
const newDecoratorArgs = ts78.updatePropertyAssignment(prop, prop.name, ts78.createArrayLiteral(updateComponentProperties(prop.initializer.elements, loader)));
|
|
18292
18247
|
return newDecoratorArgs;
|
|
18293
18248
|
});
|
|
18294
|
-
return
|
|
18249
|
+
return ts78.updateObjectLiteral(annotation, newAnnotation);
|
|
18295
18250
|
});
|
|
18296
|
-
return
|
|
18251
|
+
return ts78.updateProperty(node, node.decorators, node.modifiers, node.name, node.questionToken, node.type, ts78.updateArrayLiteral(node.initializer, newAnnotations));
|
|
18297
18252
|
}
|
|
18298
18253
|
function isIdentifierNamed(p2, name) {
|
|
18299
|
-
return !!p2.name &&
|
|
18254
|
+
return !!p2.name && ts78.isIdentifier(p2.name) && p2.name.text === name;
|
|
18300
18255
|
}
|
|
18301
18256
|
function isComponentDecorator(node, typeChecker) {
|
|
18302
|
-
if (!
|
|
18257
|
+
if (!ts78.isCallExpression(node.expression)) {
|
|
18303
18258
|
return false;
|
|
18304
18259
|
}
|
|
18305
18260
|
const callExpr = node.expression;
|
|
18306
18261
|
let identifier;
|
|
18307
|
-
if (
|
|
18262
|
+
if (ts78.isIdentifier(callExpr.expression)) {
|
|
18308
18263
|
identifier = callExpr.expression;
|
|
18309
18264
|
} else {
|
|
18310
18265
|
return false;
|
|
@@ -18312,7 +18267,7 @@ function isComponentDecorator(node, typeChecker) {
|
|
|
18312
18267
|
return isComponentSymbol(identifier, typeChecker);
|
|
18313
18268
|
}
|
|
18314
18269
|
function isComponentSymbol(identifier, typeChecker) {
|
|
18315
|
-
if (!
|
|
18270
|
+
if (!ts78.isIdentifier(identifier))
|
|
18316
18271
|
return false;
|
|
18317
18272
|
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
18318
18273
|
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
|
|
@@ -18320,7 +18275,7 @@ function isComponentSymbol(identifier, typeChecker) {
|
|
|
18320
18275
|
return false;
|
|
18321
18276
|
}
|
|
18322
18277
|
const declaration = symbol.declarations[0];
|
|
18323
|
-
if (!declaration || !
|
|
18278
|
+
if (!declaration || !ts78.isImportSpecifier(declaration)) {
|
|
18324
18279
|
return false;
|
|
18325
18280
|
}
|
|
18326
18281
|
const name = (declaration.propertyName || declaration.name).text;
|
|
@@ -18332,69 +18287,69 @@ function updateComponentProperties(args, loader) {
|
|
|
18332
18287
|
return args;
|
|
18333
18288
|
}
|
|
18334
18289
|
const componentArg = args[0];
|
|
18335
|
-
if (!
|
|
18290
|
+
if (!ts78.isObjectLiteralExpression(componentArg)) {
|
|
18336
18291
|
return args;
|
|
18337
18292
|
}
|
|
18338
18293
|
const newProperties = [];
|
|
18339
18294
|
const newStyleExprs = [];
|
|
18340
18295
|
componentArg.properties.forEach((prop) => {
|
|
18341
|
-
if (!
|
|
18296
|
+
if (!ts78.isPropertyAssignment(prop) || ts78.isComputedPropertyName(prop.name)) {
|
|
18342
18297
|
newProperties.push(prop);
|
|
18343
18298
|
return;
|
|
18344
18299
|
}
|
|
18345
18300
|
switch (prop.name.text) {
|
|
18346
18301
|
case "styles":
|
|
18347
|
-
if (!
|
|
18302
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18348
18303
|
throw new Error("styles takes an array argument");
|
|
18349
18304
|
}
|
|
18350
18305
|
newStyleExprs.push(...prop.initializer.elements);
|
|
18351
18306
|
break;
|
|
18352
18307
|
case "styleUrls":
|
|
18353
|
-
if (!
|
|
18308
|
+
if (!ts78.isArrayLiteralExpression(prop.initializer)) {
|
|
18354
18309
|
throw new Error("styleUrls takes an array argument");
|
|
18355
18310
|
}
|
|
18356
18311
|
newStyleExprs.push(...prop.initializer.elements.map((expr) => {
|
|
18357
|
-
if (!
|
|
18312
|
+
if (!ts78.isStringLiteral(expr) && !ts78.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18358
18313
|
throw new Error("Can only accept string literal arguments to styleUrls. " + PRECONDITIONS_TEXT);
|
|
18359
18314
|
}
|
|
18360
18315
|
const styles = loader.get(expr.text);
|
|
18361
|
-
return
|
|
18316
|
+
return ts78.createLiteral(styles);
|
|
18362
18317
|
}));
|
|
18363
18318
|
break;
|
|
18364
18319
|
case "templateUrl":
|
|
18365
|
-
if (!
|
|
18320
|
+
if (!ts78.isStringLiteral(prop.initializer) && !ts78.isNoSubstitutionTemplateLiteral(prop.initializer)) {
|
|
18366
18321
|
throw new Error("Can only accept a string literal argument to templateUrl. " + PRECONDITIONS_TEXT);
|
|
18367
18322
|
}
|
|
18368
18323
|
const template = loader.get(prop.initializer.text);
|
|
18369
|
-
newProperties.push(
|
|
18324
|
+
newProperties.push(ts78.updatePropertyAssignment(prop, ts78.createIdentifier("template"), ts78.createLiteral(template)));
|
|
18370
18325
|
break;
|
|
18371
18326
|
default:
|
|
18372
18327
|
newProperties.push(prop);
|
|
18373
18328
|
}
|
|
18374
18329
|
});
|
|
18375
18330
|
if (newStyleExprs.length > 0) {
|
|
18376
|
-
const newStyles =
|
|
18331
|
+
const newStyles = ts78.createPropertyAssignment(ts78.createIdentifier("styles"), ts78.createArrayLiteral(newStyleExprs));
|
|
18377
18332
|
newProperties.push(newStyles);
|
|
18378
18333
|
}
|
|
18379
|
-
return
|
|
18334
|
+
return ts78.createNodeArray([ts78.updateObjectLiteral(componentArg, newProperties)]);
|
|
18380
18335
|
}
|
|
18381
18336
|
|
|
18382
18337
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/lower_expressions.mjs
|
|
18383
18338
|
import { createLoweredSymbol, isLoweredSymbol } from "@angular/compiler";
|
|
18384
|
-
import
|
|
18339
|
+
import ts79 from "typescript";
|
|
18385
18340
|
function toMap(items, select) {
|
|
18386
18341
|
return new Map(items.map((i) => [select(i), i]));
|
|
18387
18342
|
}
|
|
18388
18343
|
function isLexicalScope(node) {
|
|
18389
18344
|
switch (node.kind) {
|
|
18390
|
-
case
|
|
18391
|
-
case
|
|
18392
|
-
case
|
|
18393
|
-
case
|
|
18394
|
-
case
|
|
18395
|
-
case
|
|
18396
|
-
case
|
|
18397
|
-
case
|
|
18345
|
+
case ts79.SyntaxKind.ArrowFunction:
|
|
18346
|
+
case ts79.SyntaxKind.FunctionExpression:
|
|
18347
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18348
|
+
case ts79.SyntaxKind.ClassExpression:
|
|
18349
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18350
|
+
case ts79.SyntaxKind.FunctionType:
|
|
18351
|
+
case ts79.SyntaxKind.TypeLiteral:
|
|
18352
|
+
case ts79.SyntaxKind.ArrayType:
|
|
18398
18353
|
return true;
|
|
18399
18354
|
}
|
|
18400
18355
|
return false;
|
|
@@ -18411,17 +18366,17 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18411
18366
|
function topLevelStatement(node) {
|
|
18412
18367
|
const declarations = [];
|
|
18413
18368
|
function visitNode(node2) {
|
|
18414
|
-
const { pos: pos2, end: end2, kind, parent: originalParent } =
|
|
18369
|
+
const { pos: pos2, end: end2, kind, parent: originalParent } = ts79.getOriginalNode(node2);
|
|
18415
18370
|
const nodeRequest = requests.get(pos2);
|
|
18416
18371
|
if (nodeRequest && nodeRequest.kind == kind && nodeRequest.end == end2) {
|
|
18417
|
-
if (originalParent && originalParent.kind ===
|
|
18372
|
+
if (originalParent && originalParent.kind === ts79.SyntaxKind.VariableDeclaration) {
|
|
18418
18373
|
const varParent = originalParent;
|
|
18419
|
-
if (varParent.name.kind ===
|
|
18374
|
+
if (varParent.name.kind === ts79.SyntaxKind.Identifier) {
|
|
18420
18375
|
const varName = varParent.name.text;
|
|
18421
18376
|
const exportName2 = nodeRequest.name;
|
|
18422
18377
|
declarations.push({
|
|
18423
18378
|
name: exportName2,
|
|
18424
|
-
node:
|
|
18379
|
+
node: ts79.createIdentifier(varName),
|
|
18425
18380
|
order: 1
|
|
18426
18381
|
});
|
|
18427
18382
|
return node2;
|
|
@@ -18429,18 +18384,18 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18429
18384
|
}
|
|
18430
18385
|
const exportName = nodeRequest.name;
|
|
18431
18386
|
declarations.push({ name: exportName, node: node2, order: 0 });
|
|
18432
|
-
return
|
|
18387
|
+
return ts79.createIdentifier(exportName);
|
|
18433
18388
|
}
|
|
18434
18389
|
let result = node2;
|
|
18435
18390
|
if (shouldVisit(pos2, end2) && !isLexicalScope(node2)) {
|
|
18436
|
-
result =
|
|
18391
|
+
result = ts79.visitEachChild(node2, visitNode, context);
|
|
18437
18392
|
}
|
|
18438
18393
|
return result;
|
|
18439
18394
|
}
|
|
18440
|
-
const { pos, end } =
|
|
18395
|
+
const { pos, end } = ts79.getOriginalNode(node);
|
|
18441
18396
|
let resultStmt;
|
|
18442
18397
|
if (shouldVisit(pos, end)) {
|
|
18443
|
-
resultStmt =
|
|
18398
|
+
resultStmt = ts79.visitEachChild(node, visitNode, context);
|
|
18444
18399
|
} else {
|
|
18445
18400
|
resultStmt = node;
|
|
18446
18401
|
}
|
|
@@ -18469,20 +18424,20 @@ function transformSourceFile(sourceFile, requests, context) {
|
|
|
18469
18424
|
tmpStatements.push(statement);
|
|
18470
18425
|
}
|
|
18471
18426
|
});
|
|
18472
|
-
tmpStatements.push(
|
|
18427
|
+
tmpStatements.push(ts79.createExportDeclaration(void 0, void 0, ts79.createNamedExports(inserts.reduce((accumulator, insert) => [...accumulator, ...insert.declarations], []).map((declaration) => ts79.createExportSpecifier(void 0, declaration.name)))));
|
|
18473
18428
|
newStatements = tmpStatements;
|
|
18474
18429
|
}
|
|
18475
|
-
const newSf =
|
|
18476
|
-
if (!(sourceFile2.flags &
|
|
18477
|
-
newSf.flags &= ~
|
|
18430
|
+
const newSf = ts79.updateSourceFileNode(sourceFile2, ts79.setTextRange(ts79.createNodeArray(newStatements), sourceFile2.statements));
|
|
18431
|
+
if (!(sourceFile2.flags & ts79.NodeFlags.Synthesized)) {
|
|
18432
|
+
newSf.flags &= ~ts79.NodeFlags.Synthesized;
|
|
18478
18433
|
}
|
|
18479
18434
|
return newSf;
|
|
18480
18435
|
}
|
|
18481
18436
|
return visitSourceFile(sourceFile);
|
|
18482
18437
|
}
|
|
18483
18438
|
function createVariableStatementForDeclarations(declarations) {
|
|
18484
|
-
const varDecls = declarations.map((i) =>
|
|
18485
|
-
return
|
|
18439
|
+
const varDecls = declarations.map((i) => ts79.createVariableDeclaration(i.name, void 0, i.node));
|
|
18440
|
+
return ts79.createVariableStatement(void 0, ts79.createVariableDeclarationList(varDecls, ts79.NodeFlags.Const));
|
|
18486
18441
|
}
|
|
18487
18442
|
function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
18488
18443
|
return (context) => (sourceFile) => {
|
|
@@ -18499,18 +18454,18 @@ function getExpressionLoweringTransformFactory(requestsMap, program) {
|
|
|
18499
18454
|
function isEligibleForLowering(node) {
|
|
18500
18455
|
if (node) {
|
|
18501
18456
|
switch (node.kind) {
|
|
18502
|
-
case
|
|
18503
|
-
case
|
|
18457
|
+
case ts79.SyntaxKind.SourceFile:
|
|
18458
|
+
case ts79.SyntaxKind.Decorator:
|
|
18504
18459
|
return true;
|
|
18505
|
-
case
|
|
18506
|
-
case
|
|
18507
|
-
case
|
|
18508
|
-
case
|
|
18460
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18461
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18462
|
+
case ts79.SyntaxKind.EnumDeclaration:
|
|
18463
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18509
18464
|
return false;
|
|
18510
|
-
case
|
|
18511
|
-
const isExported3 = (
|
|
18465
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18466
|
+
const isExported3 = (ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) == 0;
|
|
18512
18467
|
const varNode = node;
|
|
18513
|
-
return isExported3 || varNode.initializer !== void 0 && (
|
|
18468
|
+
return isExported3 || varNode.initializer !== void 0 && (ts79.isObjectLiteralExpression(varNode.initializer) || ts79.isArrayLiteralExpression(varNode.initializer) || ts79.isCallExpression(varNode.initializer));
|
|
18514
18469
|
}
|
|
18515
18470
|
return isEligibleForLowering(node.parent);
|
|
18516
18471
|
}
|
|
@@ -18523,9 +18478,9 @@ function isRewritten(value) {
|
|
|
18523
18478
|
return isMetadataGlobalReferenceExpression(value) && isLoweredSymbol(value.name);
|
|
18524
18479
|
}
|
|
18525
18480
|
function isLiteralFieldNamed(node, names) {
|
|
18526
|
-
if (node.parent && node.parent.kind ==
|
|
18481
|
+
if (node.parent && node.parent.kind == ts79.SyntaxKind.PropertyAssignment) {
|
|
18527
18482
|
const property = node.parent;
|
|
18528
|
-
if (property.parent && property.parent.kind ==
|
|
18483
|
+
if (property.parent && property.parent.kind == ts79.SyntaxKind.ObjectLiteralExpression && property.name && property.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18529
18484
|
const propertyName = property.name;
|
|
18530
18485
|
return names.has(propertyName.text);
|
|
18531
18486
|
}
|
|
@@ -18561,7 +18516,7 @@ var LowerMetadataTransform = class {
|
|
|
18561
18516
|
const isExportedSymbol = (() => {
|
|
18562
18517
|
let exportTable;
|
|
18563
18518
|
return (node) => {
|
|
18564
|
-
if (node.kind ==
|
|
18519
|
+
if (node.kind == ts79.SyntaxKind.Identifier) {
|
|
18565
18520
|
const ident = node;
|
|
18566
18521
|
if (!exportTable) {
|
|
18567
18522
|
exportTable = createExportTableFor(sourceFile);
|
|
@@ -18572,7 +18527,7 @@ var LowerMetadataTransform = class {
|
|
|
18572
18527
|
};
|
|
18573
18528
|
})();
|
|
18574
18529
|
const isExportedPropertyAccess = (node) => {
|
|
18575
|
-
if (node.kind ===
|
|
18530
|
+
if (node.kind === ts79.SyntaxKind.PropertyAccessExpression) {
|
|
18576
18531
|
const pae = node;
|
|
18577
18532
|
if (isExportedSymbol(pae.expression)) {
|
|
18578
18533
|
return true;
|
|
@@ -18586,7 +18541,7 @@ var LowerMetadataTransform = class {
|
|
|
18586
18541
|
return false;
|
|
18587
18542
|
}
|
|
18588
18543
|
let lowerable = false;
|
|
18589
|
-
if ((node.kind ===
|
|
18544
|
+
if ((node.kind === ts79.SyntaxKind.ArrowFunction || node.kind === ts79.SyntaxKind.FunctionExpression) && isEligibleForLowering(node)) {
|
|
18590
18545
|
lowerable = true;
|
|
18591
18546
|
} else if (isLiteralFieldNamed(node, this.lowerableFieldNames) && isEligibleForLowering(node) && !isExportedSymbol(node) && !isExportedPropertyAccess(node)) {
|
|
18592
18547
|
lowerable = true;
|
|
@@ -18618,35 +18573,35 @@ var LowerMetadataTransform = class {
|
|
|
18618
18573
|
};
|
|
18619
18574
|
function createExportTableFor(sourceFile) {
|
|
18620
18575
|
const exportTable = new Set();
|
|
18621
|
-
|
|
18576
|
+
ts79.forEachChild(sourceFile, function scan(node) {
|
|
18622
18577
|
switch (node.kind) {
|
|
18623
|
-
case
|
|
18624
|
-
case
|
|
18625
|
-
case
|
|
18626
|
-
if ((
|
|
18578
|
+
case ts79.SyntaxKind.ClassDeclaration:
|
|
18579
|
+
case ts79.SyntaxKind.FunctionDeclaration:
|
|
18580
|
+
case ts79.SyntaxKind.InterfaceDeclaration:
|
|
18581
|
+
if ((ts79.getCombinedModifierFlags(node) & ts79.ModifierFlags.Export) != 0) {
|
|
18627
18582
|
const classDeclaration = node;
|
|
18628
18583
|
const name = classDeclaration.name;
|
|
18629
18584
|
if (name)
|
|
18630
18585
|
exportTable.add(name.text);
|
|
18631
18586
|
}
|
|
18632
18587
|
break;
|
|
18633
|
-
case
|
|
18588
|
+
case ts79.SyntaxKind.VariableStatement:
|
|
18634
18589
|
const variableStatement = node;
|
|
18635
18590
|
for (const declaration of variableStatement.declarationList.declarations) {
|
|
18636
18591
|
scan(declaration);
|
|
18637
18592
|
}
|
|
18638
18593
|
break;
|
|
18639
|
-
case
|
|
18594
|
+
case ts79.SyntaxKind.VariableDeclaration:
|
|
18640
18595
|
const variableDeclaration = node;
|
|
18641
|
-
if ((
|
|
18596
|
+
if ((ts79.getCombinedModifierFlags(variableDeclaration) & ts79.ModifierFlags.Export) != 0 && variableDeclaration.name.kind == ts79.SyntaxKind.Identifier) {
|
|
18642
18597
|
const name = variableDeclaration.name;
|
|
18643
18598
|
exportTable.add(name.text);
|
|
18644
18599
|
}
|
|
18645
18600
|
break;
|
|
18646
|
-
case
|
|
18601
|
+
case ts79.SyntaxKind.ExportDeclaration:
|
|
18647
18602
|
const exportDeclaration = node;
|
|
18648
18603
|
const { moduleSpecifier, exportClause } = exportDeclaration;
|
|
18649
|
-
if (!moduleSpecifier && exportClause &&
|
|
18604
|
+
if (!moduleSpecifier && exportClause && ts79.isNamedExports(exportClause)) {
|
|
18650
18605
|
exportClause.elements.forEach((spec) => {
|
|
18651
18606
|
exportTable.add(spec.name.text);
|
|
18652
18607
|
});
|
|
@@ -18657,7 +18612,7 @@ function createExportTableFor(sourceFile) {
|
|
|
18657
18612
|
}
|
|
18658
18613
|
|
|
18659
18614
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/metadata_cache.mjs
|
|
18660
|
-
import
|
|
18615
|
+
import ts80 from "typescript";
|
|
18661
18616
|
var MetadataCache = class {
|
|
18662
18617
|
constructor(collector, strict, transformers) {
|
|
18663
18618
|
this.collector = collector;
|
|
@@ -18676,7 +18631,7 @@ var MetadataCache = class {
|
|
|
18676
18631
|
}
|
|
18677
18632
|
let substitute = void 0;
|
|
18678
18633
|
const declarationFile = sourceFile.isDeclarationFile;
|
|
18679
|
-
const moduleFile =
|
|
18634
|
+
const moduleFile = ts80.isExternalModule(sourceFile);
|
|
18680
18635
|
if (!declarationFile && moduleFile) {
|
|
18681
18636
|
for (let transform of this.transformers) {
|
|
18682
18637
|
const transformSubstitute = transform.start(sourceFile);
|
|
@@ -18698,11 +18653,11 @@ var MetadataCache = class {
|
|
|
18698
18653
|
};
|
|
18699
18654
|
|
|
18700
18655
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter_transform.mjs
|
|
18701
|
-
import
|
|
18656
|
+
import ts82 from "typescript";
|
|
18702
18657
|
|
|
18703
18658
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter.mjs
|
|
18704
18659
|
import { BinaryOperator as BinaryOperator2, BuiltinMethod, BuiltinVar, ClassStmt, ExternalExpr as ExternalExpr10, Statement, StmtModifier as StmtModifier2, UnaryOperator as UnaryOperator2 } from "@angular/compiler";
|
|
18705
|
-
import
|
|
18660
|
+
import ts81 from "typescript";
|
|
18706
18661
|
var METHOD_THIS_NAME = "this";
|
|
18707
18662
|
var CATCH_ERROR_NAME = "error";
|
|
18708
18663
|
var CATCH_STACK_NAME = "stack";
|
|
@@ -18716,12 +18671,12 @@ var TypeScriptNodeEmitter = class {
|
|
|
18716
18671
|
const statements = [].concat(...stmts.map((stmt) => stmt.visitStatement(converter, null)).filter((stmt) => stmt != null));
|
|
18717
18672
|
const sourceStatements = [...converter.getReexports(), ...converter.getImports(), ...statements];
|
|
18718
18673
|
if (preamble) {
|
|
18719
|
-
const preambleCommentHolder =
|
|
18720
|
-
|
|
18674
|
+
const preambleCommentHolder = ts81.createNotEmittedStatement(sourceFile);
|
|
18675
|
+
ts81.addSyntheticLeadingComment(preambleCommentHolder, ts81.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
18721
18676
|
sourceStatements.unshift(preambleCommentHolder);
|
|
18722
18677
|
}
|
|
18723
18678
|
converter.updateSourceMap(sourceStatements);
|
|
18724
|
-
const newSourceFile =
|
|
18679
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, sourceStatements);
|
|
18725
18680
|
return [newSourceFile, converter.getNodeMap()];
|
|
18726
18681
|
}
|
|
18727
18682
|
};
|
|
@@ -18734,7 +18689,7 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18734
18689
|
const classNames = new Set(classes.map((classStatement) => classStatement.name));
|
|
18735
18690
|
const prefix = prefixStatements.map((statement) => statement.visitStatement(converter, sourceFile));
|
|
18736
18691
|
let newStatements = sourceFile.statements.map((node) => {
|
|
18737
|
-
if (node.kind ==
|
|
18692
|
+
if (node.kind == ts81.SyntaxKind.ClassDeclaration) {
|
|
18738
18693
|
const classDeclaration = node;
|
|
18739
18694
|
const name = classDeclaration.name;
|
|
18740
18695
|
if (name) {
|
|
@@ -18742,9 +18697,9 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18742
18697
|
if (classStatement) {
|
|
18743
18698
|
classNames.delete(name.text);
|
|
18744
18699
|
const classMemberHolder = converter.visitDeclareClassStmt(classStatement);
|
|
18745
|
-
const newMethods = classMemberHolder.members.filter((member) => member.kind !==
|
|
18700
|
+
const newMethods = classMemberHolder.members.filter((member) => member.kind !== ts81.SyntaxKind.Constructor);
|
|
18746
18701
|
const newMembers = [...classDeclaration.members, ...newMethods];
|
|
18747
|
-
return
|
|
18702
|
+
return ts81.updateClassDeclaration(classDeclaration, classDeclaration.decorators, classDeclaration.modifiers, classDeclaration.name, classDeclaration.typeParameters, classDeclaration.heritageClauses || [], newMembers);
|
|
18748
18703
|
}
|
|
18749
18704
|
}
|
|
18750
18705
|
}
|
|
@@ -18753,13 +18708,13 @@ function updateSourceFile(sourceFile, module2, annotateForClosureCompiler) {
|
|
|
18753
18708
|
classNames.size == 0 || error(`${classNames.size == 1 ? "Class" : "Classes"} "${Array.from(classNames.keys()).join(", ")}" not generated`);
|
|
18754
18709
|
const imports = converter.getImports();
|
|
18755
18710
|
if (imports && imports.length) {
|
|
18756
|
-
const index = firstAfter(newStatements, (statement) => statement.kind ===
|
|
18711
|
+
const index = firstAfter(newStatements, (statement) => statement.kind === ts81.SyntaxKind.ImportDeclaration || statement.kind === ts81.SyntaxKind.ImportEqualsDeclaration);
|
|
18757
18712
|
newStatements = [...newStatements.slice(0, index), ...imports, ...prefix, ...newStatements.slice(index)];
|
|
18758
18713
|
} else {
|
|
18759
18714
|
newStatements = [...prefix, ...newStatements];
|
|
18760
18715
|
}
|
|
18761
18716
|
converter.updateSourceMap(newStatements);
|
|
18762
|
-
const newSourceFile =
|
|
18717
|
+
const newSourceFile = ts81.updateSourceFileNode(sourceFile, newStatements);
|
|
18763
18718
|
return [newSourceFile, converter.getNodeMap()];
|
|
18764
18719
|
}
|
|
18765
18720
|
function firstAfter(a, predicate) {
|
|
@@ -18786,20 +18741,20 @@ function escapeLiteral(value) {
|
|
|
18786
18741
|
}
|
|
18787
18742
|
function createLiteral(value) {
|
|
18788
18743
|
if (value === null) {
|
|
18789
|
-
return
|
|
18744
|
+
return ts81.createNull();
|
|
18790
18745
|
} else if (value === void 0) {
|
|
18791
|
-
return
|
|
18746
|
+
return ts81.createIdentifier("undefined");
|
|
18792
18747
|
} else {
|
|
18793
|
-
const result =
|
|
18794
|
-
if (
|
|
18795
|
-
result.kind =
|
|
18748
|
+
const result = ts81.createLiteral(value);
|
|
18749
|
+
if (ts81.isStringLiteral(result) && result.text.indexOf("\\") >= 0) {
|
|
18750
|
+
result.kind = ts81.SyntaxKind.NumericLiteral;
|
|
18796
18751
|
result.text = `"${escapeLiteral(result.text)}"`;
|
|
18797
18752
|
}
|
|
18798
18753
|
return result;
|
|
18799
18754
|
}
|
|
18800
18755
|
}
|
|
18801
18756
|
function isExportTypeStatement(statement) {
|
|
18802
|
-
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind ===
|
|
18757
|
+
return !!statement.modifiers && statement.modifiers.some((mod) => mod.kind === ts81.SyntaxKind.ExportKeyword);
|
|
18803
18758
|
}
|
|
18804
18759
|
var NodeEmitterVisitor = class {
|
|
18805
18760
|
constructor(annotateForClosureCompiler) {
|
|
@@ -18812,9 +18767,9 @@ var NodeEmitterVisitor = class {
|
|
|
18812
18767
|
}
|
|
18813
18768
|
loadExportedVariableIdentifiers(sourceFile) {
|
|
18814
18769
|
sourceFile.statements.forEach((statement) => {
|
|
18815
|
-
if (
|
|
18770
|
+
if (ts81.isVariableStatement(statement) && isExportTypeStatement(statement)) {
|
|
18816
18771
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
18817
|
-
if (
|
|
18772
|
+
if (ts81.isIdentifier(declaration.name)) {
|
|
18818
18773
|
this._exportedVariableIdentifiers.set(declaration.name.text, declaration.name);
|
|
18819
18774
|
}
|
|
18820
18775
|
});
|
|
@@ -18822,10 +18777,10 @@ var NodeEmitterVisitor = class {
|
|
|
18822
18777
|
});
|
|
18823
18778
|
}
|
|
18824
18779
|
getReexports() {
|
|
18825
|
-
return Array.from(this._reexports.entries()).map(([exportedFilePath, reexports]) =>
|
|
18780
|
+
return Array.from(this._reexports.entries()).map(([exportedFilePath, reexports]) => ts81.createExportDeclaration(void 0, void 0, ts81.createNamedExports(reexports.map(({ name, as }) => ts81.createExportSpecifier(name, as))), createLiteral(exportedFilePath)));
|
|
18826
18781
|
}
|
|
18827
18782
|
getImports() {
|
|
18828
|
-
return Array.from(this._importsWithPrefixes.entries()).map(([namespace, prefix]) =>
|
|
18783
|
+
return Array.from(this._importsWithPrefixes.entries()).map(([namespace, prefix]) => ts81.createImportDeclaration(void 0, void 0, ts81.createImportClause(void 0, ts81.createNamespaceImport(ts81.createIdentifier(prefix))), createLiteral(namespace)));
|
|
18829
18784
|
}
|
|
18830
18785
|
getNodeMap() {
|
|
18831
18786
|
return this._nodeMap;
|
|
@@ -18837,12 +18792,12 @@ var NodeEmitterVisitor = class {
|
|
|
18837
18792
|
const recordLastSourceRange = () => {
|
|
18838
18793
|
if (lastRange && lastRangeStartNode && lastRangeEndNode) {
|
|
18839
18794
|
if (lastRangeStartNode == lastRangeEndNode) {
|
|
18840
|
-
|
|
18795
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18841
18796
|
} else {
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18797
|
+
ts81.setSourceMapRange(lastRangeStartNode, lastRange);
|
|
18798
|
+
ts81.setEmitFlags(lastRangeStartNode, ts81.EmitFlags.NoTrailingSourceMap);
|
|
18799
|
+
ts81.setSourceMapRange(lastRangeEndNode, lastRange);
|
|
18800
|
+
ts81.setEmitFlags(lastRangeEndNode, ts81.EmitFlags.NoLeadingSourceMap);
|
|
18846
18801
|
}
|
|
18847
18802
|
}
|
|
18848
18803
|
};
|
|
@@ -18859,7 +18814,7 @@ var NodeEmitterVisitor = class {
|
|
|
18859
18814
|
lastRangeEndNode = tsNode;
|
|
18860
18815
|
}
|
|
18861
18816
|
}
|
|
18862
|
-
|
|
18817
|
+
ts81.forEachChild(tsNode, visitNode);
|
|
18863
18818
|
};
|
|
18864
18819
|
statements.forEach(visitNode);
|
|
18865
18820
|
recordLastSourceRange();
|
|
@@ -18881,7 +18836,7 @@ var NodeEmitterVisitor = class {
|
|
|
18881
18836
|
if (file.url) {
|
|
18882
18837
|
let source = this._templateSources.get(file);
|
|
18883
18838
|
if (!source) {
|
|
18884
|
-
source =
|
|
18839
|
+
source = ts81.createSourceMapSource(file.url, file.content, (pos) => pos);
|
|
18885
18840
|
this._templateSources.set(file, source);
|
|
18886
18841
|
}
|
|
18887
18842
|
return { pos: span.start.offset, end: span.end.offset, source };
|
|
@@ -18893,7 +18848,7 @@ var NodeEmitterVisitor = class {
|
|
|
18893
18848
|
getModifiers(stmt) {
|
|
18894
18849
|
let modifiers = [];
|
|
18895
18850
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18896
|
-
modifiers.push(
|
|
18851
|
+
modifiers.push(ts81.createToken(ts81.SyntaxKind.ExportKeyword));
|
|
18897
18852
|
}
|
|
18898
18853
|
return modifiers;
|
|
18899
18854
|
}
|
|
@@ -18910,86 +18865,86 @@ var NodeEmitterVisitor = class {
|
|
|
18910
18865
|
return null;
|
|
18911
18866
|
}
|
|
18912
18867
|
}
|
|
18913
|
-
const varDeclList =
|
|
18868
|
+
const varDeclList = ts81.createVariableDeclarationList([ts81.createVariableDeclaration(ts81.createIdentifier(stmt.name), void 0, stmt.value && stmt.value.visitExpression(this, null) || void 0)]);
|
|
18914
18869
|
if (stmt.hasModifier(StmtModifier2.Exported)) {
|
|
18915
|
-
const tsVarStmt = this.postProcess(stmt,
|
|
18916
|
-
const exportStmt = this.postProcess(stmt,
|
|
18870
|
+
const tsVarStmt = this.postProcess(stmt, ts81.createVariableStatement([], varDeclList));
|
|
18871
|
+
const exportStmt = this.postProcess(stmt, ts81.createExportDeclaration(void 0, void 0, ts81.createNamedExports([ts81.createExportSpecifier(stmt.name, stmt.name)])));
|
|
18917
18872
|
return [tsVarStmt, exportStmt];
|
|
18918
18873
|
}
|
|
18919
|
-
return this.postProcess(stmt,
|
|
18874
|
+
return this.postProcess(stmt, ts81.createVariableStatement(this.getModifiers(stmt), varDeclList));
|
|
18920
18875
|
}
|
|
18921
18876
|
visitDeclareFunctionStmt(stmt) {
|
|
18922
|
-
return this.postProcess(stmt,
|
|
18877
|
+
return this.postProcess(stmt, ts81.createFunctionDeclaration(void 0, this.getModifiers(stmt), void 0, stmt.name, void 0, stmt.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(stmt.statements)));
|
|
18923
18878
|
}
|
|
18924
18879
|
visitExpressionStmt(stmt) {
|
|
18925
|
-
return this.postProcess(stmt,
|
|
18880
|
+
return this.postProcess(stmt, ts81.createStatement(stmt.expr.visitExpression(this, null)));
|
|
18926
18881
|
}
|
|
18927
18882
|
visitReturnStmt(stmt) {
|
|
18928
|
-
return this.postProcess(stmt,
|
|
18883
|
+
return this.postProcess(stmt, ts81.createReturn(stmt.value ? stmt.value.visitExpression(this, null) : void 0));
|
|
18929
18884
|
}
|
|
18930
18885
|
visitDeclareClassStmt(stmt) {
|
|
18931
18886
|
const modifiers = this.getModifiers(stmt);
|
|
18932
18887
|
const fields = stmt.fields.map((field) => {
|
|
18933
|
-
const property =
|
|
18888
|
+
const property = ts81.createProperty(void 0, translateModifiers(field.modifiers), field.name, void 0, void 0, field.initializer == null ? ts81.createNull() : field.initializer.visitExpression(this, null));
|
|
18934
18889
|
if (this.annotateForClosureCompiler) {
|
|
18935
|
-
|
|
18890
|
+
ts81.addSyntheticLeadingComment(property, ts81.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
|
|
18936
18891
|
}
|
|
18937
18892
|
return property;
|
|
18938
18893
|
});
|
|
18939
|
-
const getters = stmt.getters.map((getter) =>
|
|
18940
|
-
const constructor = stmt.constructorMethod && [
|
|
18941
|
-
const methods = stmt.methods.filter((method) => method.name).map((method) =>
|
|
18942
|
-
return this.postProcess(stmt,
|
|
18894
|
+
const getters = stmt.getters.map((getter) => ts81.createGetAccessor(void 0, void 0, getter.name, [], void 0, this._visitStatements(getter.body)));
|
|
18895
|
+
const constructor = stmt.constructorMethod && [ts81.createConstructor(void 0, void 0, stmt.constructorMethod.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), this._visitStatements(stmt.constructorMethod.body))] || [];
|
|
18896
|
+
const methods = stmt.methods.filter((method) => method.name).map((method) => ts81.createMethod(void 0, translateModifiers(method.modifiers), void 0, method.name, void 0, void 0, method.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(method.body)));
|
|
18897
|
+
return this.postProcess(stmt, ts81.createClassDeclaration(void 0, modifiers, stmt.name, void 0, stmt.parent && [ts81.createHeritageClause(ts81.SyntaxKind.ExtendsKeyword, [stmt.parent.visitExpression(this, null)])] || [], [...fields, ...getters, ...constructor, ...methods]));
|
|
18943
18898
|
}
|
|
18944
18899
|
visitIfStmt(stmt) {
|
|
18945
|
-
return this.postProcess(stmt,
|
|
18900
|
+
return this.postProcess(stmt, ts81.createIf(stmt.condition.visitExpression(this, null), this._visitStatements(stmt.trueCase), stmt.falseCase && stmt.falseCase.length && this._visitStatements(stmt.falseCase) || void 0));
|
|
18946
18901
|
}
|
|
18947
18902
|
visitTryCatchStmt(stmt) {
|
|
18948
|
-
return this.postProcess(stmt,
|
|
18903
|
+
return this.postProcess(stmt, ts81.createTry(this._visitStatements(stmt.bodyStmts), ts81.createCatchClause(CATCH_ERROR_NAME, this._visitStatementsPrefix([ts81.createVariableStatement(void 0, [ts81.createVariableDeclaration(CATCH_STACK_NAME, void 0, ts81.createPropertyAccess(ts81.createIdentifier(CATCH_ERROR_NAME), ts81.createIdentifier(CATCH_STACK_NAME)))])], stmt.catchStmts)), void 0));
|
|
18949
18904
|
}
|
|
18950
18905
|
visitThrowStmt(stmt) {
|
|
18951
|
-
return this.postProcess(stmt,
|
|
18906
|
+
return this.postProcess(stmt, ts81.createThrow(stmt.error.visitExpression(this, null)));
|
|
18952
18907
|
}
|
|
18953
18908
|
visitWrappedNodeExpr(expr) {
|
|
18954
18909
|
return this.postProcess(expr, expr.node);
|
|
18955
18910
|
}
|
|
18956
18911
|
visitTypeofExpr(expr) {
|
|
18957
|
-
const typeOf =
|
|
18912
|
+
const typeOf = ts81.createTypeOf(expr.expr.visitExpression(this, null));
|
|
18958
18913
|
return this.postProcess(expr, typeOf);
|
|
18959
18914
|
}
|
|
18960
18915
|
visitReadVarExpr(expr) {
|
|
18961
18916
|
switch (expr.builtin) {
|
|
18962
18917
|
case BuiltinVar.This:
|
|
18963
|
-
return this.postProcess(expr,
|
|
18918
|
+
return this.postProcess(expr, ts81.createIdentifier(METHOD_THIS_NAME));
|
|
18964
18919
|
case BuiltinVar.CatchError:
|
|
18965
|
-
return this.postProcess(expr,
|
|
18920
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_ERROR_NAME));
|
|
18966
18921
|
case BuiltinVar.CatchStack:
|
|
18967
|
-
return this.postProcess(expr,
|
|
18922
|
+
return this.postProcess(expr, ts81.createIdentifier(CATCH_STACK_NAME));
|
|
18968
18923
|
case BuiltinVar.Super:
|
|
18969
|
-
return this.postProcess(expr,
|
|
18924
|
+
return this.postProcess(expr, ts81.createSuper());
|
|
18970
18925
|
}
|
|
18971
18926
|
if (expr.name) {
|
|
18972
|
-
return this.postProcess(expr,
|
|
18927
|
+
return this.postProcess(expr, ts81.createIdentifier(expr.name));
|
|
18973
18928
|
}
|
|
18974
18929
|
throw Error(`Unexpected ReadVarExpr form`);
|
|
18975
18930
|
}
|
|
18976
18931
|
visitWriteVarExpr(expr) {
|
|
18977
|
-
return this.postProcess(expr,
|
|
18932
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createIdentifier(expr.name), expr.value.visitExpression(this, null)));
|
|
18978
18933
|
}
|
|
18979
18934
|
visitWriteKeyExpr(expr) {
|
|
18980
|
-
return this.postProcess(expr,
|
|
18935
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)), expr.value.visitExpression(this, null)));
|
|
18981
18936
|
}
|
|
18982
18937
|
visitWritePropExpr(expr) {
|
|
18983
|
-
return this.postProcess(expr,
|
|
18938
|
+
return this.postProcess(expr, ts81.createAssignment(ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name), expr.value.visitExpression(this, null)));
|
|
18984
18939
|
}
|
|
18985
18940
|
visitInvokeFunctionExpr(expr) {
|
|
18986
|
-
return this.postProcess(expr,
|
|
18941
|
+
return this.postProcess(expr, ts81.createCall(expr.fn.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18987
18942
|
}
|
|
18988
18943
|
visitTaggedTemplateExpr(expr) {
|
|
18989
18944
|
throw new Error("tagged templates are not supported in pre-ivy mode.");
|
|
18990
18945
|
}
|
|
18991
18946
|
visitInstantiateExpr(expr) {
|
|
18992
|
-
return this.postProcess(expr,
|
|
18947
|
+
return this.postProcess(expr, ts81.createNew(expr.classExpr.visitExpression(this, null), void 0, expr.args.map((arg) => arg.visitExpression(this, null))));
|
|
18993
18948
|
}
|
|
18994
18949
|
visitLiteralExpr(expr) {
|
|
18995
18950
|
return this.postProcess(expr, createLiteral(expr.value));
|
|
@@ -19001,10 +18956,10 @@ var NodeEmitterVisitor = class {
|
|
|
19001
18956
|
return this.postProcess(expr, this._visitIdentifier(expr.value));
|
|
19002
18957
|
}
|
|
19003
18958
|
visitConditionalExpr(expr) {
|
|
19004
|
-
return this.postProcess(expr,
|
|
18959
|
+
return this.postProcess(expr, ts81.createParen(ts81.createConditional(expr.condition.visitExpression(this, null), expr.trueCase.visitExpression(this, null), expr.falseCase.visitExpression(this, null))));
|
|
19005
18960
|
}
|
|
19006
18961
|
visitNotExpr(expr) {
|
|
19007
|
-
return this.postProcess(expr,
|
|
18962
|
+
return this.postProcess(expr, ts81.createPrefix(ts81.SyntaxKind.ExclamationToken, expr.condition.visitExpression(this, null)));
|
|
19008
18963
|
}
|
|
19009
18964
|
visitAssertNotNullExpr(expr) {
|
|
19010
18965
|
return expr.condition.visitExpression(this, null);
|
|
@@ -19013,103 +18968,103 @@ var NodeEmitterVisitor = class {
|
|
|
19013
18968
|
return expr.value.visitExpression(this, null);
|
|
19014
18969
|
}
|
|
19015
18970
|
visitFunctionExpr(expr) {
|
|
19016
|
-
return this.postProcess(expr,
|
|
18971
|
+
return this.postProcess(expr, ts81.createFunctionExpression(void 0, void 0, expr.name || void 0, void 0, expr.params.map((p2) => ts81.createParameter(void 0, void 0, void 0, p2.name)), void 0, this._visitStatements(expr.statements)));
|
|
19017
18972
|
}
|
|
19018
18973
|
visitUnaryOperatorExpr(expr) {
|
|
19019
18974
|
let unaryOperator;
|
|
19020
18975
|
switch (expr.operator) {
|
|
19021
18976
|
case UnaryOperator2.Minus:
|
|
19022
|
-
unaryOperator =
|
|
18977
|
+
unaryOperator = ts81.SyntaxKind.MinusToken;
|
|
19023
18978
|
break;
|
|
19024
18979
|
case UnaryOperator2.Plus:
|
|
19025
|
-
unaryOperator =
|
|
18980
|
+
unaryOperator = ts81.SyntaxKind.PlusToken;
|
|
19026
18981
|
break;
|
|
19027
18982
|
default:
|
|
19028
18983
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
19029
18984
|
}
|
|
19030
|
-
const binary =
|
|
19031
|
-
return this.postProcess(expr, expr.parens ?
|
|
18985
|
+
const binary = ts81.createPrefix(unaryOperator, expr.expr.visitExpression(this, null));
|
|
18986
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
19032
18987
|
}
|
|
19033
18988
|
visitBinaryOperatorExpr(expr) {
|
|
19034
18989
|
let binaryOperator;
|
|
19035
18990
|
switch (expr.operator) {
|
|
19036
18991
|
case BinaryOperator2.And:
|
|
19037
|
-
binaryOperator =
|
|
18992
|
+
binaryOperator = ts81.SyntaxKind.AmpersandAmpersandToken;
|
|
19038
18993
|
break;
|
|
19039
18994
|
case BinaryOperator2.BitwiseAnd:
|
|
19040
|
-
binaryOperator =
|
|
18995
|
+
binaryOperator = ts81.SyntaxKind.AmpersandToken;
|
|
19041
18996
|
break;
|
|
19042
18997
|
case BinaryOperator2.Bigger:
|
|
19043
|
-
binaryOperator =
|
|
18998
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanToken;
|
|
19044
18999
|
break;
|
|
19045
19000
|
case BinaryOperator2.BiggerEquals:
|
|
19046
|
-
binaryOperator =
|
|
19001
|
+
binaryOperator = ts81.SyntaxKind.GreaterThanEqualsToken;
|
|
19047
19002
|
break;
|
|
19048
19003
|
case BinaryOperator2.Divide:
|
|
19049
|
-
binaryOperator =
|
|
19004
|
+
binaryOperator = ts81.SyntaxKind.SlashToken;
|
|
19050
19005
|
break;
|
|
19051
19006
|
case BinaryOperator2.Equals:
|
|
19052
|
-
binaryOperator =
|
|
19007
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsToken;
|
|
19053
19008
|
break;
|
|
19054
19009
|
case BinaryOperator2.Identical:
|
|
19055
|
-
binaryOperator =
|
|
19010
|
+
binaryOperator = ts81.SyntaxKind.EqualsEqualsEqualsToken;
|
|
19056
19011
|
break;
|
|
19057
19012
|
case BinaryOperator2.Lower:
|
|
19058
|
-
binaryOperator =
|
|
19013
|
+
binaryOperator = ts81.SyntaxKind.LessThanToken;
|
|
19059
19014
|
break;
|
|
19060
19015
|
case BinaryOperator2.LowerEquals:
|
|
19061
|
-
binaryOperator =
|
|
19016
|
+
binaryOperator = ts81.SyntaxKind.LessThanEqualsToken;
|
|
19062
19017
|
break;
|
|
19063
19018
|
case BinaryOperator2.Minus:
|
|
19064
|
-
binaryOperator =
|
|
19019
|
+
binaryOperator = ts81.SyntaxKind.MinusToken;
|
|
19065
19020
|
break;
|
|
19066
19021
|
case BinaryOperator2.Modulo:
|
|
19067
|
-
binaryOperator =
|
|
19022
|
+
binaryOperator = ts81.SyntaxKind.PercentToken;
|
|
19068
19023
|
break;
|
|
19069
19024
|
case BinaryOperator2.Multiply:
|
|
19070
|
-
binaryOperator =
|
|
19025
|
+
binaryOperator = ts81.SyntaxKind.AsteriskToken;
|
|
19071
19026
|
break;
|
|
19072
19027
|
case BinaryOperator2.NotEquals:
|
|
19073
|
-
binaryOperator =
|
|
19028
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsToken;
|
|
19074
19029
|
break;
|
|
19075
19030
|
case BinaryOperator2.NotIdentical:
|
|
19076
|
-
binaryOperator =
|
|
19031
|
+
binaryOperator = ts81.SyntaxKind.ExclamationEqualsEqualsToken;
|
|
19077
19032
|
break;
|
|
19078
19033
|
case BinaryOperator2.Or:
|
|
19079
|
-
binaryOperator =
|
|
19034
|
+
binaryOperator = ts81.SyntaxKind.BarBarToken;
|
|
19080
19035
|
break;
|
|
19081
19036
|
case BinaryOperator2.NullishCoalesce:
|
|
19082
|
-
binaryOperator =
|
|
19037
|
+
binaryOperator = ts81.SyntaxKind.QuestionQuestionToken;
|
|
19083
19038
|
break;
|
|
19084
19039
|
case BinaryOperator2.Plus:
|
|
19085
|
-
binaryOperator =
|
|
19040
|
+
binaryOperator = ts81.SyntaxKind.PlusToken;
|
|
19086
19041
|
break;
|
|
19087
19042
|
default:
|
|
19088
19043
|
throw new Error(`Unknown operator: ${expr.operator}`);
|
|
19089
19044
|
}
|
|
19090
|
-
const binary =
|
|
19091
|
-
return this.postProcess(expr, expr.parens ?
|
|
19045
|
+
const binary = ts81.createBinary(expr.lhs.visitExpression(this, null), binaryOperator, expr.rhs.visitExpression(this, null));
|
|
19046
|
+
return this.postProcess(expr, expr.parens ? ts81.createParen(binary) : binary);
|
|
19092
19047
|
}
|
|
19093
19048
|
visitReadPropExpr(expr) {
|
|
19094
|
-
return this.postProcess(expr,
|
|
19049
|
+
return this.postProcess(expr, ts81.createPropertyAccess(expr.receiver.visitExpression(this, null), expr.name));
|
|
19095
19050
|
}
|
|
19096
19051
|
visitReadKeyExpr(expr) {
|
|
19097
|
-
return this.postProcess(expr,
|
|
19052
|
+
return this.postProcess(expr, ts81.createElementAccess(expr.receiver.visitExpression(this, null), expr.index.visitExpression(this, null)));
|
|
19098
19053
|
}
|
|
19099
19054
|
visitLiteralArrayExpr(expr) {
|
|
19100
|
-
return this.postProcess(expr,
|
|
19055
|
+
return this.postProcess(expr, ts81.createArrayLiteral(expr.entries.map((entry) => entry.visitExpression(this, null))));
|
|
19101
19056
|
}
|
|
19102
19057
|
visitLiteralMapExpr(expr) {
|
|
19103
|
-
return this.postProcess(expr,
|
|
19058
|
+
return this.postProcess(expr, ts81.createObjectLiteral(expr.entries.map((entry) => ts81.createPropertyAssignment(entry.quoted || !_VALID_IDENTIFIER_RE.test(entry.key) ? ts81.createLiteral(entry.key) : entry.key, entry.value.visitExpression(this, null)))));
|
|
19104
19059
|
}
|
|
19105
19060
|
visitCommaExpr(expr) {
|
|
19106
|
-
return this.postProcess(expr, expr.parts.map((e) => e.visitExpression(this, null)).reduce((left, right) => left ?
|
|
19061
|
+
return this.postProcess(expr, expr.parts.map((e) => e.visitExpression(this, null)).reduce((left, right) => left ? ts81.createBinary(left, ts81.SyntaxKind.CommaToken, right) : right, null));
|
|
19107
19062
|
}
|
|
19108
19063
|
_visitStatements(statements) {
|
|
19109
19064
|
return this._visitStatementsPrefix([], statements);
|
|
19110
19065
|
}
|
|
19111
19066
|
_visitStatementsPrefix(prefix, statements) {
|
|
19112
|
-
return
|
|
19067
|
+
return ts81.createBlock([
|
|
19113
19068
|
...prefix,
|
|
19114
19069
|
...statements.map((stmt) => stmt.visitStatement(this, null)).filter((f) => f != null)
|
|
19115
19070
|
]);
|
|
@@ -19123,14 +19078,14 @@ var NodeEmitterVisitor = class {
|
|
|
19123
19078
|
prefix = `i${this._importsWithPrefixes.size}`;
|
|
19124
19079
|
this._importsWithPrefixes.set(moduleName, prefix);
|
|
19125
19080
|
}
|
|
19126
|
-
prefixIdent =
|
|
19081
|
+
prefixIdent = ts81.createIdentifier(prefix);
|
|
19127
19082
|
}
|
|
19128
19083
|
if (prefixIdent) {
|
|
19129
|
-
return
|
|
19084
|
+
return ts81.createPropertyAccess(prefixIdent, name);
|
|
19130
19085
|
} else {
|
|
19131
|
-
const id =
|
|
19086
|
+
const id = ts81.createIdentifier(name);
|
|
19132
19087
|
if (this._exportedVariableIdentifiers.has(name)) {
|
|
19133
|
-
|
|
19088
|
+
ts81.setOriginalNode(id, this._exportedVariableIdentifiers.get(name));
|
|
19134
19089
|
}
|
|
19135
19090
|
return id;
|
|
19136
19091
|
}
|
|
@@ -19139,13 +19094,13 @@ var NodeEmitterVisitor = class {
|
|
|
19139
19094
|
function modifierFromModifier(modifier) {
|
|
19140
19095
|
switch (modifier) {
|
|
19141
19096
|
case StmtModifier2.Exported:
|
|
19142
|
-
return
|
|
19097
|
+
return ts81.createToken(ts81.SyntaxKind.ExportKeyword);
|
|
19143
19098
|
case StmtModifier2.Final:
|
|
19144
|
-
return
|
|
19099
|
+
return ts81.createToken(ts81.SyntaxKind.ConstKeyword);
|
|
19145
19100
|
case StmtModifier2.Private:
|
|
19146
|
-
return
|
|
19101
|
+
return ts81.createToken(ts81.SyntaxKind.PrivateKeyword);
|
|
19147
19102
|
case StmtModifier2.Static:
|
|
19148
|
-
return
|
|
19103
|
+
return ts81.createToken(ts81.SyntaxKind.StaticKeyword);
|
|
19149
19104
|
}
|
|
19150
19105
|
}
|
|
19151
19106
|
function translateModifiers(modifiers) {
|
|
@@ -19175,9 +19130,9 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19175
19130
|
const [newSourceFile] = emitter.updateSourceFile(sourceFile, g.stmts, preamble);
|
|
19176
19131
|
return newSourceFile;
|
|
19177
19132
|
} else if (GENERATED_FILES.test(sourceFile.fileName)) {
|
|
19178
|
-
const commentStmt =
|
|
19179
|
-
|
|
19180
|
-
return
|
|
19133
|
+
const commentStmt = ts82.createNotEmittedStatement(sourceFile);
|
|
19134
|
+
ts82.addSyntheticLeadingComment(commentStmt, ts82.SyntaxKind.MultiLineCommentTrivia, preamble, true);
|
|
19135
|
+
return ts82.updateSourceFileNode(sourceFile, [commentStmt]);
|
|
19181
19136
|
}
|
|
19182
19137
|
return sourceFile;
|
|
19183
19138
|
};
|
|
@@ -19185,11 +19140,11 @@ function getAngularEmitterTransformFactory(generatedFiles, program, annotateForC
|
|
|
19185
19140
|
}
|
|
19186
19141
|
function getFileoverviewComment2(sourceFile) {
|
|
19187
19142
|
const trivia = sourceFile.getFullText().substring(0, sourceFile.getStart());
|
|
19188
|
-
const leadingComments =
|
|
19143
|
+
const leadingComments = ts82.getLeadingCommentRanges(trivia, 0);
|
|
19189
19144
|
if (!leadingComments || leadingComments.length === 0)
|
|
19190
19145
|
return "";
|
|
19191
19146
|
const comment = leadingComments[0];
|
|
19192
|
-
if (comment.kind !==
|
|
19147
|
+
if (comment.kind !== ts82.SyntaxKind.MultiLineCommentTrivia)
|
|
19193
19148
|
return "";
|
|
19194
19149
|
if (sourceFile.getFullText().substring(comment.end, comment.end + 2) !== "\n\n")
|
|
19195
19150
|
return "";
|
|
@@ -19201,7 +19156,7 @@ function getFileoverviewComment2(sourceFile) {
|
|
|
19201
19156
|
|
|
19202
19157
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/r3_metadata_transform.mjs
|
|
19203
19158
|
import { ClassStmt as ClassStmt2, StmtModifier as StmtModifier3 } from "@angular/compiler";
|
|
19204
|
-
import
|
|
19159
|
+
import ts83 from "typescript";
|
|
19205
19160
|
var PartialModuleMetadataTransformer = class {
|
|
19206
19161
|
constructor(modules) {
|
|
19207
19162
|
this.moduleMap = new Map(modules.map((m) => [m.fileName, m]));
|
|
@@ -19212,7 +19167,7 @@ var PartialModuleMetadataTransformer = class {
|
|
|
19212
19167
|
const classMap = new Map(partialModule.statements.filter(isClassStmt).map((s) => [s.name, s]));
|
|
19213
19168
|
if (classMap.size > 0) {
|
|
19214
19169
|
return (value, node) => {
|
|
19215
|
-
if (isClassMetadata(value) && node.kind ===
|
|
19170
|
+
if (isClassMetadata(value) && node.kind === ts83.SyntaxKind.ClassDeclaration) {
|
|
19216
19171
|
const classDeclaration = node;
|
|
19217
19172
|
if (classDeclaration.name) {
|
|
19218
19173
|
const partialClass = classMap.get(classDeclaration.name.text);
|
|
@@ -19661,7 +19616,7 @@ var AngularCompilerProgram = class {
|
|
|
19661
19616
|
}
|
|
19662
19617
|
});
|
|
19663
19618
|
}
|
|
19664
|
-
const tmpProgram =
|
|
19619
|
+
const tmpProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, oldTsProgram);
|
|
19665
19620
|
if (tempProgramHandlerForTest !== null) {
|
|
19666
19621
|
tempProgramHandlerForTest(tmpProgram);
|
|
19667
19622
|
}
|
|
@@ -19691,7 +19646,7 @@ var AngularCompilerProgram = class {
|
|
|
19691
19646
|
}
|
|
19692
19647
|
}
|
|
19693
19648
|
});
|
|
19694
|
-
this._tsProgram =
|
|
19649
|
+
this._tsProgram = ts84.createProgram(rootNames, this.options, this.hostAdapter, tmpProgram);
|
|
19695
19650
|
if (tsStructureIsReused(this._tsProgram) !== 2) {
|
|
19696
19651
|
throw new Error(`Internal Error: The structure of the program changed during codegen.`);
|
|
19697
19652
|
}
|
|
@@ -19700,7 +19655,7 @@ var AngularCompilerProgram = class {
|
|
|
19700
19655
|
this._analyzedModules = emptyModules;
|
|
19701
19656
|
this.oldTsProgram = void 0;
|
|
19702
19657
|
this._hostAdapter.isSourceFile = () => false;
|
|
19703
|
-
this._tsProgram =
|
|
19658
|
+
this._tsProgram = ts84.createProgram(this.rootNames, this.options, this.hostAdapter);
|
|
19704
19659
|
if (isSyntaxError(e)) {
|
|
19705
19660
|
this._addStructuralDiagnostics(e);
|
|
19706
19661
|
return;
|
|
@@ -19714,7 +19669,7 @@ var AngularCompilerProgram = class {
|
|
|
19714
19669
|
} else {
|
|
19715
19670
|
diagnostics.push({
|
|
19716
19671
|
messageText: error2.toString(),
|
|
19717
|
-
category:
|
|
19672
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19718
19673
|
source: SOURCE,
|
|
19719
19674
|
code: DEFAULT_ERROR_CODE
|
|
19720
19675
|
});
|
|
@@ -19741,7 +19696,7 @@ var AngularCompilerProgram = class {
|
|
|
19741
19696
|
start: void 0,
|
|
19742
19697
|
length: void 0,
|
|
19743
19698
|
messageText: e.message,
|
|
19744
|
-
category:
|
|
19699
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19745
19700
|
source: SOURCE,
|
|
19746
19701
|
code: DEFAULT_ERROR_CODE
|
|
19747
19702
|
}];
|
|
@@ -19846,7 +19801,7 @@ function getNgOptionDiagnostics(options) {
|
|
|
19846
19801
|
default:
|
|
19847
19802
|
return [{
|
|
19848
19803
|
messageText: 'Angular compiler options "annotationsAs" only supports "static fields" and "decorators"',
|
|
19849
|
-
category:
|
|
19804
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19850
19805
|
source: SOURCE,
|
|
19851
19806
|
code: DEFAULT_ERROR_CODE
|
|
19852
19807
|
}];
|
|
@@ -19910,7 +19865,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19910
19865
|
file: diagnosticSourceOfSpan(e.span),
|
|
19911
19866
|
start: e.span.start.offset,
|
|
19912
19867
|
length: e.span.end.offset - e.span.start.offset,
|
|
19913
|
-
category:
|
|
19868
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19914
19869
|
source: SOURCE,
|
|
19915
19870
|
code: DEFAULT_ERROR_CODE
|
|
19916
19871
|
}));
|
|
@@ -19918,7 +19873,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19918
19873
|
return [{
|
|
19919
19874
|
messageText: error2.message,
|
|
19920
19875
|
chain: error2.chain && diagnosticChainFromFormattedDiagnosticChain(error2.chain),
|
|
19921
|
-
category:
|
|
19876
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19922
19877
|
source: SOURCE,
|
|
19923
19878
|
code: DEFAULT_ERROR_CODE,
|
|
19924
19879
|
position: error2.position
|
|
@@ -19937,7 +19892,7 @@ function syntaxErrorToDiagnostics(error2, program) {
|
|
|
19937
19892
|
|
|
19938
19893
|
See https://angular.io/errors/NG6999 for more information.
|
|
19939
19894
|
`,
|
|
19940
|
-
category:
|
|
19895
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19941
19896
|
code: DEFAULT_ERROR_CODE,
|
|
19942
19897
|
source: SOURCE
|
|
19943
19898
|
}];
|
|
@@ -19945,7 +19900,7 @@ See https://angular.io/errors/NG6999 for more information.
|
|
|
19945
19900
|
}
|
|
19946
19901
|
return [{
|
|
19947
19902
|
messageText: error2.message,
|
|
19948
|
-
category:
|
|
19903
|
+
category: ts84.DiagnosticCategory.Error,
|
|
19949
19904
|
code: DEFAULT_ERROR_CODE,
|
|
19950
19905
|
source: SOURCE
|
|
19951
19906
|
}];
|
|
@@ -19956,7 +19911,7 @@ function getDtsClass(program, fileName, className) {
|
|
|
19956
19911
|
return null;
|
|
19957
19912
|
}
|
|
19958
19913
|
for (const stmt of sf.statements) {
|
|
19959
|
-
if (!
|
|
19914
|
+
if (!ts84.isClassDeclaration(stmt)) {
|
|
19960
19915
|
continue;
|
|
19961
19916
|
}
|
|
19962
19917
|
if (stmt.name === void 0 || stmt.name.text !== className) {
|
|
@@ -19968,10 +19923,10 @@ function getDtsClass(program, fileName, className) {
|
|
|
19968
19923
|
}
|
|
19969
19924
|
function isIvyNgModule(clazz) {
|
|
19970
19925
|
for (const member of clazz.members) {
|
|
19971
|
-
if (!
|
|
19926
|
+
if (!ts84.isPropertyDeclaration(member)) {
|
|
19972
19927
|
continue;
|
|
19973
19928
|
}
|
|
19974
|
-
if (
|
|
19929
|
+
if (ts84.isIdentifier(member.name) && member.name.text === "\u0275mod") {
|
|
19975
19930
|
return true;
|
|
19976
19931
|
}
|
|
19977
19932
|
}
|
|
@@ -19980,11 +19935,11 @@ function isIvyNgModule(clazz) {
|
|
|
19980
19935
|
|
|
19981
19936
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
19982
19937
|
import { isSyntaxError as isSyntaxError2 } from "@angular/compiler";
|
|
19983
|
-
import
|
|
19938
|
+
import ts85 from "typescript";
|
|
19984
19939
|
var defaultFormatHost = {
|
|
19985
|
-
getCurrentDirectory: () =>
|
|
19940
|
+
getCurrentDirectory: () => ts85.sys.getCurrentDirectory(),
|
|
19986
19941
|
getCanonicalFileName: (fileName) => fileName,
|
|
19987
|
-
getNewLine: () =>
|
|
19942
|
+
getNewLine: () => ts85.sys.newLine
|
|
19988
19943
|
};
|
|
19989
19944
|
function displayFileName(fileName, host) {
|
|
19990
19945
|
return relative(resolve(host.getCurrentDirectory()), resolve(host.getCanonicalFileName(fileName)));
|
|
@@ -20036,7 +19991,7 @@ function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
|
20036
19991
|
if (diags && diags.length) {
|
|
20037
19992
|
return diags.map((diagnostic) => {
|
|
20038
19993
|
if (isTsDiagnostic(diagnostic)) {
|
|
20039
|
-
return replaceTsWithNgInErrors(
|
|
19994
|
+
return replaceTsWithNgInErrors(ts85.formatDiagnosticsWithColorAndContext([diagnostic], host));
|
|
20040
19995
|
} else {
|
|
20041
19996
|
return formatDiagnostic(diagnostic, host);
|
|
20042
19997
|
}
|
|
@@ -20057,7 +20012,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
20057
20012
|
var _a;
|
|
20058
20013
|
try {
|
|
20059
20014
|
const fs5 = getFileSystem();
|
|
20060
|
-
const readConfigFile = (configFile) =>
|
|
20015
|
+
const readConfigFile = (configFile) => ts85.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
20061
20016
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
20062
20017
|
const { config: config2, error: error3 } = readConfigFile(configFile);
|
|
20063
20018
|
if (error3) {
|
|
@@ -20089,7 +20044,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
20089
20044
|
basePath
|
|
20090
20045
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
20091
20046
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
20092
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
20047
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts85.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
20093
20048
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
20094
20049
|
let emitFlags = EmitFlags.Default;
|
|
20095
20050
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -20101,7 +20056,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
20101
20056
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
20102
20057
|
} catch (e) {
|
|
20103
20058
|
const errors = [{
|
|
20104
|
-
category:
|
|
20059
|
+
category: ts85.DiagnosticCategory.Error,
|
|
20105
20060
|
messageText: e.stack,
|
|
20106
20061
|
file: void 0,
|
|
20107
20062
|
start: void 0,
|
|
@@ -20115,7 +20070,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
20115
20070
|
function createParseConfigHost(host, fs5 = getFileSystem()) {
|
|
20116
20071
|
return {
|
|
20117
20072
|
fileExists: host.exists.bind(host),
|
|
20118
|
-
readDirectory:
|
|
20073
|
+
readDirectory: ts85.sys.readDirectory,
|
|
20119
20074
|
readFile: host.readFile.bind(host),
|
|
20120
20075
|
useCaseSensitiveFileNames: fs5.isCaseSensitive()
|
|
20121
20076
|
};
|
|
@@ -20135,7 +20090,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20135
20090
|
}
|
|
20136
20091
|
} else {
|
|
20137
20092
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
20138
|
-
const { resolvedModule } =
|
|
20093
|
+
const { resolvedModule } = ts85.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts85.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
20139
20094
|
if (resolvedModule) {
|
|
20140
20095
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
20141
20096
|
}
|
|
@@ -20145,7 +20100,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
20145
20100
|
function exitCodeFromResult(diags) {
|
|
20146
20101
|
if (!diags)
|
|
20147
20102
|
return 0;
|
|
20148
|
-
if (diags.every((diag) => diag.category !==
|
|
20103
|
+
if (diags.every((diag) => diag.category !== ts85.DiagnosticCategory.Error)) {
|
|
20149
20104
|
return 0;
|
|
20150
20105
|
}
|
|
20151
20106
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -20185,7 +20140,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
20185
20140
|
program = void 0;
|
|
20186
20141
|
code = UNKNOWN_ERROR_CODE;
|
|
20187
20142
|
}
|
|
20188
|
-
allDiagnostics.push({ category:
|
|
20143
|
+
allDiagnostics.push({ category: ts85.DiagnosticCategory.Error, messageText: errMsg, code, source: SOURCE });
|
|
20189
20144
|
return { diagnostics: allDiagnostics, program };
|
|
20190
20145
|
}
|
|
20191
20146
|
}
|
|
@@ -20206,7 +20161,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
20206
20161
|
return allDiagnostics;
|
|
20207
20162
|
}
|
|
20208
20163
|
function hasErrors(diags) {
|
|
20209
|
-
return diags.some((d) => d.category ===
|
|
20164
|
+
return diags.some((d) => d.category === ts85.DiagnosticCategory.Error);
|
|
20210
20165
|
}
|
|
20211
20166
|
|
|
20212
20167
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
|