New J2K: Add support of enum consts initializingClass

This commit is contained in:
Ilya Kirillov
2018-12-18 14:28:18 +03:00
committed by Ilya Kirillov
parent 49a8a8f116
commit 763ea3480d
4 changed files with 7 additions and 0 deletions
@@ -321,6 +321,7 @@ class JavaToJKTreeBuilder(var symbolProvider: JKSymbolProvider) {
JKEnumConstantImpl(
JKNameIdentifierImpl(name),
with(expressionTreeMapper) { argumentList.toJK() },
initializingClass?.createClassBody() ?: JKEmptyClassBodyImpl(),
JKTypeElementImpl(JKClassTypeImpl(symbolProvider.provideDirectSymbol(containingClass!!) as JKClassSymbol, emptyList()))
)
@@ -253,6 +253,9 @@ class NewCodeBuilder {
enumConstant.arguments.accept(this)
}
}
if (enumConstant.body !is JKEmptyClassBody) {
enumConstant.body.accept(this)
}
}
override fun visitKtInitDeclaration(ktInitDeclaration: JKKtInitDeclaration) {
@@ -460,10 +460,12 @@ class JKTypeParameterTypeImpl(
class JKEnumConstantImpl(
name: JKNameIdentifier,
arguments: JKExpressionList,
body: JKClassBody,
type: JKTypeElement
) : JKEnumConstant, JKBranchElementBase(), PsiOwner by PsiOwnerImpl() {
override var name: JKNameIdentifier by child(name)
override val arguments: JKExpressionList by child(arguments)
override val body: JKClassBody by child(body)
override var type: JKTypeElement by child(type)
override var initializer: JKExpression by child(JKStubExpressionImpl())
@@ -383,6 +383,7 @@ interface JKTypeParameterListOwner : JKTreeElement {
interface JKEnumConstant : JKVariable {
val arguments: JKExpressionList
val body: JKClassBody
}
interface JKForInStatement : JKStatement {