on master help sign in
Add names in types to call graph

This changes the purpose of the call graph - it now tracks all the names which are required by a definition, either in the type or in the body, including data and type constructor definitions.

commitd3dc4186893c44e683a7ab554b8f573dfd22bf64 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 27 Jan 2016, 00:11 (11 years ago) parent0175376
2 files changed+5
src/Idris/Coverage.hs+1 src/Idris/Elab/Type.hs+4
src/Idris/Coverage.hs+1
@@ -474,6 +474,7 @@ buildSCG (_, n) = do
474474 let newscg = buildSCG' ist (rights pats) args
475475 logCoverage 5 $ "SCG is: " ++ show newscg
476476 addToCG n ( cg { scg = newscg } )
477+ _ -> return () -- CG comes from a type declaration only
477478 [] -> logCoverage 5 $ "Could not build SCG for " ++ show n ++ "\n"
478479 x -> error $ "buildSCG: " ++ show (n, x)
479480
src/Idris/Elab/Type.hs+4
@@ -102,6 +102,10 @@ buildType info syn fc opts n ty' = do
102102 logElab 3 ("Implicit " ++ show n ++ " " ++ show impls)
103103 addIBC (IBCImp n)
104104
105+ -- Add the names referenced to the call graph
106+ addCalls n (freeNames cty)
107+ addIBC (IBCCG n)
108+
105109 when (Constructor `notElem` opts) $ do
106110 let pnames = getParamsInType i [] impls cty
107111 let fninfo = FnInfo (param_pos 0 pnames cty)