typescript 4.9.0-dev.20221020 → 4.9.0-dev.20221022
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 +93 -21
- package/lib/tsserver.js +114 -37
- package/lib/tsserverlibrary.js +114 -37
- package/lib/typescript.js +114 -37
- package/lib/typescriptServices.js +114 -37
- package/lib/typingsInstaller.js +113 -36
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221022");
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -1900,8 +1900,8 @@ var ts;
|
|
|
1900
1900
|
return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length);
|
|
1901
1901
|
}
|
|
1902
1902
|
ts.compareTextSpans = compareTextSpans;
|
|
1903
|
-
function min(
|
|
1904
|
-
return compare(
|
|
1903
|
+
function min(items, compare) {
|
|
1904
|
+
return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
|
|
1905
1905
|
}
|
|
1906
1906
|
ts.min = min;
|
|
1907
1907
|
/**
|
|
@@ -5118,8 +5118,8 @@ var ts;
|
|
|
5118
5118
|
NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
|
|
5119
5119
|
NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
|
|
5120
5120
|
NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
|
|
5121
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5122
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5121
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
|
|
5122
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
5123
5123
|
NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
|
|
5124
5124
|
NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
|
|
5125
5125
|
NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
|
|
@@ -42270,12 +42270,23 @@ var ts;
|
|
|
42270
42270
|
}
|
|
42271
42271
|
function writeConfigurations() {
|
|
42272
42272
|
// Filter applicable options to place in the file
|
|
42273
|
-
var categorizedOptions = ts.
|
|
42273
|
+
var categorizedOptions = new ts.Map();
|
|
42274
|
+
// Set allowed categories in order
|
|
42275
|
+
categorizedOptions.set(ts.Diagnostics.Projects, []);
|
|
42276
|
+
categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []);
|
|
42277
|
+
categorizedOptions.set(ts.Diagnostics.Modules, []);
|
|
42278
|
+
categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []);
|
|
42279
|
+
categorizedOptions.set(ts.Diagnostics.Emit, []);
|
|
42280
|
+
categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []);
|
|
42281
|
+
categorizedOptions.set(ts.Diagnostics.Type_Checking, []);
|
|
42282
|
+
categorizedOptions.set(ts.Diagnostics.Completeness, []);
|
|
42274
42283
|
for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) {
|
|
42275
42284
|
var option = optionDeclarations_1[_i];
|
|
42276
|
-
var category = option.category;
|
|
42277
42285
|
if (isAllowedOptionForOutput(option)) {
|
|
42278
|
-
categorizedOptions.
|
|
42286
|
+
var listForCategory = categorizedOptions.get(option.category);
|
|
42287
|
+
if (!listForCategory)
|
|
42288
|
+
categorizedOptions.set(option.category, listForCategory = []);
|
|
42289
|
+
listForCategory.push(option);
|
|
42279
42290
|
}
|
|
42280
42291
|
}
|
|
42281
42292
|
// Serialize all options and their descriptions
|
|
@@ -42286,7 +42297,7 @@ var ts;
|
|
|
42286
42297
|
if (entries.length !== 0) {
|
|
42287
42298
|
entries.push({ value: "" });
|
|
42288
42299
|
}
|
|
42289
|
-
entries.push({ value: "/* ".concat(category, " */") });
|
|
42300
|
+
entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") });
|
|
42290
42301
|
for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
|
|
42291
42302
|
var option = options_1[_i];
|
|
42292
42303
|
var optionName = void 0;
|
|
@@ -73297,7 +73308,7 @@ var ts;
|
|
|
73297
73308
|
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
|
|
73298
73309
|
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
|
73299
73310
|
// declaration container are the same).
|
|
73300
|
-
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
|
|
73311
|
+
var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) ||
|
|
73301
73312
|
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 ||
|
|
73302
73313
|
isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) ||
|
|
73303
73314
|
node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ ||
|
|
@@ -73326,6 +73337,12 @@ var ts;
|
|
|
73326
73337
|
}
|
|
73327
73338
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
73328
73339
|
}
|
|
73340
|
+
function isSameScopedBindingElement(node, declaration) {
|
|
73341
|
+
if (ts.isBindingElement(declaration)) {
|
|
73342
|
+
var bindingElement = ts.findAncestor(node, ts.isBindingElement);
|
|
73343
|
+
return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration);
|
|
73344
|
+
}
|
|
73345
|
+
}
|
|
73329
73346
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
73330
73347
|
var _a;
|
|
73331
73348
|
var parent = node.parent;
|
|
@@ -73667,12 +73684,17 @@ var ts;
|
|
|
73667
73684
|
var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
|
|
73668
73685
|
var container = immediateContainer;
|
|
73669
73686
|
var needToCaptureLexicalThis = false;
|
|
73687
|
+
var inAsyncFunction = false;
|
|
73670
73688
|
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
|
|
73671
73689
|
if (!isCallExpression) {
|
|
73672
73690
|
while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
|
|
73691
|
+
if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73692
|
+
inAsyncFunction = true;
|
|
73673
73693
|
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
|
|
73674
73694
|
needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
|
|
73675
73695
|
}
|
|
73696
|
+
if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73697
|
+
inAsyncFunction = true;
|
|
73676
73698
|
}
|
|
73677
73699
|
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
|
|
73678
73700
|
var nodeCheckFlag = 0;
|
|
@@ -73778,12 +73800,12 @@ var ts;
|
|
|
73778
73800
|
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
|
|
73779
73801
|
//
|
|
73780
73802
|
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
|
|
73781
|
-
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ &&
|
|
73803
|
+
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
|
|
73782
73804
|
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
|
|
73783
|
-
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.
|
|
73805
|
+
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
|
|
73784
73806
|
}
|
|
73785
73807
|
else {
|
|
73786
|
-
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.
|
|
73808
|
+
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
|
|
73787
73809
|
}
|
|
73788
73810
|
}
|
|
73789
73811
|
if (needToCaptureLexicalThis) {
|
|
@@ -82939,7 +82961,7 @@ var ts;
|
|
|
82939
82961
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
82940
82962
|
}
|
|
82941
82963
|
// primitives with a `{ then() }` won't be unwrapped/adopted.
|
|
82942
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82964
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82943
82965
|
return undefined;
|
|
82944
82966
|
}
|
|
82945
82967
|
var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
|
|
@@ -83006,7 +83028,7 @@ var ts;
|
|
|
83006
83028
|
* Determines whether a type is an object with a callable `then` member.
|
|
83007
83029
|
*/
|
|
83008
83030
|
function isThenableType(type) {
|
|
83009
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83031
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83010
83032
|
// primitive types cannot be considered "thenable" since they are not objects.
|
|
83011
83033
|
return false;
|
|
83012
83034
|
}
|
|
@@ -98505,8 +98527,11 @@ var ts;
|
|
|
98505
98527
|
}
|
|
98506
98528
|
return ts.visitEachChild(node, visitor, context);
|
|
98507
98529
|
case 174 /* SyntaxKind.GetAccessor */:
|
|
98530
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
|
|
98508
98531
|
case 175 /* SyntaxKind.SetAccessor */:
|
|
98532
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
|
|
98509
98533
|
case 173 /* SyntaxKind.Constructor */:
|
|
98534
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
|
|
98510
98535
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
98511
98536
|
case 228 /* SyntaxKind.ClassExpression */:
|
|
98512
98537
|
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
|
|
@@ -98607,6 +98632,9 @@ var ts;
|
|
|
98607
98632
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
98608
98633
|
/*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
|
|
98609
98634
|
}
|
|
98635
|
+
function visitConstructorDeclaration(node) {
|
|
98636
|
+
return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98637
|
+
}
|
|
98610
98638
|
/**
|
|
98611
98639
|
* Visits a MethodDeclaration node.
|
|
98612
98640
|
*
|
|
@@ -98621,7 +98649,14 @@ var ts;
|
|
|
98621
98649
|
/*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
|
|
98622
98650
|
/*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
|
|
98623
98651
|
? transformAsyncFunctionBody(node)
|
|
98624
|
-
:
|
|
98652
|
+
: transformMethodBody(node));
|
|
98653
|
+
}
|
|
98654
|
+
function visitGetAccessorDeclaration(node) {
|
|
98655
|
+
return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
|
|
98656
|
+
/*type*/ undefined, transformMethodBody(node));
|
|
98657
|
+
}
|
|
98658
|
+
function visitSetAccessorDeclaration(node) {
|
|
98659
|
+
return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98625
98660
|
}
|
|
98626
98661
|
/**
|
|
98627
98662
|
* Visits a FunctionDeclaration node.
|
|
@@ -98735,6 +98770,42 @@ var ts;
|
|
|
98735
98770
|
}
|
|
98736
98771
|
return false;
|
|
98737
98772
|
}
|
|
98773
|
+
function transformMethodBody(node) {
|
|
98774
|
+
ts.Debug.assertIsDefined(node.body);
|
|
98775
|
+
var savedCapturedSuperProperties = capturedSuperProperties;
|
|
98776
|
+
var savedHasSuperElementAccess = hasSuperElementAccess;
|
|
98777
|
+
capturedSuperProperties = new ts.Set();
|
|
98778
|
+
hasSuperElementAccess = false;
|
|
98779
|
+
var updated = ts.visitFunctionBody(node.body, visitor, context);
|
|
98780
|
+
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98781
|
+
// This step isn't needed if we eventually transform this to ES5.
|
|
98782
|
+
var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
|
|
98783
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
|
|
98784
|
+
resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
|
|
98785
|
+
(ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
|
|
98786
|
+
if (emitSuperHelpers) {
|
|
98787
|
+
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98788
|
+
if (capturedSuperProperties.size) {
|
|
98789
|
+
var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
98790
|
+
substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
|
|
98791
|
+
var statements = updated.statements.slice();
|
|
98792
|
+
ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
98793
|
+
updated = factory.updateBlock(updated, statements);
|
|
98794
|
+
}
|
|
98795
|
+
if (hasSuperElementAccess) {
|
|
98796
|
+
// Emit helpers for super element access expressions (`super[x]`).
|
|
98797
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98798
|
+
ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
|
|
98799
|
+
}
|
|
98800
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98801
|
+
ts.addEmitHelper(updated, ts.asyncSuperHelper);
|
|
98802
|
+
}
|
|
98803
|
+
}
|
|
98804
|
+
}
|
|
98805
|
+
capturedSuperProperties = savedCapturedSuperProperties;
|
|
98806
|
+
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
98807
|
+
return updated;
|
|
98808
|
+
}
|
|
98738
98809
|
function transformAsyncFunctionBody(node) {
|
|
98739
98810
|
resumeLexicalEnvironment();
|
|
98740
98811
|
var original = ts.getOriginalNode(node, ts.isFunctionLike);
|
|
@@ -98767,7 +98838,7 @@ var ts;
|
|
|
98767
98838
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
98768
98839
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98769
98840
|
// This step isn't needed if we eventually transform this to ES5.
|
|
98770
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
98841
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
98771
98842
|
if (emitSuperHelpers) {
|
|
98772
98843
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98773
98844
|
if (capturedSuperProperties.size) {
|
|
@@ -98780,10 +98851,10 @@ var ts;
|
|
|
98780
98851
|
ts.setTextRange(block, node.body);
|
|
98781
98852
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98782
98853
|
// Emit helpers for super element access expressions (`super[x]`).
|
|
98783
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
98854
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98784
98855
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
98785
98856
|
}
|
|
98786
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
98857
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98787
98858
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
98788
98859
|
}
|
|
98789
98860
|
}
|
|
@@ -98855,7 +98926,7 @@ var ts;
|
|
|
98855
98926
|
// If we need to support substitutions for `super` in an async method,
|
|
98856
98927
|
// we should track it here.
|
|
98857
98928
|
if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98858
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
98929
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
98859
98930
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98860
98931
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98861
98932
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -98932,7 +99003,7 @@ var ts;
|
|
|
98932
99003
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
98933
99004
|
}
|
|
98934
99005
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
98935
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99006
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98936
99007
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
|
|
98937
99008
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
98938
99009
|
}
|
|
@@ -98947,7 +99018,7 @@ var ts;
|
|
|
98947
99018
|
function createSuperAccessVariableStatement(factory, resolver, node, names) {
|
|
98948
99019
|
// Create a variable declaration with a getter/setter (if binding) definition for each name:
|
|
98949
99020
|
// const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
|
|
98950
|
-
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99021
|
+
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
|
|
98951
99022
|
var accessors = [];
|
|
98952
99023
|
names.forEach(function (_, key) {
|
|
98953
99024
|
var name = ts.unescapeLeadingUnderscores(key);
|
|
@@ -99655,7 +99726,7 @@ var ts;
|
|
|
99655
99726
|
/*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
|
|
99656
99727
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
99657
99728
|
// This step isn't needed if we eventually transform this to ES5.
|
|
99658
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
99729
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
99659
99730
|
if (emitSuperHelpers) {
|
|
99660
99731
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
99661
99732
|
var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
@@ -99666,10 +99737,10 @@ var ts;
|
|
|
99666
99737
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
99667
99738
|
var block = factory.updateBlock(node.body, statements);
|
|
99668
99739
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
99669
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99740
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99670
99741
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
99671
99742
|
}
|
|
99672
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
99743
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
99673
99744
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
99674
99745
|
}
|
|
99675
99746
|
}
|
|
@@ -99798,7 +99869,7 @@ var ts;
|
|
|
99798
99869
|
// If we need to support substitutions for `super` in an async method,
|
|
99799
99870
|
// we should track it here.
|
|
99800
99871
|
if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
99801
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
99872
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
99802
99873
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
99803
99874
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
99804
99875
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99875,7 +99946,7 @@ var ts;
|
|
|
99875
99946
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
99876
99947
|
}
|
|
99877
99948
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
99878
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99949
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99879
99950
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
|
|
99880
99951
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
99881
99952
|
}
|
|
@@ -123901,7 +123972,7 @@ var ts;
|
|
|
123901
123972
|
var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
|
|
123902
123973
|
if (isNonDirectorySeparatorRoot &&
|
|
123903
123974
|
dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
123904
|
-
pathPartForUserCheck.search(/[a-zA-
|
|
123975
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
|
|
123905
123976
|
nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
|
|
123906
123977
|
if (nextDirectorySeparator === -1) {
|
|
123907
123978
|
// ignore "//vda1cs4850/c$/folderAtRoot"
|
|
@@ -125407,15 +125478,21 @@ var ts;
|
|
|
125407
125478
|
return undefined;
|
|
125408
125479
|
}
|
|
125409
125480
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
125410
|
-
var
|
|
125411
|
-
if (
|
|
125481
|
+
var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
125482
|
+
if (normalizedTargetPaths === undefined) {
|
|
125483
|
+
return undefined;
|
|
125484
|
+
}
|
|
125485
|
+
var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125486
|
+
var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
|
|
125487
|
+
return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
|
|
125488
|
+
});
|
|
125489
|
+
var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
|
|
125490
|
+
if (!shortest) {
|
|
125412
125491
|
return undefined;
|
|
125413
125492
|
}
|
|
125414
|
-
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125415
|
-
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
|
|
125416
125493
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
|
|
125417
|
-
? removeExtensionAndIndexPostFix(
|
|
125418
|
-
: ts.removeFileExtension(
|
|
125494
|
+
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
|
|
125495
|
+
: ts.removeFileExtension(shortest);
|
|
125419
125496
|
}
|
|
125420
125497
|
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
125421
125498
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
@@ -125552,8 +125629,8 @@ var ts;
|
|
|
125552
125629
|
}
|
|
125553
125630
|
}
|
|
125554
125631
|
}
|
|
125555
|
-
function
|
|
125556
|
-
return ts.
|
|
125632
|
+
function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
125633
|
+
return ts.mapDefined(rootDirs, function (rootDir) {
|
|
125557
125634
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
125558
125635
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
125559
125636
|
});
|
|
@@ -146062,7 +146139,7 @@ var ts;
|
|
|
146062
146139
|
return bestMatch;
|
|
146063
146140
|
}
|
|
146064
146141
|
function betterMatch(a, b) {
|
|
146065
|
-
return ts.min(a, b, compareMatches);
|
|
146142
|
+
return ts.min([a, b], compareMatches);
|
|
146066
146143
|
}
|
|
146067
146144
|
function compareMatches(a, b) {
|
|
146068
146145
|
return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */
|