projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
add travis support
[m6w6/ext-psi]
/
src
/
parser.h
diff --git
a/src/parser.h
b/src/parser.h
index 0041155ce8827fac03035b92c5b18189dbf631e3..105e974a32efd407f777c734ca39d6e4711e6d1c 100644
(file)
--- a/
src/parser.h
+++ b/
src/parser.h
@@
-60,18
+60,19
@@
typedef union impl_val {
zend_fcall *cb;
} zend;
void *ptr;
zend_fcall *cb;
} zend;
void *ptr;
- uint8_t _dbg[sizeof(void *)];
} impl_val;
typedef struct decl_type {
PSI_Token *token;
char *name;
token_t type;
} impl_val;
typedef struct decl_type {
PSI_Token *token;
char *name;
token_t type;
- struct decl_type *real;
- struct decl_struct *strct;
- struct decl_union *unn;
- struct decl_enum *enm;
- struct decl *func;
+ union {
+ struct decl_arg *def;
+ struct decl_struct *strct;
+ struct decl_union *unn;
+ struct decl_enum *enm;
+ struct decl *func;
+ } real;
} decl_type;
static inline decl_type *init_decl_type(token_t type, const char *name) {
} decl_type;
static inline decl_type *init_decl_type(token_t type, const char *name) {
@@
-81,11
+82,17
@@
static inline decl_type *init_decl_type(token_t type, const char *name) {
return t;
}
return t;
}
-static inline decl_type *real_decl_type(decl_type *type) {
- while (type->real) {
- type = type->real;
+static inline int weak_decl_type(decl_type *type) {
+ switch (type->type) {
+ case PSI_T_CHAR:
+ case PSI_T_SHORT:
+ case PSI_T_INT:
+ case PSI_T_LONG:
+ case PSI_T_NAME:
+ return type->type;
+ default:
+ return 0;
}
}
- return type;
}
static inline void free_decl(struct decl *decl);
}
static inline void free_decl(struct decl *decl);
@@
-94,7
+101,7
@@
static inline void free_decl_type(decl_type *type) {
free(type->token);
}
if (type->type == PSI_T_FUNCTION) {
free(type->token);
}
if (type->type == PSI_T_FUNCTION) {
- free_decl(type->func);
+ free_decl(type->
real.
func);
}
free(type->name);
free(type);
}
free(type->name);
free(type);
@@
-157,9
+164,9
@@
typedef struct decl_arg {
decl_type *type;
decl_var *var;
decl_struct_layout *layout;
decl_type *type;
decl_var *var;
decl_struct_layout *layout;
- struct let_stmt *let; /* FIXME: decls must not point to impls !!! */
impl_val val;
void *ptr;
impl_val val;
void *ptr;
+ void *let;
void *mem;
} decl_arg;
void *mem;
} decl_arg;
@@
-170,6
+177,7
@@
static inline decl_arg *init_decl_arg(decl_type *type, decl_var *var) {
arg->var = var;
var->arg = arg;
arg->ptr = &arg->val;
arg->var = var;
var->arg = arg;
arg->ptr = &arg->val;
+ arg->let = arg->ptr;
return arg;
}
return arg;
}
@@
-185,6
+193,13
@@
static inline void free_decl_arg(decl_arg *arg) {
free(arg);
}
free(arg);
}
+static inline decl_type *real_decl_type(decl_type *type) {
+ while (weak_decl_type(type)) {
+ type = type->real.def->type;
+ }
+ return type;
+}
+
typedef struct decl_typedefs {
size_t count;
decl_arg **list;
typedef struct decl_typedefs {
size_t count;
decl_arg **list;
@@
-919,11
+934,13
@@
static inline void free_let_callback(let_callback *cb) {
free(cb);
}
free(cb);
}
+typedef impl_val *(*let_func_handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free);
+
typedef struct let_func {
token_t type;
char *name;
impl_var *var;
typedef struct let_func {
token_t type;
char *name;
impl_var *var;
-
impl_val *(*handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free)
;
+
let_func_handler handler
;
} let_func;
static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
} let_func;
static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
@@
-1017,8
+1034,6
@@
static inline void free_let_val(let_val *let) {
typedef struct let_stmt {
decl_var *var;
let_val *val;
typedef struct let_stmt {
decl_var *var;
let_val *val;
-
- void *ptr;
} let_stmt;
static inline let_stmt *init_let_stmt(decl_var *var, let_val *val) {
} let_stmt;
static inline let_stmt *init_let_stmt(decl_var *var, let_val *val) {