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/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231105`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3034,7 +3034,7 @@ ${lanes.join("\n")}
|
|
|
3034
3034
|
function tryGetNodePerformanceHooks() {
|
|
3035
3035
|
if (isNodeLikeSystem()) {
|
|
3036
3036
|
try {
|
|
3037
|
-
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } =
|
|
3037
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
3038
3038
|
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
3039
3039
|
return {
|
|
3040
3040
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
@@ -3068,7 +3068,7 @@ ${lanes.join("\n")}
|
|
|
3068
3068
|
"use strict";
|
|
3069
3069
|
try {
|
|
3070
3070
|
const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw";
|
|
3071
|
-
etwModule =
|
|
3071
|
+
etwModule = require(etwModulePath);
|
|
3072
3072
|
} catch (e) {
|
|
3073
3073
|
etwModule = void 0;
|
|
3074
3074
|
}
|
|
@@ -3233,7 +3233,7 @@ ${lanes.join("\n")}
|
|
|
3233
3233
|
Debug.assert(!tracing, "Tracing already started");
|
|
3234
3234
|
if (fs === void 0) {
|
|
3235
3235
|
try {
|
|
3236
|
-
fs =
|
|
3236
|
+
fs = require("fs");
|
|
3237
3237
|
} catch (e) {
|
|
3238
3238
|
throw new Error(`tracing requires having fs
|
|
3239
3239
|
(original error: ${e.message || e})`);
|
|
@@ -6125,18 +6125,18 @@ ${lanes.join("\n")}
|
|
|
6125
6125
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
6126
6126
|
function getNodeSystem() {
|
|
6127
6127
|
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
6128
|
-
const _fs =
|
|
6129
|
-
const _path =
|
|
6130
|
-
const _os =
|
|
6128
|
+
const _fs = require("fs");
|
|
6129
|
+
const _path = require("path");
|
|
6130
|
+
const _os = require("os");
|
|
6131
6131
|
let _crypto;
|
|
6132
6132
|
try {
|
|
6133
|
-
_crypto =
|
|
6133
|
+
_crypto = require("crypto");
|
|
6134
6134
|
} catch {
|
|
6135
6135
|
_crypto = void 0;
|
|
6136
6136
|
}
|
|
6137
6137
|
let activeSession;
|
|
6138
6138
|
let profilePath = "./profile.cpuprofile";
|
|
6139
|
-
const Buffer2 =
|
|
6139
|
+
const Buffer2 = require("buffer").Buffer;
|
|
6140
6140
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
6141
6141
|
const platform = _os.platform();
|
|
6142
6142
|
const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
|
|
@@ -6235,7 +6235,7 @@ ${lanes.join("\n")}
|
|
|
6235
6235
|
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
6236
6236
|
tryEnableSourceMapsForHost() {
|
|
6237
6237
|
try {
|
|
6238
|
-
|
|
6238
|
+
require("source-map-support").install();
|
|
6239
6239
|
} catch {
|
|
6240
6240
|
}
|
|
6241
6241
|
},
|
|
@@ -6257,7 +6257,7 @@ ${lanes.join("\n")}
|
|
|
6257
6257
|
require: (baseDir, moduleName) => {
|
|
6258
6258
|
try {
|
|
6259
6259
|
const modulePath = resolveJSModule(moduleName, baseDir, nodeSystem);
|
|
6260
|
-
return { module:
|
|
6260
|
+
return { module: require(modulePath), modulePath, error: void 0 };
|
|
6261
6261
|
} catch (error2) {
|
|
6262
6262
|
return { module: void 0, modulePath: void 0, error: error2 };
|
|
6263
6263
|
}
|
|
@@ -6272,7 +6272,7 @@ ${lanes.join("\n")}
|
|
|
6272
6272
|
cb();
|
|
6273
6273
|
return false;
|
|
6274
6274
|
}
|
|
6275
|
-
const inspector =
|
|
6275
|
+
const inspector = require("inspector");
|
|
6276
6276
|
if (!inspector || !inspector.Session) {
|
|
6277
6277
|
cb();
|
|
6278
6278
|
return false;
|
|
@@ -25497,7 +25497,7 @@ ${lanes.join("\n")}
|
|
|
25497
25497
|
]
|
|
25498
25498
|
);
|
|
25499
25499
|
}
|
|
25500
|
-
function createAwaiterHelper(hasLexicalThis,
|
|
25500
|
+
function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
|
|
25501
25501
|
context.requestEmitHelper(awaiterHelper);
|
|
25502
25502
|
const generatorFunc = factory2.createFunctionExpression(
|
|
25503
25503
|
/*modifiers*/
|
|
@@ -25507,8 +25507,7 @@ ${lanes.join("\n")}
|
|
|
25507
25507
|
void 0,
|
|
25508
25508
|
/*typeParameters*/
|
|
25509
25509
|
void 0,
|
|
25510
|
-
|
|
25511
|
-
[],
|
|
25510
|
+
parameters ?? [],
|
|
25512
25511
|
/*type*/
|
|
25513
25512
|
void 0,
|
|
25514
25513
|
body
|
|
@@ -25520,7 +25519,7 @@ ${lanes.join("\n")}
|
|
|
25520
25519
|
void 0,
|
|
25521
25520
|
[
|
|
25522
25521
|
hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
|
|
25523
|
-
|
|
25522
|
+
argumentsExpression ?? factory2.createVoidZero(),
|
|
25524
25523
|
promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
|
|
25525
25524
|
generatorFunc
|
|
25526
25525
|
]
|
|
@@ -37729,6 +37728,7 @@ ${lanes.join("\n")}
|
|
|
37729
37728
|
["es2015.symbol", "lib.es2015.symbol.d.ts"],
|
|
37730
37729
|
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
|
|
37731
37730
|
["es2016.array.include", "lib.es2016.array.include.d.ts"],
|
|
37731
|
+
["es2016.intl", "lib.es2016.intl.d.ts"],
|
|
37732
37732
|
["es2017.date", "lib.es2017.date.d.ts"],
|
|
37733
37733
|
["es2017.object", "lib.es2017.object.d.ts"],
|
|
37734
37734
|
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
|
|
@@ -38060,6 +38060,7 @@ ${lanes.join("\n")}
|
|
|
38060
38060
|
affectsModuleResolution: true,
|
|
38061
38061
|
affectsEmit: true,
|
|
38062
38062
|
affectsBuildInfo: true,
|
|
38063
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
|
|
38063
38064
|
paramType: Diagnostics.VERSION,
|
|
38064
38065
|
showInSimplifiedHelpView: true,
|
|
38065
38066
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -42540,6 +42541,9 @@ ${lanes.join("\n")}
|
|
|
42540
42541
|
case 213 /* CallExpression */:
|
|
42541
42542
|
return hasNarrowableArgument(expr);
|
|
42542
42543
|
case 217 /* ParenthesizedExpression */:
|
|
42544
|
+
if (isJSDocTypeAssertion(expr)) {
|
|
42545
|
+
return false;
|
|
42546
|
+
}
|
|
42543
42547
|
case 235 /* NonNullExpression */:
|
|
42544
42548
|
return isNarrowingExpression(expr.expression);
|
|
42545
42549
|
case 226 /* BinaryExpression */:
|
|
@@ -69337,15 +69341,23 @@ ${lanes.join("\n")}
|
|
|
69337
69341
|
error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
69338
69342
|
return errorType;
|
|
69339
69343
|
}
|
|
69340
|
-
|
|
69341
|
-
if (
|
|
69342
|
-
if (
|
|
69343
|
-
|
|
69344
|
-
|
|
69345
|
-
|
|
69344
|
+
let container = getContainingFunction(node);
|
|
69345
|
+
if (container) {
|
|
69346
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
69347
|
+
if (container.kind === 219 /* ArrowFunction */) {
|
|
69348
|
+
error2(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
69349
|
+
} else if (hasSyntacticModifier(container, 1024 /* Async */)) {
|
|
69350
|
+
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);
|
|
69351
|
+
}
|
|
69352
|
+
}
|
|
69353
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
69354
|
+
while (container && isArrowFunction(container)) {
|
|
69355
|
+
container = getContainingFunction(container);
|
|
69356
|
+
if (container) {
|
|
69357
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
69358
|
+
}
|
|
69346
69359
|
}
|
|
69347
69360
|
}
|
|
69348
|
-
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
69349
69361
|
return getTypeOfSymbol(symbol);
|
|
69350
69362
|
}
|
|
69351
69363
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
@@ -89442,6 +89454,12 @@ ${lanes.join("\n")}
|
|
|
89442
89454
|
function accessPrivateIdentifier(env, name) {
|
|
89443
89455
|
return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
|
|
89444
89456
|
}
|
|
89457
|
+
function isSimpleParameter(node) {
|
|
89458
|
+
return !node.initializer && isIdentifier(node.name);
|
|
89459
|
+
}
|
|
89460
|
+
function isSimpleParameterList(nodes) {
|
|
89461
|
+
return every(nodes, isSimpleParameter);
|
|
89462
|
+
}
|
|
89445
89463
|
var IdentifierNameMap, IdentifierNameMultiMap;
|
|
89446
89464
|
var init_utilities3 = __esm({
|
|
89447
89465
|
"src/compiler/transformers/utilities.ts"() {
|
|
@@ -97071,6 +97089,7 @@ ${lanes.join("\n")}
|
|
|
97071
97089
|
let enclosingFunctionParameterNames;
|
|
97072
97090
|
let capturedSuperProperties;
|
|
97073
97091
|
let hasSuperElementAccess;
|
|
97092
|
+
let lexicalArgumentsBinding;
|
|
97074
97093
|
const substitutedSuperAccessors = [];
|
|
97075
97094
|
let contextFlags = 0 /* None */;
|
|
97076
97095
|
const previousOnEmitNode = context.onEmitNode;
|
|
@@ -97121,9 +97140,30 @@ ${lanes.join("\n")}
|
|
|
97121
97140
|
function visitDefault(node) {
|
|
97122
97141
|
return visitEachChild(node, visitor, context);
|
|
97123
97142
|
}
|
|
97143
|
+
function argumentsVisitor(node) {
|
|
97144
|
+
switch (node.kind) {
|
|
97145
|
+
case 218 /* FunctionExpression */:
|
|
97146
|
+
case 262 /* FunctionDeclaration */:
|
|
97147
|
+
case 174 /* MethodDeclaration */:
|
|
97148
|
+
case 177 /* GetAccessor */:
|
|
97149
|
+
case 178 /* SetAccessor */:
|
|
97150
|
+
case 176 /* Constructor */:
|
|
97151
|
+
return node;
|
|
97152
|
+
case 169 /* Parameter */:
|
|
97153
|
+
case 208 /* BindingElement */:
|
|
97154
|
+
case 260 /* VariableDeclaration */:
|
|
97155
|
+
break;
|
|
97156
|
+
case 80 /* Identifier */:
|
|
97157
|
+
if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
|
|
97158
|
+
return lexicalArgumentsBinding;
|
|
97159
|
+
}
|
|
97160
|
+
break;
|
|
97161
|
+
}
|
|
97162
|
+
return visitEachChild(node, argumentsVisitor, context);
|
|
97163
|
+
}
|
|
97124
97164
|
function visitor(node) {
|
|
97125
97165
|
if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
|
|
97126
|
-
return node;
|
|
97166
|
+
return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
|
|
97127
97167
|
}
|
|
97128
97168
|
switch (node.kind) {
|
|
97129
97169
|
case 134 /* AsyncKeyword */:
|
|
@@ -97281,15 +97321,23 @@ ${lanes.join("\n")}
|
|
|
97281
97321
|
);
|
|
97282
97322
|
}
|
|
97283
97323
|
function visitConstructorDeclaration(node) {
|
|
97284
|
-
|
|
97324
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97325
|
+
lexicalArgumentsBinding = void 0;
|
|
97326
|
+
const updated = factory2.updateConstructorDeclaration(
|
|
97285
97327
|
node,
|
|
97286
97328
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
97287
97329
|
visitParameterList(node.parameters, visitor, context),
|
|
97288
97330
|
transformMethodBody(node)
|
|
97289
97331
|
);
|
|
97332
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97333
|
+
return updated;
|
|
97290
97334
|
}
|
|
97291
97335
|
function visitMethodDeclaration(node) {
|
|
97292
|
-
|
|
97336
|
+
let parameters;
|
|
97337
|
+
const functionFlags = getFunctionFlags(node);
|
|
97338
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97339
|
+
lexicalArgumentsBinding = void 0;
|
|
97340
|
+
const updated = factory2.updateMethodDeclaration(
|
|
97293
97341
|
node,
|
|
97294
97342
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
97295
97343
|
node.asteriskToken,
|
|
@@ -97298,14 +97346,18 @@ ${lanes.join("\n")}
|
|
|
97298
97346
|
void 0,
|
|
97299
97347
|
/*typeParameters*/
|
|
97300
97348
|
void 0,
|
|
97301
|
-
visitParameterList(node.parameters, visitor, context),
|
|
97349
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
97302
97350
|
/*type*/
|
|
97303
97351
|
void 0,
|
|
97304
|
-
|
|
97352
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
|
|
97305
97353
|
);
|
|
97354
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97355
|
+
return updated;
|
|
97306
97356
|
}
|
|
97307
97357
|
function visitGetAccessorDeclaration(node) {
|
|
97308
|
-
|
|
97358
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97359
|
+
lexicalArgumentsBinding = void 0;
|
|
97360
|
+
const updated = factory2.updateGetAccessorDeclaration(
|
|
97309
97361
|
node,
|
|
97310
97362
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
97311
97363
|
node.name,
|
|
@@ -97314,55 +97366,75 @@ ${lanes.join("\n")}
|
|
|
97314
97366
|
void 0,
|
|
97315
97367
|
transformMethodBody(node)
|
|
97316
97368
|
);
|
|
97369
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97370
|
+
return updated;
|
|
97317
97371
|
}
|
|
97318
97372
|
function visitSetAccessorDeclaration(node) {
|
|
97319
|
-
|
|
97373
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97374
|
+
lexicalArgumentsBinding = void 0;
|
|
97375
|
+
const updated = factory2.updateSetAccessorDeclaration(
|
|
97320
97376
|
node,
|
|
97321
97377
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
97322
97378
|
node.name,
|
|
97323
97379
|
visitParameterList(node.parameters, visitor, context),
|
|
97324
97380
|
transformMethodBody(node)
|
|
97325
97381
|
);
|
|
97382
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97383
|
+
return updated;
|
|
97326
97384
|
}
|
|
97327
97385
|
function visitFunctionDeclaration(node) {
|
|
97328
|
-
|
|
97386
|
+
let parameters;
|
|
97387
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97388
|
+
lexicalArgumentsBinding = void 0;
|
|
97389
|
+
const functionFlags = getFunctionFlags(node);
|
|
97390
|
+
const updated = factory2.updateFunctionDeclaration(
|
|
97329
97391
|
node,
|
|
97330
97392
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
97331
97393
|
node.asteriskToken,
|
|
97332
97394
|
node.name,
|
|
97333
97395
|
/*typeParameters*/
|
|
97334
97396
|
void 0,
|
|
97335
|
-
visitParameterList(node.parameters, visitor, context),
|
|
97397
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
97336
97398
|
/*type*/
|
|
97337
97399
|
void 0,
|
|
97338
|
-
|
|
97400
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
97339
97401
|
);
|
|
97402
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97403
|
+
return updated;
|
|
97340
97404
|
}
|
|
97341
97405
|
function visitFunctionExpression(node) {
|
|
97342
|
-
|
|
97406
|
+
let parameters;
|
|
97407
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97408
|
+
lexicalArgumentsBinding = void 0;
|
|
97409
|
+
const functionFlags = getFunctionFlags(node);
|
|
97410
|
+
const updated = factory2.updateFunctionExpression(
|
|
97343
97411
|
node,
|
|
97344
97412
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
97345
97413
|
node.asteriskToken,
|
|
97346
97414
|
node.name,
|
|
97347
97415
|
/*typeParameters*/
|
|
97348
97416
|
void 0,
|
|
97349
|
-
visitParameterList(node.parameters, visitor, context),
|
|
97417
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
97350
97418
|
/*type*/
|
|
97351
97419
|
void 0,
|
|
97352
|
-
|
|
97420
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
97353
97421
|
);
|
|
97422
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97423
|
+
return updated;
|
|
97354
97424
|
}
|
|
97355
97425
|
function visitArrowFunction(node) {
|
|
97426
|
+
let parameters;
|
|
97427
|
+
const functionFlags = getFunctionFlags(node);
|
|
97356
97428
|
return factory2.updateArrowFunction(
|
|
97357
97429
|
node,
|
|
97358
97430
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
97359
97431
|
/*typeParameters*/
|
|
97360
97432
|
void 0,
|
|
97361
|
-
visitParameterList(node.parameters, visitor, context),
|
|
97433
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
97362
97434
|
/*type*/
|
|
97363
97435
|
void 0,
|
|
97364
97436
|
node.equalsGreaterThanToken,
|
|
97365
|
-
|
|
97437
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
97366
97438
|
);
|
|
97367
97439
|
}
|
|
97368
97440
|
function recordDeclarationName({ name }, names) {
|
|
@@ -97456,13 +97528,91 @@ ${lanes.join("\n")}
|
|
|
97456
97528
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
97457
97529
|
return updated;
|
|
97458
97530
|
}
|
|
97459
|
-
function
|
|
97531
|
+
function createCaptureArgumentsStatement() {
|
|
97532
|
+
Debug.assert(lexicalArgumentsBinding);
|
|
97533
|
+
const variable = factory2.createVariableDeclaration(
|
|
97534
|
+
lexicalArgumentsBinding,
|
|
97535
|
+
/*exclamationToken*/
|
|
97536
|
+
void 0,
|
|
97537
|
+
/*type*/
|
|
97538
|
+
void 0,
|
|
97539
|
+
factory2.createIdentifier("arguments")
|
|
97540
|
+
);
|
|
97541
|
+
const statement = factory2.createVariableStatement(
|
|
97542
|
+
/*modifiers*/
|
|
97543
|
+
void 0,
|
|
97544
|
+
[variable]
|
|
97545
|
+
);
|
|
97546
|
+
startOnNewLine(statement);
|
|
97547
|
+
addEmitFlags(statement, 2097152 /* CustomPrologue */);
|
|
97548
|
+
return statement;
|
|
97549
|
+
}
|
|
97550
|
+
function transformAsyncFunctionParameterList(node) {
|
|
97551
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
97552
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
97553
|
+
}
|
|
97554
|
+
const newParameters = [];
|
|
97555
|
+
for (const parameter of node.parameters) {
|
|
97556
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
97557
|
+
if (node.kind === 219 /* ArrowFunction */) {
|
|
97558
|
+
const restParameter = factory2.createParameterDeclaration(
|
|
97559
|
+
/*modifiers*/
|
|
97560
|
+
void 0,
|
|
97561
|
+
factory2.createToken(26 /* DotDotDotToken */),
|
|
97562
|
+
factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
|
|
97563
|
+
);
|
|
97564
|
+
newParameters.push(restParameter);
|
|
97565
|
+
}
|
|
97566
|
+
break;
|
|
97567
|
+
}
|
|
97568
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
97569
|
+
/*modifiers*/
|
|
97570
|
+
void 0,
|
|
97571
|
+
/*dotDotDotToken*/
|
|
97572
|
+
void 0,
|
|
97573
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
97574
|
+
);
|
|
97575
|
+
newParameters.push(newParameter);
|
|
97576
|
+
}
|
|
97577
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
97578
|
+
setTextRange(newParametersArray, node.parameters);
|
|
97579
|
+
return newParametersArray;
|
|
97580
|
+
}
|
|
97581
|
+
function transformAsyncFunctionBody(node, outerParameters) {
|
|
97582
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
97460
97583
|
resumeLexicalEnvironment();
|
|
97461
97584
|
const original = getOriginalNode(node, isFunctionLike);
|
|
97462
97585
|
const nodeType = original.type;
|
|
97463
97586
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
97464
97587
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
97588
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
97465
97589
|
const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
|
|
97590
|
+
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
97591
|
+
if (captureLexicalArguments) {
|
|
97592
|
+
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
97593
|
+
}
|
|
97594
|
+
let argumentsExpression;
|
|
97595
|
+
if (innerParameters) {
|
|
97596
|
+
if (isArrowFunction2) {
|
|
97597
|
+
const parameterBindings = [];
|
|
97598
|
+
Debug.assert(outerParameters.length <= node.parameters.length);
|
|
97599
|
+
for (let i = 0; i < node.parameters.length; i++) {
|
|
97600
|
+
Debug.assert(i < outerParameters.length);
|
|
97601
|
+
const originalParameter = node.parameters[i];
|
|
97602
|
+
const outerParameter = outerParameters[i];
|
|
97603
|
+
Debug.assertNode(outerParameter.name, isIdentifier);
|
|
97604
|
+
if (originalParameter.initializer || originalParameter.dotDotDotToken) {
|
|
97605
|
+
Debug.assert(i === outerParameters.length - 1);
|
|
97606
|
+
parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
|
|
97607
|
+
break;
|
|
97608
|
+
}
|
|
97609
|
+
parameterBindings.push(outerParameter.name);
|
|
97610
|
+
}
|
|
97611
|
+
argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
|
|
97612
|
+
} else {
|
|
97613
|
+
argumentsExpression = factory2.createIdentifier("arguments");
|
|
97614
|
+
}
|
|
97615
|
+
}
|
|
97466
97616
|
const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
|
|
97467
97617
|
enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
|
|
97468
97618
|
for (const parameter of node.parameters) {
|
|
@@ -97474,27 +97624,23 @@ ${lanes.join("\n")}
|
|
|
97474
97624
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
97475
97625
|
hasSuperElementAccess = false;
|
|
97476
97626
|
}
|
|
97627
|
+
const hasLexicalThis = inHasLexicalThisContext();
|
|
97628
|
+
let asyncBody = transformAsyncFunctionBodyWorker(node.body);
|
|
97629
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
|
|
97477
97630
|
let result;
|
|
97478
97631
|
if (!isArrowFunction2) {
|
|
97479
97632
|
const statements = [];
|
|
97480
|
-
const statementOffset = factory2.copyPrologue(
|
|
97481
|
-
node.body.statements,
|
|
97482
|
-
statements,
|
|
97483
|
-
/*ensureUseStrict*/
|
|
97484
|
-
false,
|
|
97485
|
-
visitor
|
|
97486
|
-
);
|
|
97487
97633
|
statements.push(
|
|
97488
97634
|
factory2.createReturnStatement(
|
|
97489
97635
|
emitHelpers().createAwaiterHelper(
|
|
97490
|
-
|
|
97491
|
-
|
|
97636
|
+
hasLexicalThis,
|
|
97637
|
+
argumentsExpression,
|
|
97492
97638
|
promiseConstructor,
|
|
97493
|
-
|
|
97639
|
+
innerParameters,
|
|
97640
|
+
asyncBody
|
|
97494
97641
|
)
|
|
97495
97642
|
)
|
|
97496
97643
|
);
|
|
97497
|
-
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
97498
97644
|
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
|
|
97499
97645
|
if (emitSuperHelpers) {
|
|
97500
97646
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
@@ -97504,6 +97650,9 @@ ${lanes.join("\n")}
|
|
|
97504
97650
|
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
97505
97651
|
}
|
|
97506
97652
|
}
|
|
97653
|
+
if (captureLexicalArguments) {
|
|
97654
|
+
insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
|
|
97655
|
+
}
|
|
97507
97656
|
const block = factory2.createBlock(
|
|
97508
97657
|
statements,
|
|
97509
97658
|
/*multiLine*/
|
|
@@ -97519,24 +97668,23 @@ ${lanes.join("\n")}
|
|
|
97519
97668
|
}
|
|
97520
97669
|
result = block;
|
|
97521
97670
|
} else {
|
|
97522
|
-
|
|
97523
|
-
|
|
97524
|
-
|
|
97671
|
+
result = emitHelpers().createAwaiterHelper(
|
|
97672
|
+
hasLexicalThis,
|
|
97673
|
+
argumentsExpression,
|
|
97525
97674
|
promiseConstructor,
|
|
97526
|
-
|
|
97675
|
+
innerParameters,
|
|
97676
|
+
asyncBody
|
|
97527
97677
|
);
|
|
97528
|
-
|
|
97529
|
-
|
|
97530
|
-
|
|
97531
|
-
result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
|
|
97532
|
-
} else {
|
|
97533
|
-
result = expression;
|
|
97678
|
+
if (captureLexicalArguments) {
|
|
97679
|
+
const block = factory2.converters.convertToFunctionBlock(result);
|
|
97680
|
+
result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
|
|
97534
97681
|
}
|
|
97535
97682
|
}
|
|
97536
97683
|
enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
|
|
97537
97684
|
if (!isArrowFunction2) {
|
|
97538
97685
|
capturedSuperProperties = savedCapturedSuperProperties;
|
|
97539
97686
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
97687
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
97540
97688
|
}
|
|
97541
97689
|
return result;
|
|
97542
97690
|
}
|
|
@@ -98658,7 +98806,7 @@ ${lanes.join("\n")}
|
|
|
98658
98806
|
),
|
|
98659
98807
|
/*typeParameters*/
|
|
98660
98808
|
void 0,
|
|
98661
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
98809
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
98662
98810
|
/*type*/
|
|
98663
98811
|
void 0,
|
|
98664
98812
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -98679,7 +98827,7 @@ ${lanes.join("\n")}
|
|
|
98679
98827
|
node.name,
|
|
98680
98828
|
/*typeParameters*/
|
|
98681
98829
|
void 0,
|
|
98682
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
98830
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
98683
98831
|
/*type*/
|
|
98684
98832
|
void 0,
|
|
98685
98833
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -98720,7 +98868,7 @@ ${lanes.join("\n")}
|
|
|
98720
98868
|
node.name,
|
|
98721
98869
|
/*typeParameters*/
|
|
98722
98870
|
void 0,
|
|
98723
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
98871
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
98724
98872
|
/*type*/
|
|
98725
98873
|
void 0,
|
|
98726
98874
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody2(node)
|
|
@@ -98729,21 +98877,38 @@ ${lanes.join("\n")}
|
|
|
98729
98877
|
parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
|
|
98730
98878
|
return updated;
|
|
98731
98879
|
}
|
|
98880
|
+
function transformAsyncGeneratorFunctionParameterList(node) {
|
|
98881
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
98882
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
98883
|
+
}
|
|
98884
|
+
const newParameters = [];
|
|
98885
|
+
for (const parameter of node.parameters) {
|
|
98886
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
98887
|
+
break;
|
|
98888
|
+
}
|
|
98889
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
98890
|
+
/*modifiers*/
|
|
98891
|
+
void 0,
|
|
98892
|
+
/*dotDotDotToken*/
|
|
98893
|
+
void 0,
|
|
98894
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
98895
|
+
);
|
|
98896
|
+
newParameters.push(newParameter);
|
|
98897
|
+
}
|
|
98898
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
98899
|
+
setTextRange(newParametersArray, node.parameters);
|
|
98900
|
+
return newParametersArray;
|
|
98901
|
+
}
|
|
98732
98902
|
function transformAsyncGeneratorFunctionBody(node) {
|
|
98903
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
98733
98904
|
resumeLexicalEnvironment();
|
|
98734
|
-
const statements = [];
|
|
98735
|
-
const statementOffset = factory2.copyPrologue(
|
|
98736
|
-
node.body.statements,
|
|
98737
|
-
statements,
|
|
98738
|
-
/*ensureUseStrict*/
|
|
98739
|
-
false,
|
|
98740
|
-
visitor
|
|
98741
|
-
);
|
|
98742
|
-
appendObjectRestAssignmentsIfNeeded(statements, node);
|
|
98743
98905
|
const savedCapturedSuperProperties = capturedSuperProperties;
|
|
98744
98906
|
const savedHasSuperElementAccess = hasSuperElementAccess;
|
|
98745
98907
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
98746
98908
|
hasSuperElementAccess = false;
|
|
98909
|
+
const outerStatements = [];
|
|
98910
|
+
let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
|
|
98911
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
|
|
98747
98912
|
const returnStatement = factory2.createReturnStatement(
|
|
98748
98913
|
emitHelpers().createAsyncGeneratorHelper(
|
|
98749
98914
|
factory2.createFunctionExpression(
|
|
@@ -98753,14 +98918,10 @@ ${lanes.join("\n")}
|
|
|
98753
98918
|
node.name && factory2.getGeneratedNameForNode(node.name),
|
|
98754
98919
|
/*typeParameters*/
|
|
98755
98920
|
void 0,
|
|
98756
|
-
|
|
98757
|
-
[],
|
|
98921
|
+
innerParameters ?? [],
|
|
98758
98922
|
/*type*/
|
|
98759
98923
|
void 0,
|
|
98760
|
-
|
|
98761
|
-
node.body,
|
|
98762
|
-
visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
|
|
98763
|
-
)
|
|
98924
|
+
asyncBody
|
|
98764
98925
|
),
|
|
98765
98926
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
98766
98927
|
)
|
|
@@ -98770,11 +98931,10 @@ ${lanes.join("\n")}
|
|
|
98770
98931
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
98771
98932
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
98772
98933
|
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
|
|
98773
|
-
insertStatementsAfterStandardPrologue(
|
|
98934
|
+
insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
|
|
98774
98935
|
}
|
|
98775
|
-
|
|
98776
|
-
|
|
98777
|
-
const block = factory2.updateBlock(node.body, statements);
|
|
98936
|
+
outerStatements.push(returnStatement);
|
|
98937
|
+
const block = factory2.updateBlock(node.body, outerStatements);
|
|
98778
98938
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
98779
98939
|
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
98780
98940
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
@@ -144003,7 +144163,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144003
144163
|
if (discriminatedPropertySymbols.length === 0) {
|
|
144004
144164
|
return mapDefined(contextualType.types, (t) => t.getProperty(name));
|
|
144005
144165
|
}
|
|
144006
|
-
return discriminatedPropertySymbols;
|
|
144166
|
+
return deduplicate(discriminatedPropertySymbols, equateValues);
|
|
144007
144167
|
}
|
|
144008
144168
|
function isArgumentOfElementAccessExpression(node) {
|
|
144009
144169
|
return node && node.parent && node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.argumentExpression === node;
|
|
@@ -169713,7 +169873,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169713
169873
|
const typeNames = [80 /* Identifier */, ...typeKeywords];
|
|
169714
169874
|
const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
|
|
169715
169875
|
const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]);
|
|
169716
|
-
const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]);
|
|
169876
|
+
const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */, 85 /* CatchKeyword */]);
|
|
169717
169877
|
const highPriorityCommonRules = [
|
|
169718
169878
|
// Leave comments alone
|
|
169719
169879
|
rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */),
|
|
@@ -172246,9 +172406,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172246
172406
|
init_ts5();
|
|
172247
172407
|
init_deprecate();
|
|
172248
172408
|
addObjectAllocatorPatcher((objectAllocator2) => {
|
|
172249
|
-
const
|
|
172250
|
-
if (!hasProperty(
|
|
172251
|
-
Object.defineProperty(
|
|
172409
|
+
const Identifier79 = objectAllocator2.getIdentifierConstructor();
|
|
172410
|
+
if (!hasProperty(Identifier79.prototype, "originalKeywordKind")) {
|
|
172411
|
+
Object.defineProperty(Identifier79.prototype, "originalKeywordKind", {
|
|
172252
172412
|
get: deprecate(function() {
|
|
172253
172413
|
return identifierToKeywordKind(this);
|
|
172254
172414
|
}, {
|
|
@@ -172260,8 +172420,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172260
172420
|
})
|
|
172261
172421
|
});
|
|
172262
172422
|
}
|
|
172263
|
-
if (!hasProperty(
|
|
172264
|
-
Object.defineProperty(
|
|
172423
|
+
if (!hasProperty(Identifier79.prototype, "isInJSDocNamespace")) {
|
|
172424
|
+
Object.defineProperty(Identifier79.prototype, "isInJSDocNamespace", {
|
|
172265
172425
|
get: deprecate(function() {
|
|
172266
172426
|
return this.flags & 4096 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
|
|
172267
172427
|
}, {
|
|
@@ -185510,6 +185670,8 @@ ${e.message}`;
|
|
|
185510
185670
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
185511
185671
|
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
|
|
185512
185672
|
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
|
|
185673
|
+
isSimpleParameter: () => isSimpleParameter,
|
|
185674
|
+
isSimpleParameterList: () => isSimpleParameterList,
|
|
185513
185675
|
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
|
|
185514
185676
|
isSourceFile: () => isSourceFile,
|
|
185515
185677
|
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
|
|
@@ -187918,6 +188080,8 @@ ${e.message}`;
|
|
|
187918
188080
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
187919
188081
|
isSimpleCopiableExpression: () => isSimpleCopiableExpression,
|
|
187920
188082
|
isSimpleInlineableExpression: () => isSimpleInlineableExpression,
|
|
188083
|
+
isSimpleParameter: () => isSimpleParameter,
|
|
188084
|
+
isSimpleParameterList: () => isSimpleParameterList,
|
|
187921
188085
|
isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
|
|
187922
188086
|
isSourceFile: () => isSourceFile,
|
|
187923
188087
|
isSourceFileFromLibrary: () => isSourceFileFromLibrary,
|