+++ /dev/null
-#pragma once\r
-\r
-#include "repr.h"\r
-\r
-bool checkStmt(\r
- const Stmt & s,\r
- std::vector<Namespace> namespaces,\r
- std::vector<Variable> vars)\r
-{\r
- return true;\r
-}\r
-\r
-bool checkFunction(\r
- const Function & f,\r
- std::vector<Namespace> namespaces,\r
- std::vector<Variable> vars)\r
-{\r
- vars.insert(vars.end(), f.parameters.begin(), f.parameters.end());\r
- vars.insert(vars.end(), f.body.variables.begin(), f.body.variables.end());\r
- for (auto s : f.body.statements)\r
- {\r
- if (!checkStmt(s, namespaces, vars))\r
- return false;\r
- }\r
- return true;\r
-}\r
-\r
-bool checkProgram(const Program & p)\r
-{\r
- for (auto f : p.functions)\r
- {\r
- if (!checkFunction(f, p.namespaces, p.variables))\r
- return false;\r
- }\r
- for (auto s : p.structs)\r
- {\r
- std::vector<Variable> vars = p.variables;\r
- for (auto v : s.members)\r
- vars.push_back(v);\r
- for (auto f : s.methods)\r
- {\r
- if (!checkFunction(f, p.namespaces, vars))\r
- return false;\r
- }\r
- }\r
- return true;\r
-}
\ No newline at end of file