forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate dispatch function separately from original function
Instead of adding the logic to dispatch to the correct function to the main singledispatch function itself, generate 2 separate functions: one that compiles the logic of the undecorated function normally, and a separate dispatch function that checks the first argument's type and dispatches either to one of the registered implementations or the fallback. That makes it easier to generate code when the main singledispatch function is a generator or some other kind of special function, as the code generation can generate the main singledispatch function the same way it would otherwise. Because we're no longer changing how that main singledispatch function is generated based on whether it's a singledispatch function, we don't need to store whether the current function is a singledispatch function in FuncInfo.
- Loading branch information
1 parent
099b047
commit 59555e4
Showing
2 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters