2 export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName,
3 moduleOfName, nameOfName, createName, valueNamesOf]
6 include "SCL/ReflectionJava"
8 importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where
10 unsafeSclValueByName_ :: ModuleRepository -> String -> <Proc> a
12 @JavaName getSourceRepository
13 moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository
16 moduleByName_ :: ModuleRepository -> String -> <Proc> Failable Module
18 importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" where
19 data ModuleSourceRepository
21 @JavaName getModuleNames
22 sclModuleNames_ :: ModuleSourceRepository -> [String]
24 importJava "org.simantics.scl.compiler.errors.Failable" where
27 didSucceed :: Failable a -> Boolean
28 getResult :: Failable a -> Maybe a
30 importJava "org.simantics.scl.compiler.module.Module" where
33 @JavaName getValueNames
34 valueNamesOf_ :: Module -> [String]
36 importJava "org.simantics.scl.compiler.common.names.Name" where
40 moduleOfName_ :: Name -> String
42 nameOfName_ :: Name -> String
45 createName_ :: String -> String -> Name
47 instance Show Name where
48 sb <+ n = sb << moduleOfName n << "/" << nameOfName n
50 moduleOfName = moduleOfName_
51 nameOfName = nameOfName_
52 createName = createName_
53 valueNamesOf = valueNamesOf_
57 unsafeSclValueByName :: String -> <Proc> a
58 unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY
60 possibleUnsafeSclValueByName :: String -> <Proc> Maybe a
61 possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing
63 sclModuleNames :: <Proc> [String]
64 sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY)
66 moduleByName :: String -> <Proc> Maybe Module
67 moduleByName name = getResult failable
69 failable = moduleByName_ MODULE_REPOSITORY name