Skip to content
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
10 changes: 5 additions & 5 deletions cpp2rust/converter/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,7 @@ std::string Converter::ConvertMappedMethodCall(
std::string Converter::GetMappedAsString(clang::Expr *expr, clang::Expr **args,
unsigned num_args,
TempMaterializationCtx *ctx) {
auto *tgt_ir = Mapper::GetExprTgt(GetCalleeOrExpr(expr));
auto *tgt_ir = Mapper::GetExprRule(GetCalleeOrExpr(expr));
if (!tgt_ir)
return {};

Expand All @@ -3582,18 +3582,18 @@ std::string Converter::ConvertIRFragment(
if (auto *t = std::get_if<TextFragment>(&frag)) {
result += t->text;
} else if (auto *g = std::get_if<GenericFragment>(&frag)) {
result += Mapper::InstantiateTemplate(GetCalleeOrExpr(expr), g->name);
result += Mapper::InstantiateTemplate(GetCalleeOrExpr(expr), g->n);
} else if (auto *ph = std::get_if<PlaceholderFragment>(&frag)) {
auto arg_idx = std::stoi(ph->arg.substr(1)); // "a0" -> 0
assert(arg_idx < static_cast<int>(all_args.size()));
auto arg_idx = ph->n;
assert(arg_idx < all_args.size());
auto *arg = all_args[arg_idx];
bool is_receiver = HasReceiver(expr) && arg_idx == 0;

PlaceholderCtx ph_ctx{
.param_type = Mapper::GetParamType(GetCalleeOrExpr(expr), arg_idx),
.materialize_ctx = ctx,
.materialize_idx =
is_receiver ? -1 : (arg_idx - (HasReceiver(expr) ? 1 : 0)),
is_receiver ? -1 : ((int)arg_idx - HasReceiver(expr)),
.access = ph->access,
.is_receiver = is_receiver,
.is_cpp_ptr = arg->getType()->isPointerType(),
Expand Down
Loading
Loading