X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Ftypes%2Fconst.c;h=18e9da61d1e379a71a7bd6d87cab6c9a78d8b226;hb=a88d91ed2154bdb6d2198e44c6f3868a5b398287;hp=a40a0e2b0eb35a86e07b5fafae391c299acbb7aa;hpb=9bcb1df0786a8193d65949c857baaba2f4296e84;p=m6w6%2Fext-psi diff --git a/src/types/const.c b/src/types/const.c index a40a0e2..18e9da6 100644 --- a/src/types/const.c +++ b/src/types/const.c @@ -26,12 +26,12 @@ #include "php_psi_stdinc.h" #include "data.h" -struct psi_const *psi_const_init(struct psi_const_type *type, const char *name, +struct psi_const *psi_const_init(struct psi_impl_type *type, const char *name, struct psi_impl_def_val *val) { struct psi_const *c = calloc(1, sizeof(*c)); c->type = type; - c->name = strdup(name); + c->name = strdup(name[0] == '\\' ? &name[1] : name); c->val = val; return c; } @@ -45,7 +45,7 @@ void psi_const_free(struct psi_const **constant_ptr) if (constant->token) { free(constant->token); } - psi_const_type_free(&constant->type); + psi_impl_type_free(&constant->type); free(constant->name); psi_impl_def_val_free(&constant->val); free(constant); @@ -55,14 +55,17 @@ void psi_const_free(struct psi_const **constant_ptr) void psi_const_dump(int fd, struct psi_const *cnst) { dprintf(fd, "const "); - psi_const_type_dump(fd, cnst->type); + psi_impl_type_dump(fd, cnst->type); dprintf(fd, " %s = ", cnst->name); psi_impl_def_val_dump(fd, cnst->val); dprintf(fd, ";"); } -bool psi_const_validate(struct psi_data *data, struct psi_const *c) +bool psi_const_validate(struct psi_data *data, struct psi_const *c, + struct psi_validate_scope *scope) { - /* FIXME */ + if (!psi_impl_def_val_validate(data, c->val, c->type, scope)) { + return false; + } return true; }