summaryrefslogtreecommitdiff
path: root/Zend/zend_ast.h
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-07-18 14:57:00 +0200
committerNikita Popov <nikic@php.net>2014-07-18 14:57:00 +0200
commit359f99fe4850c1338b1b52b5e98705da4de6debd (patch)
treee7c4d3bc748a535fcfb676b5a47282cb845f0248 /Zend/zend_ast.h
parent3ad55e001e09592a385bcb6373ebbeb6b585d004 (diff)
downloadphp-git-359f99fe4850c1338b1b52b5e98705da4de6debd.tar.gz
Use dedicated func_decl ast node
Functions need a bunch of extra info, that becomes inconvenient to handle using the normal ast structure.
Diffstat (limited to 'Zend/zend_ast.h')
-rw-r--r--Zend/zend_ast.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index 3c22fda349..490046d057 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -100,7 +100,6 @@ enum _zend_ast_kind {
ZEND_AST_TYPE,
ZEND_AST_FUNC_DECL,
-
ZEND_AST_CLOSURE,
ZEND_AST_CLOSURE_USES,
};
@@ -123,6 +122,18 @@ typedef struct _zend_ast_zval {
zval val;
} zend_ast_zval;
+/* Using a separate structure as it needs a bunch of extra information. */
+typedef struct _zend_ast_func_decl {
+ zend_ast_kind kind;
+ zend_bool returns_ref;
+ zend_uint start_lineno;
+ zend_uint end_lineno;
+ zend_string *name;
+ zend_ast *params;
+ zend_ast *uses;
+ zend_ast *stmt;
+} zend_ast_func_decl;
+
static inline zval *zend_ast_get_zval(zend_ast *ast) {
return &((zend_ast_zval *) ast)->val;
}
@@ -134,6 +145,11 @@ ZEND_API zend_ast *zend_ast_create_ex(
ZEND_API zend_ast *zend_ast_create(
zend_uint children, zend_ast_kind kind, ...);
+ZEND_API zend_ast *zend_ast_create_func_decl(
+ zend_ast_kind kind, zend_bool by_ref, zend_uint start_lineno, zend_uint end_lineno,
+ zend_string *name, zend_ast *params, zend_ast *uses, zend_ast *stmt
+);
+
ZEND_API zend_ast *zend_ast_create_dynamic(zend_ast_kind kind);
ZEND_API zend_ast *zend_ast_dynamic_add(zend_ast *ast, zend_ast *op);
ZEND_API void zend_ast_dynamic_shrink(zend_ast **ast);