auto hir_id = hid.value ();
- HIR::Expr *expr = mappings.lookup_hir_expr (hir_id);
-
if (auto impl_item = mappings.lookup_hir_implitem (hir_id))
{
switch (impl_item->first->get_impl_item_type ())
cpath.get ().c_str ());
break;
}
- else if (expr != nullptr)
+ else if (auto expr = mappings.lookup_hir_expr (hir_id))
{
- rust_assert (expr->get_expression_type ()
+ rust_assert (expr.value ()->get_expression_type ()
== HIR::Expr::ExprType::Closure);
// Use HIR ID as disambiguator.
v0path = v0_closure (v0path, hir_id);
insert_location (id, expr->get_locus ());
}
-HIR::Expr *
+tl::optional<HIR::Expr *>
Mappings::lookup_hir_expr (HirId id)
{
auto it = hirExprMappings.find (id);
if (it == hirExprMappings.end ())
- return nullptr;
+ return tl::nullopt;
return it->second;
}
lookup_hir_implitem (HirId id);
void insert_hir_expr (HIR::Expr *expr);
- HIR::Expr *lookup_hir_expr (HirId id);
+ tl::optional<HIR::Expr *> lookup_hir_expr (HirId id);
void insert_hir_path_expr_seg (HIR::PathExprSegment *expr);
HIR::PathExprSegment *lookup_hir_path_expr_seg (HirId id);