-#ifndef _PSI_TYPES_LET_FUNC_H
-#define _PSI_TYPES_LET_FUNC_H
+/*******************************************************************************
+ Copyright (c) 2016, Michael Wallner <mike@php.net>.
+ All rights reserved.
-typedef impl_val *(*let_func_handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free);
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
-struct let_val;
-struct let_vals;
-static inline void free_let_vals(struct let_vals *vals);
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+#ifndef PSI_TYPES_LET_FUNC_H
+#define PSI_TYPES_LET_FUNC_H
+
+#include "token.h"
+
+#include "impl_var.h"
+#include "decl_arg.h"
typedef struct let_func {
token_t type;
char *name;
impl_var *var;
- let_func_handler handler;
struct let_vals *inner;
struct let_val *outer;
decl_arg *ref;
} let_func;
-static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
- let_func *func = calloc(1, sizeof(*func));
- func->type = type;
- func->name = strdup(name);
- func->var = var;
- return func;
-}
-
-static inline void free_let_func(let_func *func) {
- free_impl_var(func->var);
- free(func->name);
- if (func->inner) {
- free_let_vals(func->inner);
- }
- free(func);
-}
+let_func *init_let_func(token_t type, const char *name, impl_var *var);
+void free_let_func(let_func *func);
+void dump_let_func(int fd, let_func *func, unsigned level);
+
+struct psi_data;
+struct impl;
+
+int validate_let_func(struct psi_data *data, let_func *func, decl_var *let_var, struct impl *impl);
#endif