Code cleanup: get rid of _ (mostly renamed to arg)
This commit is contained in:
@@ -24,7 +24,7 @@ public class JvmCliVirtualFileFinder(private val index: JvmDependenciesIndex) :
|
|||||||
|
|
||||||
override fun findVirtualFileWithHeader(classId: ClassId): VirtualFile? {
|
override fun findVirtualFileWithHeader(classId: ClassId): VirtualFile? {
|
||||||
val classFileName = classId.getRelativeClassName().asString().replace('.', '$')
|
val classFileName = classId.getRelativeClassName().asString().replace('.', '$')
|
||||||
return index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
|
return index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, rootType ->
|
||||||
dir.findChild("$classFileName.class")?.let {
|
dir.findChild("$classFileName.class")?.let {
|
||||||
if (it.isValid()) it else null
|
if (it.isValid()) it else null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ public class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager)
|
|||||||
override fun findPackage(packageName: String): PsiPackage? {
|
override fun findPackage(packageName: String): PsiPackage? {
|
||||||
var found = false
|
var found = false
|
||||||
val packageFqName = packageName.toSafeFqName() ?: return null
|
val packageFqName = packageName.toSafeFqName() ?: return null
|
||||||
index.traverseDirectoriesInPackage(packageFqName) { _, __ ->
|
index.traverseDirectoriesInPackage(packageFqName) { dir, rootType ->
|
||||||
found = true
|
found = true
|
||||||
//abort on first found
|
//abort on first found
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class FakeCallResolver(
|
|||||||
val fakeBindingTrace = context.replaceBindingTrace(fakeTrace)
|
val fakeBindingTrace = context.replaceBindingTrace(fakeTrace)
|
||||||
|
|
||||||
return makeAndResolveFakeCallInContext(receiver, fakeBindingTrace, valueArguments, name, callElement) { fake ->
|
return makeAndResolveFakeCallInContext(receiver, fakeBindingTrace, valueArguments, name, callElement) { fake ->
|
||||||
fakeTrace.commit({ _, key ->
|
fakeTrace.commit({ slice, key ->
|
||||||
// excluding all entries related to fake expression
|
// excluding all entries related to fake expression
|
||||||
key != fake
|
key != fake
|
||||||
}, true)
|
}, true)
|
||||||
|
|||||||
+9
-9
@@ -81,24 +81,24 @@ private object DeclarationKindDetector : JetVisitor<AnnotationHostKind?, Unit?>(
|
|||||||
|
|
||||||
fun detect(declaration: JetDeclaration) = declaration.accept(this, null)
|
fun detect(declaration: JetDeclaration) = declaration.accept(this, null)
|
||||||
|
|
||||||
override fun visitDeclaration(d: JetDeclaration, _: Unit?) = null
|
override fun visitDeclaration(d: JetDeclaration, data: Unit?) = null
|
||||||
|
|
||||||
override fun visitClass(d: JetClass, _: Unit?) = detect(d, if (d.isInterface()) "interface" else "class")
|
override fun visitClass(d: JetClass, data: Unit?) = detect(d, if (d.isInterface()) "interface" else "class")
|
||||||
|
|
||||||
override fun visitNamedFunction(d: JetNamedFunction, _: Unit?) = detect(d, "fun")
|
override fun visitNamedFunction(d: JetNamedFunction, data: Unit?) = detect(d, "fun")
|
||||||
|
|
||||||
override fun visitProperty(d: JetProperty, _: Unit?) = detect(d, d.getValOrVarKeyword().getText()!!)
|
override fun visitProperty(d: JetProperty, data: Unit?) = detect(d, d.getValOrVarKeyword().getText()!!)
|
||||||
|
|
||||||
override fun visitMultiDeclaration(d: JetMultiDeclaration, _: Unit?) = detect(d, d.getValOrVarKeyword()?.getText() ?: "val",
|
override fun visitMultiDeclaration(d: JetMultiDeclaration, data: Unit?) = detect(d, d.getValOrVarKeyword()?.getText() ?: "val",
|
||||||
name = d.getEntries().map { it.getName()!! }.join(", ", "(", ")"))
|
name = d.getEntries().map { it.getName()!! }.join(", ", "(", ")"))
|
||||||
|
|
||||||
override fun visitTypeParameter(d: JetTypeParameter, _: Unit?) = detect(d, "type parameter", newLineNeeded = false)
|
override fun visitTypeParameter(d: JetTypeParameter, data: Unit?) = detect(d, "type parameter", newLineNeeded = false)
|
||||||
|
|
||||||
override fun visitEnumEntry(d: JetEnumEntry, _: Unit?) = detect(d, "enum entry")
|
override fun visitEnumEntry(d: JetEnumEntry, data: Unit?) = detect(d, "enum entry")
|
||||||
|
|
||||||
override fun visitParameter(d: JetParameter, _: Unit?) = detect(d, "parameter", newLineNeeded = false)
|
override fun visitParameter(d: JetParameter, data: Unit?) = detect(d, "parameter", newLineNeeded = false)
|
||||||
|
|
||||||
override fun visitObjectDeclaration(d: JetObjectDeclaration, _: Unit?): AnnotationHostKind? {
|
override fun visitObjectDeclaration(d: JetObjectDeclaration, data: Unit?): AnnotationHostKind? {
|
||||||
if (d.isCompanion()) return detect(d, "companion object", name = "${d.getName()} of ${d.getStrictParentOfType<JetClass>()?.getName()}")
|
if (d.isCompanion()) return detect(d, "companion object", name = "${d.getName()} of ${d.getStrictParentOfType<JetClass>()?.getName()}")
|
||||||
if (d.getParent() is JetObjectLiteralExpression) return null
|
if (d.getParent() is JetObjectLiteralExpression) return null
|
||||||
return detect(d, "object")
|
return detect(d, "object")
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class KotlinConsoleRunner(
|
|||||||
|
|
||||||
keeper.putVirtualFileToConsole(consoleFile, this)
|
keeper.putVirtualFileToConsole(consoleFile, this)
|
||||||
processHandler.addProcessListener(object : ProcessAdapter() {
|
processHandler.addProcessListener(object : ProcessAdapter() {
|
||||||
override fun processTerminated(_: ProcessEvent) {
|
override fun processTerminated(event: ProcessEvent) {
|
||||||
keeper.removeConsole(consoleFile)
|
keeper.removeConsole(consoleFile)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -123,7 +123,7 @@ public class KotlinConsoleRunner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createExecuteActionHandler() = object : ProcessBackedConsoleExecuteActionHandler(processHandler, false) {
|
override fun createExecuteActionHandler() = object : ProcessBackedConsoleExecuteActionHandler(processHandler, false) {
|
||||||
override fun runExecuteAction(_: LanguageConsoleView) = executor.executeCommand()
|
override fun runExecuteAction(consoleView: LanguageConsoleView) = executor.executeCommand()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fillToolBarActions(toolbarActions: DefaultActionGroup,
|
override fun fillToolBarActions(toolbarActions: DefaultActionGroup,
|
||||||
|
|||||||
+1
-1
@@ -60,6 +60,6 @@ public class KotlinConsoleModuleDialog(private val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createRunAction(module: Module) = object : AnAction(module.name) {
|
private fun createRunAction(module: Module) = object : AnAction(module.name) {
|
||||||
override fun actionPerformed(_: AnActionEvent) = runConsole(module)
|
override fun actionPerformed(e: AnActionEvent) = runConsole(module)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,5 +57,5 @@ public class BuildAndRestartConsoleAction(
|
|||||||
private val runner: KotlinConsoleRunner
|
private val runner: KotlinConsoleRunner
|
||||||
) : AnAction("Build and restart", "Build module '${runner.module.name}' and restart", AllIcons.Actions.Restart) {
|
) : AnAction("Build and restart", "Build module '${runner.module.name}' and restart", AllIcons.Actions.Restart) {
|
||||||
|
|
||||||
override fun actionPerformed(_: AnActionEvent) = runner.compilerHelper.compileModule()
|
override fun actionPerformed(e: AnActionEvent) = runner.compilerHelper.compileModule()
|
||||||
}
|
}
|
||||||
+1
-1
@@ -24,5 +24,5 @@ public class KotlinConsoleGutterContentProvider : BasicGutterContentProvider() {
|
|||||||
* This method overriding is needed to prevent [BasicGutterContentProvider] from adding some strange unicode
|
* This method overriding is needed to prevent [BasicGutterContentProvider] from adding some strange unicode
|
||||||
* symbols of zero width and to ease range highlighting.
|
* symbols of zero width and to ease range highlighting.
|
||||||
*/
|
*/
|
||||||
override fun beforeEvaluate(_: Editor) = Unit
|
override fun beforeEvaluate(editor: Editor) = Unit
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class CodeBuilder(private val topElement: PsiElement?, private var docConverter:
|
|||||||
|
|
||||||
if (prefix.lineBreaksBefore > 0) {
|
if (prefix.lineBreaksBefore > 0) {
|
||||||
val lineBreaksToAdd = prefix.lineBreaksBefore - builder.trailingLineBreakCount()
|
val lineBreaksToAdd = prefix.lineBreaksBefore - builder.trailingLineBreakCount()
|
||||||
for (_ in 1..lineBreaksToAdd) {
|
for (it in 1..lineBreaksToAdd) {
|
||||||
append("\n", false)
|
append("\n", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user