Skip to content

Commit 6065201

Browse files
dependabot[bot]github-actions[bot]buke
authored
deps(deps): bump microsoft/typescript-go from dc6ce07 to 7c2dab6 (#38)
* deps(deps): bump microsoft/typescript-go from `dc6ce07` to `7c2dab6` Bumps [microsoft/typescript-go](https://github.com/microsoft/typescript-go) from `dc6ce07` to `7c2dab6`. - [Commits](microsoft/typescript-go@dc6ce07...7c2dab6) --- updated-dependencies: - dependency-name: microsoft/typescript-go dependency-version: 7c2dab6c4248845a1dde0693a6609bf2655e8463 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * chore(sync): mirror internal packages into pkg/ (auto) (#39) Co-authored-by: buke <1013738+buke@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: buke <1013738+buke@users.noreply.github.com>
1 parent 8e9cd76 commit 6065201

File tree

2,866 files changed

+6628
-3475
lines changed

Some content is hidden

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

2,866 files changed

+6628
-3475
lines changed

microsoft/typescript-go

Submodule typescript-go updated 2866 files

pkg/api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func (api *API) ParseConfigFile(configFileName string) (*ConfigFileResponse, err
127127
api.session,
128128
configDir,
129129
nil, /*existingOptions*/
130+
nil, /*existingOptionsRaw*/
130131
configFileName,
131132
nil, /*resolutionStack*/
132133
nil, /*extraFileExtensions*/

pkg/checker/checker.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26600,11 +26600,6 @@ func (c *Checker) isAssignmentToReadonlyEntity(expr *ast.Node, symbol *ast.Symbo
2660026600
if expressionSymbol.Flags&ast.SymbolFlagsModuleExports != 0 {
2660126601
return false
2660226602
}
26603-
// references through namespace import should be readonly
26604-
if expressionSymbol.Flags&ast.SymbolFlagsAlias != 0 {
26605-
declaration := c.getDeclarationOfAliasSymbol(expressionSymbol)
26606-
return declaration != nil && ast.IsNamespaceImport(declaration)
26607-
}
2660826603
}
2660926604
}
2661026605
if c.isReadonlySymbol(symbol) {
@@ -26627,6 +26622,17 @@ func (c *Checker) isAssignmentToReadonlyEntity(expr *ast.Node, symbol *ast.Symbo
2662726622
}
2662826623
return true
2662926624
}
26625+
if ast.IsAccessExpression(expr) {
26626+
// references through namespace import should be readonly
26627+
node := ast.SkipParentheses(expr.Expression())
26628+
if ast.IsIdentifier(node) {
26629+
expressionSymbol := c.getResolvedSymbol(node)
26630+
if expressionSymbol.Flags&ast.SymbolFlagsAlias != 0 {
26631+
declaration := c.getDeclarationOfAliasSymbol(expressionSymbol)
26632+
return declaration != nil && ast.IsNamespaceImport(declaration)
26633+
}
26634+
}
26635+
}
2663026636
return false
2663126637
}
2663226638

pkg/checker/checker_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ foo.bar;`
3838
cd := "/"
3939
host := compiler.NewCompilerHost(cd, fs, bundled.LibPath(), nil, nil)
4040

41-
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile("/tsconfig.json", &core.CompilerOptions{}, host, nil)
41+
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile("/tsconfig.json", &core.CompilerOptions{}, nil, host, nil)
4242
assert.Equal(t, len(errors), 0, "Expected no errors in parsed command line")
4343

4444
p := compiler.NewProgram(compiler.ProgramOptions{
@@ -71,7 +71,7 @@ func TestCheckSrcCompiler(t *testing.T) {
7171
rootPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath), "src", "compiler")
7272

7373
host := compiler.NewCompilerHost(rootPath, fs, bundled.LibPath(), nil, nil)
74-
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), &core.CompilerOptions{}, host, nil)
74+
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), &core.CompilerOptions{}, nil, host, nil)
7575
assert.Equal(t, len(errors), 0, "Expected no errors in parsed command line")
7676
p := compiler.NewProgram(compiler.ProgramOptions{
7777
Config: parsed,
@@ -88,7 +88,7 @@ func BenchmarkNewChecker(b *testing.B) {
8888
rootPath := tspath.CombinePaths(tspath.NormalizeSlashes(repo.TypeScriptSubmodulePath), "src", "compiler")
8989

9090
host := compiler.NewCompilerHost(rootPath, fs, bundled.LibPath(), nil, nil)
91-
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), &core.CompilerOptions{}, host, nil)
91+
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), &core.CompilerOptions{}, nil, host, nil)
9292
assert.Equal(b, len(errors), 0, "Expected no errors in parsed command line")
9393
p := compiler.NewProgram(compiler.ProgramOptions{
9494
Config: parsed,

pkg/compiler/checkerpool.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ type checkerPool struct {
3232

3333
var _ CheckerPool = (*checkerPool)(nil)
3434

35-
func newCheckerPool(checkerCount int, program *Program) *checkerPool {
35+
func newCheckerPool(program *Program) *checkerPool {
36+
checkerCount := 4
37+
if program.SingleThreaded() {
38+
checkerCount = 1
39+
} else if c := program.Options().Checkers; c != nil {
40+
checkerCount = *c
41+
}
42+
43+
checkerCount = max(min(checkerCount, len(program.files), 256), 1)
44+
3645
pool := &checkerPool{
3746
program: program,
3847
checkerCount: checkerCount,

pkg/compiler/fileloader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type processedFiles struct {
6969
// if file was included using source file and its output is actually part of program
7070
// this contains mapping from output to source file
7171
outputFileToProjectReferenceSource map[tspath.Path]string
72+
finishedProcessing bool
7273
}
7374

7475
type jsxRuntimeImportSpecifier struct {

pkg/compiler/filesparser.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ func (w *filesParser) getProcessedFiles(loader *fileLoader) processedFiles {
372372
}
373373

374374
return processedFiles{
375+
finishedProcessing: true,
375376
resolver: loader.resolver,
376377
files: allFiles,
377378
filesByPath: filesByPath,

pkg/compiler/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ func (h *compilerHost) GetSourceFile(opts ast.SourceFileParseOptions) *ast.Sourc
8484
}
8585

8686
func (h *compilerHost) GetResolvedProjectReference(fileName string, path tspath.Path) *tsoptions.ParsedCommandLine {
87-
commandLine, _ := tsoptions.GetParsedCommandLineOfConfigFilePath(fileName, path, nil, h, h.extendedConfigCache)
87+
commandLine, _ := tsoptions.GetParsedCommandLineOfConfigFilePath(fileName, path, nil, nil /*optionsRaw*/, h, h.extendedConfigCache)
8888
return commandLine
8989
}

pkg/compiler/program.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ func (p *Program) GetSourceFileFromReference(origin *ast.SourceFile, ref *ast.Fi
222222

223223
func NewProgram(opts ProgramOptions) *Program {
224224
p := &Program{opts: opts}
225-
p.initCheckerPool()
226225
p.processedFiles = processAllProgramFiles(p.opts, p.SingleThreaded())
226+
p.initCheckerPool()
227227
p.verifyCompilerOptions()
228228
return p
229229
}
@@ -259,16 +259,14 @@ func (p *Program) UpdateProgram(changedFilePath tspath.Path, newHost CompilerHos
259259
}
260260

261261
func (p *Program) initCheckerPool() {
262+
if !p.finishedProcessing {
263+
panic("Program must finish processing files before initializing checker pool")
264+
}
265+
262266
if p.opts.CreateCheckerPool != nil {
263267
p.checkerPool = p.opts.CreateCheckerPool(p)
264268
} else {
265-
checkers := 4
266-
if p.SingleThreaded() {
267-
checkers = 1
268-
} else if p.Options().Checkers != nil {
269-
checkers = min(max(*p.Options().Checkers, 1), 256)
270-
}
271-
p.checkerPool = newCheckerPool(checkers, p)
269+
p.checkerPool = newCheckerPool(p)
272270
}
273271
}
274272

pkg/compiler/program_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func BenchmarkNewProgram(b *testing.B) {
299299

300300
host := compiler.NewCompilerHost(rootPath, fs, bundled.LibPath(), nil, nil)
301301

302-
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), nil, host, nil)
302+
parsed, errors := tsoptions.GetParsedCommandLineOfConfigFile(tspath.CombinePaths(rootPath, "tsconfig.json"), nil, nil, host, nil)
303303
assert.Equal(b, len(errors), 0, "Expected no errors in parsed command line")
304304

305305
opts := compiler.ProgramOptions{

0 commit comments

Comments
 (0)