module {
export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName,
- documentationOfSCLValue, sclValueRef]
+ documentationOfSCLValue, sclValueRef, possibleModuleSourceText]
}
include "./CurrentModuleRepository"
@JavaName getModuleNames
sclModuleNames_ :: ModuleSourceRepository -> [String]
+
+ @JavaName getPossibleSourceText
+ possibleModuleSourceText_ :: ModuleSourceRepository -> String -> <Proc> Maybe String
importJava "org.simantics.scl.compiler.errors.Failable" where
data Failable a
moduleByName :: String -> <Proc> Maybe Module
moduleByName name = getResult failable
where
- failable = moduleByName_ MODULE_REPOSITORY name
\ No newline at end of file
+ failable = moduleByName_ MODULE_REPOSITORY name
+
+possibleModuleSourceText :: String -> <Proc> Maybe String
+possibleModuleSourceText name = possibleModuleSourceText_ (moduleSourceRepositoryOf MODULE_REPOSITORY) name
\ No newline at end of file
package org.simantics.scl.compiler.source.repository;
+import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import org.simantics.scl.compiler.module.repository.ModuleRepository;
import org.simantics.scl.compiler.module.repository.UpdateListener;
import org.simantics.scl.compiler.source.ModuleSource;
+import org.simantics.scl.compiler.source.TextualModuleSource;
import gnu.trove.procedure.TObjectProcedure;
*/
default void clear() {
}
+
+ default String getPossibleSourceText(String moduleName) throws IOException {
+ ModuleSource moduleSource = getModuleSource(moduleName, null);
+ if(moduleSource == null)
+ return null;
+ if(!(moduleSource instanceof TextualModuleSource))
+ return null;
+ return ((TextualModuleSource)moduleSource).getSourceText(null);
+ }
}