-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Split deferred node traversal out from check.cpp #4559
Conversation
Context& context, Parse::DeferredDefinitionIndex index, | ||
Parse::FunctionDefinitionStartId node_id) -> void { | ||
worklist_.push_back(CheckSkippedDefinition{ | ||
index, HandleFunctionDefinitionSuspend(context, node_id)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call to HandleFunctionDefinitionSuspend
is really breaking the abstraction that these two factored out classes are trying to provide -- this isn't a reusable traversal because it also has this weird side-effect of calling a Handle
function.
Please can you add a TODO
to move this call out of the worklist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// When we reach the start of a deferred definition scope, add a task to the | ||
// worklist to check future skipped definitions in the new context. | ||
if (IsStartOfDeferredDefinitionScope(parse_kind)) { | ||
worklist_.PushEnterDeferredDefinitionScope(context_); | ||
} | ||
|
||
// When we reach the end of a deferred definition scope, add a task to the | ||
// worklist to leave the scope. If this is not a nested scope, start | ||
// checking the deferred definitions now. | ||
if (IsEndOfDeferredDefinitionScope(parse_kind)) { | ||
chunks_.back().checking_deferred_definitions = | ||
worklist_.SuspendFinishedScopeAndPush(context_); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These calls make me sad for the same reason as the one in the worklist. Can you add a TODO for these also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I'm looking at adding more significant logic to checking, particularly for interop. But check.cpp is getting large, and I think just adding more logic will make it harder to reason about, so I'm looking at splitting it up. This moves out NodeIdTraversal and DeferredDefinitionWorklist because they're already independent from the other code, and are reasonably sized to have their own files.
I'm looking at adding more significant logic to checking, particularly for interop. But check.cpp is getting large, and I think just adding more logic will make it harder to reason about, so I'm looking at splitting it up. This moves out NodeIdTraversal and DeferredDefinitionWorklist because they're already independent from the other code, and are reasonably sized to have their own files.