Light Classes: Primary constructor fixes

This commit is contained in:
Alexey Sedunov
2015-06-08 18:50:11 +03:00
parent 608ce59f15
commit 1ea2c24562
16 changed files with 70 additions and 72 deletions
@@ -340,11 +340,8 @@ public class JetRefactoringUtil {
if (method instanceof KotlinLightMethod) {
JetDeclaration declaration = ((KotlinLightMethod) method).getOrigin();
if (declaration instanceof JetNamedFunction) {
result.add(((JetNamedFunction) declaration).getValueParameters().get(parameterIndex));
}
else if (declaration instanceof JetClass) {
result.add(((JetClass) declaration).getPrimaryConstructorParameters().get(parameterIndex));
if (declaration instanceof JetFunction) {
result.add(((JetFunction) declaration).getValueParameters().get(parameterIndex));
}
}
else {
@@ -1,12 +1,14 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="X in MyClass ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="X in MyClass() in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="X in MyClass2() in MyClass2 ()"/>
<node text="Anonymous in MyClass2() in MyClass2 ()"/>
<node text="E in bar() in main.kt ()"/>
</node>
@@ -18,6 +18,10 @@ class MyClass(a: A = run { class X: A(); object: A() {} }) {
}
}
class MyClass2 {
constructor(a: A = run { class X: A(); object: A() {} })
}
val bar: Int
get() {
class E: A()
@@ -1,12 +1,12 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="X in MyClass ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="B ()"/>
<node text="C in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="X in MyClass() in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
</node>
@@ -1,10 +1,10 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="F in t() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="Anonymous in x() in main.kt ()"/>
<node text="B ()"/>
<node text="C in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="F in t() in MyClass ()"/>
</node>
@@ -1,10 +1,10 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="F in t() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="Anonymous in x() in main.kt ()"/>
<node text="B ()"/>
<node text="C in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="F in t() in MyClass ()"/>
</node>
@@ -1,12 +1,12 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="X in MyClass ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="B ()"/>
<node text="C in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="X in MyClass() in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
</node>
@@ -1,12 +1,12 @@
<node text="A ()" base="true">
<node text="B ()"/>
<node text="X in MyClass ()"/>
<node text="Anonymous in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="C in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
<node text="Anonymous in MyClass() in MyClass ()"/>
<node text="Anonymous in foo() in MyClass ()"/>
<node text="B ()"/>
<node text="C in MyClass ()"/>
<node text="D in foo() in MyClass ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="E in bar() in main.kt ()"/>
<node text="F in foo() in MyClass ()"/>
<node text="G in MyClass ()"/>
<node text="X in MyClass() in MyClass ()"/>
<node text="X in foo() in MyClass ()"/>
</node>