Skip to content

Commit 3ae8828

Browse files
committed
Move ppDeps from IR to Stack2JS
This is the only place it is used. Furthermore, having it defined in IR removes it from the context of having to make it be valid JSON; anything that is deemed 'prettier' might by accident be "re"used
1 parent 05422b9 commit 3ae8828

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

compiler/src/IR.hs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,6 @@ instance ComputesDependencies FunDef where
154154
dependencies (FunDef _ _ _ bb) = dependencies bb
155155

156156

157-
ppDeps :: ComputesDependencies a => a -> (PP.Doc , PP.Doc, PP.Doc)
158-
ppDeps a = let (ffs_0,lls_0, atoms_0) = execWriter (dependencies a)
159-
(ffs, lls, aas) = (nub ffs_0, nub lls_0, nub atoms_0)
160-
161-
format dd =
162-
let tt = map (PP.doubleQuotes . ppId) dd in
163-
(PP.brackets.PP.hsep) (PP.punctuate PP.comma tt)
164-
in ( format ffs, format lls , format aas )
165-
166-
167157
-----------------------------------------------------------
168158
-- Serialization instances
169159
-----------------------------------------------------------

compiler/src/Stack2JS.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,17 @@ instance ToJS FunDef where
258258
let lits = constsToJS consts
259259
jj <- toJS bb
260260
debug <- ask
261-
let (irdeps, libdeps, atomdeps ) = IR.ppDeps irfdef
261+
262+
let ppDeps :: IR.ComputesDependencies a => a -> (PP.Doc, PP.Doc, PP.Doc)
263+
ppDeps a = let (ffs_0,lls_0, atoms_0) = execWriter (IR.dependencies a)
264+
265+
(ffs, lls, aas) = (nub ffs_0, nub lls_0, nub atoms_0)
266+
267+
format dd = let tt = map (PP.doubleQuotes . ppId) dd
268+
in (PP.brackets.PP.hsep) (PP.punctuate PP.comma tt)
269+
in (format ffs, format lls, format aas)
270+
271+
let (irdeps, libdeps, atomdeps ) = ppDeps irfdef
262272
sparseSlotIdxPP <- ppSparseSlotIdx
263273

264274
return $

0 commit comments

Comments
 (0)