summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-12 17:25:23 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2018-01-12 18:05:13 +0100
commitdb417349545efeb8e54f2281192bd3480c78e1a4 (patch)
tree198ef6a31e99bae4230b0c2fc6d6198a6923be4e
parent4dfde2cd245e3d8ffcb426232fa8245d5b0b88fc (diff)
eolian: store typedecl/class in type
-rw-r--r--src/lib/eolian/database_validate.c14
-rw-r--r--src/lib/eolian/eolian_database.h5
2 files changed, 12 insertions, 7 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 9ac74dba76..b6e40b690a 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -225,7 +225,6 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
225 } 225 }
226 return _validate(&tp->base); 226 return _validate(&tp->base);
227 } 227 }
228 Eolian_Typedecl *tpp;
229 /* builtins */ 228 /* builtins */
230 int id = eo_lexer_keyword_str_to_id(tp->full_name); 229 int id = eo_lexer_keyword_str_to_id(tp->full_name);
231 if (id) 230 if (id)
@@ -253,21 +252,22 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
253 return _validate(&tp->base); 252 return _validate(&tp->base);
254 } 253 }
255 /* user defined */ 254 /* user defined */
256 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(src, tp); 255 tp->tdecl = (Eolian_Typedecl *)eolian_type_typedecl_get(src, tp);
257 if (!tpp) 256 if (!tp->tdecl)
258 { 257 {
259 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name); 258 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
260 return _obj_error(&tp->base, buf); 259 return _obj_error(&tp->base, buf);
261 } 260 }
262 if (!_validate_typedecl(src, tpp)) 261 if (!_validate_typedecl(src, tp->tdecl))
263 return EINA_FALSE; 262 return EINA_FALSE;
264 if (tpp->freefunc && !tp->freefunc) 263 if (tp->tdecl->freefunc && !tp->freefunc)
265 tp->freefunc = eina_stringshare_ref(tpp->freefunc); 264 tp->freefunc = eina_stringshare_ref(tp->tdecl->freefunc);
266 return _validate(&tp->base); 265 return _validate(&tp->base);
267 } 266 }
268 case EOLIAN_TYPE_CLASS: 267 case EOLIAN_TYPE_CLASS:
269 { 268 {
270 if (!eolian_type_class_get(src, tp)) 269 tp->klass = (Eolian_Class *)eolian_type_class_get(src, tp);
270 if (!tp->klass)
271 { 271 {
272 snprintf(buf, sizeof(buf), "undefined class %s " 272 snprintf(buf, sizeof(buf), "undefined class %s "
273 "(likely wrong namespacing)", tp->full_name); 273 "(likely wrong namespacing)", tp->full_name);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index f68093df3b..00a3967183 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -196,6 +196,11 @@ struct _Eolian_Type
196 Eina_Stringshare *full_name; 196 Eina_Stringshare *full_name;
197 Eina_List *namespaces; 197 Eina_List *namespaces;
198 Eina_Stringshare *freefunc; 198 Eina_Stringshare *freefunc;
199 union
200 {
201 Eolian_Class *klass;
202 Eolian_Typedecl *tdecl;
203 };
199 Eina_Bool is_const :1; 204 Eina_Bool is_const :1;
200 Eina_Bool is_ptr :1; 205 Eina_Bool is_ptr :1;
201 Eina_Bool owned :1; 206 Eina_Bool owned :1;