Commit f36b5cd4 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Refactoring

parent 8bae3512
......@@ -3,7 +3,8 @@ module VectMonad (
VM,
noV, tryV, maybeV, orElseV, fixV, localV, closedV, initV,
cloneName, newExportedVar, newLocalVar, newDummyVar, newTyVar,
cloneName, cloneId,
newExportedVar, newLocalVar, newDummyVar, newTyVar,
Builtins(..), paDictTyCon, paDictDataCon,
builtin,
......@@ -307,6 +308,14 @@ cloneName mk_occ name = liftM make (liftDs newUnique)
(nameSrcSpan name)
| otherwise = mkSystemName u occ_name
cloneId :: (OccName -> OccName) -> Id -> Type -> VM Id
cloneId mk_occ id ty
= do
name <- cloneName mk_occ (getName id)
let id' | isExportedId id = Id.mkExportedLocalId name ty
| otherwise = Id.mkLocalId name ty
return id'
newExportedVar :: OccName -> Type -> VM Var
newExportedVar occ_name ty
= do
......
......@@ -101,10 +101,8 @@ vectTopBind b@(Rec bs)
vectTopBinder :: Var -> VM Var
vectTopBinder var
= do
vty <- vectType (idType var)
name <- cloneName mkVectOcc (getName var)
let var' | isExportedId var = Id.mkExportedLocalId name vty
| otherwise = Id.mkLocalId name vty
vty <- vectType (idType var)
var' <- cloneId mkVectOcc var vty
defGlobalVar var var'
return var'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment