Scripts for bootstrapping various programming languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
1.6 KiB

diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp
index 7c9367e4..bdd5e4a7 100644
--- a/src/hir_typeck/expr_check.cpp
+++ b/src/hir_typeck/expr_check.cpp
@@ -887,12 +887,16 @@ namespace {
else
{
// 1. Look up the encoded trait
- const auto& trait = (
- node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::Fn ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn")
- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnMut ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut")
- : node.m_trait_used == ::HIR::ExprNode_CallValue::TraitUsed::FnOnce ? m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once")
- : throw ""
- );
+ const ::HIR::SimplePath* trait_p;
+ switch(node.m_trait_used)
+ {
+ case ::HIR::ExprNode_CallValue::TraitUsed::Fn: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn"); break;
+ case ::HIR::ExprNode_CallValue::TraitUsed::FnMut: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_mut"); break;
+ case ::HIR::ExprNode_CallValue::TraitUsed::FnOnce: trait_p = &m_resolve.m_crate.get_lang_item_path(node.span(), "fn_once"); break;
+ default:
+ throw "";
+ }
+ const auto& trait = *trait_p;
::std::vector< ::HIR::TypeRef> tup_ents;
for(const auto& arg : node.m_args) {