@@ -12,7 +12,7 @@ import qualified Text.Pandoc as Pan
1212import Unique
1313import Generate.Cases
1414import SourceSyntax.Everything hiding (parens)
15−import SourceSyntax.Location as Loc
15+import SourceSyntax.Location
1616import qualified Transform.SortDefinitions as SD
1717
1818deprime :: String -> String
@@ -130,12 +130,12 @@ instance ToJS (Def t v) where
130130 | isOp x = globalAssign ("_op['" ++ x ++ "']") `liftM` toJS' e
131131 | otherwise = assign (deprime x) `liftM` toJS' e
132132
133− toJS (Def pattern e) =
133+ toJS (Def pattern e@(L s _)) =
134134 do n <- guid
135135 let x = "_" ++ show n
136− var = Loc.none . Var
136+ var = L s . Var
137137 toDef y' = let y = deprime y' in
138− Def (PVar y) (Loc.none $ Case (var x) [(pattern, var y)])
138+ Def (PVar y) (L s $ Case (var x) [(pattern, var y)])
139139 stmt <- assign x `liftM` toJS' e
140140 vars <- toJS . map toDef . Set.toList $ SD.boundVars pattern
141141 return (stmt ++ vars)
@@ -196,7 +196,7 @@ instance ToJS (Expr t v) where
196196 Record fs -> makeRecord fs
197197 Binop op e1 e2 -> binop op `liftM` toJS' e1 `ap` toJS' e2
198198
199− Lambda p e -> liftM (fastFunc . ret) (toJS' body)
199+ Lambda p e@(L s _) -> liftM (fastFunc . ret) (toJS' body)
200200 where
201201 fastFunc body
202202 | length args < 2 || length args > 9 = foldr jsFunc body args
@@ -207,7 +207,7 @@ instance ToJS (Expr t v) where
207207 case pattern of
208208 PVar x -> (deprime x : args, body)
209209 _ -> let arg = "arg" ++ show n
210− in (arg:args, Loc.none (Case (Loc.none (Var arg)) [(pattern, body)]))
210+ in (arg:args, L s (Case (L s (Var arg)) [(pattern, body)]))
211211
212212 (patterns, innerBody) = collect [p] e
213213