X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fscl%2FSCL%2FReflection.scl;fp=bundles%2Forg.simantics.scl.compiler%2Fscl%2FSCL%2FReflection.scl;h=cf8b88eeac1aa42ded978b60a4b6cd77d735d98a;hb=db54e4ca935111cfe3574a01bb9be3cf083258cc;hp=0000000000000000000000000000000000000000;hpb=97bda0b72e59e22e64d757b340b6bf8d10d11c66;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/scl/SCL/Reflection.scl b/bundles/org.simantics.scl.compiler/scl/SCL/Reflection.scl new file mode 100644 index 000000000..cf8b88eea --- /dev/null +++ b/bundles/org.simantics.scl.compiler/scl/SCL/Reflection.scl @@ -0,0 +1,27 @@ +module { + export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames] +} + +include "SCL/ReflectionJava" + +importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where + @JavaName getValue + unsafeSclValueByName_ :: ModuleRepository -> String -> a + + @JavaName getSourceRepository + moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository + +importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" where + data ModuleSourceRepository + + @JavaName getModuleNames + sclModuleNames_ :: ModuleSourceRepository -> [String] + +unsafeSclValueByName :: String -> a +unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY + +possibleUnsafeSclValueByName :: String -> Maybe a +possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing + +sclModuleNames :: [String] +sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY)