aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-15 16:14:02 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-03-15 16:34:39 +0100
commitdf83efcef96064aa44b08278a6df653614ad7981 (patch)
tree8ceffe31449f93a16bfc19c6974a67bb06bd55c6
parenteolian: manage exprs through node system (diff)
downloadefl-df83efcef96064aa44b08278a6df653614ad7981.tar.gz
eolian: remove the temps system
-rw-r--r--src/lib/eolian/eo_lexer.c10
-rw-r--r--src/lib/eolian/eo_lexer.h24
2 files changed, 11 insertions, 23 deletions
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index 3600ad1000..9db35a238f 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -1109,15 +1109,6 @@ eo_lexer_node_release(Eo_Lexer *ls, Eolian_Object *obj)
}
static void
-_temps_free(Eo_Lexer_Temps *tmp)
-{
- Eolian_Typedecl *tpd;
-
- EINA_LIST_FREE(tmp->type_decls, tpd)
- database_typedecl_del(tpd);
-}
-
-static void
_free_tok(Eo_Token *tok)
{
if (tok->token < START_CUSTOM || tok->token == TOK_NUMBER ||
@@ -1165,7 +1156,6 @@ eo_lexer_free(Eo_Lexer *ls)
_free_tok(&ls->t);
eo_lexer_context_clear(ls);
- _temps_free(&ls->tmp);
Eo_Lexer_Dtor *dtor;
EINA_LIST_FREE(ls->dtors, dtor)
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index edef8fc5c7..4381c2e517 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -119,13 +119,6 @@ typedef struct _Lexer_Ctx
Eo_Token token;
} Lexer_Ctx;
-typedef struct _Eo_Lexer_Temps
-{
- Eolian_Class *kls;
- Eina_List *type_decls;
- Eina_List *expr_defs;
-} Eo_Lexer_Temps;
-
typedef struct _Eo_Lexer_Dtor
{
Eina_Free_Cb free_cb;
@@ -178,14 +171,19 @@ typedef struct _Eo_Lexer
/* saved context info */
Eina_List *saved_ctxs;
- /* represents the temporaries, every object that is allocated by the
- * parser is temporarily put here so the resources can be reclaimed in
- * case of error - and it's nulled when it's written into a more permanent
- * position (e.g. as part of another struct, or into nodes */
- Eo_Lexer_Temps tmp;
-
Eolian_Class *klass;
+ /* a dtor list; dtors can be pushed and popped during
+ * parser execution to simulate scoped resource management
+ *
+ * unpopped dtors (e.g. on error) are run when the state is freed
+ */
Eina_List *dtors;
+ /* a node hash; eolian objects can be allocated through this and
+ * they are stored here (with 1 reference) until they're released
+ * into the environment (they also get deref'd)
+ *
+ * if the release never happens, everything is just freed when the state is
+ */
Eina_Hash *nodes;
/* whether we allow lexing expression related tokens */