@@ -171,7 +171,7 @@ valueToJs opts m e (Let ds val) = do
171171 ret <- valueToJs opts m e val
172172 return $ JSApp (JSFunction Nothing [] (JSBlock (decls ++ [JSReturn ret]))) []
173173valueToJs opts m e (Abs (Left arg) val) = do
174− ret <- valueToJs opts m (bindName m arg e) val
174+ ret <- valueToJs opts m e val
175175 return $ JSFunction Nothing [identToJs arg] (JSBlock [JSReturn ret])
176176valueToJs opts m e (TypedValue _ (Abs (Left arg) val) ty) | optionsPerformRuntimeTypeChecks opts = do
177177 let arg' = identToJs arg
@@ -201,22 +201,6 @@ extendObj obj sts = do
201201 stToAssign (s, js) = JSAssignment (JSAccessor s jsNewObj) js
202202 extend = map stToAssign sts
203203 return $ JSApp (JSFunction Nothing [] block) []
204− where
205−
206−-- |
207−-- Temporarily extends the environment with a single local variable name
208−--
209−bindName :: ModuleName -> Ident -> Environment -> Environment
210−bindName m ident = bindNames m [ident]
211−
212−-- |
213−-- Temporarily extends the environment to include local variable names introduced by lambda
214−-- abstractions or case statements
215−--
216−bindNames :: ModuleName -> [Ident] -> Environment -> Environment
217−bindNames m idents env = env { names = M.fromList [ ((m, ident), (noType, LocalVariable)) | ident <- idents ] `M.union` names env }
218− where
219− noType = error "Temporary lambda variable type was read"
220204
221205-- |
222206-- Generate code in the simplified Javascript intermediate representation for runtime type checks.
@@ -274,7 +258,7 @@ bindersToJs :: (Functor m, Applicative m, Monad m) => Options -> ModuleName -> E
274258bindersToJs opts m e binders vals = do
275259 valNames <- replicateM (length vals) freshName
276260 jss <- forM binders $ \(CaseAlternative bs grd result) -> do
277− ret <- valueToJs opts m (bindNames m (concatMap binderNames bs) e) result
261+ ret <- valueToJs opts m e result
278262 go valNames [JSReturn ret] bs grd
279263 return $ JSApp (JSFunction Nothing valNames (JSBlock (concat jss ++ [JSThrow (JSStringLiteral "Failed pattern match")])))
280264 vals