- /* we must have exactly one ret stmt delcaring the native func to call */
- /* and which type cast to apply */
- if (impl->stmts->ret.count != 1) {
- if (impl->stmts->ret.count > 1) {
- data->error(data, impl->stmts->ret.list[1]->token, PSI_WARNING,
- "Too many `return` statements for implmentation %s;"
- " found %zu, exactly one is needed",
- impl->func->name, impl->stmts->ret.count);
- } else {
- data->error(data, impl->func->token, PSI_WARNING,
- "Missing `return` statement for implementation %s",
- impl->func->name);
- }
- return 0;
- }
+bool psi_return_stmt_validate(struct psi_data *data,
+ struct psi_validate_scope *scope)
+{
+ struct psi_return_stmt *ret;
+ size_t count = psi_plist_count(scope->impl->stmts.ret);