diff options
author | Camil Staps | 2017-07-28 23:46:38 +0200 |
---|---|---|
committer | Camil Staps | 2017-07-28 23:46:38 +0200 |
commit | fe76e2ad510ec9e4df965a9620f8d36778222c08 (patch) | |
tree | 4caec2a73064dc9ed44214c9625c99cf379647b8 /Sil/Check.icl | |
parent | Add a semi-memoized fibonacci with lists (diff) |
Add globals on A-stack
Diffstat (limited to 'Sil/Check.icl')
-rw-r--r-- | Sil/Check.icl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Sil/Check.icl b/Sil/Check.icl index c51d73c..f9147bf 100644 --- a/Sil/Check.icl +++ b/Sil/Check.icl @@ -34,6 +34,8 @@ where = "Type error: no return from non-void function '" <+ f <+ "'." toString (LocalVoid f l) = "Type error: local variable '" <+ l <+ "' in '" <+ f <+ "' cannot have type Void." + toString (BasicGlobal g) + = "Error: global variable '" <+ g <+ "' cannot have a basic type." instance <<< CheckError where <<< f e = f <<< toString e <<< "\r\n" @@ -42,6 +44,7 @@ checkProgram err prog = checkErrors [ checkFunctionNames , checkMainFunction + , checkGlobals ] prog $ appFst flatten $ mapSt (flip checkFunction) prog.p_funs err where @@ -56,6 +59,12 @@ where \\ fs <- tails [f.f_name \\ f <- p.p_funs] | not (isEmpty fs) && isMember (hd fs) (tl fs)] + checkGlobals :: Program -> [CheckError] + checkGlobals p = + [ BasicGlobal g.init_name + \\ g <- p.p_globals + | (typeSize g.init_type).bsize <> 0] + checkFunction :: *(Maybe *File) Function -> *([CheckError], *Maybe *File) checkFunction err f = checkErrors [ checkLocals |