Skip to content

Commit

Permalink
Add call and method call default visitors
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc
	(DefaultResolver::visit):
	New for AST::CallExpr and AST::MethodCallExpr.
	* resolve/rust-default-resolver.h
	(DefaultResolver::visit): Likewise.

Signed-off-by: Owen Avery <[email protected]>
  • Loading branch information
powerboat9 authored and P-E-P committed May 21, 2024
1 parent 9ff8ac9 commit 80e0560
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions gcc/rust/resolve/rust-default-resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,36 @@ void
DefaultResolver::visit (AST::ReturnExpr &expr)
{}

void
DefaultResolver::visit (AST::CallExpr &expr)
{
expr.get_function_expr ().accept_vis (*this);

for (auto &param : expr.get_params ())
param->accept_vis (*this);
}

void
DefaultResolver::visit (AST::MethodCallExpr &expr)
{
expr.get_receiver_expr ().accept_vis (*this);

if (expr.get_method_name ().has_generic_args ())
{
auto &args = expr.get_method_name ().get_generic_args ();
for (auto &arg : args.get_generic_args ())
arg.accept_vis (*this);
for (auto &arg : args.get_binding_args ())
if (!arg.is_error ())
arg.get_type ().accept_vis (*this);
for (auto &arg : args.get_lifetime_args ())
arg.accept_vis (*this);
}

for (auto &param : expr.get_params ())
param->accept_vis (*this);
}

void
DefaultResolver::visit (AST::LoopExpr &expr)
{}
Expand Down
2 changes: 2 additions & 0 deletions gcc/rust/resolve/rust-default-resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class DefaultResolver : public AST::DefaultASTVisitor
void visit (AST::RangeFromToInclExpr &);
void visit (AST::RangeToInclExpr &);
void visit (AST::ReturnExpr &);
void visit (AST::CallExpr &);
void visit (AST::MethodCallExpr &);
void visit (AST::LoopExpr &);
void visit (AST::WhileLoopExpr &);
void visit (AST::WhileLetLoopExpr &);
Expand Down

0 comments on commit 80e0560

Please sign in to comment.