Refactoring: Extract JetClassOrObject.getOrCreateBody() function

This commit is contained in:
Alexey Sedunov
2015-07-13 15:58:46 +03:00
parent 83e28b360f
commit 3c36795984
4 changed files with 8 additions and 22 deletions
@@ -44,6 +44,8 @@ abstract public class JetClassOrObject : JetTypeParameterListOwnerStub<KotlinCla
public fun getBody(): JetClassBody? = getStubOrPsiChild(JetStubElementTypes.CLASS_BODY)
public fun getOrCreateBody(): JetClassBody = getBody() ?: add(JetPsiFactory(this).createEmptyClassBody()) as JetClassBody
public fun isTopLevel(): Boolean = getStub()?.isTopLevel() ?: (getParent() is JetFile)
public fun isLocal(): Boolean = getStub()?.isLocal() ?: JetPsiUtil.isLocal(this)