Skip to content

[AST] Introduce ArgumentList #38836

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

Merged
merged 14 commits into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions include/swift/AST/ASTWalker.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace swift {

class ArgumentList;
class Decl;
class Expr;
class ClosureExpr;
Expand Down Expand Up @@ -244,6 +245,30 @@ class ASTWalker {
/// traversal is terminated and returns failure.
virtual bool walkToParameterListPost(ParameterList *PL) { return true; }

/// This method is called when first visiting an argument list before walking
/// into its arguments.
///
/// \param ArgList The argument list to walk.
///
/// \returns a pair indicating whether to visit the arguments, along with
/// the argument list that should replace this argument list in the tree. If
/// the latter is null, the traversal will be terminated.
///
/// The default implementation returns \c {true, ArgList}.
virtual std::pair<bool, ArgumentList *>
walkToArgumentListPre(ArgumentList *ArgList) {
return {true, ArgList};
}

/// This method is called after visiting the arguments in an argument list.
/// If it returns null, the walk is terminated; otherwise, the
/// returned argument list is spliced in where the old argument list
/// previously appeared.
///
/// The default implementation always returns the argument list.
virtual ArgumentList *walkToArgumentListPost(ArgumentList *ArgList) {
return ArgList;
}

protected:
ASTWalker() = default;
Expand Down
Loading