From ebde44b28b551f670c9e5c4c038d03e94bfbb1d2 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 30 Jul 2017 09:17:44 +0200 Subject: Reorganise: make Position a field in Syntax types --- Sil/Syntax.icl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Sil/Syntax.icl') diff --git a/Sil/Syntax.icl b/Sil/Syntax.icl index a8a0631..0749dde 100644 --- a/Sil/Syntax.icl +++ b/Sil/Syntax.icl @@ -65,14 +65,17 @@ where toString (BLit b) = toString b toString (ILit i) = toString i +instance getPos Function where getPos f = f.f_pos +instance getPos Initialisation where getPos i = i.init_pos + instance allStatements Program -where allStatements p = concatMap (allStatements o fromPositioned) p.p_funs +where allStatements p = concatMap allStatements p.p_funs instance allStatements Function where allStatements f = allStatements f.f_code instance allStatements CodeBlock -where allStatements cb = concatMap (allStatements o fromPositioned) cb.cb_content +where allStatements cb = concatMap allStatements cb.cb_content instance allStatements Statement where @@ -87,7 +90,7 @@ where instance allCodeBlocks Function where allCodeBlocks f = allCodeBlocks f.f_code instance allCodeBlocks CodeBlock -where allCodeBlocks cb = [cb:concatMap (allCodeBlocks o fromPositioned) cb.cb_content] +where allCodeBlocks cb = [cb:concatMap allCodeBlocks cb.cb_content] instance allCodeBlocks Statement where @@ -102,4 +105,4 @@ where allLocals f.f_code instance allLocals CodeBlock -where allLocals cb = [(i.init_type, i.init_name) \\ i <- map fromPositioned cb.cb_init] +where allLocals cb = [(i.init_type, i.init_name) \\ i <- cb.cb_init] -- cgit v1.2.3