Skip to content

Commit 678ab6f

Browse files
authored
Port verifyCompilerOptions, error on things removed from this repo (#1381)
1 parent a942c19 commit 678ab6f

File tree

552 files changed

+6965
-7217
lines changed

Some content is hidden

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

552 files changed

+6965
-7217
lines changed

internal/checker/checker.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,17 +1830,8 @@ func (c *Checker) isBlockScopedNameDeclaredBeforeUse(declaration *ast.Node, usag
18301830
useFile := ast.GetSourceFileOfNode(usage)
18311831
declContainer := ast.GetEnclosingBlockScopeContainer(declaration)
18321832
if declarationFile != useFile {
1833-
if (c.moduleKind != core.ModuleKindNone && (declarationFile.ExternalModuleIndicator != nil || useFile.ExternalModuleIndicator != nil)) || c.compilerOptions.OutFile == "" || IsInTypeQuery(usage) || declaration.Flags&ast.NodeFlagsAmbient != 0 {
1834-
// nodes are in different files and order cannot be determined
1835-
return true
1836-
}
1837-
// declaration is after usage
1838-
// can be legal if usage is deferred (i.e. inside function or in initializer of instance property)
1839-
if c.isUsedInFunctionOrInstanceProperty(usage, declaration, declContainer) {
1840-
return true
1841-
}
1842-
sourceFiles := c.program.SourceFiles()
1843-
return slices.Index(sourceFiles, declarationFile) <= slices.Index(sourceFiles, useFile)
1833+
// nodes are in different files and order cannot be determined
1834+
return true
18441835
}
18451836
// deferred usage in a type context is always OK regardless of the usage position:
18461837
if usage.Flags&ast.NodeFlagsJSDoc != 0 || IsInTypeQuery(usage) || c.isInAmbientOrTypeNode(usage) {

internal/checker/nodebuilderimpl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ func (b *nodeBuilderImpl) getSpecifierForModuleSymbol(symbol *ast.Symbol, overri
10731073
if ok {
10741074
return result
10751075
}
1076-
isBundle := len(b.ch.compilerOptions.OutFile) > 0
1076+
isBundle := false // !!! remove me
10771077
// For declaration bundles, we need to generate absolute paths relative to the common source dir for imports,
10781078
// just like how the declaration emitter does for the ambient module declarations - we can easily accomplish this
10791079
// using the `baseUrl` compiler option (which we would otherwise never use in declaration emit) and a non-relative

internal/checker/utilities.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ func findInMap[K comparable, V any](m map[K]V, predicate func(V) bool) V {
4444
return *new(V)
4545
}
4646

47-
func boolToTristate(b bool) core.Tristate {
48-
if b {
49-
return core.TSTrue
50-
}
51-
return core.TSFalse
52-
}
53-
5447
func isCompoundAssignment(token ast.Kind) bool {
5548
return token >= ast.KindFirstCompoundAssignment && token <= ast.KindLastCompoundAssignment
5649
}

internal/compiler/emitter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ func sourceFileMayBeEmitted(sourceFile *ast.SourceFile, host SourceFileMayBeEmit
436436
}
437437

438438
func getSourceFilesToEmit(host SourceFileMayBeEmittedHost, targetSourceFile *ast.SourceFile, forceDtsEmit bool) []*ast.SourceFile {
439-
// !!! outFile not yet implemented, may be deprecated
440439
var sourceFiles []*ast.SourceFile
441440
if targetSourceFile != nil {
442441
sourceFiles = []*ast.SourceFile{targetSourceFile}
@@ -453,6 +452,7 @@ func isSourceFileNotJson(file *ast.SourceFile) bool {
453452
}
454453

455454
func getDeclarationDiagnostics(host EmitHost, file *ast.SourceFile) []*ast.Diagnostic {
455+
// TODO: use p.getSourceFilesToEmit cache
456456
fullFiles := core.Filter(getSourceFilesToEmit(host, file, false), isSourceFileNotJson)
457457
if !core.Some(fullFiles, func(f *ast.SourceFile) bool { return f == file }) {
458458
return []*ast.Diagnostic{}

0 commit comments

Comments
 (0)