[groovy] improve readability: convert if-else to when expression
authorDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Mon, 24 Oct 2016 10:50:18 +0000 (13:50 +0300)
committerDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Mon, 24 Oct 2016 10:50:18 +0000 (13:50 +0300)
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/delegatesTo/grDelegatesToUtil.kt

index cab5ecae91a2a68ed68c53149c2b8f74166aeb90..b58f00800a117643060ffabf80804c0dea902372 100644 (file)
@@ -55,15 +55,11 @@ fun getContainingCall(closableBlock: GrClosableBlock): GrCall? {
   return null
 }
 
-fun resolveActualCall(call: GrCall): GroovyResolveResult = if (call is GrMethodCall) {
-  CachedValuesManager.getCachedValue(call) {
-    Result.create(
-        doResolveActualCall(call), PsiModificationTracker.MODIFICATION_COUNT
-    )
+fun resolveActualCall(call: GrCall): GroovyResolveResult = when (call) {
+  is GrMethodCall -> CachedValuesManager.getCachedValue(call) {
+    Result.create(doResolveActualCall(call), PsiModificationTracker.MODIFICATION_COUNT)
   }
-}
-else {
-  call.advancedResolve()
+  else -> call.advancedResolve()
 }
 
 private fun doResolveActualCall(call: GrMethodCall): GroovyResolveResult {