-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dart2wasm] Some refactoring around context and capture generation
This mainly refactors code that use the `Closures` type to make it a bit more clear what it does and how it does it, and make it more difficult to misuse. Changes: - Make `CaptureFinder`, `ContextCollector`, `Closures.findCapures`, `Closures.collectContexts`, `Closures.buildContexts` private. It doesn't make sense to use these types outside, and the `Closures` members need to be called together and in the right order. Make them private and call them in the constructor. Reduces API surface of `closures.dart` and makes it easier to use. - Document all public members of `Closures`. - Remove unused `ClosureRepresentation.exportSuffix`. - In `TearOffCodeGenerator`, inline the single-use function `generateTearOffGetter`. Makes it clear that the code is not reused elsewhere. - Make the type of `Types.nonNullableTypeType` more precise. Use it in `closures.dart` instead of having a separate copy of the same thing. - In a few places where we had function body entirely guarded with an `if`, add an early return. For example: ``` void f() { if (x) { ... lots of code ... } } ``` Becomes: ``` void f() { if (!x) return; ... lots of code ... } ``` Similarly do it in loop bodies. Change-Id: Ia2a74b89ae311b8f32b9f1a4e72c51d4ea3861e8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392942 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com>
- Loading branch information
Showing
5 changed files
with
159 additions
and
126 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
Oops, something went wrong.