Eina_Iterator *itr = eolian_type_aliases_get_by_file(eo_filename);
EINA_ITERATOR_FOREACH(itr, tp)
{
+ /* avoid for the time being */
+ if (eolian_type_type_get(eolian_type_base_type_get(tp)) == EOLIAN_TYPE_ENUM)
+ continue;
Eina_Strbuf *type_buf = _type_generate(tp);
if (type_buf)
{
if (tp->name) eina_stringshare_del(tp->name);
if (tp->full_name) eina_stringshare_del(tp->full_name);
if (tp->fields) eina_hash_free(tp->fields);
- if (tp->field_names) eina_list_free(tp->field_names);
+ if (tp->field_names) EINA_LIST_FREE(tp->field_names, sp)
+ eina_stringshare_del(sp);
if (tp->namespaces) EINA_LIST_FREE(tp->namespaces, sp)
- eina_stringshare_del(sp);
+ eina_stringshare_del(sp);
if (tp->comment) eina_stringshare_del(tp->comment);
if (tp->legacy) eina_stringshare_del(tp->legacy);
free(tp);
if (l != eina_list_last(tp->field_names))
eina_strbuf_append(buf, ", ");
}
- eina_strbuf_append(buf, "}");
+ eina_strbuf_append(buf, " }");
if (name)
{
eina_strbuf_append_char(buf, ' ');
if (l != eina_list_last(tp->field_names))
printf(", ");
}
- printf("}");
+ printf(" }");
}
if (tp->is_own)
putchar(')');
expr->value.s = eina_stringshare_add(eina_strbuf_string_get
(buf));
pop_strbuf(ls);
- eo_lexer_get(ls);
break;
}
}
int prec = get_binop_prec(op);
if ((op < 0) || (prec < 0) || (prec < min_prec))
break;
+ eo_lexer_get(ls);
rhs = parse_expr_bin(ls, prec + 1);
pop_expr(ls);
pop_expr(ls);
eina_hash_add(def->fields, fname, fdef);
def->field_names = eina_list_append(def->field_names, fname);
pop_type(ls);
- eina_stringshare_del(fname);
check_next(ls, ';');
if (ls->t.token == TOK_COMMENT)
{
}
eina_hash_add(def->fields, fname, fdef);
def->field_names = eina_list_append(def->field_names, fname);
- eina_stringshare_del(fname);
Eina_Bool want_next = (ls->t.token == ',');
if (want_next)
eo_lexer_get(ls);
--- /dev/null
+// regular named enum
+enum Foo {
+ bar,
+ baz = 5 * 3
+}
+
+enum Bar {
+ foo = enum Foo.baz
+}
+
+type Baz: enum _Baz {
+ flag1 = 1 << 0,
+ flag2 = 1 << 1,
+ flag3 = 1 << 2
+};
+
+const foo: int = Baz.flag1;
+
+class Enum {
+ methods {
+ foo {
+ params {
+ int idx;
+ }
+ return: own(char*);
+ }
+ }
+}
} Bar;
struct Named {
- const char *something;
int field;
+ const char *something;
};
struct Another {
}
END_TEST
+START_TEST(eolian_enum)
+{
+ const Eolian_Type *type = NULL;
+ const Eolian_Class *class;
+
+ eolian_init();
+
+ /* Parsing */
+ fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/enum.eo"));
+
+ /* Check that the class Dummy is still readable */
+ fail_if(!(class = eolian_class_get_by_name("Enum")));
+ fail_if(!eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD));
+
+ eolian_shutdown();
+}
+END_TEST
+
START_TEST(eolian_class_funcs)
{
const Eolian_Function *fid = NULL;
tcase_add_test(tc, eolian_struct);
tcase_add_test(tc, eolian_extern);
tcase_add_test(tc, eolian_var);
+ tcase_add_test(tc, eolian_enum);
tcase_add_test(tc, eolian_class_funcs);
}