New J2K: Add support of enum consts initializingClass
This commit is contained in:
committed by
Ilya Kirillov
parent
49a8a8f116
commit
763ea3480d
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user