@@ -10,7 +10,7 @@ import Data.Either (partitionEithers)
1010import qualified Text.Pandoc as Pan
1111
1212import Unique
13−import Generate.Cases (caseToMatch, deprime, matchSubst, Match(..), Clause(..))
13+import Generate.Cases
1414import SourceSyntax.Everything
1515import SourceSyntax.Location
1616import qualified Transform.SortDefinitions as SD
@@ -75,7 +75,7 @@ jsModule modul =
7575 jsExports = setup ("elm" : names modul) ++
7676 ret (assign' ("elm." ++ modName) (brackets exs))
7777 where
78− exs = indent . commaSep . concatMap (pair . deprime) $ "_op" : exports modul
78+ exs = indent . commaSep . concatMap pair $ "_op" : exports modul
7979 pair x | isOp x = []
8080 | otherwise = ["\n" ++ x ++ " : " ++ x]
8181
@@ -120,14 +120,13 @@ instance ToJS (Def t v) where
120120 -- TODO: Make this handle patterns besides plain variables
121121 toJS (Def (PVar x) e)
122122 | isOp x = globalAssign ("_op['" ++ x ++ "']") `liftM` toJS' e
123− | otherwise = assign (deprime x) `liftM` toJS' e
123+ | otherwise = assign x `liftM` toJS' e
124124
125125 toJS (Def pattern e@(L s _)) =
126126 do n <- guid
127127 let x = "_" ++ show n
128128 var = L s . Var
129− toDef y' = let y = deprime y' in
130− Def (PVar y) (L s $ Case (var x) [(pattern, var y)])
129+ toDef y = Def (PVar y) (L s $ Case (var x) [(pattern, var y)])
131130 stmt <- assign x `liftM` toJS' e
132131 vars <- toJS . map toDef . Set.toList $ SD.boundVars pattern
133132 return (stmt ++ vars)
@@ -145,18 +144,18 @@ toJS' (L span expr) =
145144 Case e cases -> caseToJS span e cases
146145 _ -> toJS expr
147146
148−remove x e = "_N.remove('" ++ deprime x ++ "', " ++ e ++ ")"
149−addField x v e = "_N.insert('" ++ deprime x ++ "', " ++ v ++ ", " ++ e ++ ")"
147+remove x e = "_N.remove('" ++ x ++ "', " ++ e ++ ")"
148+addField x v e = "_N.insert('" ++ x ++ "', " ++ v ++ ", " ++ e ++ ")"
150149setField fs e = "_N.replace(" ++ jsList (map f fs) ++ ", " ++ e ++ ")"
151− where f (x,v) = "['" ++ deprime x ++ "'," ++ v ++ "]"
152−access x e = e ++ "." ++ deprime x
150+ where f (x,v) = "['" ++ x ++ "'," ++ v ++ "]"
151+access x e = e ++ "." ++ x
153152makeRecord kvs = record `liftM` collect kvs
154153 where
155154 combine r (k,v) = Map.insertWith (++) k v r
156155 collect = liftM (List.foldl' combine Map.empty) . mapM prep
157156 prep (k, e) =
158157 do v <- toJS' e
159− return (deprime k, [v])
158+ return (k, [v])
160159 fields fs =
161160 brackets ("\n "++List.intercalate ",\n " (map (\(k,v) -> k++":"++v) fs))
162161 hidden = fields . map (second jsList) .
@@ -177,7 +176,7 @@ instance ToJS Literal where
177176instance ToJS (Expr t v) where
178177 toJS expr =
179178 case expr of
180− Var x -> return (deprime x)
179+ Var x -> return x
181180 Literal lit -> toJS lit
182181 Range lo hi -> jsRange `liftM` toJS' lo `ap` toJS' hi
183182 Access e x -> access x `liftM` toJS' e
@@ -200,7 +199,7 @@ instance ToJS (Expr t v) where
200199
201200 depattern (pattern,n) (args, body) =
202201 case pattern of
203− PVar x -> (deprime x : args, body)
202+ PVar x -> (x : args, body)
204203 _ -> let arg = "arg" ++ show n
205204 in (arg:args, L s (Case (L s (Var arg)) [(pattern, body)]))
206205
@@ -268,7 +267,7 @@ caseToJS span e ps = do
268267 (tempVar,match) <- caseToMatch ps
269268 e' <- toJS' e
270269 let (match',stmt) = case e of
271− L _ (Var x) -> (matchSubst [(tempVar,deprime x)] match, "")
270+ L _ (Var x) -> (matchSubst [(tempVar,x)] match, "")
272271 _ -> (match, assign tempVar e')
273272 matches <- matchToJS span match'
274273 return $ jsFunc "" (stmt ++ matches) ++ "()"