typescript 4.6.0-dev.20220112 → 4.6.0-dev.20220116
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/lib/tsc.js +187 -77
- package/lib/tsserver.js +264 -110
- package/lib/tsserverlibrary.js +264 -110
- package/lib/typescript.js +264 -110
- package/lib/typescriptServices.js +264 -110
- package/lib/typingsInstaller.js +234 -96
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220116";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -5502,7 +5502,7 @@ var ts;
|
|
|
5502
5502
|
Parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts.DiagnosticCategory.Error, "Parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Parameter '{0}' cannot reference identifier '{1}' declared after it."),
|
|
5503
5503
|
Duplicate_index_signature_for_type_0: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_index_signature_for_type_0_2374", "Duplicate index signature for type '{0}'."),
|
|
5504
5504
|
Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2375, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2375", "Type '{0}' is not assignable to type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
5505
|
-
|
|
5505
|
+
A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2376, ts.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_2376", "A 'super' call must be the first statement in the constructor to refer to 'super' or 'this' when a derived class contains initialized properties, parameter properties, or private identifiers."),
|
|
5506
5506
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
5507
5507
|
A_get_accessor_must_return_a_value: diag(2378, ts.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
5508
5508
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
@@ -5525,6 +5525,7 @@ var ts;
|
|
|
5525
5525
|
constructor_cannot_be_used_as_a_parameter_property_name: diag(2398, ts.DiagnosticCategory.Error, "constructor_cannot_be_used_as_a_parameter_property_name_2398", "'constructor' cannot be used as a parameter property name."),
|
|
5526
5526
|
Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."),
|
|
5527
5527
|
Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."),
|
|
5528
|
+
A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers: diag(2401, ts.DiagnosticCategory.Error, "A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_in_2401", "A 'super' call must be a root-level statement within a constructor of a derived class that contains initialized properties, parameter properties, or private identifiers."),
|
|
5528
5529
|
Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."),
|
|
5529
5530
|
Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."),
|
|
5530
5531
|
The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."),
|
|
@@ -11924,6 +11925,28 @@ var ts;
|
|
|
11924
11925
|
}
|
|
11925
11926
|
}
|
|
11926
11927
|
ts.getThisContainer = getThisContainer;
|
|
11928
|
+
function isThisContainerOrFunctionBlock(node) {
|
|
11929
|
+
switch (node.kind) {
|
|
11930
|
+
case 213:
|
|
11931
|
+
case 255:
|
|
11932
|
+
case 212:
|
|
11933
|
+
case 166:
|
|
11934
|
+
return true;
|
|
11935
|
+
case 234:
|
|
11936
|
+
switch (node.parent.kind) {
|
|
11937
|
+
case 170:
|
|
11938
|
+
case 168:
|
|
11939
|
+
case 171:
|
|
11940
|
+
case 172:
|
|
11941
|
+
return true;
|
|
11942
|
+
default:
|
|
11943
|
+
return false;
|
|
11944
|
+
}
|
|
11945
|
+
default:
|
|
11946
|
+
return false;
|
|
11947
|
+
}
|
|
11948
|
+
}
|
|
11949
|
+
ts.isThisContainerOrFunctionBlock = isThisContainerOrFunctionBlock;
|
|
11927
11950
|
function isInTopLevelContext(node) {
|
|
11928
11951
|
if (ts.isIdentifier(node) && (ts.isClassDeclaration(node.parent) || ts.isFunctionDeclaration(node.parent)) && node.parent.name === node) {
|
|
11929
11952
|
node = node.parent;
|
|
@@ -20925,7 +20948,7 @@ var ts;
|
|
|
20925
20948
|
return getExportName(node, allowComments, allowSourceMaps);
|
|
20926
20949
|
}
|
|
20927
20950
|
function copyPrologue(source, target, ensureUseStrict, visitor) {
|
|
20928
|
-
var offset = copyStandardPrologue(source, target, ensureUseStrict);
|
|
20951
|
+
var offset = copyStandardPrologue(source, target, 0, ensureUseStrict);
|
|
20929
20952
|
return copyCustomPrologue(source, target, offset, visitor);
|
|
20930
20953
|
}
|
|
20931
20954
|
function isUseStrictPrologue(node) {
|
|
@@ -20934,10 +20957,10 @@ var ts;
|
|
|
20934
20957
|
function createUseStrictPrologue() {
|
|
20935
20958
|
return ts.startOnNewLine(createExpressionStatement(createStringLiteral("use strict")));
|
|
20936
20959
|
}
|
|
20937
|
-
function copyStandardPrologue(source, target, ensureUseStrict) {
|
|
20960
|
+
function copyStandardPrologue(source, target, statementOffset, ensureUseStrict) {
|
|
20961
|
+
if (statementOffset === void 0) { statementOffset = 0; }
|
|
20938
20962
|
ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array");
|
|
20939
20963
|
var foundUseStrict = false;
|
|
20940
|
-
var statementOffset = 0;
|
|
20941
20964
|
var numStatements = source.length;
|
|
20942
20965
|
while (statementOffset < numStatements) {
|
|
20943
20966
|
var statement = source[statementOffset];
|
|
@@ -22087,7 +22110,7 @@ var ts;
|
|
|
22087
22110
|
importName: "__createBinding",
|
|
22088
22111
|
scoped: false,
|
|
22089
22112
|
priority: 1,
|
|
22090
|
-
text: "\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.
|
|
22113
|
+
text: "\n var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n }) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n }));"
|
|
22091
22114
|
};
|
|
22092
22115
|
ts.setModuleDefaultHelper = {
|
|
22093
22116
|
name: "typescript:commonjscreatevalue",
|
|
@@ -33509,7 +33532,7 @@ var ts;
|
|
|
33509
33532
|
? 1 : 0
|
|
33510
33533
|
};
|
|
33511
33534
|
}
|
|
33512
|
-
if (ts.isImplicitGlob(spec)) {
|
|
33535
|
+
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
33513
33536
|
return {
|
|
33514
33537
|
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
33515
33538
|
flags: 1
|
|
@@ -65808,25 +65831,29 @@ var ts;
|
|
|
65808
65831
|
if (classExtendsNull) {
|
|
65809
65832
|
error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
65810
65833
|
}
|
|
65811
|
-
var
|
|
65834
|
+
var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
|
|
65812
65835
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
65813
65836
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
|
|
65814
|
-
if (
|
|
65815
|
-
|
|
65816
|
-
|
|
65817
|
-
|
|
65818
|
-
|
|
65819
|
-
|
|
65820
|
-
|
|
65821
|
-
|
|
65837
|
+
if (superCallShouldBeRootLevel) {
|
|
65838
|
+
if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
|
|
65839
|
+
error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65840
|
+
}
|
|
65841
|
+
else {
|
|
65842
|
+
var superCallStatement = void 0;
|
|
65843
|
+
for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
|
|
65844
|
+
var statement = _a[_i];
|
|
65845
|
+
if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
|
|
65846
|
+
superCallStatement = statement;
|
|
65847
|
+
break;
|
|
65848
|
+
}
|
|
65849
|
+
if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
65850
|
+
break;
|
|
65851
|
+
}
|
|
65822
65852
|
}
|
|
65823
|
-
if (
|
|
65824
|
-
|
|
65853
|
+
if (superCallStatement === undefined) {
|
|
65854
|
+
error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65825
65855
|
}
|
|
65826
65856
|
}
|
|
65827
|
-
if (!superCallStatement) {
|
|
65828
|
-
error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
|
|
65829
|
-
}
|
|
65830
65857
|
}
|
|
65831
65858
|
}
|
|
65832
65859
|
else if (!classExtendsNull) {
|
|
@@ -65834,6 +65861,19 @@ var ts;
|
|
|
65834
65861
|
}
|
|
65835
65862
|
}
|
|
65836
65863
|
}
|
|
65864
|
+
function superCallIsRootLevelInConstructor(superCall, body) {
|
|
65865
|
+
var superCallParent = ts.walkUpParenthesizedExpressions(superCall.parent);
|
|
65866
|
+
return ts.isExpressionStatement(superCallParent) && superCallParent.parent === body;
|
|
65867
|
+
}
|
|
65868
|
+
function nodeImmediatelyReferencesSuperOrThis(node) {
|
|
65869
|
+
if (node.kind === 106 || node.kind === 108) {
|
|
65870
|
+
return true;
|
|
65871
|
+
}
|
|
65872
|
+
if (ts.isThisContainerOrFunctionBlock(node)) {
|
|
65873
|
+
return false;
|
|
65874
|
+
}
|
|
65875
|
+
return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
|
|
65876
|
+
}
|
|
65837
65877
|
function checkAccessorDeclaration(node) {
|
|
65838
65878
|
if (produceDiagnostics) {
|
|
65839
65879
|
if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node))
|
|
@@ -74697,25 +74737,26 @@ var ts;
|
|
|
74697
74737
|
}
|
|
74698
74738
|
}
|
|
74699
74739
|
ts.getNonAssignmentOperatorForCompoundAssignment = getNonAssignmentOperatorForCompoundAssignment;
|
|
74700
|
-
function
|
|
74701
|
-
if (
|
|
74702
|
-
|
|
74703
|
-
|
|
74704
|
-
|
|
74705
|
-
|
|
74706
|
-
|
|
74707
|
-
|
|
74708
|
-
|
|
74709
|
-
|
|
74710
|
-
|
|
74711
|
-
|
|
74712
|
-
|
|
74740
|
+
function getSuperCallFromStatement(statement) {
|
|
74741
|
+
if (!ts.isExpressionStatement(statement)) {
|
|
74742
|
+
return undefined;
|
|
74743
|
+
}
|
|
74744
|
+
var expression = ts.skipParentheses(statement.expression);
|
|
74745
|
+
return ts.isSuperCall(expression)
|
|
74746
|
+
? expression
|
|
74747
|
+
: undefined;
|
|
74748
|
+
}
|
|
74749
|
+
ts.getSuperCallFromStatement = getSuperCallFromStatement;
|
|
74750
|
+
function findSuperStatementIndex(statements, indexAfterLastPrologueStatement) {
|
|
74751
|
+
for (var i = indexAfterLastPrologueStatement; i < statements.length; i += 1) {
|
|
74752
|
+
var statement = statements[i];
|
|
74753
|
+
if (getSuperCallFromStatement(statement)) {
|
|
74754
|
+
return i;
|
|
74713
74755
|
}
|
|
74714
|
-
return index;
|
|
74715
74756
|
}
|
|
74716
|
-
return
|
|
74757
|
+
return -1;
|
|
74717
74758
|
}
|
|
74718
|
-
ts.
|
|
74759
|
+
ts.findSuperStatementIndex = findSuperStatementIndex;
|
|
74719
74760
|
function getProperties(node, requireInitializer, isStatic) {
|
|
74720
74761
|
return ts.filter(node.members, function (m) { return isInitializedOrStaticProperty(m, requireInitializer, isStatic); });
|
|
74721
74762
|
}
|
|
@@ -75918,6 +75959,7 @@ var ts;
|
|
|
75918
75959
|
case 176:
|
|
75919
75960
|
case 133:
|
|
75920
75961
|
return factory.createIdentifier("Boolean");
|
|
75962
|
+
case 197:
|
|
75921
75963
|
case 149:
|
|
75922
75964
|
return factory.createIdentifier("String");
|
|
75923
75965
|
case 147:
|
|
@@ -76155,11 +76197,20 @@ var ts;
|
|
|
76155
76197
|
return ts.visitFunctionBody(body, visitor, context);
|
|
76156
76198
|
}
|
|
76157
76199
|
var statements = [];
|
|
76158
|
-
var indexOfFirstStatement = 0;
|
|
76159
76200
|
resumeLexicalEnvironment();
|
|
76160
|
-
|
|
76161
|
-
ts.
|
|
76162
|
-
|
|
76201
|
+
var indexAfterLastPrologueStatement = factory.copyPrologue(body.statements, statements, false, visitor);
|
|
76202
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, indexAfterLastPrologueStatement);
|
|
76203
|
+
if (superStatementIndex >= 0) {
|
|
76204
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, indexAfterLastPrologueStatement, superStatementIndex + 1 - indexAfterLastPrologueStatement));
|
|
76205
|
+
}
|
|
76206
|
+
var parameterPropertyAssignments = ts.mapDefined(parametersWithPropertyAssignments, transformParameterWithPropertyAssignment);
|
|
76207
|
+
if (superStatementIndex >= 0) {
|
|
76208
|
+
ts.addRange(statements, parameterPropertyAssignments);
|
|
76209
|
+
}
|
|
76210
|
+
else {
|
|
76211
|
+
statements = ts.addRange(parameterPropertyAssignments, statements);
|
|
76212
|
+
}
|
|
76213
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
76163
76214
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
76164
76215
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
|
|
76165
76216
|
ts.setTextRange(block, body);
|
|
@@ -77541,6 +77592,7 @@ var ts;
|
|
|
77541
77592
|
return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor));
|
|
77542
77593
|
}
|
|
77543
77594
|
function transformConstructorBody(node, constructor, isDerivedClass) {
|
|
77595
|
+
var _a;
|
|
77544
77596
|
var properties = ts.getProperties(node, false, false);
|
|
77545
77597
|
if (!useDefineForClassFields) {
|
|
77546
77598
|
properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); });
|
|
@@ -77551,34 +77603,65 @@ var ts;
|
|
|
77551
77603
|
return ts.visitFunctionBody(undefined, visitor, context);
|
|
77552
77604
|
}
|
|
77553
77605
|
resumeLexicalEnvironment();
|
|
77554
|
-
var
|
|
77606
|
+
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
77607
|
+
var indexOfFirstStatementAfterSuper = 0;
|
|
77608
|
+
var prologueStatementCount = 0;
|
|
77609
|
+
var superStatementIndex = -1;
|
|
77555
77610
|
var statements = [];
|
|
77556
|
-
if (
|
|
77557
|
-
|
|
77611
|
+
if ((_a = constructor === null || constructor === void 0 ? void 0 : constructor.body) === null || _a === void 0 ? void 0 : _a.statements) {
|
|
77612
|
+
prologueStatementCount = factory.copyPrologue(constructor.body.statements, statements, false, visitor);
|
|
77613
|
+
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
77614
|
+
if (superStatementIndex >= 0) {
|
|
77615
|
+
indexOfFirstStatementAfterSuper = superStatementIndex + 1;
|
|
77616
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuper - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
77617
|
+
}
|
|
77558
77618
|
}
|
|
77559
|
-
if (
|
|
77560
|
-
|
|
77619
|
+
if (needsSyntheticConstructor) {
|
|
77620
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(factory.createSuper(), undefined, [factory.createSpreadElement(factory.createIdentifier("arguments"))])));
|
|
77561
77621
|
}
|
|
77622
|
+
var parameterPropertyDeclarationCount = 0;
|
|
77562
77623
|
if (constructor === null || constructor === void 0 ? void 0 : constructor.body) {
|
|
77563
|
-
|
|
77564
|
-
|
|
77565
|
-
afterParameterProperties = constructor.body.statements.length;
|
|
77624
|
+
if (useDefineForClassFields) {
|
|
77625
|
+
statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); });
|
|
77566
77626
|
}
|
|
77567
|
-
|
|
77568
|
-
|
|
77569
|
-
|
|
77627
|
+
else {
|
|
77628
|
+
for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) {
|
|
77629
|
+
var statement = _b[_i];
|
|
77630
|
+
if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
77631
|
+
parameterPropertyDeclarationCount++;
|
|
77632
|
+
}
|
|
77633
|
+
}
|
|
77634
|
+
if (parameterPropertyDeclarationCount > 0) {
|
|
77635
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuper, parameterPropertyDeclarationCount);
|
|
77636
|
+
if (superStatementIndex >= 0) {
|
|
77637
|
+
ts.addRange(statements, parameterProperties);
|
|
77638
|
+
}
|
|
77639
|
+
else if (needsSyntheticConstructor) {
|
|
77640
|
+
statements = __spreadArray(__spreadArray([
|
|
77641
|
+
statements[0]
|
|
77642
|
+
], parameterProperties, true), statements.slice(1), true);
|
|
77643
|
+
}
|
|
77644
|
+
else {
|
|
77645
|
+
statements = __spreadArray(__spreadArray([], parameterProperties, true), statements, true);
|
|
77646
|
+
}
|
|
77647
|
+
indexOfFirstStatementAfterSuper += parameterPropertyDeclarationCount;
|
|
77570
77648
|
}
|
|
77571
|
-
indexOfFirstStatement = afterParameterProperties;
|
|
77572
77649
|
}
|
|
77573
77650
|
}
|
|
77574
77651
|
var receiver = factory.createThis();
|
|
77575
77652
|
addMethodStatements(statements, privateMethodsAndAccessors, receiver);
|
|
77576
77653
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
77577
77654
|
if (constructor) {
|
|
77578
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements,
|
|
77655
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuper + prologueStatementCount));
|
|
77579
77656
|
}
|
|
77580
77657
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
77581
77658
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined);
|
|
77659
|
+
function visitBodyStatement(statement) {
|
|
77660
|
+
if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) {
|
|
77661
|
+
return undefined;
|
|
77662
|
+
}
|
|
77663
|
+
return visitor(statement);
|
|
77664
|
+
}
|
|
77582
77665
|
}
|
|
77583
77666
|
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
|
|
77584
77667
|
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
|
|
@@ -80639,40 +80722,47 @@ var ts;
|
|
|
80639
80722
|
var prologue = [];
|
|
80640
80723
|
var statements = [];
|
|
80641
80724
|
resumeLexicalEnvironment();
|
|
80642
|
-
var
|
|
80725
|
+
var existingPrologue = ts.takeWhile(constructor.body.statements, ts.isPrologueDirective);
|
|
80726
|
+
var _a = findSuperCallAndStatementIndex(constructor.body.statements, existingPrologue), superCall = _a.superCall, superStatementIndex = _a.superStatementIndex;
|
|
80727
|
+
var postSuperStatementsStart = superStatementIndex === -1 ? existingPrologue.length : superStatementIndex + 1;
|
|
80728
|
+
var statementOffset = postSuperStatementsStart;
|
|
80643
80729
|
if (!hasSynthesizedSuper)
|
|
80644
|
-
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, false);
|
|
80645
|
-
addDefaultValueAssignmentsIfNeeded(statements, constructor);
|
|
80646
|
-
addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper);
|
|
80730
|
+
statementOffset = factory.copyStandardPrologue(constructor.body.statements, prologue, statementOffset, false);
|
|
80647
80731
|
if (!hasSynthesizedSuper)
|
|
80648
|
-
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor);
|
|
80732
|
+
statementOffset = factory.copyCustomPrologue(constructor.body.statements, statements, statementOffset, visitor, undefined);
|
|
80649
80733
|
var superCallExpression;
|
|
80650
80734
|
if (hasSynthesizedSuper) {
|
|
80651
80735
|
superCallExpression = createDefaultSuperCallOrThis();
|
|
80652
80736
|
}
|
|
80653
|
-
else if (
|
|
80654
|
-
|
|
80655
|
-
if (ts.isExpressionStatement(firstStatement) && ts.isSuperCall(firstStatement.expression)) {
|
|
80656
|
-
superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression);
|
|
80657
|
-
}
|
|
80737
|
+
else if (superCall) {
|
|
80738
|
+
superCallExpression = visitSuperCallInBody(superCall);
|
|
80658
80739
|
}
|
|
80659
80740
|
if (superCallExpression) {
|
|
80660
80741
|
hierarchyFacts |= 8192;
|
|
80661
|
-
statementOffset++;
|
|
80662
80742
|
}
|
|
80743
|
+
addDefaultValueAssignmentsIfNeeded(prologue, constructor);
|
|
80744
|
+
addRestParameterIfNeeded(prologue, constructor, hasSynthesizedSuper);
|
|
80663
80745
|
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset));
|
|
80664
80746
|
factory.mergeLexicalEnvironment(prologue, endLexicalEnvironment());
|
|
80665
80747
|
insertCaptureNewTargetIfNeeded(prologue, constructor, false);
|
|
80666
|
-
if (isDerivedClass) {
|
|
80667
|
-
if (superCallExpression &&
|
|
80668
|
-
var
|
|
80748
|
+
if (isDerivedClass || superCallExpression) {
|
|
80749
|
+
if (superCallExpression && postSuperStatementsStart === constructor.body.statements.length && !(constructor.body.transformFlags & 8192)) {
|
|
80750
|
+
var superCall_1 = ts.cast(ts.cast(superCallExpression, ts.isBinaryExpression).left, ts.isCallExpression);
|
|
80669
80751
|
var returnStatement = factory.createReturnStatement(superCallExpression);
|
|
80670
|
-
ts.setCommentRange(returnStatement, ts.getCommentRange(
|
|
80671
|
-
ts.setEmitFlags(
|
|
80752
|
+
ts.setCommentRange(returnStatement, ts.getCommentRange(superCall_1));
|
|
80753
|
+
ts.setEmitFlags(superCall_1, 1536);
|
|
80672
80754
|
statements.push(returnStatement);
|
|
80673
80755
|
}
|
|
80674
80756
|
else {
|
|
80675
|
-
|
|
80757
|
+
if (superStatementIndex <= existingPrologue.length) {
|
|
80758
|
+
insertCaptureThisForNode(statements, constructor, superCallExpression || createActualThis());
|
|
80759
|
+
}
|
|
80760
|
+
else {
|
|
80761
|
+
insertCaptureThisForNode(prologue, constructor, createActualThis());
|
|
80762
|
+
if (superCallExpression) {
|
|
80763
|
+
insertSuperThisCaptureThisForNode(statements, superCallExpression);
|
|
80764
|
+
}
|
|
80765
|
+
}
|
|
80676
80766
|
if (!isSufficientlyCoveredByReturnStatements(constructor.body)) {
|
|
80677
80767
|
statements.push(factory.createReturnStatement(factory.createUniqueName("_this", 16 | 32)));
|
|
80678
80768
|
}
|
|
@@ -80681,9 +80771,23 @@ var ts;
|
|
|
80681
80771
|
else {
|
|
80682
80772
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
80683
80773
|
}
|
|
80684
|
-
var
|
|
80685
|
-
ts.setTextRange(
|
|
80686
|
-
return
|
|
80774
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)), constructor.body.statements), true);
|
|
80775
|
+
ts.setTextRange(body, constructor.body);
|
|
80776
|
+
return body;
|
|
80777
|
+
}
|
|
80778
|
+
function findSuperCallAndStatementIndex(originalBodyStatements, existingPrologue) {
|
|
80779
|
+
for (var i = existingPrologue.length; i < originalBodyStatements.length; i += 1) {
|
|
80780
|
+
var superCall = ts.getSuperCallFromStatement(originalBodyStatements[i]);
|
|
80781
|
+
if (superCall) {
|
|
80782
|
+
return {
|
|
80783
|
+
superCall: superCall,
|
|
80784
|
+
superStatementIndex: i,
|
|
80785
|
+
};
|
|
80786
|
+
}
|
|
80787
|
+
}
|
|
80788
|
+
return {
|
|
80789
|
+
superStatementIndex: -1,
|
|
80790
|
+
};
|
|
80687
80791
|
}
|
|
80688
80792
|
function isSufficientlyCoveredByReturnStatements(statement) {
|
|
80689
80793
|
if (statement.kind === 246) {
|
|
@@ -80810,6 +80914,12 @@ var ts;
|
|
|
80810
80914
|
}
|
|
80811
80915
|
return false;
|
|
80812
80916
|
}
|
|
80917
|
+
function insertSuperThisCaptureThisForNode(statements, superExpression) {
|
|
80918
|
+
enableSubstitutionsForCapturedThis();
|
|
80919
|
+
var assignSuperExpression = factory.createExpressionStatement(factory.createBinaryExpression(factory.createThis(), 63, superExpression));
|
|
80920
|
+
ts.insertStatementAfterCustomPrologue(statements, assignSuperExpression);
|
|
80921
|
+
ts.setCommentRange(assignSuperExpression, ts.getOriginalNode(superExpression).parent);
|
|
80922
|
+
}
|
|
80813
80923
|
function insertCaptureThisForNode(statements, node, initializer) {
|
|
80814
80924
|
enableSubstitutionsForCapturedThis();
|
|
80815
80925
|
var captureThisStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
|
|
@@ -81019,7 +81129,7 @@ var ts;
|
|
|
81019
81129
|
var statementOffset;
|
|
81020
81130
|
resumeLexicalEnvironment();
|
|
81021
81131
|
if (ts.isBlock(body)) {
|
|
81022
|
-
statementOffset = factory.copyStandardPrologue(body.statements, prologue, false);
|
|
81132
|
+
statementOffset = factory.copyStandardPrologue(body.statements, prologue, 0, false);
|
|
81023
81133
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedFunction);
|
|
81024
81134
|
statementOffset = factory.copyCustomPrologue(body.statements, statements, statementOffset, visitor, ts.isHoistedVariableStatement);
|
|
81025
81135
|
}
|
|
@@ -81936,7 +82046,7 @@ var ts;
|
|
|
81936
82046
|
ts.addRange(statements, classStatements, 1);
|
|
81937
82047
|
return factory.restoreOuterExpressions(node.expression, factory.restoreOuterExpressions(variable.initializer, factory.restoreOuterExpressions(aliasAssignment && aliasAssignment.right, factory.updateCallExpression(call, factory.restoreOuterExpressions(call.expression, factory.updateFunctionExpression(func, undefined, undefined, undefined, undefined, func.parameters, undefined, factory.updateBlock(func.body, statements))), undefined, call.arguments))));
|
|
81938
82048
|
}
|
|
81939
|
-
function
|
|
82049
|
+
function visitSuperCallInBody(node) {
|
|
81940
82050
|
return visitCallExpressionWithPotentialCapturedThisAssignment(node, false);
|
|
81941
82051
|
}
|
|
81942
82052
|
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
|
|
@@ -99106,7 +99216,7 @@ var ts;
|
|
|
99106
99216
|
function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
99107
99217
|
return ts.firstDefined(rootDirs, function (rootDir) {
|
|
99108
99218
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
99109
|
-
return isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
99219
|
+
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
99110
99220
|
});
|
|
99111
99221
|
}
|
|
99112
99222
|
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|