From 310ee67c351fd4acb6699f26c355a8bac72efb23 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Thu, 7 Dec 2017 01:38:33 +0900 Subject: [PATCH] REPL, minor: Ignore empty lines (#KT-21611) --- .../kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt index cda2ce466ff..094d0bcf837 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt @@ -31,6 +31,10 @@ class GenericReplCompilingEvaluator(val compiler: ReplCompiler, override fun createState(lock: ReentrantReadWriteLock): IReplStageState<*> = AggregatedReplStageState(compiler.createState(lock), evaluator.createState(lock), lock) override fun compileAndEval(state: IReplStageState<*>, codeLine: ReplCodeLine, scriptArgs: ScriptArgsWithTypes?, invokeWrapper: InvokeWrapper?): ReplEvalResult { + if (codeLine.code.trim().isEmpty()) { + return ReplEvalResult.UnitResult() + } + return state.lock.write { val aggregatedState = state.asState(AggregatedReplStageState::class.java) val compiled = compiler.compile(state, codeLine)