typescript 5.4.0-dev.20231103 → 5.4.0-dev.20231105
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/lib.es2016.d.ts +1 -0
- package/lib/lib.es2016.intl.d.ts +31 -0
- package/lib/tsc.js +235 -72
- package/lib/tsserver.js +244 -78
- package/lib/typescript.js +253 -89
- package/lib/typingsInstaller.js +3 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -1721,6 +1721,8 @@ __export(server_exports, {
|
|
|
1721
1721
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
1722
1722
|
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
|
|
1723
1723
|
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
|
|
1724
|
+
isSimpleParameter: () => isSimpleParameter,
|
|
1725
|
+
isSimpleParameterList: () => isSimpleParameterList,
|
|
1724
1726
|
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
|
|
1725
1727
|
isSourceFile: () => isSourceFile,
|
|
1726
1728
|
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
|
|
@@ -2328,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2328
2330
|
|
|
2329
2331
|
// src/compiler/corePublic.ts
|
|
2330
2332
|
var versionMajorMinor = "5.4";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2333
|
+
var version = `${versionMajorMinor}.0-dev.20231105`;
|
|
2332
2334
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2335
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2336
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -27668,7 +27670,7 @@ function createEmitHelperFactory(context) {
|
|
|
27668
27670
|
]
|
|
27669
27671
|
);
|
|
27670
27672
|
}
|
|
27671
|
-
function createAwaiterHelper(hasLexicalThis,
|
|
27673
|
+
function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
|
|
27672
27674
|
context.requestEmitHelper(awaiterHelper);
|
|
27673
27675
|
const generatorFunc = factory2.createFunctionExpression(
|
|
27674
27676
|
/*modifiers*/
|
|
@@ -27678,8 +27680,7 @@ function createEmitHelperFactory(context) {
|
|
|
27678
27680
|
void 0,
|
|
27679
27681
|
/*typeParameters*/
|
|
27680
27682
|
void 0,
|
|
27681
|
-
|
|
27682
|
-
[],
|
|
27683
|
+
parameters ?? [],
|
|
27683
27684
|
/*type*/
|
|
27684
27685
|
void 0,
|
|
27685
27686
|
body
|
|
@@ -27691,7 +27692,7 @@ function createEmitHelperFactory(context) {
|
|
|
27691
27692
|
void 0,
|
|
27692
27693
|
[
|
|
27693
27694
|
hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
|
|
27694
|
-
|
|
27695
|
+
argumentsExpression ?? factory2.createVoidZero(),
|
|
27695
27696
|
promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
|
|
27696
27697
|
generatorFunc
|
|
27697
27698
|
]
|
|
@@ -38246,6 +38247,7 @@ var libEntries = [
|
|
|
38246
38247
|
["es2015.symbol", "lib.es2015.symbol.d.ts"],
|
|
38247
38248
|
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
|
|
38248
38249
|
["es2016.array.include", "lib.es2016.array.include.d.ts"],
|
|
38250
|
+
["es2016.intl", "lib.es2016.intl.d.ts"],
|
|
38249
38251
|
["es2017.date", "lib.es2017.date.d.ts"],
|
|
38250
38252
|
["es2017.object", "lib.es2017.object.d.ts"],
|
|
38251
38253
|
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
|
|
@@ -38577,6 +38579,7 @@ var targetOptionDeclaration = {
|
|
|
38577
38579
|
affectsModuleResolution: true,
|
|
38578
38580
|
affectsEmit: true,
|
|
38579
38581
|
affectsBuildInfo: true,
|
|
38582
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
|
|
38580
38583
|
paramType: Diagnostics.VERSION,
|
|
38581
38584
|
showInSimplifiedHelpView: true,
|
|
38582
38585
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -44693,6 +44696,9 @@ function createBinder() {
|
|
|
44693
44696
|
case 213 /* CallExpression */:
|
|
44694
44697
|
return hasNarrowableArgument(expr);
|
|
44695
44698
|
case 217 /* ParenthesizedExpression */:
|
|
44699
|
+
if (isJSDocTypeAssertion(expr)) {
|
|
44700
|
+
return false;
|
|
44701
|
+
}
|
|
44696
44702
|
case 235 /* NonNullExpression */:
|
|
44697
44703
|
return isNarrowingExpression(expr.expression);
|
|
44698
44704
|
case 226 /* BinaryExpression */:
|
|
@@ -71570,15 +71576,23 @@ function createTypeChecker(host) {
|
|
|
71570
71576
|
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
71571
71577
|
return errorType;
|
|
71572
71578
|
}
|
|
71573
|
-
|
|
71574
|
-
if (
|
|
71575
|
-
if (
|
|
71576
|
-
|
|
71577
|
-
|
|
71578
|
-
|
|
71579
|
+
let container = getContainingFunction(node);
|
|
71580
|
+
if (container) {
|
|
71581
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
71582
|
+
if (container.kind === 219 /* ArrowFunction */) {
|
|
71583
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
71584
|
+
} else if (hasSyntacticModifier(container, 1024 /* Async */)) {
|
|
71585
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
|
|
71586
|
+
}
|
|
71587
|
+
}
|
|
71588
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
71589
|
+
while (container && isArrowFunction(container)) {
|
|
71590
|
+
container = getContainingFunction(container);
|
|
71591
|
+
if (container) {
|
|
71592
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
71593
|
+
}
|
|
71579
71594
|
}
|
|
71580
71595
|
}
|
|
71581
|
-
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
71582
71596
|
return getTypeOfSymbol(symbol);
|
|
71583
71597
|
}
|
|
71584
71598
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
@@ -91606,6 +91620,12 @@ function setPrivateIdentifier(privateEnv, name, entry) {
|
|
|
91606
91620
|
function accessPrivateIdentifier(env, name) {
|
|
91607
91621
|
return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
|
|
91608
91622
|
}
|
|
91623
|
+
function isSimpleParameter(node) {
|
|
91624
|
+
return !node.initializer && isIdentifier(node.name);
|
|
91625
|
+
}
|
|
91626
|
+
function isSimpleParameterList(nodes) {
|
|
91627
|
+
return every(nodes, isSimpleParameter);
|
|
91628
|
+
}
|
|
91609
91629
|
|
|
91610
91630
|
// src/compiler/transformers/destructuring.ts
|
|
91611
91631
|
var FlattenLevel = /* @__PURE__ */ ((FlattenLevel2) => {
|
|
@@ -99092,6 +99112,7 @@ function transformES2017(context) {
|
|
|
99092
99112
|
let enclosingFunctionParameterNames;
|
|
99093
99113
|
let capturedSuperProperties;
|
|
99094
99114
|
let hasSuperElementAccess;
|
|
99115
|
+
let lexicalArgumentsBinding;
|
|
99095
99116
|
const substitutedSuperAccessors = [];
|
|
99096
99117
|
let contextFlags = 0 /* None */;
|
|
99097
99118
|
const previousOnEmitNode = context.onEmitNode;
|
|
@@ -99142,9 +99163,30 @@ function transformES2017(context) {
|
|
|
99142
99163
|
function visitDefault(node) {
|
|
99143
99164
|
return visitEachChild(node, visitor, context);
|
|
99144
99165
|
}
|
|
99166
|
+
function argumentsVisitor(node) {
|
|
99167
|
+
switch (node.kind) {
|
|
99168
|
+
case 218 /* FunctionExpression */:
|
|
99169
|
+
case 262 /* FunctionDeclaration */:
|
|
99170
|
+
case 174 /* MethodDeclaration */:
|
|
99171
|
+
case 177 /* GetAccessor */:
|
|
99172
|
+
case 178 /* SetAccessor */:
|
|
99173
|
+
case 176 /* Constructor */:
|
|
99174
|
+
return node;
|
|
99175
|
+
case 169 /* Parameter */:
|
|
99176
|
+
case 208 /* BindingElement */:
|
|
99177
|
+
case 260 /* VariableDeclaration */:
|
|
99178
|
+
break;
|
|
99179
|
+
case 80 /* Identifier */:
|
|
99180
|
+
if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
|
|
99181
|
+
return lexicalArgumentsBinding;
|
|
99182
|
+
}
|
|
99183
|
+
break;
|
|
99184
|
+
}
|
|
99185
|
+
return visitEachChild(node, argumentsVisitor, context);
|
|
99186
|
+
}
|
|
99145
99187
|
function visitor(node) {
|
|
99146
99188
|
if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
|
|
99147
|
-
return node;
|
|
99189
|
+
return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
|
|
99148
99190
|
}
|
|
99149
99191
|
switch (node.kind) {
|
|
99150
99192
|
case 134 /* AsyncKeyword */:
|
|
@@ -99302,15 +99344,23 @@ function transformES2017(context) {
|
|
|
99302
99344
|
);
|
|
99303
99345
|
}
|
|
99304
99346
|
function visitConstructorDeclaration(node) {
|
|
99305
|
-
|
|
99347
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99348
|
+
lexicalArgumentsBinding = void 0;
|
|
99349
|
+
const updated = factory2.updateConstructorDeclaration(
|
|
99306
99350
|
node,
|
|
99307
99351
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
99308
99352
|
visitParameterList(node.parameters, visitor, context),
|
|
99309
99353
|
transformMethodBody(node)
|
|
99310
99354
|
);
|
|
99355
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99356
|
+
return updated;
|
|
99311
99357
|
}
|
|
99312
99358
|
function visitMethodDeclaration(node) {
|
|
99313
|
-
|
|
99359
|
+
let parameters;
|
|
99360
|
+
const functionFlags = getFunctionFlags(node);
|
|
99361
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99362
|
+
lexicalArgumentsBinding = void 0;
|
|
99363
|
+
const updated = factory2.updateMethodDeclaration(
|
|
99314
99364
|
node,
|
|
99315
99365
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
99316
99366
|
node.asteriskToken,
|
|
@@ -99319,14 +99369,18 @@ function transformES2017(context) {
|
|
|
99319
99369
|
void 0,
|
|
99320
99370
|
/*typeParameters*/
|
|
99321
99371
|
void 0,
|
|
99322
|
-
visitParameterList(node.parameters, visitor, context),
|
|
99372
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
99323
99373
|
/*type*/
|
|
99324
99374
|
void 0,
|
|
99325
|
-
|
|
99375
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
|
|
99326
99376
|
);
|
|
99377
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99378
|
+
return updated;
|
|
99327
99379
|
}
|
|
99328
99380
|
function visitGetAccessorDeclaration(node) {
|
|
99329
|
-
|
|
99381
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99382
|
+
lexicalArgumentsBinding = void 0;
|
|
99383
|
+
const updated = factory2.updateGetAccessorDeclaration(
|
|
99330
99384
|
node,
|
|
99331
99385
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
99332
99386
|
node.name,
|
|
@@ -99335,55 +99389,75 @@ function transformES2017(context) {
|
|
|
99335
99389
|
void 0,
|
|
99336
99390
|
transformMethodBody(node)
|
|
99337
99391
|
);
|
|
99392
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99393
|
+
return updated;
|
|
99338
99394
|
}
|
|
99339
99395
|
function visitSetAccessorDeclaration(node) {
|
|
99340
|
-
|
|
99396
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99397
|
+
lexicalArgumentsBinding = void 0;
|
|
99398
|
+
const updated = factory2.updateSetAccessorDeclaration(
|
|
99341
99399
|
node,
|
|
99342
99400
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
99343
99401
|
node.name,
|
|
99344
99402
|
visitParameterList(node.parameters, visitor, context),
|
|
99345
99403
|
transformMethodBody(node)
|
|
99346
99404
|
);
|
|
99405
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99406
|
+
return updated;
|
|
99347
99407
|
}
|
|
99348
99408
|
function visitFunctionDeclaration(node) {
|
|
99349
|
-
|
|
99409
|
+
let parameters;
|
|
99410
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99411
|
+
lexicalArgumentsBinding = void 0;
|
|
99412
|
+
const functionFlags = getFunctionFlags(node);
|
|
99413
|
+
const updated = factory2.updateFunctionDeclaration(
|
|
99350
99414
|
node,
|
|
99351
99415
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
99352
99416
|
node.asteriskToken,
|
|
99353
99417
|
node.name,
|
|
99354
99418
|
/*typeParameters*/
|
|
99355
99419
|
void 0,
|
|
99356
|
-
visitParameterList(node.parameters, visitor, context),
|
|
99420
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
99357
99421
|
/*type*/
|
|
99358
99422
|
void 0,
|
|
99359
|
-
|
|
99423
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
99360
99424
|
);
|
|
99425
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99426
|
+
return updated;
|
|
99361
99427
|
}
|
|
99362
99428
|
function visitFunctionExpression(node) {
|
|
99363
|
-
|
|
99429
|
+
let parameters;
|
|
99430
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99431
|
+
lexicalArgumentsBinding = void 0;
|
|
99432
|
+
const functionFlags = getFunctionFlags(node);
|
|
99433
|
+
const updated = factory2.updateFunctionExpression(
|
|
99364
99434
|
node,
|
|
99365
99435
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
99366
99436
|
node.asteriskToken,
|
|
99367
99437
|
node.name,
|
|
99368
99438
|
/*typeParameters*/
|
|
99369
99439
|
void 0,
|
|
99370
|
-
visitParameterList(node.parameters, visitor, context),
|
|
99440
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
99371
99441
|
/*type*/
|
|
99372
99442
|
void 0,
|
|
99373
|
-
|
|
99443
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
99374
99444
|
);
|
|
99445
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99446
|
+
return updated;
|
|
99375
99447
|
}
|
|
99376
99448
|
function visitArrowFunction(node) {
|
|
99449
|
+
let parameters;
|
|
99450
|
+
const functionFlags = getFunctionFlags(node);
|
|
99377
99451
|
return factory2.updateArrowFunction(
|
|
99378
99452
|
node,
|
|
99379
99453
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
99380
99454
|
/*typeParameters*/
|
|
99381
99455
|
void 0,
|
|
99382
|
-
visitParameterList(node.parameters, visitor, context),
|
|
99456
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
99383
99457
|
/*type*/
|
|
99384
99458
|
void 0,
|
|
99385
99459
|
node.equalsGreaterThanToken,
|
|
99386
|
-
|
|
99460
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
99387
99461
|
);
|
|
99388
99462
|
}
|
|
99389
99463
|
function recordDeclarationName({ name }, names) {
|
|
@@ -99477,13 +99551,91 @@ function transformES2017(context) {
|
|
|
99477
99551
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
99478
99552
|
return updated;
|
|
99479
99553
|
}
|
|
99480
|
-
function
|
|
99554
|
+
function createCaptureArgumentsStatement() {
|
|
99555
|
+
Debug.assert(lexicalArgumentsBinding);
|
|
99556
|
+
const variable = factory2.createVariableDeclaration(
|
|
99557
|
+
lexicalArgumentsBinding,
|
|
99558
|
+
/*exclamationToken*/
|
|
99559
|
+
void 0,
|
|
99560
|
+
/*type*/
|
|
99561
|
+
void 0,
|
|
99562
|
+
factory2.createIdentifier("arguments")
|
|
99563
|
+
);
|
|
99564
|
+
const statement = factory2.createVariableStatement(
|
|
99565
|
+
/*modifiers*/
|
|
99566
|
+
void 0,
|
|
99567
|
+
[variable]
|
|
99568
|
+
);
|
|
99569
|
+
startOnNewLine(statement);
|
|
99570
|
+
addEmitFlags(statement, 2097152 /* CustomPrologue */);
|
|
99571
|
+
return statement;
|
|
99572
|
+
}
|
|
99573
|
+
function transformAsyncFunctionParameterList(node) {
|
|
99574
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
99575
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
99576
|
+
}
|
|
99577
|
+
const newParameters = [];
|
|
99578
|
+
for (const parameter of node.parameters) {
|
|
99579
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
99580
|
+
if (node.kind === 219 /* ArrowFunction */) {
|
|
99581
|
+
const restParameter = factory2.createParameterDeclaration(
|
|
99582
|
+
/*modifiers*/
|
|
99583
|
+
void 0,
|
|
99584
|
+
factory2.createToken(26 /* DotDotDotToken */),
|
|
99585
|
+
factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
|
|
99586
|
+
);
|
|
99587
|
+
newParameters.push(restParameter);
|
|
99588
|
+
}
|
|
99589
|
+
break;
|
|
99590
|
+
}
|
|
99591
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
99592
|
+
/*modifiers*/
|
|
99593
|
+
void 0,
|
|
99594
|
+
/*dotDotDotToken*/
|
|
99595
|
+
void 0,
|
|
99596
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
99597
|
+
);
|
|
99598
|
+
newParameters.push(newParameter);
|
|
99599
|
+
}
|
|
99600
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
99601
|
+
setTextRange(newParametersArray, node.parameters);
|
|
99602
|
+
return newParametersArray;
|
|
99603
|
+
}
|
|
99604
|
+
function transformAsyncFunctionBody(node, outerParameters) {
|
|
99605
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
99481
99606
|
resumeLexicalEnvironment();
|
|
99482
99607
|
const original = getOriginalNode(node, isFunctionLike);
|
|
99483
99608
|
const nodeType = original.type;
|
|
99484
99609
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
99485
99610
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
99611
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
99486
99612
|
const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
|
|
99613
|
+
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
99614
|
+
if (captureLexicalArguments) {
|
|
99615
|
+
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
99616
|
+
}
|
|
99617
|
+
let argumentsExpression;
|
|
99618
|
+
if (innerParameters) {
|
|
99619
|
+
if (isArrowFunction2) {
|
|
99620
|
+
const parameterBindings = [];
|
|
99621
|
+
Debug.assert(outerParameters.length <= node.parameters.length);
|
|
99622
|
+
for (let i = 0; i < node.parameters.length; i++) {
|
|
99623
|
+
Debug.assert(i < outerParameters.length);
|
|
99624
|
+
const originalParameter = node.parameters[i];
|
|
99625
|
+
const outerParameter = outerParameters[i];
|
|
99626
|
+
Debug.assertNode(outerParameter.name, isIdentifier);
|
|
99627
|
+
if (originalParameter.initializer || originalParameter.dotDotDotToken) {
|
|
99628
|
+
Debug.assert(i === outerParameters.length - 1);
|
|
99629
|
+
parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
|
|
99630
|
+
break;
|
|
99631
|
+
}
|
|
99632
|
+
parameterBindings.push(outerParameter.name);
|
|
99633
|
+
}
|
|
99634
|
+
argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
|
|
99635
|
+
} else {
|
|
99636
|
+
argumentsExpression = factory2.createIdentifier("arguments");
|
|
99637
|
+
}
|
|
99638
|
+
}
|
|
99487
99639
|
const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
|
|
99488
99640
|
enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
|
|
99489
99641
|
for (const parameter of node.parameters) {
|
|
@@ -99495,27 +99647,23 @@ function transformES2017(context) {
|
|
|
99495
99647
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
99496
99648
|
hasSuperElementAccess = false;
|
|
99497
99649
|
}
|
|
99650
|
+
const hasLexicalThis = inHasLexicalThisContext();
|
|
99651
|
+
let asyncBody = transformAsyncFunctionBodyWorker(node.body);
|
|
99652
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
|
|
99498
99653
|
let result;
|
|
99499
99654
|
if (!isArrowFunction2) {
|
|
99500
99655
|
const statements = [];
|
|
99501
|
-
const statementOffset = factory2.copyPrologue(
|
|
99502
|
-
node.body.statements,
|
|
99503
|
-
statements,
|
|
99504
|
-
/*ensureUseStrict*/
|
|
99505
|
-
false,
|
|
99506
|
-
visitor
|
|
99507
|
-
);
|
|
99508
99656
|
statements.push(
|
|
99509
99657
|
factory2.createReturnStatement(
|
|
99510
99658
|
emitHelpers().createAwaiterHelper(
|
|
99511
|
-
|
|
99512
|
-
|
|
99659
|
+
hasLexicalThis,
|
|
99660
|
+
argumentsExpression,
|
|
99513
99661
|
promiseConstructor,
|
|
99514
|
-
|
|
99662
|
+
innerParameters,
|
|
99663
|
+
asyncBody
|
|
99515
99664
|
)
|
|
99516
99665
|
)
|
|
99517
99666
|
);
|
|
99518
|
-
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
99519
99667
|
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
|
|
99520
99668
|
if (emitSuperHelpers) {
|
|
99521
99669
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
@@ -99525,6 +99673,9 @@ function transformES2017(context) {
|
|
|
99525
99673
|
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
99526
99674
|
}
|
|
99527
99675
|
}
|
|
99676
|
+
if (captureLexicalArguments) {
|
|
99677
|
+
insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
|
|
99678
|
+
}
|
|
99528
99679
|
const block = factory2.createBlock(
|
|
99529
99680
|
statements,
|
|
99530
99681
|
/*multiLine*/
|
|
@@ -99540,24 +99691,23 @@ function transformES2017(context) {
|
|
|
99540
99691
|
}
|
|
99541
99692
|
result = block;
|
|
99542
99693
|
} else {
|
|
99543
|
-
|
|
99544
|
-
|
|
99545
|
-
|
|
99694
|
+
result = emitHelpers().createAwaiterHelper(
|
|
99695
|
+
hasLexicalThis,
|
|
99696
|
+
argumentsExpression,
|
|
99546
99697
|
promiseConstructor,
|
|
99547
|
-
|
|
99698
|
+
innerParameters,
|
|
99699
|
+
asyncBody
|
|
99548
99700
|
);
|
|
99549
|
-
|
|
99550
|
-
|
|
99551
|
-
|
|
99552
|
-
result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
|
|
99553
|
-
} else {
|
|
99554
|
-
result = expression;
|
|
99701
|
+
if (captureLexicalArguments) {
|
|
99702
|
+
const block = factory2.converters.convertToFunctionBlock(result);
|
|
99703
|
+
result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
|
|
99555
99704
|
}
|
|
99556
99705
|
}
|
|
99557
99706
|
enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
|
|
99558
99707
|
if (!isArrowFunction2) {
|
|
99559
99708
|
capturedSuperProperties = savedCapturedSuperProperties;
|
|
99560
99709
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
99710
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
99561
99711
|
}
|
|
99562
99712
|
return result;
|
|
99563
99713
|
}
|
|
@@ -100673,7 +100823,7 @@ function transformES2018(context) {
|
|
|
100673
100823
|
),
|
|
100674
100824
|
/*typeParameters*/
|
|
100675
100825
|
void 0,
|
|
100676
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
100826
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
100677
100827
|
/*type*/
|
|
100678
100828
|
void 0,
|
|
100679
100829
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -100694,7 +100844,7 @@ function transformES2018(context) {
|
|
|
100694
100844
|
node.name,
|
|
100695
100845
|
/*typeParameters*/
|
|
100696
100846
|
void 0,
|
|
100697
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
100847
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
100698
100848
|
/*type*/
|
|
100699
100849
|
void 0,
|
|
100700
100850
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -100735,7 +100885,7 @@ function transformES2018(context) {
|
|
|
100735
100885
|
node.name,
|
|
100736
100886
|
/*typeParameters*/
|
|
100737
100887
|
void 0,
|
|
100738
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
100888
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
100739
100889
|
/*type*/
|
|
100740
100890
|
void 0,
|
|
100741
100891
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -100744,21 +100894,38 @@ function transformES2018(context) {
|
|
|
100744
100894
|
parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
|
|
100745
100895
|
return updated;
|
|
100746
100896
|
}
|
|
100897
|
+
function transformAsyncGeneratorFunctionParameterList(node) {
|
|
100898
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
100899
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
100900
|
+
}
|
|
100901
|
+
const newParameters = [];
|
|
100902
|
+
for (const parameter of node.parameters) {
|
|
100903
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
100904
|
+
break;
|
|
100905
|
+
}
|
|
100906
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
100907
|
+
/*modifiers*/
|
|
100908
|
+
void 0,
|
|
100909
|
+
/*dotDotDotToken*/
|
|
100910
|
+
void 0,
|
|
100911
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
100912
|
+
);
|
|
100913
|
+
newParameters.push(newParameter);
|
|
100914
|
+
}
|
|
100915
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
100916
|
+
setTextRange(newParametersArray, node.parameters);
|
|
100917
|
+
return newParametersArray;
|
|
100918
|
+
}
|
|
100747
100919
|
function transformAsyncGeneratorFunctionBody(node) {
|
|
100920
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
100748
100921
|
resumeLexicalEnvironment();
|
|
100749
|
-
const statements = [];
|
|
100750
|
-
const statementOffset = factory2.copyPrologue(
|
|
100751
|
-
node.body.statements,
|
|
100752
|
-
statements,
|
|
100753
|
-
/*ensureUseStrict*/
|
|
100754
|
-
false,
|
|
100755
|
-
visitor
|
|
100756
|
-
);
|
|
100757
|
-
appendObjectRestAssignmentsIfNeeded(statements, node);
|
|
100758
100922
|
const savedCapturedSuperProperties = capturedSuperProperties;
|
|
100759
100923
|
const savedHasSuperElementAccess = hasSuperElementAccess;
|
|
100760
100924
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
100761
100925
|
hasSuperElementAccess = false;
|
|
100926
|
+
const outerStatements = [];
|
|
100927
|
+
let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
|
|
100928
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
|
|
100762
100929
|
const returnStatement = factory2.createReturnStatement(
|
|
100763
100930
|
emitHelpers().createAsyncGeneratorHelper(
|
|
100764
100931
|
factory2.createFunctionExpression(
|
|
@@ -100768,14 +100935,10 @@ function transformES2018(context) {
|
|
|
100768
100935
|
node.name && factory2.getGeneratedNameForNode(node.name),
|
|
100769
100936
|
/*typeParameters*/
|
|
100770
100937
|
void 0,
|
|
100771
|
-
|
|
100772
|
-
[],
|
|
100938
|
+
innerParameters ?? [],
|
|
100773
100939
|
/*type*/
|
|
100774
100940
|
void 0,
|
|
100775
|
-
|
|
100776
|
-
node.body,
|
|
100777
|
-
visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
|
|
100778
|
-
)
|
|
100941
|
+
asyncBody
|
|
100779
100942
|
),
|
|
100780
100943
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
100781
100944
|
)
|
|
@@ -100785,11 +100948,10 @@ function transformES2018(context) {
|
|
|
100785
100948
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
100786
100949
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
100787
100950
|
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
|
|
100788
|
-
insertStatementsAfterStandardPrologue(
|
|
100951
|
+
insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
|
|
100789
100952
|
}
|
|
100790
|
-
|
|
100791
|
-
|
|
100792
|
-
const block = factory2.updateBlock(node.body, statements);
|
|
100953
|
+
outerStatements.push(returnStatement);
|
|
100954
|
+
const block = factory2.updateBlock(node.body, outerStatements);
|
|
100793
100955
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
100794
100956
|
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
100795
100957
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
@@ -146060,7 +146222,7 @@ function getPropertySymbolsFromContextualType(node, checker, contextualType, uni
|
|
|
146060
146222
|
if (discriminatedPropertySymbols.length === 0) {
|
|
146061
146223
|
return mapDefined(contextualType.types, (t) => t.getProperty(name));
|
|
146062
146224
|
}
|
|
146063
|
-
return discriminatedPropertySymbols;
|
|
146225
|
+
return deduplicate(discriminatedPropertySymbols, equateValues);
|
|
146064
146226
|
}
|
|
146065
146227
|
function isArgumentOfElementAccessExpression(node) {
|
|
146066
146228
|
return node && node.parent && node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.argumentExpression === node;
|
|
@@ -170248,7 +170410,7 @@ function getAllRules() {
|
|
|
170248
170410
|
const typeNames = [80 /* Identifier */, ...typeKeywords];
|
|
170249
170411
|
const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
|
|
170250
170412
|
const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]);
|
|
170251
|
-
const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]);
|
|
170413
|
+
const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */, 85 /* CatchKeyword */]);
|
|
170252
170414
|
const highPriorityCommonRules = [
|
|
170253
170415
|
// Leave comments alone
|
|
170254
170416
|
rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */),
|
|
@@ -174236,6 +174398,8 @@ __export(ts_exports2, {
|
|
|
174236
174398
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
174237
174399
|
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
|
|
174238
174400
|
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
|
|
174401
|
+
isSimpleParameter: () => isSimpleParameter,
|
|
174402
|
+
isSimpleParameterList: () => isSimpleParameterList,
|
|
174239
174403
|
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
|
|
174240
174404
|
isSourceFile: () => isSourceFile,
|
|
174241
174405
|
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
|
|
@@ -174950,9 +175114,9 @@ function buildOverload(name) {
|
|
|
174950
175114
|
|
|
174951
175115
|
// src/deprecatedCompat/5.0/identifierProperties.ts
|
|
174952
175116
|
addObjectAllocatorPatcher((objectAllocator2) => {
|
|
174953
|
-
const
|
|
174954
|
-
if (!hasProperty(
|
|
174955
|
-
Object.defineProperty(
|
|
175117
|
+
const Identifier79 = objectAllocator2.getIdentifierConstructor();
|
|
175118
|
+
if (!hasProperty(Identifier79.prototype, "originalKeywordKind")) {
|
|
175119
|
+
Object.defineProperty(Identifier79.prototype, "originalKeywordKind", {
|
|
174956
175120
|
get: deprecate(function() {
|
|
174957
175121
|
return identifierToKeywordKind(this);
|
|
174958
175122
|
}, {
|
|
@@ -174964,8 +175128,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
|
|
|
174964
175128
|
})
|
|
174965
175129
|
});
|
|
174966
175130
|
}
|
|
174967
|
-
if (!hasProperty(
|
|
174968
|
-
Object.defineProperty(
|
|
175131
|
+
if (!hasProperty(Identifier79.prototype, "isInJSDocNamespace")) {
|
|
175132
|
+
Object.defineProperty(Identifier79.prototype, "isInJSDocNamespace", {
|
|
174969
175133
|
get: deprecate(function() {
|
|
174970
175134
|
return this.flags & 4096 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
|
|
174971
175135
|
}, {
|
|
@@ -188896,6 +189060,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188896
189060
|
isSignedNumericLiteral,
|
|
188897
189061
|
isSimpleCopiableExpression,
|
|
188898
189062
|
isSimpleInlineableExpression,
|
|
189063
|
+
isSimpleParameter,
|
|
189064
|
+
isSimpleParameterList,
|
|
188899
189065
|
isSingleOrDoubleQuote,
|
|
188900
189066
|
isSourceFile,
|
|
188901
189067
|
isSourceFileFromLibrary,
|