DL_Enum* d = &gwi->enum_data;
const Enum_Def edef = new_enum_def(gwi->gwion->mp, d->base, d->t ? insert_symbol(gwi->gwion->st, d->t) : NULL,
loc_cpy(gwi->gwion->mp, gwi->loc));
- if(traverse_enum_def(gwi->gwion->env, edef) < 0) {
- if(!edef->t)
- free_enum_def(gwi->gwion->mp, edef);
- return NULL;
- }
+ const m_bool ret = traverse_enum_def(gwi->gwion->env, edef);
import_enum_end(gwi, &edef->values);
- const Type t =edef->t;
+ const Type t = ret > 0 ? edef->t : NULL;
free_enum_def(gwi->gwion->mp, edef);
return t;
}
NAME := ${NAME}
SRC = ${NAME}.c
OBJ = $(SRC:.c=.o)
-CFLAGS = -std=c99 $(../../gwion -k 2>&1 | grep CFLAGS | sed 's/CFLAGS: //') ${INC} ${CICFLAGS} -Wall -Wextra
+CFLAGS = -std=c99 $(../../gwion -k 2>&1 | grep CFLAGS | sed 's/CFLAGS: //') ${INC} ${CICFLAGS} -Wall -Wextra -g -Og
LDFLAGS = $(../../gwion -k 2>&1 | grep LDFLAGS)
# os specific
--- /dev/null
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "object.h"
+#include "instr.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+
+GWION_IMPORT(enum_test) {
+ GWI_BB(gwi_enum_ini(gwi, "int"))
+ GWI_BB(gwi_enum_add(gwi, "zero", 0))
+ GWI_OB(gwi_enum_end(gwi))
+ return GW_OK;
+}
--- /dev/null
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "object.h"
+#include "instr.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+
+GWION_IMPORT(enum_test) {
+ GWI_BB(gwi_enum_ini(gwi, NULL))
+ GWI_BB(gwi_enum_add(gwi, "adc", 0))
+ GWI_OB(gwi_enum_end(gwi))
+ return GW_OK;
+}