eolian: put structs and typedefs right in the respective hashmaps without going through nodes

This commit is contained in:
Daniel Kolesa 2014-07-21 11:42:05 +01:00
parent 6f805a9998
commit 5d1cd61c92
4 changed files with 5 additions and 22 deletions

View File

@ -433,7 +433,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
return EINA_FALSE;
}
if (eot) goto nodeloop;
if (eot) goto done;
EINA_LIST_FOREACH(ls->nodes, k, nd) if (nd->type == NODE_CLASS)
{
@ -448,7 +448,6 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
return EINA_FALSE;
}
nodeloop:
EINA_LIST_FOREACH(ls->nodes, k, nd)
{
switch (nd->type)
@ -457,21 +456,12 @@ nodeloop:
if (!_db_fill_class(nd->def_class, filename))
goto error;
break;
case NODE_TYPEDEF:
if (!database_type_add(nd->def_typedef))
goto error;
nd->def_typedef = NULL;
break;
case NODE_STRUCT:
if (!database_struct_add(nd->def_struct))
goto error;
nd->def_struct = NULL;
break;
default:
break;
}
}
done:
eo_lexer_free(ls);
return EINA_TRUE;

View File

@ -607,11 +607,6 @@ eo_lexer_free(Eo_Lexer *ls)
case NODE_CLASS:
eo_definitions_class_def_free(nd->def_class);
break;
case NODE_TYPEDEF:
database_typedef_del(nd->def_typedef);
break;
case NODE_STRUCT:
database_type_del(nd->def_struct);
default:
break;
}

View File

@ -95,9 +95,7 @@ typedef struct _Eo_Token
enum Nodes
{
NODE_CLASS = 0,
NODE_TYPEDEF,
NODE_STRUCT
NODE_CLASS = 0
};
/* represents a node, aka a result of parsing - currently class, typedef

View File

@ -268,7 +268,7 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern)
}
}
check_match(ls, '}', '{', line, column);
if (name) append_node(ls, NODE_STRUCT, def);
if (name) database_struct_add(def);
return def;
}
@ -1060,7 +1060,7 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
case KW_type:
{
parse_typedef(ls);
append_node(ls, NODE_TYPEDEF, ls->tmp.typedef_def);
database_type_add(ls->tmp.typedef_def);
ls->tmp.typedef_def = NULL;
break;
}