Smart completion: minor changes

This commit is contained in:
Valentin Kipyatkov
2014-04-22 14:15:07 +04:00
parent e017f4d952
commit 19aa35ffeb
2 changed files with 23 additions and 27 deletions
@@ -62,7 +62,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso
else if (DescriptorUtils.isEnumEntry(descriptor)) { else if (DescriptorUtils.isEnumEntry(descriptor)) {
classifier = { ExpectedInfoClassification.MATCHES } /* we do not need to check type of enum entry because it's taken from proper enum */ classifier = { ExpectedInfoClassification.MATCHES } /* we do not need to check type of enum entry because it's taken from proper enum */
} }
else{ else {
return return
} }
@@ -96,7 +96,6 @@ fun MutableCollection<LookupElement>.addLookupElements(expectedInfos: Collection
} }
fun MutableCollection<LookupElement>.addLookupElementsForNullable(factory: () -> LookupElement?, matchedInfos: Collection<ExpectedInfo>) { fun MutableCollection<LookupElement>.addLookupElementsForNullable(factory: () -> LookupElement?, matchedInfos: Collection<ExpectedInfo>) {
run {
var lookupElement = factory() var lookupElement = factory()
if (lookupElement != null) { if (lookupElement != null) {
lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement!!) { lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement!!) {
@@ -111,10 +110,8 @@ fun MutableCollection<LookupElement>.addLookupElementsForNullable(factory: () ->
lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.suppressAutoInsertion()
add(lookupElement!!.addTail(matchedInfos)) add(lookupElement!!.addTail(matchedInfos))
} }
}
run { lookupElement = factory()
var lookupElement = factory()
if (lookupElement != null) { if (lookupElement != null) {
lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement!!) { lookupElement = object: LookupElementDecorator<LookupElement>(lookupElement!!) {
override fun renderElement(presentation: LookupElementPresentation) { override fun renderElement(presentation: LookupElementPresentation) {
@@ -128,7 +125,6 @@ fun MutableCollection<LookupElement>.addLookupElementsForNullable(factory: () ->
lookupElement = lookupElement!!.suppressAutoInsertion() lookupElement = lookupElement!!.suppressAutoInsertion()
add(lookupElement!!.addTail(matchedInfos)) add(lookupElement!!.addTail(matchedInfos))
} }
}
} }
fun functionType(function: FunctionDescriptor): JetType? { fun functionType(function: FunctionDescriptor): JetType? {