Generate constructor light methods with origin set to Kotlin class/object declaration
This commit is contained in:
@@ -1114,7 +1114,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
assert constructorDescriptor != null;
|
assert constructorDescriptor != null;
|
||||||
final JvmMethodSignature constructorSignature = typeMapper.mapSignature(constructorDescriptor);
|
final JvmMethodSignature constructorSignature = typeMapper.mapSignature(constructorDescriptor);
|
||||||
|
|
||||||
functionCodegen.generateMethod(null, constructorSignature, constructorDescriptor, constructorContext,
|
functionCodegen.generateMethod(myClass, constructorSignature, constructorDescriptor, constructorContext,
|
||||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+10
-3
@@ -38,6 +38,8 @@ import org.jetbrains.jet.lang.psi.JetPropertyAccessor
|
|||||||
import org.jetbrains.jet.lang.psi.psiUtil.getParentByType
|
import org.jetbrains.jet.lang.psi.psiUtil.getParentByType
|
||||||
import org.jetbrains.jet.lang.psi.JetProperty
|
import org.jetbrains.jet.lang.psi.JetProperty
|
||||||
import com.intellij.psi.PsiTypeParameter
|
import com.intellij.psi.PsiTypeParameter
|
||||||
|
import org.jetbrains.jet.lang.psi.JetClassOrObject
|
||||||
|
import com.intellij.psi.impl.light.LightTypeParameterListBuilder
|
||||||
|
|
||||||
public class KotlinLightMethodForDeclaration(
|
public class KotlinLightMethodForDeclaration(
|
||||||
manager: PsiManager, override val delegate: PsiMethod, override val origin: JetDeclaration, containingClass: PsiClass
|
manager: PsiManager, override val delegate: PsiMethod, override val origin: JetDeclaration, containingClass: PsiClass
|
||||||
@@ -59,9 +61,14 @@ public class KotlinLightMethodForDeclaration(
|
|||||||
private val typeParamsList: CachedValue<PsiTypeParameterList> by Delegates.blockingLazy {
|
private val typeParamsList: CachedValue<PsiTypeParameterList> by Delegates.blockingLazy {
|
||||||
val cacheManager = CachedValuesManager.getManager(delegate.getProject())
|
val cacheManager = CachedValuesManager.getManager(delegate.getProject())
|
||||||
cacheManager.createCachedValue<PsiTypeParameterList>({
|
cacheManager.createCachedValue<PsiTypeParameterList>({
|
||||||
val declaration =
|
val declaration = if (origin is JetPropertyAccessor) origin.getParentByType(javaClass<JetProperty>()) else origin
|
||||||
if (origin is JetPropertyAccessor) origin.getParentByType(javaClass<JetProperty>()) else origin
|
|
||||||
val list = LightClassUtil.buildLightTypeParameterList(this@KotlinLightMethodForDeclaration, origin)
|
val list = if (origin is JetClassOrObject) {
|
||||||
|
LightTypeParameterListBuilder(getManager(), getLanguage())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LightClassUtil.buildLightTypeParameterList(this@KotlinLightMethodForDeclaration, origin)
|
||||||
|
}
|
||||||
CachedValueProvider.Result.create(list, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT)
|
CachedValueProvider.Result.create(list, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT)
|
||||||
}, false)
|
}, false)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user