From: Michael Wallner Date: Fri, 27 Nov 2015 12:40:26 +0000 (+0100) Subject: flush X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=ea0162a1698563a49de50456cd3f2cc18b83a05e;hp=4b5ceb304b924c50eaf8263ad394493ff806fed4 flush --- diff --git a/Makefile.frag b/Makefile.frag index bca0f48..e5e4608 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -27,6 +27,8 @@ lemon.c: $(PHP_PSI_SRCDIR)/src/context.c: $(PHP_PSI_SRCDIR)/config.m4 touch $@ +$(PHP_PSI_BUILDDIR)/parser.h: $(PHP_PSI_BUILDDIR)/parser_proc.h + touch $@ $(PHP_PSI_SRCDIR)/src/%.c: $(PHP_PSI_BUILDDIR)/parser.h touch $@ $(PHP_PSI_SRCDIR)/src/parser_proc.y: $(PHP_PSI_BUILDDIR)/parser.h diff --git a/psi.d/stat.psi b/psi.d/stat.psi index 82d6249..17dc188 100644 --- a/psi.d/stat.psi +++ b/psi.d/stat.psi @@ -1,3 +1,4 @@ +// extern int stat(char *path, struct stat *buf); function psi\stat(string $path, array &$buf = NULL) : int { let path = strval($path); let buf = calloc(1, struct stat); diff --git a/src/context.c b/src/context.c index 44f8299..05d5aac 100644 --- a/src/context.c +++ b/src/context.c @@ -452,7 +452,8 @@ static inline int validate_set_value(PSI_Data *data, set_value *set, decl_arg *r if (set->count) { int is_to_array = (set->func->type == PSI_T_TO_ARRAY); int is_pointer_to_struct = (ref_type->type == PSI_T_STRUCT && ref->var->pointer_level); - if (is_to_array && !is_pointer_to_struct) { + + if (!is_to_array && !is_pointer_to_struct) { data->error(E_WARNING, "Inner `set` statement casts only work with " "to_array() casts on structs or pointers: %s(%s...", set->func->name, set->vars->vars[0]->name); return 0; diff --git a/tests/stat/stat001.phpt b/tests/stat/stat001.phpt index edfc45f..9051123 100644 --- a/tests/stat/stat001.phpt +++ b/tests/stat/stat001.phpt @@ -16,7 +16,7 @@ var_dump(psi\stat(__FILE__, $stat), $stat); --EXPECTF-- ===TEST=== int(0) -array(13) { +array(16) { ["st_dev"]=> int(%d) ["st_ino"]=> @@ -32,7 +32,7 @@ array(13) { ["st_rdev"]=> int(%d) ["st_size"]=> - int(76) + int(75) ["st_atim"]=> array(2) { ["tv_sec"]=> @@ -40,6 +40,8 @@ array(13) { ["tv_nsec"]=> int(%d) } + ["st_atime"]=> + int(%d) ["st_mtim"]=> array(2) { ["tv_sec"]=> @@ -47,6 +49,8 @@ array(13) { ["tv_nsec"]=> int(%d) } + ["st_mtime"]=> + int(%d) ["st_ctim"]=> array(2) { ["tv_sec"]=> @@ -54,6 +58,8 @@ array(13) { ["tv_nsec"]=> int(%d) } + ["st_ctime"]=> + int(%d) ["st_blksize"]=> int(%d) ["st_blocks"]=>