on master help sign in
Switch more files over to new Expressions
commit947b82ed095afac4ac7a393a693b5c3b5b8a0ac0 authorEvan Czaplicki <evan@Evans-MacBook-Air.local> dateThu 4 Jul 2013, 17:31 (13 years ago) parent5c68f6b
2 files changed+5−10
compiler/Generate/Noscript.hs+1−2 compiler/Types/Alias.hs+4−8
compiler/Generate/Noscript.hs+1−2
@@ -19,8 +19,7 @@ instance Extract (Declaration t v) where
1919 extract _ = []
2020
2121instance Extract (Def t v) where
22− extract (FnDef _ _ e) = extract e
23− extract (OpDef _ _ _ e) = extract e
22+ extract (Def _ e) = extract e
2423 extract _ = []
2524
2625instance Extract e => Extract (Located e) where
compiler/Types/Alias.hs+4−8
@@ -6,6 +6,7 @@ import Control.Arrow (second)
66import Data.List (group,sort)
77import qualified Data.Map as Map
88import qualified Data.Set as Set
9+import Transform.SortDefinitions
910import Types.Substitutions (subst)
1011import Types.Types
1112import Data.Data
@@ -77,9 +78,7 @@ badKinds decls = map msg (concatMap bad decls)
7778 badDef def =
7879 case def of
7980 TypeAnnotation _ tipe -> badType tipe
80− FnDef _ _ expr ->
81− concatMap badDef $ concat [defList | Let defList _ <- universeBi expr]
82− OpDef _ _ _ expr ->
81+ Def _ expr ->
8382 concatMap badDef $ concat [defList | Let defList _ <- universeBi expr]
8483
8584 --bad :: Declaration t v -> [String]
@@ -106,8 +105,7 @@ definition s =
106105defName :: Def t v -> [String]
107106defName d =
108107 case d of
109− FnDef n _ _ -> [n]
110− OpDef n _ _ _ -> [n]
108+ Def pattern _ -> Set.toList (boundVars pattern)
111109 _ -> []
112110
113111dups :: [Declaration t v] -> [String]
@@ -141,9 +139,7 @@ badOrder decls =
141139 --actualPairs :: [Def t v] -> [String]
142140 actualPairs decls =
143141 case decls of
144− Definition (TypeAnnotation n _) : Definition (FnDef m _ _) : rest ->
145− (if n == m then [n] else []) ++ actualPairs rest
146− Definition (TypeAnnotation n _) : Definition (OpDef m _ _ _) : rest ->
142+ Definition (TypeAnnotation n _) : Definition (Def (PVar m) _) : rest ->
147143 (if n == m then [n] else []) ++ actualPairs rest
148144 t:s:rest -> actualPairs (s:rest)
149145 _ -> []