eolian: perform correct unit lookups in public API
This finally enables looking up things from the current unit rather than from a backing storage in the Eolian state. This also means that the benefits of having a unit system will finally be visible.
This commit is contained in:
parent
39820fb5f5
commit
a11e70ab3c
|
@ -36,7 +36,7 @@ eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(class_name);
|
||||
Eolian_Class *cl = eina_hash_find(unit->state->unit.classes, shr);
|
||||
Eolian_Class *cl = eina_hash_find(unit->classes, shr);
|
||||
eina_stringshare_del(shr);
|
||||
return cl;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ eolian_class_type_get(const Eolian_Class *cl)
|
|||
EAPI Eina_Iterator *
|
||||
eolian_all_classes_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.classes) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL);
|
||||
}
|
||||
|
||||
EAPI const Eolian_Documentation *
|
||||
|
|
|
@ -278,7 +278,7 @@ Eolian_Typedecl *database_type_decl_find(const Eolian_Unit *unit, const Eolian_T
|
|||
int kw = eo_lexer_keyword_str_to_id(tp->full_name);
|
||||
if (!kw || kw < KW_byte || kw >= KW_true)
|
||||
{
|
||||
Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, tp->full_name);
|
||||
Eolian_Declaration *decl = eina_hash_find(unit->decls, tp->full_name);
|
||||
if (decl && decl->type != EOLIAN_DECL_CLASS
|
||||
&& decl->type != EOLIAN_DECL_VAR)
|
||||
return decl->data;
|
||||
|
|
|
@ -11,7 +11,7 @@ eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.aliases, shr);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->aliases, shr);
|
||||
eina_stringshare_del(shr);
|
||||
if (!tp) return NULL;
|
||||
return tp;
|
||||
|
@ -22,7 +22,7 @@ eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.structs, shr);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->structs, shr);
|
||||
eina_stringshare_del(shr);
|
||||
if (!tp) return NULL;
|
||||
return tp;
|
||||
|
@ -33,7 +33,7 @@ eolian_typedecl_enum_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->state->unit.enums, shr);
|
||||
Eolian_Typedecl *tp = eina_hash_find(unit->enums, shr);
|
||||
eina_stringshare_del(shr);
|
||||
if (!tp) return NULL;
|
||||
return tp;
|
||||
|
@ -75,19 +75,19 @@ eolian_typedecl_enums_get_by_file(const Eolian_Unit *unit, const char *fname)
|
|||
EAPI Eina_Iterator *
|
||||
eolian_typedecl_all_aliases_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.aliases) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->aliases) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_typedecl_all_structs_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.structs) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->structs) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_typedecl_all_enums_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.enums) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->enums) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eolian_Type_Type
|
||||
|
|
|
@ -10,7 +10,7 @@ eolian_variable_global_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
Eolian_Variable *v = eina_hash_find(unit->state->unit.globals, shr);
|
||||
Eolian_Variable *v = eina_hash_find(unit->globals, shr);
|
||||
eina_stringshare_del(shr);
|
||||
return v;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ eolian_variable_constant_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
Eolian_Variable *v = eina_hash_find(unit->state->unit.constants, shr);
|
||||
Eolian_Variable *v = eina_hash_find(unit->constants, shr);
|
||||
eina_stringshare_del(shr);
|
||||
return v;
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ eolian_variable_constants_get_by_file(const Eolian_Unit *unit,
|
|||
EAPI Eina_Iterator *
|
||||
eolian_variable_all_constants_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.constants) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->constants) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_variable_all_globals_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.globals) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->globals) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eolian_Variable_Type
|
||||
|
|
|
@ -38,7 +38,7 @@ eolian_declaration_get_by_name(const Eolian_Unit *unit, const char *name)
|
|||
{
|
||||
if (!unit) return NULL;
|
||||
Eina_Stringshare *shr = eina_stringshare_add(name);
|
||||
const Eolian_Declaration *decl = eina_hash_find(unit->state->unit.decls, shr);
|
||||
const Eolian_Declaration *decl = eina_hash_find(unit->decls, shr);
|
||||
eina_stringshare_del(shr);
|
||||
return decl;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ eolian_declarations_get_by_file(const Eolian *state, const char *fname)
|
|||
EAPI Eina_Iterator *
|
||||
eolian_all_declarations_get(const Eolian_Unit *unit)
|
||||
{
|
||||
return (unit ? eina_hash_iterator_data_new(unit->state->unit.decls) : NULL);
|
||||
return (unit ? eina_hash_iterator_data_new(unit->decls) : NULL);
|
||||
}
|
||||
|
||||
EAPI Eolian_Declaration_Type
|
||||
|
|
Loading…
Reference in New Issue