Minor fixes after inspecting code-style

This commit is contained in:
Vitaliy.Bibaev
2018-06-09 12:42:24 +03:00
committed by Yan Zhulanow
parent 2d22267cf1
commit c1ebc2788d
8 changed files with 19 additions and 20 deletions
@@ -5,5 +5,5 @@ package org.jetbrains.kotlin.idea.debugger.sequence.lib
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
object LibraryUtil { object LibraryUtil {
val KOTLIN_LANGUAGE_ID = "kotlin" const val KOTLIN_LANGUAGE_ID = "kotlin"
} }
@@ -63,7 +63,7 @@ class KotlinSequencesSupport : LibrarySupportBase() {
private fun sortedOperations(vararg names: String): Array<IntermediateOperation> = private fun sortedOperations(vararg names: String): Array<IntermediateOperation> =
names.map { SortedOperation(it) }.toTypedArray() names.map { SortedOperation(it) }.toTypedArray()
private class FilterIsInstanceOperationHandler() : IntermediateOperationBase( private class FilterIsInstanceOperationHandler : IntermediateOperationBase(
"filterIsInstance", ::FilterIsInstanceHandler, "filterIsInstance", ::FilterIsInstanceHandler,
SimplePeekCallTraceInterpreter(), FilteredMapResolver() SimplePeekCallTraceInterpreter(), FilteredMapResolver()
) )
@@ -29,11 +29,10 @@ class KotlinChainTransformerImpl(private val typeExtractor: CallTypeExtractor) :
val intermediateCalls = mutableListOf<IntermediateStreamCall>() val intermediateCalls = mutableListOf<IntermediateStreamCall>()
for (call in callChain.subList(0, callChain.size - 1)) { for (call in callChain.subList(0, callChain.size - 1)) {
val (typeBefore, typeAfter) = typeExtractor.extractIntermediateCallTypes(call) val (typeBefore, typeAfter) = typeExtractor.extractIntermediateCallTypes(call)
intermediateCalls += IntermediateStreamCallImpl(call.callName(), intermediateCalls += IntermediateStreamCallImpl(
call.valueArguments.map { createCallArgument(call, it) }, call.callName(), call.valueArguments.map { createCallArgument(call, it) },
typeBefore, typeBefore, typeAfter,
typeAfter, call.textRange
call.textRange
) )
} }
@@ -46,7 +46,7 @@ open class TerminatedChainBuilder(
val parentCall = expression.previousCall() val parentCall = expression.previousCall()
if (parentCall is KtCallExpression && callChecker.isStreamCall(parentCall)) { if (parentCall is KtCallExpression && callChecker.isStreamCall(parentCall)) {
myPreviousCalls.put(expression, parentCall) myPreviousCalls[expression] = parentCall
updateCallTree(parentCall) updateCallTree(parentCall)
} }
} }
@@ -64,7 +64,7 @@ open class TerminatedChainBuilder(
current = myPreviousCalls[current] current = myPreviousCalls[current]
} }
Collections.reverse(chain) chain.reverse()
chains.add(chain) chains.add(chain)
} }
@@ -17,10 +17,10 @@ import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.withArgs
*/ */
class FilterCallHandler : BothSemanticsHandler { class FilterCallHandler : BothSemanticsHandler {
private companion object { private companion object {
val VALUES_ARRAY_NAME = "objectsInPredicate" const val VALUES_ARRAY_NAME = "objectsInPredicate"
val PREDICATE_RESULT_ARRAY_NAME = "filteringResults" const val PREDICATE_RESULT_ARRAY_NAME = "filteringResults"
fun oldPredicateVariableName(order: Int): String = "filterPredicate" + order fun oldPredicateVariableName(order: Int): String = "filterPredicate$order"
} }
override fun variablesDeclaration(call: StreamCall, order: Int, dsl: Dsl): List<VariableDeclaration> { override fun variablesDeclaration(call: StreamCall, order: Int, dsl: Dsl): List<VariableDeclaration> {
@@ -18,8 +18,8 @@ import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
*/ */
class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) { class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) {
private companion object { private companion object {
val KEY_EXTRACTOR_VARIABLE_PREFIX = "keyExtractor" const val KEY_EXTRACTOR_VARIABLE_PREFIX = "keyExtractor"
val TRANSITIONS_ARRAY_NAME = "transitionsArray" const val TRANSITIONS_ARRAY_NAME = "transitionsArray"
} }
private val peekHandler = PeekTraceHandler(callNumber, "distinctBy", call.typeBefore, call.typeAfter, dsl) private val peekHandler = PeekTraceHandler(callNumber, "distinctBy", call.typeBefore, call.typeAfter, dsl)
@@ -43,7 +43,7 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) :
doKotlinTearDown(LightPlatformTestCase.getProject(), { super.tearDown() }) doKotlinTearDown(LightPlatformTestCase.getProject(), { super.tearDown() })
} }
override final fun getRelativeTestPath(): String = relativePath final override fun getRelativeTestPath(): String = relativePath
override fun setUp() { override fun setUp() {
super.setUp() super.setUp()
@@ -106,7 +106,7 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) :
checkChains(chains) checkChains(chains)
} }
protected fun checkChains(chains: MutableList<StreamChain>) { private fun checkChains(chains: MutableList<StreamChain>) {
TestCase.assertFalse(chains.isEmpty()) TestCase.assertFalse(chains.isEmpty())
} }
} }
@@ -49,7 +49,7 @@ abstract class KotlinTraceTestCase : KotlinDebuggerTestBase() {
fun doTest(filePath: String) = doTestImpl(filePath) fun doTest(filePath: String) = doTestImpl(filePath)
override fun createDebugProcess(path: String) { override fun createDebugProcess(path: String) {
val filePath = Paths.get(path); val filePath = Paths.get(path)
FileBasedIndex.getInstance().requestReindex(VfsUtil.findFileByIoFile(filePath.toFile(), true)!!) FileBasedIndex.getInstance().requestReindex(VfsUtil.findFileByIoFile(filePath.toFile(), true)!!)
val packagePath = StringUtil.substringAfterLast(filePath.parent.toAbsolutePath().toString(), "src${File.separatorChar}") val packagePath = StringUtil.substringAfterLast(filePath.parent.toAbsolutePath().toString(), "src${File.separatorChar}")
?: throw AssertionError("test data must be placed into test app project in 'src' directory") ?: throw AssertionError("test data must be placed into test app project in 'src' directory")
@@ -145,7 +145,7 @@ abstract class KotlinTraceTestCase : KotlinDebuggerTestBase() {
}, testRootDisposable) }, testRootDisposable)
} }
protected fun getPositionResolver(): DebuggerPositionResolver { private fun getPositionResolver(): DebuggerPositionResolver {
return DebuggerPositionResolverImpl() return DebuggerPositionResolverImpl()
} }
@@ -169,7 +169,7 @@ abstract class KotlinTraceTestCase : KotlinDebuggerTestBase() {
traceChecker.checkResolvedChain(resolvedTrace) traceChecker.checkResolvedChain(resolvedTrace)
} }
protected fun handleResultValue(result: Value?) { private fun handleResultValue(result: Value?) {
} }
private fun getResultInterpreter(): TraceResultInterpreter { private fun getResultInterpreter(): TraceResultInterpreter {
@@ -196,7 +196,7 @@ abstract class KotlinTraceTestCase : KotlinDebuggerTestBase() {
fun byIndex(index: Int): ChainSelector { fun byIndex(index: Int): ChainSelector {
return object : ChainSelector { return object : ChainSelector {
override fun select(chains: List<StreamChain>): StreamChain = chains.get(index) override fun select(chains: List<StreamChain>): StreamChain = chains[index]
} }
} }
} }