Skip to content

Commit 322f6cd

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix-direct-arg-completion
2 parents 6d31988 + 7c378db commit 322f6cd

File tree

395 files changed

+30758
-3710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+30758
-3710
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
node-version:
23-
- "19"
23+
- "20"
2424
- "18"
2525
- "16"
2626
- "14"

Herebyfile.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ export const runTestsAndWatch = task({
616616
});
617617

618618
process.on("SIGINT", endWatchMode);
619-
process.on("SIGKILL", endWatchMode);
620619
process.on("beforeExit", endWatchMode);
621620
watchTestsEmitter.on("rebuild", onRebuild);
622621
testCaseWatcher.on("all", onChange);

package-lock.json

Lines changed: 98 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler/checker.ts

Lines changed: 125 additions & 67 deletions
Large diffs are not rendered by default.

src/compiler/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7835,12 +7835,12 @@ namespace Parser {
78357835

78367836
function parseClassElement(): ClassElement {
78377837
const pos = getNodePos();
7838+
const hasJSDoc = hasPrecedingJSDocComment();
78387839
if (token() === SyntaxKind.SemicolonToken) {
78397840
nextToken();
7840-
return finishNode(factory.createSemicolonClassElement(), pos);
7841+
return withJSDoc(finishNode(factory.createSemicolonClassElement(), pos), hasJSDoc);
78417842
}
78427843

7843-
const hasJSDoc = hasPrecedingJSDocComment();
78447844
const modifiers = parseModifiers(/*allowDecorators*/ true, /*permitConstAsModifier*/ true, /*stopOnStartOfClassStaticBlock*/ true);
78457845
if (token() === SyntaxKind.StaticKeyword && lookAhead(nextTokenIsOpenBrace)) {
78467846
return parseClassStaticBlockDeclaration(pos, hasJSDoc, modifiers);

src/compiler/transformers/es2018.ts

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -767,11 +767,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile
767767
const exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression);
768768
setSourceMapRange(exitNonUserCodeStatement, node.expression);
769769

770-
const enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue());
771-
const enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression);
772-
setSourceMapRange(exitNonUserCodeStatement, node.expression);
773-
774-
const statements: Statement[] = [];
770+
const statements: Statement[] = [iteratorValueStatement, exitNonUserCodeStatement];
775771
const binding = createForOfBindingStatement(factory, node.initializer, value);
776772
statements.push(visitNode(binding, visitor, isStatement));
777773

@@ -787,28 +783,13 @@ export function transformES2018(context: TransformationContext): (x: SourceFile
787783
statements.push(statement);
788784
}
789785

790-
const body = setEmitFlags(
791-
setTextRange(
792-
factory.createBlock(
793-
setTextRange(factory.createNodeArray(statements), statementsLocation),
794-
/*multiLine*/ true
795-
),
796-
bodyLocation
786+
return setTextRange(
787+
factory.createBlock(
788+
setTextRange(factory.createNodeArray(statements), statementsLocation),
789+
/*multiLine*/ true
797790
),
798-
EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps
791+
bodyLocation
799792
);
800-
801-
return factory.createBlock([
802-
iteratorValueStatement,
803-
exitNonUserCodeStatement,
804-
factory.createTryStatement(
805-
body,
806-
/*catchClause*/ undefined,
807-
factory.createBlock([
808-
enterNonUserCodeStatement
809-
])
810-
)
811-
]);
812793
}
813794

814795
function createDownlevelAwait(expression: Expression) {
@@ -859,7 +840,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile
859840
factory.createAssignment(done, getDone),
860841
factory.createLogicalNot(done)
861842
]),
862-
/*incrementor*/ undefined,
843+
/*incrementor*/ factory.createAssignment(nonUserCode, factory.createTrue()),
863844
/*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)
864845
),
865846
/*location*/ node

src/compiler/transformers/legacyDecorators.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
isBlock,
3838
isCallToHelper,
3939
isClassElement,
40+
isClassStaticBlockDeclaration,
4041
isComputedPropertyName,
4142
isDecorator,
4243
isExportOrDefaultModifier,
@@ -339,6 +340,27 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S
339340
let decorationStatements: Statement[] | undefined = [];
340341
({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
341342

343+
// If we're emitting to ES2022 or later then we need to reassign the class alias before
344+
// static initializers are evaluated.
345+
const assignClassAliasInStaticBlock =
346+
languageVersion >= ScriptTarget.ES2022 &&
347+
!!classAlias &&
348+
some(members, member =>
349+
isPropertyDeclaration(member) && hasSyntacticModifier(member, ModifierFlags.Static) ||
350+
isClassStaticBlockDeclaration(member));
351+
if (assignClassAliasInStaticBlock) {
352+
members = setTextRange(factory.createNodeArray([
353+
factory.createClassStaticBlockDeclaration(
354+
factory.createBlock([
355+
factory.createExpressionStatement(
356+
factory.createAssignment(classAlias, factory.createThis())
357+
)
358+
])
359+
),
360+
...members
361+
]), members);
362+
}
363+
342364
const classExpression = factory.createClassExpression(
343365
modifiers,
344366
name && isGeneratedIdentifier(name) ? undefined : name,
@@ -355,7 +377,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S
355377
declName,
356378
/*exclamationToken*/ undefined,
357379
/*type*/ undefined,
358-
classAlias ? factory.createAssignment(classAlias, classExpression) : classExpression
380+
classAlias && !assignClassAliasInStaticBlock ? factory.createAssignment(classAlias, classExpression) : classExpression
359381
);
360382
setOriginalNode(varDecl, node);
361383

0 commit comments

Comments
 (0)