+ if (!check) {
+ V->error(PSI_WARNING, "Missing `let` statement for arg '%s %.*s%s'"
+ " of declaration '%s' for implementation '%s'",
+ darg->type->name, (int) darg->var->pointer_level, "*****",
+ darg->var->name, impl->decl->func->var->name, impl->func->name);
+ return 0;
+ }
+ }
+ /* check that the let_value references a known variable or NULL */
+ for (i = 0; i < impl->stmts->let.count; ++i) {
+ let_stmt *let = impl->stmts->let.list[i];
+ int check = 0;
+
+ if (let->val && let->val->func && let->val->func->alloc) {
+ if (!validate_decl_type(V, let->val->func->alloc->type)) {
+ V->error(PSI_WARNING, "Cannot use '%s' as type for calloc in `let` statement",
+ let->val->func->alloc->type->name);
+ return 0;
+ }
+ }
+ if (let->val && let->val->var) {
+ if (impl->func->args) for (j = 0; j < impl->func->args->count; ++j) {
+ impl_arg *iarg = impl->func->args->args[j];
+
+ if (!strcmp(let->val->var->name, iarg->var->name)) {
+ let->arg = iarg;
+ check = 1;
+ break;
+ }
+ }
+ if (!check) {
+ V->error(PSI_WARNING, "Unknown value '$%s' of `let` statement"
+ " for variable '%s' of implementation '%s'",
+ let->val->var->name, let->var->name, impl->func->name);
+ return 0;
+ }
+ }