From ce005b9a45cb3a764068ae7721567aff0b86f073 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 12 Oct 2019 17:41:48 +0200 Subject: [PATCH] :art: Improve import again --- src/lib/import.c | 8 ++++---- tests/import/class_template.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/import.c b/src/lib/import.c index 0b3fb10c..2eda223f 100644 --- a/src/lib/import.c +++ b/src/lib/import.c @@ -392,11 +392,11 @@ tl_xxx(close, '>', --) ANN Type_List str2tl(const Env env, const m_str s, const loc_t pos) { struct GetTl gtl = { .str=s, .sz = strlen(s) }; for(m_uint i = 0; i < gtl.sz; ++i) { - if(s[i] == '<' && !gtl.lvl) + if(s[i] == '<') CHECK_BO(tl_open(>l, ++i)) - if(s[i] == '~' && !gtl.lvl) + else if(s[i] == '~') CHECK_BO(tl_close(>l, ++i)) - if(s[i] == ',' && !gtl.lvl) + else if(s[i] == ',' && !gtl.lvl) return tlnext(env, s, i, pos); } return _str2tl(env, s, pos); @@ -408,7 +408,7 @@ ANN Type_Decl* str2decl(const Env env, const m_str s, m_uint *depth, const loc_t Type_Decl* td = new_type_decl(env->gwion->mp, id); const m_str tl_name = get_type_name(env, s, 1); if(tl_name) { - if(!(td->types = str2tl(env, type_name, pos)) || !type_decl_resolve(env, td)) { + if(!(td->types = str2tl(env, tl_name, pos)) || !type_decl_resolve(env, td)) { free_type_decl(env->gwion->mp, td); return NULL; } diff --git a/tests/import/class_template.c b/tests/import/class_template.c index fa6afa67..e532daa5 100644 --- a/tests/import/class_template.c +++ b/tests/import/class_template.c @@ -34,13 +34,13 @@ GWION_IMPORT(class_template) { GWI_OB((t_class_template = gwi_mk_type(gwi, "ClassTemplate", SZ_INT, "Object"))) GWI_BB(gwi_class_ini(gwi, t_class_template, class_template_ctor, NULL)) gwi_tmpl_end(gwi); - GWI_BB(gwi_item_ini(gwi, "A[]", "key")) + GWI_BB(gwi_item_ini(gwi, "A[]", "key")) GWI_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL))) GWI_BB(gwi_item_ini(gwi, "B[]", "value")) GWI_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL))) GWI_BB(gwi_class_end(gwi)) - GWI_BB(gwi_item_ini(gwi, "ClassTemplate<~Ptr<~int~>,int~>", "testObject")) + GWI_BB(gwi_item_ini(gwi, "ClassTemplate<~Ptr<~int~>,int[]~>", "testObject")) GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL)) return GW_OK; } -- 2.43.0