@@ -278,6 +278,15 @@ ASTLowerTraitItem::visit (AST::Function &func)
278
278
function_params.push_back (hir_param);
279
279
}
280
280
281
+ if (func.has_self_param ())
282
+ {
283
+ // insert mappings for self
284
+ // TODO: Is this correct ? Looks fishy
285
+ mappings.insert_hir_self_param (&*self_param);
286
+ mappings.insert_location (self_param->get_mappings ().get_hirid (),
287
+ self_param->get_locus ());
288
+ }
289
+
281
290
HIR::TraitFunctionDecl decl (func.get_function_name (),
282
291
std::move (qualifiers),
283
292
std::move (generic_params),
@@ -301,14 +310,6 @@ ASTLowerTraitItem::visit (AST::Function &func)
301
310
= new HIR::TraitItemFunc (mapping, std::move (decl), std::move (block_expr),
302
311
func.get_outer_attrs (), func.get_locus ());
303
312
translated = trait_item;
304
- if (func.has_self_param ())
305
- {
306
- // insert mappings for self
307
- // TODO: Is this correct ? Looks fishy
308
- mappings.insert_hir_self_param (&*self_param);
309
- mappings.insert_location (self_param->get_mappings ().get_hirid (),
310
- self_param->get_locus ());
311
- }
312
313
313
314
// add the mappings for the function params at the end
314
315
for (auto ¶m : trait_item->get_decl ().get_function_params ())
0 commit comments