Improve class name generation for scripts and REPL snippets

- allow to override default name/scheme
- implement host/engine specific names for jsr223 to avoid classloading
  clashes (also fix "eval in eval" test)
This commit is contained in:
Ilya Chernikov
2019-09-16 14:13:09 +02:00
parent 6de05bb2c7
commit d3b826c71d
7 changed files with 43 additions and 7 deletions
@@ -109,7 +109,6 @@ open class GenericReplCompiler(
CompilationErrorHandler.THROW_EXCEPTION
)
val generatedClassname = makeScriptBaseName(codeLine)
compilerState.history.push(LineId(codeLine), scriptDescriptor)
val classes = generationState.factory.asList().map { CompiledClassData(it.relativePath, it.asByteArray()) }
@@ -117,7 +116,7 @@ open class GenericReplCompiler(
return ReplCompileResult.CompiledClasses(
LineId(codeLine),
compilerState.history.map { it.id },
generatedClassname,
scriptDescriptor.name.identifier,
classes,
generationState.scriptSpecific.resultFieldName != null,
classpathAddendum ?: emptyList(),