typescript 4.9.0-dev.20221021 → 4.9.0-dev.20221023
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 +73 -17
- package/lib/tsserver.js +93 -33
- package/lib/tsserverlibrary.js +93 -33
- package/lib/typescript.js +93 -33
- package/lib/typescriptServices.js +93 -33
- package/lib/typingsInstaller.js +92 -32
- package/package.json +1 -1
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221023");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -1891,8 +1891,8 @@ var ts;
|
|
|
1891
1891
|
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);
|
|
1892
1892
|
}
|
|
1893
1893
|
ts.compareTextSpans = compareTextSpans;
|
|
1894
|
-
function min(
|
|
1895
|
-
return compare(
|
|
1894
|
+
function min(items, compare) {
|
|
1895
|
+
return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
|
|
1896
1896
|
}
|
|
1897
1897
|
ts.min = min;
|
|
1898
1898
|
/**
|
|
@@ -5109,8 +5109,8 @@ var ts;
|
|
|
5109
5109
|
NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
|
|
5110
5110
|
NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
|
|
5111
5111
|
NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
|
|
5112
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5113
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5112
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
|
|
5113
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
5114
5114
|
NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
|
|
5115
5115
|
NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
|
|
5116
5116
|
NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
|
|
@@ -63312,7 +63312,7 @@ var ts;
|
|
|
63312
63312
|
type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
|
|
63313
63313
|
// Mapping<Mapping<T>> === Mapping<T>
|
|
63314
63314
|
type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
|
|
63315
|
-
type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */
|
|
63315
|
+
type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
|
|
63316
63316
|
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
|
|
63317
63317
|
isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
|
|
63318
63318
|
type;
|
|
@@ -73675,12 +73675,17 @@ var ts;
|
|
|
73675
73675
|
var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
|
|
73676
73676
|
var container = immediateContainer;
|
|
73677
73677
|
var needToCaptureLexicalThis = false;
|
|
73678
|
+
var inAsyncFunction = false;
|
|
73678
73679
|
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
|
|
73679
73680
|
if (!isCallExpression) {
|
|
73680
73681
|
while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
|
|
73682
|
+
if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73683
|
+
inAsyncFunction = true;
|
|
73681
73684
|
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
|
|
73682
73685
|
needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
|
|
73683
73686
|
}
|
|
73687
|
+
if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73688
|
+
inAsyncFunction = true;
|
|
73684
73689
|
}
|
|
73685
73690
|
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
|
|
73686
73691
|
var nodeCheckFlag = 0;
|
|
@@ -73786,12 +73791,12 @@ var ts;
|
|
|
73786
73791
|
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
|
|
73787
73792
|
//
|
|
73788
73793
|
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
|
|
73789
|
-
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ &&
|
|
73794
|
+
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
|
|
73790
73795
|
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
|
|
73791
|
-
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.
|
|
73796
|
+
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
|
|
73792
73797
|
}
|
|
73793
73798
|
else {
|
|
73794
|
-
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.
|
|
73799
|
+
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
|
|
73795
73800
|
}
|
|
73796
73801
|
}
|
|
73797
73802
|
if (needToCaptureLexicalThis) {
|
|
@@ -82947,7 +82952,7 @@ var ts;
|
|
|
82947
82952
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
82948
82953
|
}
|
|
82949
82954
|
// primitives with a `{ then() }` won't be unwrapped/adopted.
|
|
82950
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82955
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82951
82956
|
return undefined;
|
|
82952
82957
|
}
|
|
82953
82958
|
var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
|
|
@@ -83014,7 +83019,7 @@ var ts;
|
|
|
83014
83019
|
* Determines whether a type is an object with a callable `then` member.
|
|
83015
83020
|
*/
|
|
83016
83021
|
function isThenableType(type) {
|
|
83017
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83022
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83018
83023
|
// primitive types cannot be considered "thenable" since they are not objects.
|
|
83019
83024
|
return false;
|
|
83020
83025
|
}
|
|
@@ -98513,8 +98518,11 @@ var ts;
|
|
|
98513
98518
|
}
|
|
98514
98519
|
return ts.visitEachChild(node, visitor, context);
|
|
98515
98520
|
case 174 /* SyntaxKind.GetAccessor */:
|
|
98521
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
|
|
98516
98522
|
case 175 /* SyntaxKind.SetAccessor */:
|
|
98523
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
|
|
98517
98524
|
case 173 /* SyntaxKind.Constructor */:
|
|
98525
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
|
|
98518
98526
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
98519
98527
|
case 228 /* SyntaxKind.ClassExpression */:
|
|
98520
98528
|
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
|
|
@@ -98615,6 +98623,9 @@ var ts;
|
|
|
98615
98623
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
98616
98624
|
/*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
|
|
98617
98625
|
}
|
|
98626
|
+
function visitConstructorDeclaration(node) {
|
|
98627
|
+
return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98628
|
+
}
|
|
98618
98629
|
/**
|
|
98619
98630
|
* Visits a MethodDeclaration node.
|
|
98620
98631
|
*
|
|
@@ -98629,7 +98640,14 @@ var ts;
|
|
|
98629
98640
|
/*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
|
|
98630
98641
|
/*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
|
|
98631
98642
|
? transformAsyncFunctionBody(node)
|
|
98632
|
-
:
|
|
98643
|
+
: transformMethodBody(node));
|
|
98644
|
+
}
|
|
98645
|
+
function visitGetAccessorDeclaration(node) {
|
|
98646
|
+
return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
|
|
98647
|
+
/*type*/ undefined, transformMethodBody(node));
|
|
98648
|
+
}
|
|
98649
|
+
function visitSetAccessorDeclaration(node) {
|
|
98650
|
+
return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98633
98651
|
}
|
|
98634
98652
|
/**
|
|
98635
98653
|
* Visits a FunctionDeclaration node.
|
|
@@ -98743,6 +98761,42 @@ var ts;
|
|
|
98743
98761
|
}
|
|
98744
98762
|
return false;
|
|
98745
98763
|
}
|
|
98764
|
+
function transformMethodBody(node) {
|
|
98765
|
+
ts.Debug.assertIsDefined(node.body);
|
|
98766
|
+
var savedCapturedSuperProperties = capturedSuperProperties;
|
|
98767
|
+
var savedHasSuperElementAccess = hasSuperElementAccess;
|
|
98768
|
+
capturedSuperProperties = new ts.Set();
|
|
98769
|
+
hasSuperElementAccess = false;
|
|
98770
|
+
var updated = ts.visitFunctionBody(node.body, visitor, context);
|
|
98771
|
+
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98772
|
+
// This step isn't needed if we eventually transform this to ES5.
|
|
98773
|
+
var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
|
|
98774
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
|
|
98775
|
+
resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
|
|
98776
|
+
(ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
|
|
98777
|
+
if (emitSuperHelpers) {
|
|
98778
|
+
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98779
|
+
if (capturedSuperProperties.size) {
|
|
98780
|
+
var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
98781
|
+
substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
|
|
98782
|
+
var statements = updated.statements.slice();
|
|
98783
|
+
ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
98784
|
+
updated = factory.updateBlock(updated, statements);
|
|
98785
|
+
}
|
|
98786
|
+
if (hasSuperElementAccess) {
|
|
98787
|
+
// Emit helpers for super element access expressions (`super[x]`).
|
|
98788
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98789
|
+
ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
|
|
98790
|
+
}
|
|
98791
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98792
|
+
ts.addEmitHelper(updated, ts.asyncSuperHelper);
|
|
98793
|
+
}
|
|
98794
|
+
}
|
|
98795
|
+
}
|
|
98796
|
+
capturedSuperProperties = savedCapturedSuperProperties;
|
|
98797
|
+
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
98798
|
+
return updated;
|
|
98799
|
+
}
|
|
98746
98800
|
function transformAsyncFunctionBody(node) {
|
|
98747
98801
|
resumeLexicalEnvironment();
|
|
98748
98802
|
var original = ts.getOriginalNode(node, ts.isFunctionLike);
|
|
@@ -98775,7 +98829,7 @@ var ts;
|
|
|
98775
98829
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
98776
98830
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98777
98831
|
// This step isn't needed if we eventually transform this to ES5.
|
|
98778
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
98832
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
98779
98833
|
if (emitSuperHelpers) {
|
|
98780
98834
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98781
98835
|
if (capturedSuperProperties.size) {
|
|
@@ -98788,10 +98842,10 @@ var ts;
|
|
|
98788
98842
|
ts.setTextRange(block, node.body);
|
|
98789
98843
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98790
98844
|
// Emit helpers for super element access expressions (`super[x]`).
|
|
98791
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
98845
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98792
98846
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
98793
98847
|
}
|
|
98794
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
98848
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98795
98849
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
98796
98850
|
}
|
|
98797
98851
|
}
|
|
@@ -98863,7 +98917,7 @@ var ts;
|
|
|
98863
98917
|
// If we need to support substitutions for `super` in an async method,
|
|
98864
98918
|
// we should track it here.
|
|
98865
98919
|
if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98866
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
98920
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
98867
98921
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98868
98922
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98869
98923
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -98940,7 +98994,7 @@ var ts;
|
|
|
98940
98994
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
98941
98995
|
}
|
|
98942
98996
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
98943
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
98997
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98944
98998
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
|
|
98945
98999
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
98946
99000
|
}
|
|
@@ -98955,7 +99009,7 @@ var ts;
|
|
|
98955
99009
|
function createSuperAccessVariableStatement(factory, resolver, node, names) {
|
|
98956
99010
|
// Create a variable declaration with a getter/setter (if binding) definition for each name:
|
|
98957
99011
|
// const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
|
|
98958
|
-
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99012
|
+
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
|
|
98959
99013
|
var accessors = [];
|
|
98960
99014
|
names.forEach(function (_, key) {
|
|
98961
99015
|
var name = ts.unescapeLeadingUnderscores(key);
|
|
@@ -99663,7 +99717,7 @@ var ts;
|
|
|
99663
99717
|
/*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
|
|
99664
99718
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
99665
99719
|
// This step isn't needed if we eventually transform this to ES5.
|
|
99666
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
99720
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
99667
99721
|
if (emitSuperHelpers) {
|
|
99668
99722
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
99669
99723
|
var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
@@ -99674,10 +99728,10 @@ var ts;
|
|
|
99674
99728
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
99675
99729
|
var block = factory.updateBlock(node.body, statements);
|
|
99676
99730
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
99677
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99731
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99678
99732
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
99679
99733
|
}
|
|
99680
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
99734
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
99681
99735
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
99682
99736
|
}
|
|
99683
99737
|
}
|
|
@@ -99806,7 +99860,7 @@ var ts;
|
|
|
99806
99860
|
// If we need to support substitutions for `super` in an async method,
|
|
99807
99861
|
// we should track it here.
|
|
99808
99862
|
if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
99809
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
99863
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
99810
99864
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
99811
99865
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
99812
99866
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99883,7 +99937,7 @@ var ts;
|
|
|
99883
99937
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
99884
99938
|
}
|
|
99885
99939
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
99886
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99940
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99887
99941
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
|
|
99888
99942
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
99889
99943
|
}
|
|
@@ -123909,7 +123963,7 @@ var ts;
|
|
|
123909
123963
|
var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
|
|
123910
123964
|
if (isNonDirectorySeparatorRoot &&
|
|
123911
123965
|
dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
123912
|
-
pathPartForUserCheck.search(/[a-zA-
|
|
123966
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
|
|
123913
123967
|
nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
|
|
123914
123968
|
if (nextDirectorySeparator === -1) {
|
|
123915
123969
|
// ignore "//vda1cs4850/c$/folderAtRoot"
|
|
@@ -125415,15 +125469,21 @@ var ts;
|
|
|
125415
125469
|
return undefined;
|
|
125416
125470
|
}
|
|
125417
125471
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
125418
|
-
var
|
|
125419
|
-
if (
|
|
125472
|
+
var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
125473
|
+
if (normalizedTargetPaths === undefined) {
|
|
125474
|
+
return undefined;
|
|
125475
|
+
}
|
|
125476
|
+
var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125477
|
+
var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
|
|
125478
|
+
return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
|
|
125479
|
+
});
|
|
125480
|
+
var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
|
|
125481
|
+
if (!shortest) {
|
|
125420
125482
|
return undefined;
|
|
125421
125483
|
}
|
|
125422
|
-
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125423
|
-
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
|
|
125424
125484
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
|
|
125425
|
-
? removeExtensionAndIndexPostFix(
|
|
125426
|
-
: ts.removeFileExtension(
|
|
125485
|
+
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
|
|
125486
|
+
: ts.removeFileExtension(shortest);
|
|
125427
125487
|
}
|
|
125428
125488
|
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
125429
125489
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
@@ -125560,8 +125620,8 @@ var ts;
|
|
|
125560
125620
|
}
|
|
125561
125621
|
}
|
|
125562
125622
|
}
|
|
125563
|
-
function
|
|
125564
|
-
return ts.
|
|
125623
|
+
function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
125624
|
+
return ts.mapDefined(rootDirs, function (rootDir) {
|
|
125565
125625
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
125566
125626
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
125567
125627
|
});
|
|
@@ -146070,7 +146130,7 @@ var ts;
|
|
|
146070
146130
|
return bestMatch;
|
|
146071
146131
|
}
|
|
146072
146132
|
function betterMatch(a, b) {
|
|
146073
|
-
return ts.min(a, b, compareMatches);
|
|
146133
|
+
return ts.min([a, b], compareMatches);
|
|
146074
146134
|
}
|
|
146075
146135
|
function compareMatches(a, b) {
|
|
146076
146136
|
return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
92
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221023");
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -1881,8 +1881,8 @@ var ts;
|
|
|
1881
1881
|
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);
|
|
1882
1882
|
}
|
|
1883
1883
|
ts.compareTextSpans = compareTextSpans;
|
|
1884
|
-
function min(
|
|
1885
|
-
return compare(
|
|
1884
|
+
function min(items, compare) {
|
|
1885
|
+
return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; });
|
|
1886
1886
|
}
|
|
1887
1887
|
ts.min = min;
|
|
1888
1888
|
/**
|
|
@@ -5099,8 +5099,8 @@ var ts;
|
|
|
5099
5099
|
NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance";
|
|
5100
5100
|
NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic";
|
|
5101
5101
|
NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
|
|
5102
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5103
|
-
NodeCheckFlags[NodeCheckFlags["
|
|
5102
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync";
|
|
5103
|
+
NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync";
|
|
5104
5104
|
NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
|
|
5105
5105
|
NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed";
|
|
5106
5106
|
NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass";
|
|
@@ -63302,7 +63302,7 @@ var ts;
|
|
|
63302
63302
|
type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
|
|
63303
63303
|
// Mapping<Mapping<T>> === Mapping<T>
|
|
63304
63304
|
type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type :
|
|
63305
|
-
type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */
|
|
63305
|
+
type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
|
|
63306
63306
|
// This handles Mapping<`${number}`> and Mapping<`${bigint}`>
|
|
63307
63307
|
isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) :
|
|
63308
63308
|
type;
|
|
@@ -73665,12 +73665,17 @@ var ts;
|
|
|
73665
73665
|
var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
|
|
73666
73666
|
var container = immediateContainer;
|
|
73667
73667
|
var needToCaptureLexicalThis = false;
|
|
73668
|
+
var inAsyncFunction = false;
|
|
73668
73669
|
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
|
|
73669
73670
|
if (!isCallExpression) {
|
|
73670
73671
|
while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) {
|
|
73672
|
+
if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73673
|
+
inAsyncFunction = true;
|
|
73671
73674
|
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
|
|
73672
73675
|
needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */;
|
|
73673
73676
|
}
|
|
73677
|
+
if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */))
|
|
73678
|
+
inAsyncFunction = true;
|
|
73674
73679
|
}
|
|
73675
73680
|
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
|
|
73676
73681
|
var nodeCheckFlag = 0;
|
|
@@ -73776,12 +73781,12 @@ var ts;
|
|
|
73776
73781
|
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
|
|
73777
73782
|
//
|
|
73778
73783
|
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
|
|
73779
|
-
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ &&
|
|
73784
|
+
if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) {
|
|
73780
73785
|
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
|
|
73781
|
-
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.
|
|
73786
|
+
getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */;
|
|
73782
73787
|
}
|
|
73783
73788
|
else {
|
|
73784
|
-
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.
|
|
73789
|
+
getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */;
|
|
73785
73790
|
}
|
|
73786
73791
|
}
|
|
73787
73792
|
if (needToCaptureLexicalThis) {
|
|
@@ -82937,7 +82942,7 @@ var ts;
|
|
|
82937
82942
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
82938
82943
|
}
|
|
82939
82944
|
// primitives with a `{ then() }` won't be unwrapped/adopted.
|
|
82940
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82945
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
82941
82946
|
return undefined;
|
|
82942
82947
|
}
|
|
82943
82948
|
var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217
|
|
@@ -83004,7 +83009,7 @@ var ts;
|
|
|
83004
83009
|
* Determines whether a type is an object with a callable `then` member.
|
|
83005
83010
|
*/
|
|
83006
83011
|
function isThenableType(type) {
|
|
83007
|
-
if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83012
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) {
|
|
83008
83013
|
// primitive types cannot be considered "thenable" since they are not objects.
|
|
83009
83014
|
return false;
|
|
83010
83015
|
}
|
|
@@ -98503,8 +98508,11 @@ var ts;
|
|
|
98503
98508
|
}
|
|
98504
98509
|
return ts.visitEachChild(node, visitor, context);
|
|
98505
98510
|
case 174 /* SyntaxKind.GetAccessor */:
|
|
98511
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node);
|
|
98506
98512
|
case 175 /* SyntaxKind.SetAccessor */:
|
|
98513
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node);
|
|
98507
98514
|
case 173 /* SyntaxKind.Constructor */:
|
|
98515
|
+
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node);
|
|
98508
98516
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
98509
98517
|
case 228 /* SyntaxKind.ClassExpression */:
|
|
98510
98518
|
return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node);
|
|
@@ -98605,6 +98613,9 @@ var ts;
|
|
|
98605
98613
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
98606
98614
|
/*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node);
|
|
98607
98615
|
}
|
|
98616
|
+
function visitConstructorDeclaration(node) {
|
|
98617
|
+
return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98618
|
+
}
|
|
98608
98619
|
/**
|
|
98609
98620
|
* Visits a MethodDeclaration node.
|
|
98610
98621
|
*
|
|
@@ -98619,7 +98630,14 @@ var ts;
|
|
|
98619
98630
|
/*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context),
|
|
98620
98631
|
/*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */
|
|
98621
98632
|
? transformAsyncFunctionBody(node)
|
|
98622
|
-
:
|
|
98633
|
+
: transformMethodBody(node));
|
|
98634
|
+
}
|
|
98635
|
+
function visitGetAccessorDeclaration(node) {
|
|
98636
|
+
return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context),
|
|
98637
|
+
/*type*/ undefined, transformMethodBody(node));
|
|
98638
|
+
}
|
|
98639
|
+
function visitSetAccessorDeclaration(node) {
|
|
98640
|
+
return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node));
|
|
98623
98641
|
}
|
|
98624
98642
|
/**
|
|
98625
98643
|
* Visits a FunctionDeclaration node.
|
|
@@ -98733,6 +98751,42 @@ var ts;
|
|
|
98733
98751
|
}
|
|
98734
98752
|
return false;
|
|
98735
98753
|
}
|
|
98754
|
+
function transformMethodBody(node) {
|
|
98755
|
+
ts.Debug.assertIsDefined(node.body);
|
|
98756
|
+
var savedCapturedSuperProperties = capturedSuperProperties;
|
|
98757
|
+
var savedHasSuperElementAccess = hasSuperElementAccess;
|
|
98758
|
+
capturedSuperProperties = new ts.Set();
|
|
98759
|
+
hasSuperElementAccess = false;
|
|
98760
|
+
var updated = ts.visitFunctionBody(node.body, visitor, context);
|
|
98761
|
+
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98762
|
+
// This step isn't needed if we eventually transform this to ES5.
|
|
98763
|
+
var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration);
|
|
98764
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ &&
|
|
98765
|
+
resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) &&
|
|
98766
|
+
(ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */;
|
|
98767
|
+
if (emitSuperHelpers) {
|
|
98768
|
+
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98769
|
+
if (capturedSuperProperties.size) {
|
|
98770
|
+
var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
98771
|
+
substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true;
|
|
98772
|
+
var statements = updated.statements.slice();
|
|
98773
|
+
ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
98774
|
+
updated = factory.updateBlock(updated, statements);
|
|
98775
|
+
}
|
|
98776
|
+
if (hasSuperElementAccess) {
|
|
98777
|
+
// Emit helpers for super element access expressions (`super[x]`).
|
|
98778
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98779
|
+
ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper);
|
|
98780
|
+
}
|
|
98781
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98782
|
+
ts.addEmitHelper(updated, ts.asyncSuperHelper);
|
|
98783
|
+
}
|
|
98784
|
+
}
|
|
98785
|
+
}
|
|
98786
|
+
capturedSuperProperties = savedCapturedSuperProperties;
|
|
98787
|
+
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
98788
|
+
return updated;
|
|
98789
|
+
}
|
|
98736
98790
|
function transformAsyncFunctionBody(node) {
|
|
98737
98791
|
resumeLexicalEnvironment();
|
|
98738
98792
|
var original = ts.getOriginalNode(node, ts.isFunctionLike);
|
|
@@ -98765,7 +98819,7 @@ var ts;
|
|
|
98765
98819
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
98766
98820
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
98767
98821
|
// This step isn't needed if we eventually transform this to ES5.
|
|
98768
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
98822
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
98769
98823
|
if (emitSuperHelpers) {
|
|
98770
98824
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98771
98825
|
if (capturedSuperProperties.size) {
|
|
@@ -98778,10 +98832,10 @@ var ts;
|
|
|
98778
98832
|
ts.setTextRange(block, node.body);
|
|
98779
98833
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98780
98834
|
// Emit helpers for super element access expressions (`super[x]`).
|
|
98781
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
98835
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98782
98836
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
98783
98837
|
}
|
|
98784
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
98838
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
98785
98839
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
98786
98840
|
}
|
|
98787
98841
|
}
|
|
@@ -98853,7 +98907,7 @@ var ts;
|
|
|
98853
98907
|
// If we need to support substitutions for `super` in an async method,
|
|
98854
98908
|
// we should track it here.
|
|
98855
98909
|
if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
98856
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
98910
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
98857
98911
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
98858
98912
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
98859
98913
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -98930,7 +98984,7 @@ var ts;
|
|
|
98930
98984
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
98931
98985
|
}
|
|
98932
98986
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
98933
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
98987
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98934
98988
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */),
|
|
98935
98989
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
98936
98990
|
}
|
|
@@ -98945,7 +98999,7 @@ var ts;
|
|
|
98945
98999
|
function createSuperAccessVariableStatement(factory, resolver, node, names) {
|
|
98946
99000
|
// Create a variable declaration with a getter/setter (if binding) definition for each name:
|
|
98947
99001
|
// const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... });
|
|
98948
|
-
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99002
|
+
var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0;
|
|
98949
99003
|
var accessors = [];
|
|
98950
99004
|
names.forEach(function (_, key) {
|
|
98951
99005
|
var name = ts.unescapeLeadingUnderscores(key);
|
|
@@ -99653,7 +99707,7 @@ var ts;
|
|
|
99653
99707
|
/*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */)));
|
|
99654
99708
|
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
|
99655
99709
|
// This step isn't needed if we eventually transform this to ES5.
|
|
99656
|
-
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.
|
|
99710
|
+
var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */);
|
|
99657
99711
|
if (emitSuperHelpers) {
|
|
99658
99712
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
99659
99713
|
var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties);
|
|
@@ -99664,10 +99718,10 @@ var ts;
|
|
|
99664
99718
|
ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
99665
99719
|
var block = factory.updateBlock(node.body, statements);
|
|
99666
99720
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
99667
|
-
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.
|
|
99721
|
+
if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99668
99722
|
ts.addEmitHelper(block, ts.advancedAsyncSuperHelper);
|
|
99669
99723
|
}
|
|
99670
|
-
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.
|
|
99724
|
+
else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) {
|
|
99671
99725
|
ts.addEmitHelper(block, ts.asyncSuperHelper);
|
|
99672
99726
|
}
|
|
99673
99727
|
}
|
|
@@ -99796,7 +99850,7 @@ var ts;
|
|
|
99796
99850
|
// If we need to support substitutions for `super` in an async method,
|
|
99797
99851
|
// we should track it here.
|
|
99798
99852
|
if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
99799
|
-
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.
|
|
99853
|
+
var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */);
|
|
99800
99854
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
99801
99855
|
var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
99802
99856
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -99873,7 +99927,7 @@ var ts;
|
|
|
99873
99927
|
|| kind === 175 /* SyntaxKind.SetAccessor */;
|
|
99874
99928
|
}
|
|
99875
99929
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
99876
|
-
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.
|
|
99930
|
+
if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) {
|
|
99877
99931
|
return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"),
|
|
99878
99932
|
/*typeArguments*/ undefined, [argumentExpression]), "value"), location);
|
|
99879
99933
|
}
|
|
@@ -123899,7 +123953,7 @@ var ts;
|
|
|
123899
123953
|
var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */;
|
|
123900
123954
|
if (isNonDirectorySeparatorRoot &&
|
|
123901
123955
|
dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
123902
|
-
pathPartForUserCheck.search(/[a-zA-
|
|
123956
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart
|
|
123903
123957
|
nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1);
|
|
123904
123958
|
if (nextDirectorySeparator === -1) {
|
|
123905
123959
|
// ignore "//vda1cs4850/c$/folderAtRoot"
|
|
@@ -125405,15 +125459,21 @@ var ts;
|
|
|
125405
125459
|
return undefined;
|
|
125406
125460
|
}
|
|
125407
125461
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
|
|
125408
|
-
var
|
|
125409
|
-
if (
|
|
125462
|
+
var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
125463
|
+
if (normalizedTargetPaths === undefined) {
|
|
125464
|
+
return undefined;
|
|
125465
|
+
}
|
|
125466
|
+
var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125467
|
+
var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) {
|
|
125468
|
+
return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); });
|
|
125469
|
+
});
|
|
125470
|
+
var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators);
|
|
125471
|
+
if (!shortest) {
|
|
125410
125472
|
return undefined;
|
|
125411
125473
|
}
|
|
125412
|
-
var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
|
|
125413
|
-
var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
|
|
125414
125474
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
|
|
125415
|
-
? removeExtensionAndIndexPostFix(
|
|
125416
|
-
: ts.removeFileExtension(
|
|
125475
|
+
? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions)
|
|
125476
|
+
: ts.removeFileExtension(shortest);
|
|
125417
125477
|
}
|
|
125418
125478
|
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
125419
125479
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
@@ -125550,8 +125610,8 @@ var ts;
|
|
|
125550
125610
|
}
|
|
125551
125611
|
}
|
|
125552
125612
|
}
|
|
125553
|
-
function
|
|
125554
|
-
return ts.
|
|
125613
|
+
function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
|
|
125614
|
+
return ts.mapDefined(rootDirs, function (rootDir) {
|
|
125555
125615
|
var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
|
|
125556
125616
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
125557
125617
|
});
|