Forward diagnostics to the evaluation result
This commit is contained in:
committed by
Ilya Chernikov
parent
962a767e54
commit
e5ca572b91
@@ -43,9 +43,10 @@ class BasicJvmReplEvaluator(val scriptEvaluator: ScriptEvaluator = BasicJvmScrip
|
|||||||
}
|
}
|
||||||
|
|
||||||
val snippetVal = snippet.get()
|
val snippetVal = snippet.get()
|
||||||
val newEvalRes = when (val res = scriptEvaluator(snippetVal, currentConfiguration)) {
|
val evalRes = scriptEvaluator(snippetVal, currentConfiguration)
|
||||||
|
val newEvalRes = when (evalRes) {
|
||||||
is ResultWithDiagnostics.Success -> {
|
is ResultWithDiagnostics.Success -> {
|
||||||
val retVal = res.value.returnValue
|
val retVal = evalRes.value.returnValue
|
||||||
when (retVal) {
|
when (retVal) {
|
||||||
is ResultValue.Error -> history.add(retVal.scriptClass, null)
|
is ResultValue.Error -> history.add(retVal.scriptClass, null)
|
||||||
is ResultValue.Value, is ResultValue.Unit -> history.add(retVal.scriptClass, retVal.scriptInstance)
|
is ResultValue.Value, is ResultValue.Unit -> history.add(retVal.scriptClass, retVal.scriptInstance)
|
||||||
@@ -58,7 +59,7 @@ class BasicJvmReplEvaluator(val scriptEvaluator: ScriptEvaluator = BasicJvmScrip
|
|||||||
|
|
||||||
val newNode = lastEvaluatedSnippet.add(newEvalRes)
|
val newNode = lastEvaluatedSnippet.add(newEvalRes)
|
||||||
lastEvaluatedSnippet = newNode
|
lastEvaluatedSnippet = newNode
|
||||||
return newNode.asSuccess()
|
return newNode.asSuccess(evalRes.reports)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user