Skip to content

Commit d23400f

Browse files
authored
fix target_f_name computing (#1543)
1 parent 1e74b8f commit d23400f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

compiler/code-gen/files/tl2cpp/tl-combinator.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ void CombinatorStore::gen_arg_processing(CodeGenerator &W, const std::unique_ptr
104104
W << "auto _cur_arg = "
105105
<< fmt_format("tl_arr_get(tl_object, {}, {}, {}L)", tl2cpp::register_tl_const_str(arg->name), arg->idx, tl2cpp::hash_tl_const_str(arg->name))
106106
<< ";" << NL;
107-
W << "string target_f_name = "
108-
<< fmt_format("tl_arr_get(_cur_arg, {}, 0, {}L).as_string()", tl2cpp::register_tl_const_str("_"), tl2cpp::hash_tl_const_str("_"))
107+
W << "mixed target_f_name_mixed = "
108+
<< fmt_format("tl_arr_get(_cur_arg, {}, 0, {}L)", tl2cpp::register_tl_const_str("_"), tl2cpp::hash_tl_const_str("_"))
109109
<< ";" << NL;
110+
W << "if (!target_f_name_mixed.is_string()) " << BEGIN
111+
<< R"(CurrentTlQuery::get().raise_storing_error("Field \"_\" of \")" << arg->name << R"(\" array is not string");)" << NL
112+
<< "return {};" << NL
113+
<< END << NL;
114+
W << "string target_f_name = target_f_name_mixed.as_string();" << NL;
110115
W << fmt_format("if (!{}tl_storers_ht.has_key(target_f_name)) ", k2_tl_storers_prefix) << BEGIN
111116
<< "CurrentTlQuery::get().raise_storing_error(\"Function %s not found in tl-scheme\", target_f_name.c_str());" << NL
112117
<< "return {};" << NL

0 commit comments

Comments
 (0)