abouttreesummaryrefslogcommitdiff
path: root/src/check.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-12 10:32:51 +0200
committerPatrick Schönberger2021-08-12 10:32:51 +0200
commit66a27d2fc7c1ad4e97de76d4982168a0fed9920a (patch)
treeca3f0e5d740214bc7ecd85949a278e64e49898b7 /src/check.h
parentc4231c6faf4e1b4650b075c641b0bb8c053739e4 (diff)
downloadtoc-66a27d2fc7c1ad4e97de76d4982168a0fed9920a.tar.gz
toc-66a27d2fc7c1ad4e97de76d4982168a0fed9920a.zip
comments
Diffstat (limited to 'src/check.h')
-rw-r--r--src/check.h47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/check.h b/src/check.h
deleted file mode 100644
index 091b646..0000000
--- a/src/check.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#pragma once
-
-#include "repr.h"
-
-bool checkStmt(
- const Stmt & s,
- std::vector<Namespace> namespaces,
- std::vector<Variable> vars)
-{
- return true;
-}
-
-bool checkFunction(
- const Function & f,
- std::vector<Namespace> namespaces,
- std::vector<Variable> 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, namespaces, vars))
- return false;
- }
- return true;
-}
-
-bool checkProgram(const Program & p)
-{
- for (auto f : p.functions)
- {
- if (!checkFunction(f, p.namespaces, p.variables))
- return false;
- }
- 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)
- {
- if (!checkFunction(f, p.namespaces, vars))
- return false;
- }
- }
- return true;
-} \ No newline at end of file