[minor] Fix potential problems with sequence, add a todo

This commit is contained in:
Ilya Chernikov
2019-08-27 14:47:24 +02:00
parent c9b25cad01
commit 947867286c
2 changed files with 4 additions and 4 deletions
@@ -154,10 +154,10 @@ private fun CompiledScript<*>.makeClassLoaderFromDependencies(baseClassLoader: C
(dep as? JvmDependency)?.classpath?.asSequence()?.map { it.toURI().toURL() } ?: emptySequence()
}
?: emptySequence()
}.distinct()
}.distinct().toList()
// TODO: previous dependencies and classloaders should be taken into account here
return if (dependencies.none()) baseClassLoader
else URLClassLoader(dependencies.toList().toTypedArray(), baseClassLoader)
return if (dependencies.isEmpty()) baseClassLoader
else URLClassLoader(dependencies.toTypedArray(), baseClassLoader)
}
const val KOTLIN_SCRIPT_METADATA_PATH = "META-INF/kotlin/script"
@@ -89,7 +89,7 @@ internal fun getScriptKtFile(
val scriptText = getMergedScriptText(script, scriptCompilationConfiguration)
val virtualFile = ScriptLightVirtualFile(
script.scriptFileName(script, scriptCompilationConfiguration),
(script as? FileBasedScriptSource)?.file?.path,
(script as? FileBasedScriptSource)?.file?.path, // TODO: should be absolute path here
scriptText
)
val ktFile = psiFileFactory.trySetupPsiForFile(virtualFile, KotlinLanguage.INSTANCE, true, false) as KtFile?