X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/71a20a4f3d4e5f5278f7d004af710af89dfd7ebc..66a27d2fc7c1ad4e97de76d4982168a0fed9920a:/src/check.h diff --git a/src/check.h b/src/check.h deleted file mode 100644 index d85bd81..0000000 --- a/src/check.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include "repr.h" - -bool checkStmt( - const Stmt & s, - std::vector structs, - std::vector funcs, - std::vector vars) -{ - return true; -} - -bool checkFunction( - const Function & f, - std::vector structs, - std::vector funcs, - std::vector vars) -{ - vars.insert(vars.end(), f.parameters.begin(), f.parameters.end()); - vars.insert(vars.end(), f.body.variables.begin(), f.body.variables.end()); - for (auto s : f.body.statements) - { - if (!checkStmt(s, structs, funcs, vars)) - return false; - } - return true; -} - -bool checkProgram(const Program & p) -{ - for (auto f : p.functions) - { - if (!checkFunction(f, p.structs, p.functions, p.variables)) - return false; - } - for (auto s : p.structs) - { - std::vector vars = p.variables; - for (auto v : s.members) - vars.push_back(v); - for (auto f : s.methods) - { - if (!checkFunction(f, p.structs, p.functions, vars)) - return false; - } - } - return true; -} \ No newline at end of file