Skip to content

Commit f6c0749

Browse files
committed
Merge branch 'master' into web-worker-server
2 parents 94faf66 + d93590e commit f6c0749

File tree

746 files changed

+70220
-2529
lines changed

Some content is hidden

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

746 files changed

+70220
-2529
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ yarn-error.log
4343
.parallelperf.*
4444
.failed-tests
4545
TEST-results.xml
46-
package-lock.json
4746
tests
4847
.vscode
4948
.git
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name : CodeQL Configuration
2+
3+
paths:
4+
- './src'

.github/workflows/codeql.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Code scanning - action"
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 19 * * 0'
8+
9+
jobs:
10+
CodeQL-Build:
11+
12+
# CodeQL runs on ubuntu-latest and windows-latest
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
with:
19+
# We must fetch at least the immediate parents so that if this is
20+
# a pull request then we can checkout the head.
21+
fetch-depth: 2
22+
23+
# If this run was triggered by a pull request event, then checkout
24+
# the head of the pull request instead of the merge commit.
25+
- run: git checkout HEAD^2
26+
if: ${{ github.event_name == 'pull_request' }}
27+
28+
# Initializes the CodeQL tools for scanning.
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v1
31+
with:
32+
config-file: ./.github/codeql/codeql-configuration.yml
33+
# Override language selection by uncommenting this and choosing your languages
34+
# with:
35+
# languages: go, javascript, csharp, python, cpp, java
36+
37+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38+
# If this step fails, then you should remove it and run the build manually (see below)
39+
- name: Autobuild
40+
uses: github/codeql-action/autobuild@v1
41+
42+
# ℹ️ Command-line programs to run using the OS shell.
43+
# 📚 https://git.io/JvXDl
44+
45+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46+
# and modify them (or add more) to build your code if your project
47+
# uses a compiled language
48+
49+
#- run: |
50+
# make bootstrap
51+
# make release
52+
53+
- name: Perform CodeQL Analysis
54+
uses: github/codeql-action/analyze@v1

.github/workflows/sync-branch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- uses: actions/checkout@v2
2222
with:
2323
ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }}
24+
fetch-depth: 0
2425
# This does a test post-merge and only pushes the result if the test succeeds
2526
# required client_payload members:
2627
# branch_name - the target branch

.vscode/launch.template.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,24 @@
4747
"console": "integratedTerminal",
4848
"outFiles": [
4949
"${workspaceRoot}/built/local/run.js"
50-
]
50+
],
51+
52+
// NOTE: To use this, you must switch the "type" above to "pwa-node". You may also need to follow the instructions
53+
// here: https://github.com/microsoft/vscode-js-debug#nightly-extension to use the js-debug nightly until
54+
// this feature is shipping in insiders or to a release:
55+
// "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
5156
},
5257
{
5358
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
5459
"type": "node",
5560
"request": "attach",
5661
"name": "Attach to VS Code TS Server via Port",
57-
"processId": "${command:PickProcess}"
62+
"processId": "${command:PickProcess}",
63+
64+
// NOTE: To use this, you must switch the "type" above to "pwa-node". You may also need to follow the instructions
65+
// here: https://github.com/microsoft/vscode-js-debug#nightly-extension to use the js-debug nightly until
66+
// this feature is shipping in insiders or to a release:
67+
// "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
5868
}
5969
]
6070
}

Gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ const cleanTypesMap = () => del("built/local/typesMap.json");
413413
cleanTasks.push(cleanTypesMap);
414414

415415
// Drop a copy of diagnosticMessages.generated.json into the built/local folder. This allows
416-
// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
416+
// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
417417
// pipeline that generates the localization artifacts that are then fed into the translation process.
418418
const builtLocalDiagnosticMessagesGeneratedJson = "built/local/diagnosticMessages.generated.json";
419419
const copyBuiltLocalDiagnosticMessages = () => src(diagnosticMessagesGeneratedJson)
@@ -591,7 +591,7 @@ task("LKG").flags = {
591591
" --built": "Compile using the built version of the compiler.",
592592
};
593593

594-
const generateSpec = () => exec("cscript", ["//nologo", "scripts/word2md.js", path.resolve("doc/TypeScript Language Specification.docx"), path.resolve("doc/spec.md")]);
594+
const generateSpec = () => exec("cscript", ["//nologo", "scripts/word2md.js", path.resolve("doc/TypeScript Language Specification - ARCHIVED.docx"), path.resolve("doc/spec-ARCHIVED.md")]);
595595
task("generate-spec", series(buildScripts, generateSpec));
596596
task("generate-spec").description = "Generates a Markdown version of the Language Specification";
597597

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ with any additional questions or comments.
4444

