swift
b1669185 - [Playgrounds] NFC: Allow transform of a `BraceStmt` to know the brace's parent AST node

Commit
2 years ago
[Playgrounds] NFC: Allow transform of a `BraceStmt` to know the brace's parent AST node Instead of passing in a list of ad hoc parameters to `PlaygroundTransform::transformBraceStmt()` to convey context to the transform, it's cleaner and more extensible to pass in the parent `ASTNode` so the transform function can examine it directly. This lets the code that's inside the transform function emit the right kinds of playground log callbacks based on the transform options, letting us for example distinguish between function vs closure parameters. This is something that just passing in the parameters doesn't allow. This will also make it easier to extend logging to new kinds of computed results in the future, such as `for-each` loop variables. This also lets us get rid of the current `TopLevel` boolean, since the code can check if the parent is a `TopLevelCodeDecl`. This is a WIP pending more testing. This diff itself has no functional change, so it isn't clear that new unit tests are needed.
Author
Committer
Parents
Loading