on master help sign in
cosmetic: minor indentation and naming changes
commitc5c4da6461d69bb4284951622174f9bf5aa862dd authorEvan Czaplicki <info@elm-lang.org> dateFri 28 Aug 2015, 20:34 (11 years ago) parent472eef7
5 files changed+32−22
src/AST/Expression/Canonical.hs+7−6 src/AST/Expression/Optimized.hs+1−2 src/AST/Variable.hs+11−6 src/Canonicalize/Declaration.hs+10−5 src/Optimize/TailCalls.hs+3−3
src/AST/Expression/Canonical.hs+7−6
@@ -28,15 +28,16 @@ data Def
2828 deriving (Show)
2929
3030
31−data Facts =
32− Facts
33− { freeVariables :: [Var.TopLevelVar]
34− } deriving (Eq, Ord, Show)
31+data Facts = Facts
32+ { dependencies :: [Var.TopLevel]
33+ }
34+ deriving (Eq, Ord, Show)
3535
3636
3737dummyFacts :: Facts
38−dummyFacts = Facts $ error "This should be set by Canonicalize.Sort"
39−
38+dummyFacts =
39+ Facts (error "This should be set by Canonicalize.Sort")
40+
4041
4142instance P.Pretty Def where
4243 pretty dealiaser _ (Definition _ pattern expr maybeTipe) =
src/AST/Expression/Optimized.hs+1−2
@@ -6,7 +6,6 @@ module AST.Expression.Optimized
66 ) where
77
88import qualified AST.Expression.General as General
9−import qualified AST.Expression.Canonical as Canonical
109import qualified AST.Pattern as Pattern
1110import qualified AST.Type as Type
1211import qualified AST.Variable as Var
@@ -27,7 +26,7 @@ data Def
2726
2827data Facts = Facts
2928 { tailRecursionDetails :: Maybe String
30− , freeVariables :: [Var.TopLevelVar]
29+ , dependencies :: [Var.TopLevel]
3130 }
3231 deriving (Show)
3332
src/AST/Variable.hs+11−6
@@ -11,18 +11,23 @@ import qualified AST.Module.Name as ModuleName
1111import qualified Reporting.PrettyPrint as P
1212
1313
14−-- VARIABLES
14+-- RAW NAMES
1515
1616newtype Raw = Raw String
1717 deriving (Eq, Ord, Show)
1818
1919
20−data TopLevelVar =
21− TopLevelVar
22− { topVarModule :: ModuleName.Canonical
23− , topVarName :: String
24− } deriving (Eq, Ord, Show)
20+-- TOP LEVEL NAMES
2521
22+data TopLevel = TopLevelVar
23+ { topHome :: ModuleName.Canonical
24+ , topName :: String
25+ }
26+ deriving (Eq, Ord, Show)
27+
28+
29+
30+-- CANONICAL NAMES
2631
2732data Home
2833 = BuiltIn
src/Canonicalize/Declaration.hs+10−5
@@ -19,10 +19,12 @@ toExpr moduleName decls =
1919
2020toDefs :: ModuleName.Canonical -> D.CanonicalDecl -> [Canonical.Def]
2121toDefs moduleName (A.A (region,_) decl) =
22− let typeVar = Var.fromModule moduleName
22+ let
23+ typeVar =
24+ Var.fromModule moduleName
2325
24− loc expr =
25− A.A region expr
26+ loc expr =
27+ A.A region expr
2628 in
2729 case decl of
2830 D.Definition def ->
@@ -91,5 +93,8 @@ buildFunction body@(A.A ann _) vars =
9193
9294definition :: String -> Canonical.Expr -> R.Region -> T.Canonical -> Canonical.Def
9395definition name expr@(A.A ann _) region tipe =
94− Canonical.Definition Canonical.dummyFacts
95− (A.A ann (P.Var name)) expr (Just (A.A region tipe))
96+ Canonical.Definition
97+ Canonical.dummyFacts
98+ (A.A ann (P.Var name))
99+ expr
100+ (Just (A.A region tipe))
src/Optimize/TailCalls.hs+3−3
@@ -73,9 +73,9 @@ detectTailRecursion (Can.Definition canonFacts pattern expression _) =
7373 A.A () (Lambda x e)
7474
7575 facts =
76− Opt.Facts
77− (if isTailCall then fmap fst context else Nothing)
78− (Can.freeVariables canonFacts)
76+ Opt.Facts
77+ (if isTailCall then fmap fst context else Nothing)
78+ (Can.dependencies canonFacts)
7979 in
8080 Opt.Definition
8181 facts