-
Notifications
You must be signed in to change notification settings - Fork 783
Unify locks used on checkers between exclusive pool borrows and EmitResolver scopes #2080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -857,12 +857,15 @@ type Checker struct { | |
| activeTypeMappersCaches []map[string]*Type | ||
| ambientModulesOnce sync.Once | ||
| ambientModules []*ast.Symbol | ||
|
|
||
| lock *sync.Mutex | ||
| } | ||
|
|
||
| func NewChecker(program Program) *Checker { | ||
| func NewChecker(program Program) (*Checker, *sync.Mutex) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels weird to me; can we just have a method that returns
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is this intended to force callers to reckon with the locking?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Precisely that - it forces the callers to reckon with the lock in some way or intentionally discard it. (And basically no caller other than tests should discard it) |
||
| program.BindSourceFiles() | ||
|
|
||
| c := &Checker{} | ||
| c.lock = &sync.Mutex{} | ||
| c.id = nextCheckerID.Add(1) | ||
| c.program = program | ||
| c.compilerOptions = program.Options() | ||
|
|
@@ -1071,7 +1074,7 @@ func NewChecker(program Program) *Checker { | |
| c.initializeClosures() | ||
| c.initializeIterationResolvers() | ||
| c.initializeChecker() | ||
| return c | ||
| return c, c.lock | ||
| } | ||
|
|
||
| func createFileIndexMap(files []*ast.SourceFile) map[*ast.SourceFile]int { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.