From e31e63aabed7c8bd63a278b22cada88b18216902 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Mon, 17 Nov 2014 15:07:15 +0300 Subject: [PATCH] Small refactoring: replaced code with 'getOrPut' library function --- .../jetbrains/jet/lang/resolve/scopes/SubstitutingScope.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/SubstitutingScope.kt b/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/SubstitutingScope.kt index d259439e68f..de19946a732 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/SubstitutingScope.kt +++ b/core/descriptors/src/org/jetbrains/jet/lang/resolve/scopes/SubstitutingScope.kt @@ -38,12 +38,7 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su substitutedDescriptors = HashMap() } - var substituted: DeclarationDescriptor? = substitutedDescriptors!!.get(descriptor) - if (substituted == null && !substitutedDescriptors!!.containsKey(descriptor)) { - substituted = descriptor.substitute(substitutor) - - substitutedDescriptors!!.put(descriptor, substituted) - } + val substituted = substitutedDescriptors!!.getOrPut(descriptor, { descriptor.substitute(substitutor) }) [suppress("UNCHECKED_CAST")] return substituted as D?