Put lines history into all data structures returned by repl, refactor storage and passing of the history for that

This commit is contained in:
Ilya Chernikov
2016-11-21 19:16:55 +01:00
parent 125cc6ebfb
commit 7a79fff9d6
12 changed files with 156 additions and 84 deletions
@@ -71,8 +71,8 @@ open class KotlinRemoteReplClientBase(
})
}
override fun check(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplCheckResult {
return compileService.remoteReplLineCheck(sessionId, codeLine, history.toList()).get()
override fun check(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplCheckResult {
return compileService.remoteReplLineCheck(sessionId, codeLine, history).get()
}
}
@@ -101,8 +101,8 @@ class KotlinRemoteReplCompiler(
operationsTracer = operationsTracer
), ReplCompiler {
override fun compile(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplCompileResult {
return compileService.remoteReplLineCompile(sessionId, codeLine, history.toList()).get()
override fun compile(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplCompileResult {
return compileService.remoteReplLineCompile(sessionId, codeLine, history).get()
}
}
@@ -138,7 +138,7 @@ class KotlinRemoteReplEvaluator(
operationsTracer = operationsTracer
), ReplEvaluator {
override fun eval(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplEvalResult {
return compileService.remoteReplLineEval(sessionId, codeLine, history.toList()).get()
override fun eval(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplEvalResult {
return compileService.remoteReplLineEval(sessionId, codeLine, history).get()
}
}
@@ -141,11 +141,12 @@ open class KotlinJvmReplService(
}
}
override fun check(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplCheckResult {
override fun check(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplCheckResult {
operationsTracer?.before("check")
try {
return replCompiler?.check(codeLine, history)
?: ReplCheckResult.Error(messageCollector.firstErrorMessage ?: "Unknown error",
?: ReplCheckResult.Error(history,
messageCollector.firstErrorMessage ?: "Unknown error",
messageCollector.firstErrorLocation ?: CompilerMessageLocation.NO_LOCATION)
}
finally {
@@ -153,11 +154,12 @@ open class KotlinJvmReplService(
}
}
override fun compile(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplCompileResult {
override fun compile(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplCompileResult {
operationsTracer?.before("compile")
try {
return replCompiler?.compile(codeLine, history)
?: ReplCompileResult.Error(messageCollector.firstErrorMessage ?: "Unknown error",
?: ReplCompileResult.Error(history,
messageCollector.firstErrorMessage ?: "Unknown error",
messageCollector.firstErrorLocation ?: CompilerMessageLocation.NO_LOCATION)
}
finally {
@@ -165,11 +167,12 @@ open class KotlinJvmReplService(
}
}
override fun eval(codeLine: ReplCodeLine, history: Iterable<ReplCodeLine>): ReplEvalResult = synchronized(this) {
override fun eval(codeLine: ReplCodeLine, history: List<ReplCodeLine>): ReplEvalResult = synchronized(this) {
operationsTracer?.before("eval")
try {
return replCompiler?.let { compileAndEval(it, compiledEvaluator, codeLine, history) }
?: ReplEvalResult.Error.CompileTime(messageCollector.firstErrorMessage ?: "Unknown error",
?: ReplEvalResult.Error.CompileTime(history,
messageCollector.firstErrorMessage ?: "Unknown error",
messageCollector.firstErrorLocation ?: CompilerMessageLocation.NO_LOCATION)
}
finally {