Add total reset to repl history and state interfaces
This commit is contained in:
+5
-3
@@ -37,10 +37,12 @@ class RemoteReplCompilerStateHistory(private val state: RemoteReplCompilerState)
|
||||
throw NotImplementedError("pop from remote history is not supported")
|
||||
}
|
||||
|
||||
override fun reset(): Iterable<ILineId> = state.replStateFacade.historyReset().apply {
|
||||
currentGeneration.incrementAndGet()
|
||||
}
|
||||
|
||||
override fun resetTo(id: ILineId): Iterable<ILineId> = state.replStateFacade.historyResetTo(id).apply {
|
||||
if (isNotEmpty()) {
|
||||
currentGeneration.incrementAndGet()
|
||||
}
|
||||
currentGeneration.incrementAndGet()
|
||||
}
|
||||
|
||||
val currentGeneration = AtomicInteger(REPL_CODE_LINE_FIRST_GEN)
|
||||
|
||||
+3
@@ -31,6 +31,9 @@ interface ReplStateFacade : Remote {
|
||||
@Throws(RemoteException::class)
|
||||
fun historyGet(index: Int): ILineId
|
||||
|
||||
@Throws(RemoteException::class)
|
||||
fun historyReset(): List<ILineId>
|
||||
|
||||
@Throws(RemoteException::class)
|
||||
fun historyResetTo(id: ILineId): List<ILineId>
|
||||
}
|
||||
@@ -35,5 +35,7 @@ class RemoteReplStateFacadeServer(val _id: Int,
|
||||
|
||||
override fun historyGet(index: Int): ILineId = state.history[index].id
|
||||
|
||||
override fun historyReset(): List<ILineId> = state.history.reset().toList()
|
||||
|
||||
override fun historyResetTo(id: ILineId): List<ILineId> = state.history.resetTo(id).toList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user