diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-10-19 13:22:29 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-10-19 13:22:29 +0300 |
commit | 3fe698b90493cf9f61bb794b2eb61a1296052be7 (patch) | |
tree | 42c9f9a19e52a92e1acf7dea4bb78a8ec75cd19e /Zend | |
parent | 03384cae3c46254ccfd5d703b408a0f1d011ee3c (diff) | |
download | php-git-3fe698b90493cf9f61bb794b2eb61a1296052be7.tar.gz |
Mark "top-level" functions.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_compile.c | 4 | ||||
-rw-r--r-- | Zend/zend_compile.h | 52 |
2 files changed, 30 insertions, 26 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 39ee2a1063..93766b98b5 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5895,6 +5895,10 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /* CG(active_op_array) = op_array; + if (toplevel) { + op_array->fn_flags |= ZEND_ACC_TOP_LEVEL; + } + zend_oparray_context_begin(&orig_oparray_context); if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_INFO) { diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5ce27ba85f..8d34e0107c 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -223,6 +223,9 @@ typedef struct _zend_oparray_context { /* Function has typed arguments / class has typed props | | | */ #define ZEND_ACC_HAS_TYPE_HINTS (1 << 8) /* ? | X | | */ /* | | | */ +/* Top-level class or function declaration | | | */ +#define ZEND_ACC_TOP_LEVEL (1 << 9) /* X | X | | */ +/* | | | */ /* Class Flags (unused: 16...) | | | */ /* =========== | | | */ /* | | | */ @@ -240,75 +243,72 @@ typedef struct _zend_oparray_context { /* | | | */ /* Class has magic methods __get/__set/__unset/ | | | */ /* __isset that use guards | | | */ -#define ZEND_ACC_USE_GUARDS (1 << 9) /* X | | | */ +#define ZEND_ACC_USE_GUARDS (1 << 10) /* X | | | */ /* | | | */ /* Class constants updated | | | */ -#define ZEND_ACC_CONSTANTS_UPDATED (1 << 10) /* X | | | */ +#define ZEND_ACC_CONSTANTS_UPDATED (1 << 11) /* X | | | */ /* | | | */ /* Class extends another class | | | */ -#define ZEND_ACC_INHERITED (1 << 11) /* X | | | */ +#define ZEND_ACC_INHERITED (1 << 12) /* X | | | */ /* | | | */ /* Class implements interface(s) | | | */ -#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 12) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 13) /* X | | | */ /* | | | */ /* Class uses trait(s) | | | */ -#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 13) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 14) /* X | | | */ /* | | | */ /* User class has methods with static variables | | | */ -#define ZEND_HAS_STATIC_IN_METHODS (1 << 14) /* X | | | */ -/* | | | */ -/* Top-level class declaration | | | */ -#define ZEND_ACC_TOP_LEVEL (1 << 15) /* X | | | */ +#define ZEND_HAS_STATIC_IN_METHODS (1 << 15) /* X | | | */ /* | | | */ -/* Function Flags (unused: 25...30) | | | */ +/* Function Flags (unused: 26...30) | | | */ /* ============== | | | */ /* | | | */ /* deprecation flag | | | */ -#define ZEND_ACC_DEPRECATED (1 << 9) /* | X | | */ +#define ZEND_ACC_DEPRECATED (1 << 10) /* | X | | */ /* | | | */ /* Function returning by reference | | | */ -#define ZEND_ACC_RETURN_REFERENCE (1 << 10) /* | X | | */ +#define ZEND_ACC_RETURN_REFERENCE (1 << 11) /* | X | | */ /* | | | */ /* Function has a return type | | | */ -#define ZEND_ACC_HAS_RETURN_TYPE (1 << 11) /* | X | | */ +#define ZEND_ACC_HAS_RETURN_TYPE (1 << 12) /* | X | | */ /* | | | */ /* Function with variable number of arguments | | | */ -#define ZEND_ACC_VARIADIC (1 << 12) /* | X | | */ +#define ZEND_ACC_VARIADIC (1 << 13) /* | X | | */ /* | | | */ /* op_array has finally blocks (user only) | | | */ -#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 13) /* | X | | */ +#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 14) /* | X | | */ /* | | | */ /* "main" op_array with | | | */ /* ZEND_DECLARE_INHERITED_CLASS_DELAYED opcodes | | | */ -#define ZEND_ACC_EARLY_BINDING (1 << 14) /* | X | | */ +#define ZEND_ACC_EARLY_BINDING (1 << 15) /* | X | | */ /* | | | */ /* method flag (bc only), any method that has this | | | */ /* flag can be used statically and non statically. | | | */ -#define ZEND_ACC_ALLOW_STATIC (1 << 15) /* | X | | */ +#define ZEND_ACC_ALLOW_STATIC (1 << 16) /* | X | | */ /* | | | */ /* call through user function trampoline. e.g. | | | */ /* __call, __callstatic | | | */ -#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 16) /* | X | | */ +#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 17) /* | X | | */ /* | | | */ /* disable inline caching | | | */ -#define ZEND_ACC_NEVER_CACHE (1 << 17) /* | X | | */ +#define ZEND_ACC_NEVER_CACHE (1 << 18) /* | X | | */ /* | | | */ /* Closure related | | | */ -#define ZEND_ACC_CLOSURE (1 << 18) /* | X | | */ -#define ZEND_ACC_FAKE_CLOSURE (1 << 19) /* | X | | */ +#define ZEND_ACC_CLOSURE (1 << 19) /* | X | | */ +#define ZEND_ACC_FAKE_CLOSURE (1 << 20) /* | X | | */ /* | | | */ /* run_time_cache allocated on heap (user only) | | | */ -#define ZEND_ACC_HEAP_RT_CACHE (1 << 20) /* | X | | */ +#define ZEND_ACC_HEAP_RT_CACHE (1 << 21) /* | X | | */ /* | | | */ /* method flag used by Closure::__invoke() | | | */ -#define ZEND_ACC_USER_ARG_INFO (1 << 21) /* | X | | */ +#define ZEND_ACC_USER_ARG_INFO (1 << 22) /* | X | | */ /* | | | */ -#define ZEND_ACC_GENERATOR (1 << 22) /* | X | | */ +#define ZEND_ACC_GENERATOR (1 << 23) /* | X | | */ /* | | | */ -#define ZEND_ACC_DONE_PASS_TWO (1 << 23) /* | X | | */ +#define ZEND_ACC_DONE_PASS_TWO (1 << 24) /* | X | | */ /* | | | */ /* internal function is allocated at arena (int only) | | | */ -#define ZEND_ACC_ARENA_ALLOCATED (1 << 24) /* | X | | */ +#define ZEND_ACC_ARENA_ALLOCATED (1 << 25) /* | X | | */ /* | | | */ /* op_array uses strict mode types | | | */ #define ZEND_ACC_STRICT_TYPES (1 << 31) /* | X | | */ |