summaryrefslogtreecommitdiff
path: root/src/lib/eolian/database_type_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eolian/database_type_api.c')
-rw-r--r--src/lib/eolian/database_type_api.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c
index 5edaed9..d733a93 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -266,7 +266,7 @@ eolian_type_next_type_get(const Eolian_Type *tp)
266} 266}
267 267
268EAPI const Eolian_Typedecl * 268EAPI const Eolian_Typedecl *
269eolian_type_typedecl_get(const Eolian_Type *tp) 269eolian_type_typedecl_get(const Eolian_Unit *unit, const Eolian_Type *tp)
270{ 270{
271 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); 271 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
272 if (eolian_type_type_get(tp) != EOLIAN_TYPE_REGULAR) 272 if (eolian_type_type_get(tp) != EOLIAN_TYPE_REGULAR)
@@ -277,7 +277,7 @@ eolian_type_typedecl_get(const Eolian_Type *tp)
277 int kw = eo_lexer_keyword_str_to_id(tp->full_name); 277 int kw = eo_lexer_keyword_str_to_id(tp->full_name);
278 if (!kw || kw < KW_byte || kw >= KW_true) 278 if (!kw || kw < KW_byte || kw >= KW_true)
279 { 279 {
280 Eolian_Declaration *decl = eina_hash_find(_decls, tp->full_name); 280 Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, tp->full_name);
281 if (decl && decl->type != EOLIAN_DECL_CLASS 281 if (decl && decl->type != EOLIAN_DECL_CLASS
282 && decl->type != EOLIAN_DECL_VAR) 282 && decl->type != EOLIAN_DECL_VAR)
283 return decl->data; 283 return decl->data;
@@ -293,22 +293,22 @@ eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
293} 293}
294 294
295EAPI const Eolian_Type * 295EAPI const Eolian_Type *
296eolian_type_aliased_base_get(const Eolian_Type *tp) 296eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp)
297{ 297{
298 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr) 298 if (!tp || tp->type != EOLIAN_TYPE_REGULAR || tp->is_ptr)
299 return tp; 299 return tp;
300 const Eolian_Typedecl *btp = eolian_type_typedecl_get(tp); 300 const Eolian_Typedecl *btp = eolian_type_typedecl_get(unit, tp);
301 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS)) 301 if (btp && (btp->type == EOLIAN_TYPEDECL_ALIAS))
302 return eolian_typedecl_aliased_base_get(btp); 302 return eolian_typedecl_aliased_base_get(unit, btp);
303 return tp; 303 return tp;
304} 304}
305 305
306EAPI const Eolian_Type * 306EAPI const Eolian_Type *
307eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp) 307eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp)
308{ 308{
309 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS) 309 if (!tp || tp->type != EOLIAN_TYPEDECL_ALIAS)
310 return NULL; 310 return NULL;
311 return eolian_type_aliased_base_get(tp->base_type); 311 return eolian_type_aliased_base_get(unit, tp->base_type);
312} 312}
313 313
314EAPI const Eolian_Class * 314EAPI const Eolian_Class *
@@ -349,13 +349,14 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
349} 349}
350 350
351EAPI Eina_Stringshare * 351EAPI Eina_Stringshare *
352eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype) 352eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp,
353 Eolian_C_Type_Type ctype)
353{ 354{
354 Eina_Stringshare *ret; 355 Eina_Stringshare *ret;
355 Eina_Strbuf *buf; 356 Eina_Strbuf *buf;
356 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); 357 EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
357 buf = eina_strbuf_new(); 358 buf = eina_strbuf_new();
358 database_type_to_str(tp, buf, NULL, ctype); 359 database_type_to_str(unit, tp, buf, NULL, ctype);
359 ret = eina_stringshare_add(eina_strbuf_string_get(buf)); 360 ret = eina_stringshare_add(eina_strbuf_string_get(buf));
360 eina_strbuf_free(buf); 361 eina_strbuf_free(buf);
361 return ret; 362 return ret;