From 79123d6bb6ad46ff57948580a6c40e6e01d1cae0 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Thu, 16 Oct 2014 15:13:34 +0400 Subject: [PATCH] Minor --- .../org/jetbrains/jet/plugin/completion/KeywordCompletion.kt | 5 ++--- idea/testData/completion/keywords/AfterFuns.kt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt b/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt index 67ffb52b183..9029841811a 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/KeywordCompletion.kt @@ -176,11 +176,10 @@ object KeywordCompletion { private fun PsiElement.prevLeafSkipWhitespacesAndComments(): PsiElement? { var leaf = prevLeaf() - while (leaf != null) { - if (leaf !is PsiWhiteSpace && leaf !is PsiComment) return leaf + while (leaf is PsiWhiteSpace || leaf is PsiComment) { leaf = leaf!!.prevLeaf() } - return null + return leaf } // builds text within scope (or from the start of the file) before position element excluding almost all declarations diff --git a/idea/testData/completion/keywords/AfterFuns.kt b/idea/testData/completion/keywords/AfterFuns.kt index c147bc4047c..2f1482b668c 100644 --- a/idea/testData/completion/keywords/AfterFuns.kt +++ b/idea/testData/completion/keywords/AfterFuns.kt @@ -4,7 +4,7 @@ class A { } fun bar() { - fun() + foo() }