Skip to content

Commit ad20f99

Browse files
Merge pull request #602 from microsoft/main
Create a new pull request by comparing changes across two branches
2 parents 97a7f41 + 55f1248 commit ad20f99

File tree

274 files changed

+38801
-1175
lines changed

Some content is hidden

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

274 files changed

+38801
-1175
lines changed

Herebyfile.mjs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,6 @@ export const knip = task({
604604
run: () => exec(process.execPath, ["node_modules/knip/bin/knip.js", "--tags=+internal,-knipignore", "--exclude=duplicates,enumMembers", ...(cmdLineOptions.fix ? ["--fix"] : [])]),
605605
});
606606

607-
const { main: cancellationToken, watch: watchCancellationToken } = entrypointBuildTask({
608-
name: "cancellation-token",
609-
project: "src/cancellationToken",
610-
srcEntrypoint: "./src/cancellationToken/cancellationToken.ts",
611-
builtEntrypoint: "./built/local/cancellationToken/cancellationToken.js",
612-
output: "./built/local/cancellationToken.js",
613-
});
614-
615607
const { main: typingsInstaller, watch: watchTypingsInstaller } = entrypointBuildTask({
616608
name: "typings-installer",
617609
buildDeps: [generateDiagnostics],
@@ -661,14 +653,14 @@ const copyBuiltLocalDiagnosticMessages = task({
661653
export const otherOutputs = task({
662654
name: "other-outputs",
663655
description: "Builds miscelaneous scripts and documents distributed with the LKG",
664-
dependencies: [cancellationToken, typingsInstaller, watchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
656+
dependencies: [typingsInstaller, watchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
665657
});
666658

667659
export const watchOtherOutputs = task({
668660
name: "watch-other-outputs",
669661
description: "Builds miscelaneous scripts and documents distributed with the LKG",
670662
hiddenFromTaskList: true,
671-
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
663+
dependencies: [watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
672664
});
673665

674666
export const local = task({
@@ -916,7 +908,6 @@ export const produceLKG = task({
916908
}
917909

918910
const expectedFiles = [
919-
"built/local/cancellationToken.js",
920911
"built/local/tsc.js",
921912
"built/local/_tsc.js",
922913
"built/local/tsserver.js",

knip.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"includeEntryExports": true,
44
"entry": [
55
"Herebyfile.mjs",
6-
"src/cancellationToken/cancellationToken.ts",
76
"src/testRunner/_namespaces/Harness.ts",
87
"src/tsc/tsc.ts",
98
"src/tsserver/server.ts",

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "https://www.typescriptlang.org/",
5-
"version": "5.7.0",
5+
"version": "5.8.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

scripts/produceLKG.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ async function copyTypesMap() {
4848
}
4949

5050
async function copyScriptOutputs() {
51-
await copyFromBuiltLocal("cancellationToken.js");
5251
await copyFromBuiltLocal("tsc.js");
5352
await copyFromBuiltLocal("_tsc.js");
5453
await copyFromBuiltLocal("tsserver.js");

src/cancellationToken/cancellationToken.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/cancellationToken/tsconfig.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/compiler/binder.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
543543
var preSwitchCaseFlow: FlowNode | undefined;
544544
var activeLabelList: ActiveLabel | undefined;
545545
var hasExplicitReturn: boolean;
546+
var inReturnPosition: boolean;
546547
var hasFlowEffects: boolean;
547548

548549
// state used for emit helpers
@@ -622,6 +623,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
622623
currentExceptionTarget = undefined;
623624
activeLabelList = undefined;
624625
hasExplicitReturn = false;
626+
inReturnPosition = false;
625627
hasFlowEffects = false;
626628
inAssignmentPattern = false;
627629
emitFlags = NodeFlags.None;
@@ -967,7 +969,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
967969
const saveContainer = container;
968970
const saveThisParentContainer = thisParentContainer;
969971
const savedBlockScopeContainer = blockScopeContainer;
972+
const savedInReturnPosition = inReturnPosition;
970973

974+
if (node.kind === SyntaxKind.ArrowFunction && node.body.kind !== SyntaxKind.Block) inReturnPosition = true;
971975
// Depending on what kind of node this is, we may have to adjust the current container
972976
// and block-container. If the current node is a container, then it is automatically
973977
// considered the current block-container as well. Also, for containers that we know
@@ -1071,6 +1075,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
10711075
bindChildren(node);
10721076
}
10731077

1078+
inReturnPosition = savedInReturnPosition;
10741079
container = saveContainer;
10751080
thisParentContainer = saveThisParentContainer;
10761081
blockScopeContainer = savedBlockScopeContainer;
@@ -1571,7 +1576,10 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
15711576
}
15721577

15731578
function bindReturnOrThrow(node: ReturnStatement | ThrowStatement): void {
1579+
const savedInReturnPosition = inReturnPosition;
1580+
inReturnPosition = true;
15741581
bind(node.expression);
1582+
inReturnPosition = savedInReturnPosition;
15751583
if (node.kind === SyntaxKind.ReturnStatement) {
15761584
hasExplicitReturn = true;
15771585
if (currentReturnTarget) {
@@ -2016,10 +2024,16 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
20162024
hasFlowEffects = false;
20172025
bindCondition(node.condition, trueLabel, falseLabel);
20182026
currentFlow = finishFlowLabel(trueLabel);
2027+
if (inReturnPosition) {
2028+
node.flowNodeWhenTrue = currentFlow;
2029+
}
20192030
bind(node.questionToken);
20202031
bind(node.whenTrue);
20212032
addAntecedent(postExpressionLabel, currentFlow);
20222033
currentFlow = finishFlowLabel(falseLabel);
2034+
if (inReturnPosition) {
2035+
node.flowNodeWhenFalse = currentFlow;
2036+
}
20232037
bind(node.colonToken);
20242038
bind(node.whenFalse);
20252039
addAntecedent(postExpressionLabel, currentFlow);

0 commit comments

Comments
 (0)