Skip to content

Commit dc60996

Browse files
authored
Merge pull request #38836 from hamishknight/toil-and-tuple
2 parents c7a60a8 + 3e28bbb commit dc60996

File tree

96 files changed

+3834
-4960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3834
-4960
lines changed

include/swift/AST/ASTWalker.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace swift {
2020

21+
class ArgumentList;
2122
class Decl;
2223
class Expr;
2324
class ClosureExpr;
@@ -244,6 +245,30 @@ class ASTWalker {
244245
/// traversal is terminated and returns failure.
245246
virtual bool walkToParameterListPost(ParameterList *PL) { return true; }
246247

248+
/// This method is called when first visiting an argument list before walking
249+
/// into its arguments.
250+
///
251+
/// \param ArgList The argument list to walk.
252+
///
253+
/// \returns a pair indicating whether to visit the arguments, along with
254+
/// the argument list that should replace this argument list in the tree. If
255+
/// the latter is null, the traversal will be terminated.
256+
///
257+
/// The default implementation returns \c {true, ArgList}.
258+
virtual std::pair<bool, ArgumentList *>
259+
walkToArgumentListPre(ArgumentList *ArgList) {
260+
return {true, ArgList};
261+
}
262+
263+
/// This method is called after visiting the arguments in an argument list.
264+
/// If it returns null, the walk is terminated; otherwise, the
265+
/// returned argument list is spliced in where the old argument list
266+
/// previously appeared.
267+
///
268+
/// The default implementation always returns the argument list.
269+
virtual ArgumentList *walkToArgumentListPost(ArgumentList *ArgList) {
270+
return ArgList;
271+
}
247272

248273
protected:
249274
ASTWalker() = default;

0 commit comments

Comments
 (0)