Renamed LazyElement -> DeferredElement
This commit is contained in:
committed by
valentin
parent
17622f8259
commit
567bb6fd1a
@@ -68,8 +68,8 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
public fun convertAnnotation(annotation: PsiAnnotation, brackets: Boolean, newLineAfter: Boolean): Annotation? {
|
public fun convertAnnotation(annotation: PsiAnnotation, brackets: Boolean, newLineAfter: Boolean): Annotation? {
|
||||||
val qualifiedName = annotation.getQualifiedName()
|
val qualifiedName = annotation.getQualifiedName()
|
||||||
if (qualifiedName == CommonClassNames.JAVA_LANG_DEPRECATED && annotation.getParameterList().getAttributes().isEmpty()) {
|
if (qualifiedName == CommonClassNames.JAVA_LANG_DEPRECATED && annotation.getParameterList().getAttributes().isEmpty()) {
|
||||||
val lazyExpression = converter.lazyElement<Expression> { LiteralExpression("\"\"").assignNoPrototype() }
|
val deferredExpression = converter.deferredElement<Expression> { LiteralExpression("\"\"").assignNoPrototype() }
|
||||||
return Annotation(Identifier("deprecated").assignNoPrototype(), listOf(null to lazyExpression), brackets, newLineAfter).assignPrototype(annotation) //TODO: insert comment
|
return Annotation(Identifier("deprecated").assignNoPrototype(), listOf(null to deferredExpression), brackets, newLineAfter).assignPrototype(annotation) //TODO: insert comment
|
||||||
}
|
}
|
||||||
|
|
||||||
val nameRef = annotation.getNameReferenceElement()
|
val nameRef = annotation.getNameReferenceElement()
|
||||||
@@ -86,14 +86,14 @@ class AnnotationConverter(private val converter: Converter) {
|
|||||||
val isVarArg = method == lastMethod /* converted to vararg in Kotlin */
|
val isVarArg = method == lastMethod /* converted to vararg in Kotlin */
|
||||||
val attrValues = convertAttributeValue(value, expectedType, isVarArg, it.getName() == null)
|
val attrValues = convertAttributeValue(value, expectedType, isVarArg, it.getName() == null)
|
||||||
|
|
||||||
attrValues.map { attrName to converter.lazyElement(it) }
|
attrValues.map { attrName to converter.deferredElement(it) }
|
||||||
}
|
}
|
||||||
return Annotation(name, arguments, brackets, newLineAfter).assignPrototype(annotation)
|
return Annotation(name, arguments, brackets, newLineAfter).assignPrototype(annotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun convertAnnotationMethodDefault(method: PsiAnnotationMethod): LazyElement<Expression>? {
|
public fun convertAnnotationMethodDefault(method: PsiAnnotationMethod): DeferredElement<Expression>? {
|
||||||
val value = method.getDefaultValue() ?: return null
|
val value = method.getDefaultValue() ?: return null
|
||||||
return converter.lazyElement(convertAttributeValue(value, method.getReturnType(), false, false).single())
|
return converter.deferredElement(convertAttributeValue(value, method.getReturnType(), false, false).single())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun convertAttributeValue(value: PsiAnnotationMemberValue?, expectedType: PsiType?, isVararg: Boolean, isUnnamed: Boolean): List<(CodeConverter) -> Expression> {
|
private fun convertAttributeValue(value: PsiAnnotationMemberValue?, expectedType: PsiType?, isVararg: Boolean, isUnnamed: Boolean): List<(CodeConverter) -> Expression> {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var baseClassParams: List<LazyElement<Expression>> = listOf()
|
public var baseClassParams: List<DeferredElement<Expression>> = listOf()
|
||||||
private set
|
private set
|
||||||
|
|
||||||
public fun convertConstructor(constructor: PsiMethod,
|
public fun convertConstructor(constructor: PsiMethod,
|
||||||
@@ -193,7 +193,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return FactoryFunction(constructor.declarationIdentifier(), annotations, correctFactoryFunctionAccess(modifiers),
|
return FactoryFunction(constructor.declarationIdentifier(), annotations, correctFactoryFunctionAccess(modifiers),
|
||||||
factoryFunctionType, params, typeParameterList, converter.lazyElement(::convertBody))
|
factoryFunctionType, params, typeParameterList, converter.deferredElement(::convertBody))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
val methodCall = (statement as? PsiExpressionStatement)?.getExpression() as? PsiMethodCallExpression
|
val methodCall = (statement as? PsiExpressionStatement)?.getExpression() as? PsiMethodCallExpression
|
||||||
if (methodCall != null && methodCall.isSuperConstructorCall()) {
|
if (methodCall != null && methodCall.isSuperConstructorCall()) {
|
||||||
baseClassParams = methodCall.getArgumentList().getExpressions().map {
|
baseClassParams = methodCall.getArgumentList().getExpressions().map {
|
||||||
correctedConverter.lazyElement { codeConverter -> codeConverter.correct().convertExpression(it) }
|
correctedConverter.deferredElement { codeConverter -> codeConverter.correct().convertExpression(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
val parameter = params[i]
|
val parameter = params[i]
|
||||||
val indexFromEnd = params.size - i - 1
|
val indexFromEnd = params.size - i - 1
|
||||||
val defaultValue = if (indexFromEnd < lastParamDefaults.size)
|
val defaultValue = if (indexFromEnd < lastParamDefaults.size)
|
||||||
correctedConverter.lazyElement { codeConverter -> codeConverter.correct().convertExpression(lastParamDefaults[indexFromEnd], parameter.getType()) }
|
correctedConverter.deferredElement { codeConverter -> codeConverter.correct().convertExpression(lastParamDefaults[indexFromEnd], parameter.getType()) }
|
||||||
else
|
else
|
||||||
null
|
null
|
||||||
if (!parameterToField.containsKey(parameter)) {
|
if (!parameterToField.containsKey(parameter)) {
|
||||||
@@ -297,7 +297,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
defaultValue).assignPrototypes(listOf(parameter, field), CommentsAndSpacesInheritance(blankLinesBefore = false))
|
defaultValue).assignPrototypes(listOf(parameter, field), CommentsAndSpacesInheritance(blankLinesBefore = false))
|
||||||
}
|
}
|
||||||
}).assignPrototype(primaryConstructor.getParameterList())
|
}).assignPrototype(primaryConstructor.getParameterList())
|
||||||
return PrimaryConstructor(annotations, modifiers, parameterList, converter.lazyElement(bodyGenerator)).assignPrototype(primaryConstructor)
|
return PrimaryConstructor(annotations, modifiers, parameterList, converter.deferredElement(bodyGenerator)).assignPrototype(primaryConstructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findBackingFieldForConstructorParameter(parameter: PsiParameter, constructor: PsiMethod): Pair<PsiField, PsiStatement>? {
|
private fun findBackingFieldForConstructorParameter(parameter: PsiParameter, constructor: PsiMethod): Pair<PsiField, PsiStatement>? {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
// state which is shared between all converter's based on this one
|
// state which is shared between all converter's based on this one
|
||||||
private class CommonState {
|
private class CommonState {
|
||||||
val importsToAdd = LinkedHashSet<String>()
|
val importsToAdd = LinkedHashSet<String>()
|
||||||
val lazyElements = ArrayList<LazyElement<*>>()
|
val deferredElements = ArrayList<DeferredElement<*>>()
|
||||||
val usageProcessings = ArrayList<UsageProcessing>()
|
val usageProcessings = ArrayList<UsageProcessing>()
|
||||||
val postUnfoldActions = ArrayList<() -> Unit>()
|
val postUnfoldActions = ArrayList<() -> Unit>()
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
val element = convertTopElement(elementToConvert) ?: return null
|
val element = convertTopElement(elementToConvert) ?: return null
|
||||||
return object: IntermediateResult {
|
return object: IntermediateResult {
|
||||||
override fun finishConversion(usageProcessings: Collection<UsageProcessing>): String {
|
override fun finishConversion(usageProcessings: Collection<UsageProcessing>): String {
|
||||||
unfoldLazyElements(usageProcessings)
|
unfoldDeferredElements(usageProcessings)
|
||||||
|
|
||||||
val builder = CodeBuilder(elementToConvert)
|
val builder = CodeBuilder(elementToConvert)
|
||||||
builder.append(element)
|
builder.append(element)
|
||||||
@@ -108,22 +108,22 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun unfoldLazyElements(usageProcessings: Collection<UsageProcessing>) {
|
private fun unfoldDeferredElements(usageProcessings: Collection<UsageProcessing>) {
|
||||||
val codeConverter = createDefaultCodeConverter().withSpecialExpressionConverter(UsageProcessingExpressionConverter(usageProcessings))
|
val codeConverter = createDefaultCodeConverter().withSpecialExpressionConverter(UsageProcessingExpressionConverter(usageProcessings))
|
||||||
|
|
||||||
// we use loop with index because new lazy elements can be added during unfolding
|
// we use loop with index because new deferred elements can be added during unfolding
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i < commonState.lazyElements.size) {
|
while (i < commonState.deferredElements.size) {
|
||||||
val lazyElement = commonState.lazyElements[i++]
|
val deferredElement = commonState.deferredElements[i++]
|
||||||
lazyElement.unfold(codeConverter.withConverter(this.withState(lazyElement.converterState)))
|
deferredElement.unfold(codeConverter.withConverter(this.withState(deferredElement.converterState)))
|
||||||
}
|
}
|
||||||
|
|
||||||
commonState.postUnfoldActions.forEach { it() }
|
commonState.postUnfoldActions.forEach { it() }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun<TResult : Element> lazyElement(generator: (CodeConverter) -> TResult): LazyElement<TResult> {
|
public fun<TResult : Element> deferredElement(generator: (CodeConverter) -> TResult): DeferredElement<TResult> {
|
||||||
val element = LazyElement(generator, personalState)
|
val element = DeferredElement(generator, personalState)
|
||||||
commonState.lazyElements.add(element)
|
commonState.deferredElements.add(element)
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
commonState.usageProcessings.add(processing)
|
commonState.usageProcessings.add(processing)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun addPostUnfoldLazyElementsAction(action: () -> Unit) {
|
public fun addPostUnfoldDeferredElementsAction(action: () -> Unit) {
|
||||||
commonState.postUnfoldActions.add(action)
|
commonState.postUnfoldActions.add(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
}
|
}
|
||||||
}.filterNotNull()
|
}.filterNotNull()
|
||||||
|
|
||||||
addPostUnfoldLazyElementsAction {
|
addPostUnfoldDeferredElementsAction {
|
||||||
assert(importList != null)
|
assert(importList != null)
|
||||||
if (importsToAdd.isNotEmpty()) {
|
if (importsToAdd.isNotEmpty()) {
|
||||||
importList!!.imports = importList.imports + importsToAdd.map { Import(it).assignNoPrototype() }
|
importList!!.imports = importList.imports + importsToAdd.map { Import(it).assignNoPrototype() }
|
||||||
@@ -254,7 +254,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public fun convertInitializer(initializer: PsiClassInitializer): Initializer {
|
public fun convertInitializer(initializer: PsiClassInitializer): Initializer {
|
||||||
return Initializer(lazyElement { codeConverter -> codeConverter.convertBlock(initializer.getBody()) },
|
return Initializer(deferredElement { codeConverter -> codeConverter.convertBlock(initializer.getBody()) },
|
||||||
convertModifiers(initializer)).assignPrototype(initializer)
|
convertModifiers(initializer)).assignPrototype(initializer)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
annotations,
|
annotations,
|
||||||
modifiers,
|
modifiers,
|
||||||
typeConverter.convertType(field.getType(), Nullability.NotNull),
|
typeConverter.convertType(field.getType(), Nullability.NotNull),
|
||||||
lazyElement { codeConverter -> ExpressionList(codeConverter.convertExpressions(argumentList?.getExpressions() ?: array())).assignPrototype(argumentList) })
|
deferredElement { codeConverter -> ExpressionList(codeConverter.convertExpressions(argumentList?.getExpressions() ?: array())).assignPrototype(argumentList) })
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val isVal = isVal(referenceSearcher, field)
|
val isVal = isVal(referenceSearcher, field)
|
||||||
@@ -288,7 +288,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
annotations,
|
annotations,
|
||||||
modifiers,
|
modifiers,
|
||||||
propertyType,
|
propertyType,
|
||||||
lazyElement { codeConverter -> codeConverter.convertExpression(field.getInitializer(), field.getType()) },
|
deferredElement { codeConverter -> codeConverter.convertExpression(field.getInitializer(), field.getType()) },
|
||||||
isVal,
|
isVal,
|
||||||
typeToDeclare != null,
|
typeToDeclare != null,
|
||||||
shouldGenerateDefaultInitializer(referenceSearcher, field),
|
shouldGenerateDefaultInitializer(referenceSearcher, field),
|
||||||
@@ -369,7 +369,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
|
|
||||||
var params = convertParameterList(method.getParameterList())
|
var params = convertParameterList(method.getParameterList())
|
||||||
val typeParameterList = convertTypeParameterList(method.getTypeParameterList())
|
val typeParameterList = convertTypeParameterList(method.getTypeParameterList())
|
||||||
var body = lazyElement { (codeConverter: CodeConverter) ->
|
var body = deferredElement { (codeConverter: CodeConverter) ->
|
||||||
val body = codeConverter.withMethodReturnType(method.getReturnType()).convertBlock(method.getBody())
|
val body = codeConverter.withMethodReturnType(method.getReturnType()).convertBlock(method.getBody())
|
||||||
postProcessBody(body)
|
postProcessBody(body)
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
nullability: Nullability = Nullability.Default,
|
nullability: Nullability = Nullability.Default,
|
||||||
varValModifier: Parameter.VarValModifier = Parameter.VarValModifier.None,
|
varValModifier: Parameter.VarValModifier = Parameter.VarValModifier.None,
|
||||||
modifiers: Modifiers = Modifiers.Empty(),
|
modifiers: Modifiers = Modifiers.Empty(),
|
||||||
defaultValue: LazyElement<Expression>? = null): Parameter {
|
defaultValue: DeferredElement<Expression>? = null): Parameter {
|
||||||
var type = typeConverter.convertVariableType(parameter)
|
var type = typeConverter.convertVariableType(parameter)
|
||||||
when (nullability) {
|
when (nullability) {
|
||||||
Nullability.NotNull -> type = type.toNotNullType()
|
Nullability.NotNull -> type = type.toNotNullType()
|
||||||
@@ -516,7 +516,7 @@ class Converter private(private val elementToConvert: PsiElement,
|
|||||||
if (types.isEmpty()) return Annotations.Empty()
|
if (types.isEmpty()) return Annotations.Empty()
|
||||||
val arguments = types.indices.map { index ->
|
val arguments = types.indices.map { index ->
|
||||||
val convertedType = typeConverter.convertType(types[index], Nullability.NotNull)
|
val convertedType = typeConverter.convertType(types[index], Nullability.NotNull)
|
||||||
null to lazyElement<Expression> { MethodCallExpression.buildNotNull(null, "javaClass", listOf(), listOf(convertedType)).assignPrototype(refElements[index]) }
|
null to deferredElement<Expression> { MethodCallExpression.buildNotNull(null, "javaClass", listOf(), listOf(convertedType)).assignPrototype(refElements[index]) }
|
||||||
}
|
}
|
||||||
val annotation = Annotation(Identifier("throws").assignNoPrototype(), arguments, false, true)
|
val annotation = Annotation(Identifier("throws").assignNoPrototype(), arguments, false, true)
|
||||||
return Annotations(listOf(annotation.assignPrototype(throwsList))).assignPrototype(throwsList)
|
return Annotations(listOf(annotation.assignPrototype(throwsList))).assignPrototype(throwsList)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package org.jetbrains.jet.j2k.ast
|
|||||||
|
|
||||||
import org.jetbrains.jet.j2k.*
|
import org.jetbrains.jet.j2k.*
|
||||||
|
|
||||||
class Annotation(val name: Identifier, val arguments: List<Pair<Identifier?, LazyElement<Expression>>>, val brackets: Boolean, val newLineAfter: Boolean) : Element() {
|
class Annotation(val name: Identifier, val arguments: List<Pair<Identifier?, DeferredElement<Expression>>>, val brackets: Boolean, val newLineAfter: Boolean) : Element() {
|
||||||
private fun CodeBuilder.surroundWithBrackets(action: () -> Unit) {
|
private fun CodeBuilder.surroundWithBrackets(action: () -> Unit) {
|
||||||
if (brackets) append("[")
|
if (brackets) append("[")
|
||||||
action()
|
action()
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ open class Class(
|
|||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
val typeParameterList: TypeParameterList,
|
val typeParameterList: TypeParameterList,
|
||||||
val extendsTypes: List<Type>,
|
val extendsTypes: List<Type>,
|
||||||
val baseClassParams: List<LazyElement<Expression>>,
|
val baseClassParams: List<DeferredElement<Expression>>,
|
||||||
val implementsTypes: List<Type>,
|
val implementsTypes: List<Type>,
|
||||||
val body: ClassBody
|
val body: ClassBody
|
||||||
) : Member(annotations, modifiers) {
|
) : Member(annotations, modifiers) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ abstract class Member(val annotations: Annotations, val modifiers: Modifiers) :
|
|||||||
|
|
||||||
class ClassBody (
|
class ClassBody (
|
||||||
val primaryConstructorSignature: PrimaryConstructorSignature?,
|
val primaryConstructorSignature: PrimaryConstructorSignature?,
|
||||||
val baseClassParams: List<LazyElement<Expression>>,
|
val baseClassParams: List<DeferredElement<Expression>>,
|
||||||
val members: List<Member>,
|
val members: List<Member>,
|
||||||
val classObjectMembers: List<Member>,
|
val classObjectMembers: List<Member>,
|
||||||
val factoryFunctions: List<FactoryFunction>,
|
val factoryFunctions: List<FactoryFunction>,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.intellij.util.IncorrectOperationException
|
|||||||
class PrimaryConstructor(annotations: Annotations,
|
class PrimaryConstructor(annotations: Annotations,
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
val parameterList: ParameterList,
|
val parameterList: ParameterList,
|
||||||
val body: LazyElement<Block>)
|
val body: DeferredElement<Block>)
|
||||||
: Member(annotations, modifiers) {
|
: Member(annotations, modifiers) {
|
||||||
|
|
||||||
override fun generateCode(builder: CodeBuilder) { throw IncorrectOperationException() }
|
override fun generateCode(builder: CodeBuilder) { throw IncorrectOperationException() }
|
||||||
@@ -34,7 +34,7 @@ class PrimaryConstructor(annotations: Annotations,
|
|||||||
val signature = PrimaryConstructorSignature(annotations, modifiers, parameterList)
|
val signature = PrimaryConstructorSignature(annotations, modifiers, parameterList)
|
||||||
|
|
||||||
// assign prototypes later because we don't know yet whether the body is empty or not
|
// assign prototypes later because we don't know yet whether the body is empty or not
|
||||||
converter.addPostUnfoldLazyElementsAction {
|
converter.addPostUnfoldDeferredElementsAction {
|
||||||
val inheritance = CommentsAndSpacesInheritance(blankLinesBefore = false, commentsAfter = body.isEmpty, commentsInside = body.isEmpty)
|
val inheritance = CommentsAndSpacesInheritance(blankLinesBefore = false, commentsAfter = body.isEmpty, commentsInside = body.isEmpty)
|
||||||
signature.assignPrototypesFrom(this, inheritance)
|
signature.assignPrototypesFrom(this, inheritance)
|
||||||
}
|
}
|
||||||
@@ -66,5 +66,5 @@ class FactoryFunction(name: Identifier,
|
|||||||
returnType: Type,
|
returnType: Type,
|
||||||
parameterList: ParameterList,
|
parameterList: ParameterList,
|
||||||
typeParameterList: TypeParameterList,
|
typeParameterList: TypeParameterList,
|
||||||
body: LazyElement<Block>)
|
body: DeferredElement<Block>)
|
||||||
: Function(name, annotations, modifiers, returnType, typeParameterList, parameterList, body, false)
|
: Function(name, annotations, modifiers, returnType, typeParameterList, parameterList, body, false)
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ object EmptyElementPrototypes {
|
|||||||
public fun set(thisRef: Element, desc: PropertyMetadata, value: List<PrototypeInfo>?) { }
|
public fun set(thisRef: Element, desc: PropertyMetadata, value: List<PrototypeInfo>?) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// this class should never be created directly - Converter.lazyElement() should be used!
|
// this class should never be created directly - Converter.deferredElement() should be used!
|
||||||
class LazyElement<TResult : Element>(
|
class DeferredElement<TResult : Element>(
|
||||||
private var generator: (CodeConverter) -> TResult,
|
private var generator: (CodeConverter) -> TResult,
|
||||||
public val converterState: Converter.PersonalState
|
public val converterState: Converter.PersonalState
|
||||||
) : Element() {
|
) : Element() {
|
||||||
@@ -114,7 +114,7 @@ class LazyElement<TResult : Element>(
|
|||||||
|
|
||||||
private val resultNotNull: TResult
|
private val resultNotNull: TResult
|
||||||
get() {
|
get() {
|
||||||
assert(result != null) { "No code generated for lazy element $this. Possible reason is that it has been created directly instead of Converter.lazyElement() call." }
|
assert(result != null) { "No code generated for deferred element $this. Possible reason is that it has been created directly instead of Converter.lazyElement() call." }
|
||||||
return result!!
|
return result!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Enum(
|
|||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
typeParameterList: TypeParameterList,
|
typeParameterList: TypeParameterList,
|
||||||
extendsTypes: List<Type>,
|
extendsTypes: List<Type>,
|
||||||
baseClassParams: List<LazyElement<Expression>>,
|
baseClassParams: List<DeferredElement<Expression>>,
|
||||||
implementsTypes: List<Type>,
|
implementsTypes: List<Type>,
|
||||||
body: ClassBody
|
body: ClassBody
|
||||||
) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, baseClassParams, implementsTypes, body) {
|
) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, baseClassParams, implementsTypes, body) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class EnumConstant(
|
|||||||
annotations: Annotations,
|
annotations: Annotations,
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
val type: Type,
|
val type: Type,
|
||||||
val params: LazyElement<ExpressionList>
|
val params: DeferredElement<ExpressionList>
|
||||||
) : Member(annotations, modifiers) {
|
) : Member(annotations, modifiers) {
|
||||||
|
|
||||||
override fun generateCode(builder: CodeBuilder) {
|
override fun generateCode(builder: CodeBuilder) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ open class Function(
|
|||||||
val returnType: Type,
|
val returnType: Type,
|
||||||
val typeParameterList: TypeParameterList,
|
val typeParameterList: TypeParameterList,
|
||||||
val parameterList: ParameterList,
|
val parameterList: ParameterList,
|
||||||
val body: LazyElement<Block>?,
|
val body: DeferredElement<Block>?,
|
||||||
val isInTrait: Boolean
|
val isInTrait: Boolean
|
||||||
) : Member(annotations, modifiers) {
|
) : Member(annotations, modifiers) {
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package org.jetbrains.jet.j2k.ast
|
|||||||
|
|
||||||
import org.jetbrains.jet.j2k.*
|
import org.jetbrains.jet.j2k.*
|
||||||
|
|
||||||
class Initializer(val body: LazyElement<Block>, modifiers: Modifiers) : Member(Annotations.Empty(), modifiers) {
|
class Initializer(val body: DeferredElement<Block>, modifiers: Modifiers) : Member(Annotations.Empty(), modifiers) {
|
||||||
override fun generateCode(builder: CodeBuilder) {
|
override fun generateCode(builder: CodeBuilder) {
|
||||||
builder.append(body)
|
builder.append(body)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Parameter(val identifier: Identifier,
|
|||||||
val varVal: Parameter.VarValModifier,
|
val varVal: Parameter.VarValModifier,
|
||||||
val annotations: Annotations,
|
val annotations: Annotations,
|
||||||
val modifiers: Modifiers,
|
val modifiers: Modifiers,
|
||||||
val defaultValue: LazyElement<Expression>? = null) : Element() {
|
val defaultValue: DeferredElement<Expression>? = null) : Element() {
|
||||||
public enum class VarValModifier {
|
public enum class VarValModifier {
|
||||||
None
|
None
|
||||||
Val
|
Val
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Property(
|
|||||||
annotations: Annotations,
|
annotations: Annotations,
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
val type: Type,
|
val type: Type,
|
||||||
private val initializer: LazyElement<Expression>,
|
private val initializer: DeferredElement<Expression>,
|
||||||
val isVal: Boolean,
|
val isVal: Boolean,
|
||||||
val explicitType: Boolean,
|
val explicitType: Boolean,
|
||||||
private val defaultInitializer: Boolean,
|
private val defaultInitializer: Boolean,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Trait(name: Identifier,
|
|||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
typeParameterList: TypeParameterList,
|
typeParameterList: TypeParameterList,
|
||||||
extendsTypes: List<Type>,
|
extendsTypes: List<Type>,
|
||||||
baseClassParams: List<LazyElement<Expression>>,
|
baseClassParams: List<DeferredElement<Expression>>,
|
||||||
implementsTypes: List<Type>,
|
implementsTypes: List<Type>,
|
||||||
body: ClassBody
|
body: ClassBody
|
||||||
) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, baseClassParams, implementsTypes, body) {
|
) : Class(name, annotations, modifiers, typeParameterList, extendsTypes, baseClassParams, implementsTypes, body) {
|
||||||
|
|||||||
Reference in New Issue
Block a user