3 export = [whoCalls, unusedDefinitions]
6 import "SCL/ModuleRepository"
8 @JavaType "org.simantics.scl.compiler.module.debug.SymbolReference"
10 @JavaType "org.simantics.scl.compiler.module.debug.SymbolReference"
11 @FieldNames [referred, referrer, referenceLocation]
12 SymbolReference {referred :: Name, referrer :: Name, referenceLocation :: Location}
14 importJava "org.simantics.scl.compiler.module.debug.ModuleDebugInfo" where
17 symbolReferences :: ModuleDebugInfo -> [SymbolReference]
19 importJava "org.simantics.scl.compiler.module.Module" where
20 @JavaName "getModuleDebugInfo"
22 debugInfo :: Module -> Maybe ModuleDebugInfo
24 whoCalls :: String -> String -> <Proc> [(String, String, Long)]
25 whoCalls moduleName valueName =
26 [ (callerModuleName, nameOfName referrer, referenceLocation)
27 | callerModuleName <- sclModuleNames
28 , Just callerModule = moduleByName callerModuleName
29 , Just debugInfo = debugInfo callerModule
30 , SymbolReference {referred, referrer, referenceLocation} <- symbolReferences debugInfo
34 name = createName moduleName valueName
36 unusedDefinitions :: <Proc> [Name]
38 [ createName moduleName def
39 | moduleName <- sclModuleNames
40 , Just module = moduleByName moduleName
41 , def <- valueNamesOf module
45 | callerModuleName <- sclModuleNames
46 , Just callerModule = moduleByName callerModuleName
47 , Just debugInfo = debugInfo callerModule
48 , SymbolReference {referred} <- symbolReferences debugInfo