4545
* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
4646
* [Programming handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html)
47-
* [Language specification](https://github.com/microsoft/TypeScript/blob/master/doc/spec.md)
4847
* [Homepage](https://www.typescriptlang.org/)
4948

5049
## Building

doc/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This directory contains miscellaneous documentation such as the TypeScript language specification and logo.
44
If you are looking for more introductory material, you might want to take a look at the [TypeScript Handbook](https://github.com/Microsoft/TypeScript-Handbook).
55

6-
# Spec Contributions
7-
8-
The specification is first authored as a Microsoft Word (docx) file and then generated into Markdown and PDF formats.
9-
Due to the binary format of docx files, and the merging difficulties that may come with it, it is preferred that **any suggestions or problems found in the spec should be [filed as issues](https://github.com/Microsoft/TypeScript/issues/new)** rather than sent as pull requests.
6+
7+
# Archived Spec
8+
9+
NOTE: the files in this directory are NOT meant to be edited. They are a snapshot of the out-of-date specification which is no longer being updated. We will not be accepting changes to these documents.
File renamed without changes.

package-lock.json

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

scripts/run-sequence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function runSequence(tasks, opts = { timeout: 100000, shell: true }) {
1010
for (const task of tasks) {
1111
console.log(`${task[0]} ${task[1].join(" ")}`);
1212
const result = cp.spawnSync(task[0], task[1], opts);
13-
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
13+
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && "stderr: " + result.stderr.toString()}${result.stdout && "\nstdout: " + result.stdout.toString()}`);
1414
console.log(result.stdout && result.stdout.toString());
1515
lastResult = result;
1616
}

src/compiler/binder.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,14 @@ namespace ts {
174174
const binder = createBinder();
175175

176176
export function bindSourceFile(file: SourceFile, options: CompilerOptions) {
177+
tracing.begin(tracing.Phase.Bind, "bindSourceFile", { path: file.path });
177178
performance.mark("beforeBind");
178179
perfLogger.logStartBindFile("" + file.fileName);
179180
binder(file, options);
180181
perfLogger.logStopBindFile();
181182
performance.mark("afterBind");
182183
performance.measure("Bind", "beforeBind", "afterBind");
184+
tracing.end();
183185
}
184186

185187
function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
@@ -831,6 +833,7 @@ namespace ts {
831833
function isNarrowingExpression(expr: Expression): boolean {
832834
switch (expr.kind) {
833835
case SyntaxKind.Identifier:
836+
case SyntaxKind.PrivateIdentifier:
834837
case SyntaxKind.ThisKeyword:
835838
case SyntaxKind.PropertyAccessExpression:
836839
case SyntaxKind.ElementAccessExpression:
@@ -850,7 +853,7 @@ namespace ts {
850853
}
851854

852855
function isNarrowableReference(expr: Expression): boolean {
853-
return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.ThisKeyword || expr.kind === SyntaxKind.SuperKeyword ||
856+
return expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PrivateIdentifier || expr.kind === SyntaxKind.ThisKeyword || expr.kind === SyntaxKind.SuperKeyword ||
854857
(isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
855858
isElementAccessExpression(expr) && isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression) ||
856859
isAssignmentExpression(expr) && isNarrowableReference(expr.left);
@@ -2805,9 +2808,9 @@ namespace ts {
28052808
return symbol;
28062809
});
28072810
if (symbol) {
2808-
const flags = isClassExpression(node.right) ?
2809-
SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.Class :
2810-
SymbolFlags.Property | SymbolFlags.ExportValue;
2811+
const isAlias = isAliasableExpression(node.right) && (isExportsIdentifier(node.left.expression) || isModuleExportsAccessExpression(node.left.expression));
2812+
const flags = isAlias ? SymbolFlags.Alias : SymbolFlags.Property | SymbolFlags.ExportValue;
2813+
setParent(node.left, node);
28112814
declareSymbol(symbol.exports!, symbol, node.left, flags, SymbolFlags.None);
28122815
}
28132816
}
@@ -2974,6 +2977,10 @@ namespace ts {
29742977
if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
29752978
return;
29762979
}
2980+
const rootExpr = getLeftmostAccessExpression(node.left);
2981+
if (isIdentifier(rootExpr) && lookupSymbolForName(container, rootExpr.escapedText)!?.flags & SymbolFlags.Alias) {
2982+
return;
2983+
}
29772984
// Fix up parent pointers since we're going to use these nodes before we bind into them
29782985
setParent(node.left, node);
29792986
setParent(node.right, node);

0 commit comments

Comments
 (0)