+
+ }
+ return false;
+}
+
+bool psi_impl_def_val_validate(struct psi_data *data,
+ struct psi_impl_def_val *val, struct psi_impl_type *type,
+ struct psi_validate_scope *scope)
+{
+ /* NULL can be anything */
+ if (val->type == PSI_T_NULL) {
+ return true;
+ }
+
+ /* a number can be anything */
+ if (val->type == PSI_T_NUMBER) {
+ if (!psi_num_exp_validate(data, val->data.num, scope)) {
+ return false;
+ }
+ val->ityp = psi_num_exp_exec(val->data.num, &val->ival, NULL, scope->cpp);
+ }
+
+ /* forced type, like `const <type> foo`, or function param `<type> $xyz` */
+ if (type) {
+ return psi_impl_def_val_validate_impl_type(data, val, type, scope);
+ }
+
+ switch (val->type) {
+ case PSI_T_NUMBER:
+ case PSI_T_NULL:
+ case PSI_T_TRUE:
+ case PSI_T_FALSE:
+ case PSI_T_STRING:
+ return true;
+ default:
+ assert(0);
+ break;