X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fscl%2FSCL%2FModuleRepository.scl;h=7d035d8cf6e380c66e3a16d228a237e34ecd2c7b;hp=eceb418be1a70c5a439737888c491681c040c5b9;hb=23e46c2b019eeb71a911f6d0837b2de20da28196;hpb=c07a8f3914123e9b75a11290994a8b78bd3f01f7 diff --git a/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl b/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl index eceb418be..7d035d8cf 100644 --- a/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl +++ b/bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl @@ -1,10 +1,19 @@ module { - export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName] + export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName, + documentationOfSCLValue, sclValueRef] } include "./CurrentModuleRepository" include "./Module" +importJava "org.simantics.scl.compiler.elaboration.modules.SCLValue" where + data SCLValue + + @JavaName getDocumentation + documentationOfSCLValue_ :: SCLValue -> Maybe String + +documentationOfSCLValue value = fromMaybe "" (documentationOfSCLValue_ value) + importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where // data ModuleRepository // defined in CurrentModuleRepository @@ -12,6 +21,9 @@ importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where @JavaName getValue unsafeSclValueByName_ :: ModuleRepository -> String -> a + @JavaName getValueRef + sclValueRef_ :: ModuleRepository -> String -> Maybe SCLValue + @JavaName getSourceRepository moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository @@ -33,6 +45,8 @@ importJava "org.simantics.scl.compiler.errors.Failable" where unsafeSclValueByName :: String -> a unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY +sclValueRef name = sclValueRef_ MODULE_REPOSITORY name + possibleUnsafeSclValueByName :: String -> Maybe a possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing