]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/scl/SCL/ModuleRepository.scl
(refs #7811) Some new functions for SCL reflection
[simantics/platform.git] / bundles / org.simantics.scl.compiler / scl / SCL / ModuleRepository.scl
index eceb418be1a70c5a439737888c491681c040c5b9..7d035d8cf6e380c66e3a16d228a237e34ecd2c7b 100644 (file)
@@ -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 -> <Proc> 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 -> <Proc> a
     
+    @JavaName getValueRef
+    sclValueRef_ :: ModuleRepository -> String -> <Proc> Maybe SCLValue
+    
     @JavaName getSourceRepository
     moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository
     
@@ -33,6 +45,8 @@ importJava "org.simantics.scl.compiler.errors.Failable" where
 unsafeSclValueByName :: String -> <Proc> a
 unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY
 
+sclValueRef name = sclValueRef_ MODULE_REPOSITORY name
+
 possibleUnsafeSclValueByName :: String -> <Proc> Maybe a
 possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing