Implement import test, fix import support in compiler and evaluator

This commit is contained in:
Ilya Chernikov
2018-12-09 22:35:39 +01:00
parent fce68102bd
commit 1e74ab5a62
10 changed files with 133 additions and 49 deletions
@@ -234,6 +234,9 @@ interface CompiledScript<out ScriptBase : Any> {
*/
suspend fun getClass(scriptEvaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<KClass<*>>
val importedScripts: List<CompiledScript<*>>?
get() = null
/**
* The scripts compiled along with this one in one module, imported or otherwise included into compilation
*/
val otherScripts: List<CompiledScript<*>>
get() = emptyList()
}
@@ -42,9 +42,9 @@ fun getMergedScriptText(script: SourceCode, configuration: ScriptCompilationConf
/**
* The implementation of the SourceCode for a script located in a file
*/
open class FileScriptSource(val file: File) : ExternalSourceCode {
open class FileScriptSource(val file: File, private val preloadedText: String? = null) : ExternalSourceCode {
override val externalLocation: URL get() = file.toURI().toURL()
override val text: String by lazy { file.readText() }
override val text: String by lazy { preloadedText ?: file.readText() }
}
/**