cpp
[m6w6/ext-psi] / src / types / decl_enum_item.c
index e39f0b071837e03843b9a04c320ba69074b8c109..c403d97113626e134d8ed0f98e74b992e7ef5a17 100644 (file)
@@ -47,7 +47,7 @@ void psi_decl_enum_item_free(struct psi_decl_enum_item **i_ptr)
                if (i->num) {
                        if (i->num == &i->inc) {
                                switch (i->inc.op) {
-                               case 0:
+                               case PSI_T_NUMBER:
                                        psi_number_free(&i->inc.data.n);
                                        break;
                                case PSI_T_PLUS:
@@ -86,12 +86,13 @@ bool psi_decl_enum_item_validate(struct psi_data *data,
                        item->inc.data.b.lhs = psi_num_exp_init_unary(PSI_T_LPAREN,
                                        psi_num_exp_copy(item->prev->num));
                        item->inc.data.b.rhs = psi_num_exp_init_num(
-                                                       psi_number_init(PSI_T_INT64, &one));
+                                                       psi_number_init(PSI_T_INT64, &one, 0));
                        item->num = &item->inc;
                } else {
                        int64_t nil = 0;
 
-                       item->inc.data.n = psi_number_init(PSI_T_INT64, &nil);
+                       item->inc.op = PSI_T_NUMBER;
+                       item->inc.data.n = psi_number_init(PSI_T_INT64, &nil, 0);
                        item->num = &item->inc;
                }
        }
@@ -100,7 +101,7 @@ bool psi_decl_enum_item_validate(struct psi_data *data,
                return false;
        }
 
-       item->val = psi_long_num_exp(item->num, NULL);
+       item->val = psi_long_num_exp(item->num, NULL, NULL);
 
        return true;
 }