abouttreesummaryrefslogcommitdiff
path: root/src/check.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-03 12:08:12 +0200
committerPatrick Schönberger2021-08-03 12:08:12 +0200
commit71a20a4f3d4e5f5278f7d004af710af89dfd7ebc (patch)
tree4227c1cc0c0310a4b73f3b30b5ac1ee7c90b274e /src/check.h
parent17fac686375c2823d22415e32e5b7e63bbfe7c54 (diff)
downloadtoc-71a20a4f3d4e5f5278f7d004af710af89dfd7ebc.tar.gz
toc-71a20a4f3d4e5f5278f7d004af710af89dfd7ebc.zip
add namespace, private struct member grammar, change bracket style
Diffstat (limited to 'src/check.h')
-rw-r--r--src/check.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/check.h b/src/check.h
index 4e52ccd..d85bd81 100644
--- a/src/check.h
+++ b/src/check.h
@@ -19,7 +19,8 @@ bool checkFunction(
{
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) {
+ for (auto s : f.body.statements)
+ {
if (!checkStmt(s, structs, funcs, vars))
return false;
}
@@ -28,15 +29,18 @@ bool checkFunction(
bool checkProgram(const Program & p)
{
- for (auto f : p.functions) {
+ for (auto f : p.functions)
+ {
if (!checkFunction(f, p.structs, p.functions, p.variables))
return false;
}
- for (auto s : p.structs) {
+ for (auto s : p.structs)
+ {
std::vector<Variable> vars = p.variables;
for (auto v : s.members)
vars.push_back(v);
- for (auto f : s.methods) {
+ for (auto f : s.methods)
+ {
if (!checkFunction(f, p.structs, p.functions, vars))
return false;
}