projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
interned strings
[m6w6/ext-psi]
/
src
/
types
/
const.c
diff --git
a/src/types/const.c
b/src/types/const.c
index a40a0e2b0eb35a86e07b5fafae391c299acbb7aa..1a06e431eb3358492362b6cba62ab82449b7d9cb 100644
(file)
--- a/
src/types/const.c
+++ b/
src/types/const.c
@@
-26,12
+26,17
@@
#include "php_psi_stdinc.h"
#include "data.h"
#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, zend_string
*name,
struct psi_impl_def_val *val)
{
struct psi_const *c = calloc(1, sizeof(*c));
struct psi_impl_def_val *val)
{
struct psi_const *c = calloc(1, sizeof(*c));
+
+ if (name->val[0] == '\\') {
+ c->name = zend_string_init(&name->val[1], name->len-1, 1);
+ } else {
+ c->name = zend_string_copy(name);
+ }
c->type = type;
c->type = type;
- c->name = strdup(name);
c->val = val;
return c;
}
c->val = val;
return c;
}
@@
-42,11
+47,9
@@
void psi_const_free(struct psi_const **constant_ptr)
struct psi_const *constant = *constant_ptr;
*constant_ptr = NULL;
struct psi_const *constant = *constant_ptr;
*constant_ptr = NULL;
- if (constant->token) {
- free(constant->token);
- }
- psi_const_type_free(&constant->type);
- free(constant->name);
+ psi_token_free(&constant->token);
+ psi_impl_type_free(&constant->type);
+ zend_string_release(constant->name);
psi_impl_def_val_free(&constant->val);
free(constant);
}
psi_impl_def_val_free(&constant->val);
free(constant);
}
@@
-55,14
+58,17
@@
void psi_const_free(struct psi_const **constant_ptr)
void psi_const_dump(int fd, struct psi_const *cnst)
{
dprintf(fd, "const ");
void psi_const_dump(int fd, struct psi_const *cnst)
{
dprintf(fd, "const ");
- psi_
const
_type_dump(fd, cnst->type);
- dprintf(fd, " %s = ", cnst->name);
+ psi_
impl
_type_dump(fd, cnst->type);
+ dprintf(fd, " %s = ", cnst->name
->val
);
psi_impl_def_val_dump(fd, cnst->val);
dprintf(fd, ";");
}
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;
}
return true;
}