Display function value properly
This commit is contained in:
committed by
Ilya Chernikov
parent
c901d6cebc
commit
396ba6cdd5
+1
-1
@@ -110,7 +110,7 @@ open class GenericReplEvaluator(
|
||||
|
||||
val resultFieldName = scriptResultFieldName(compileResult.lineId.no)
|
||||
val resultField = scriptClass.getDeclaredField(resultFieldName).apply { isAccessible = true }
|
||||
val resultValue: Any? = resultField.get(scriptInstance)
|
||||
val resultValue: Any? = if (!compileResult.isFunctionType) resultField.get(scriptInstance) else "<function>"
|
||||
|
||||
return if (compileResult.hasResult) ReplEvalResult.ValueResult(resultFieldName, resultValue, compileResult.type)
|
||||
else ReplEvalResult.UnitResult()
|
||||
|
||||
@@ -89,7 +89,8 @@ sealed class ReplCompileResult : Serializable {
|
||||
val classes: List<CompiledClassData>,
|
||||
val hasResult: Boolean,
|
||||
val classpathAddendum: List<File>,
|
||||
val type: String?) : ReplCompileResult() {
|
||||
val type: String?,
|
||||
val isFunctionType: Boolean) : ReplCompileResult() {
|
||||
companion object { private val serialVersionUID: Long = 2L }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user