Build stubs for insides of local objects and classes

This commit is contained in:
Pavel V. Talanov
2014-05-20 17:50:35 +04:00
parent e33144f89a
commit b4b24262a0
20 changed files with 175 additions and 49 deletions
@@ -4,3 +4,14 @@ PsiJetFileStubImpl[package=]
CLASS:[fqName=T, isEnumEntry=false, isLocal=false, isTopLevel=true, isTrait=true, name=T, superNames=[]]
PROPERTY:[fqName=obj, hasDelegate=false, hasDelegateExpression=false, hasInitializer=true, hasReceiverTypeRef=false, hasReturnTypeRef=false, isTopLevel=true, isVar=false, name=obj]
OBJECT_DECLARATION:[fqName=null, isClassObject=false, isLocal=true, isObjectLiteral=true, isTopLevel=false, name=null, superNames=[A, T]]
DELEGATION_SPECIFIER_LIST:
DELEGATOR_SUPER_CALL:
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=A]
DELEGATOR_SUPER_CLASS:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
CLASS_BODY:
+10
View File
@@ -5,3 +5,13 @@ PsiJetFileStubImpl[package=]
FUN:[fqName=foo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=foo]
VALUE_PARAMETER_LIST:
CLASS:[fqName=null, isEnumEntry=false, isLocal=true, isTopLevel=false, isTrait=false, name=Test, superNames=[A, T]]
DELEGATION_SPECIFIER_LIST:
DELEGATOR_SUPER_CALL:
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=A]
DELEGATOR_SUPER_CLASS:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
@@ -5,3 +5,13 @@ PsiJetFileStubImpl[package=]
FUN:[fqName=foo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=foo]
VALUE_PARAMETER_LIST:
CLASS:[fqName=null, isEnumEntry=false, isLocal=true, isTopLevel=false, isTrait=false, name=Test, superNames=[A, T]]
DELEGATION_SPECIFIER_LIST:
DELEGATOR_SUPER_CALL:
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=A]
DELEGATOR_SUPER_CLASS:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
@@ -5,3 +5,13 @@ PsiJetFileStubImpl[package=]
FUN:[fqName=foo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=foo]
VALUE_PARAMETER_LIST:
OBJECT_DECLARATION:[fqName=null, isClassObject=false, isLocal=true, isObjectLiteral=false, isTopLevel=false, name=O, superNames=[A, T]]
DELEGATION_SPECIFIER_LIST:
DELEGATOR_SUPER_CALL:
CONSTRUCTOR_CALLEE:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=A]
DELEGATOR_SUPER_CLASS:
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=T]
@@ -0,0 +1,12 @@
PsiJetFileStubImpl[package=]
PACKAGE_DIRECTIVE:
FUN:[fqName=f, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=f]
MODIFIER_LIST:[public]
CLASS:[fqName=null, isEnumEntry=false, isLocal=true, isTopLevel=false, isTrait=false, name=C, superNames=[]]
CLASS_BODY:
FUN:[fqName=null, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=f]
VALUE_PARAMETER_LIST:
PROPERTY:[fqName=null, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReceiverTypeRef=false, hasReturnTypeRef=true, isTopLevel=false, isVar=false, name=c]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
@@ -0,0 +1,8 @@
public fun f {
class C {
fun f() {
}
val c: Int
}
}
@@ -0,0 +1,12 @@
PsiJetFileStubImpl[package=]
PACKAGE_DIRECTIVE:
FUN:[fqName=f, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=f]
VALUE_PARAMETER_LIST:
OBJECT_DECLARATION:[fqName=null, isClassObject=false, isLocal=true, isObjectLiteral=false, isTopLevel=false, name=foo, superNames=[]]
CLASS_BODY:
FUN:[fqName=null, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=foo]
VALUE_PARAMETER_LIST:
PROPERTY:[fqName=null, hasDelegate=false, hasDelegateExpression=false, hasInitializer=true, hasReceiverTypeRef=false, hasReturnTypeRef=true, isTopLevel=false, isVar=false, name=foo]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
@@ -0,0 +1,10 @@
fun f() {
object foo {
fun foo() {
for (a in listOf(1, 2, 3)) {
}
}
val foo: Int = 3
}
}
@@ -0,0 +1,11 @@
PsiJetFileStubImpl[package=]
PACKAGE_DIRECTIVE:
PROPERTY:[fqName=p, hasDelegate=false, hasDelegateExpression=false, hasInitializer=true, hasReceiverTypeRef=false, hasReturnTypeRef=false, isTopLevel=true, isVar=false, name=p]
OBJECT_DECLARATION:[fqName=null, isClassObject=false, isLocal=true, isObjectLiteral=true, isTopLevel=false, name=null, superNames=[]]
CLASS_BODY:
FUN:[fqName=null, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=f]
VALUE_PARAMETER_LIST:
PROPERTY:[fqName=null, hasDelegate=false, hasDelegateExpression=false, hasInitializer=true, hasReceiverTypeRef=false, hasReturnTypeRef=true, isTopLevel=false, isVar=false, name=p]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
@@ -0,0 +1,4 @@
val p = object {
fun f() {}
val p: Int = 3
}
@@ -0,0 +1,11 @@
PsiJetFileStubImpl[package=]
PACKAGE_DIRECTIVE:
PROPERTY:[fqName=p, hasDelegate=true, hasDelegateExpression=true, hasInitializer=false, hasReceiverTypeRef=false, hasReturnTypeRef=false, isTopLevel=true, isVar=false, name=p]
OBJECT_DECLARATION:[fqName=null, isClassObject=false, isLocal=true, isObjectLiteral=true, isTopLevel=false, name=null, superNames=[]]
CLASS_BODY:
FUN:[fqName=null, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=f]
VALUE_PARAMETER_LIST:
PROPERTY:[fqName=null, hasDelegate=false, hasDelegateExpression=false, hasInitializer=true, hasReceiverTypeRef=false, hasReturnTypeRef=true, isTopLevel=false, isVar=false, name=p]
TYPE_REFERENCE:
USER_TYPE:[isAbsoluteInRootPackage=false]
REFERENCE_EXPRESSION:[referencedName=Int]
@@ -0,0 +1,4 @@
val p by object {
fun f() {}
val p: Int = 1
}
@@ -37,8 +37,7 @@ public abstract class AbstractStubBuilderTest extends LightCodeInsightFixtureTes
JetFileStubBuilder jetStubBuilder = new JetFileStubBuilder();
StubElement lighterTree = jetStubBuilder.buildStubTree(file);
String stubTree = DebugUtil.stubTreeToString(lighterTree)
.replace(NO_NAME_FOR_LAZY_RESOLVE.asString(), "<no name>")
.replace(":" + PsiJetPlaceHolderStubImpl.class.getSimpleName(), "");
.replace(NO_NAME_FOR_LAZY_RESOLVE.asString(), "<no name>");
String expectedFile = sourcePath.replace(".kt", ".expected");
JetTestUtils.assertEqualsToFile(new File(expectedFile), stubTree);
}
@@ -116,6 +116,16 @@ public class StubBuilderTestGenerated extends AbstractStubBuilderTest {
doTest("idea/testData/stubs/ManyAnnotationsOnFunction.kt");
}
@TestMetadata("MembersInLocalClass.kt")
public void testMembersInLocalClass() throws Exception {
doTest("idea/testData/stubs/MembersInLocalClass.kt");
}
@TestMetadata("MembersInLocalObject.kt")
public void testMembersInLocalObject() throws Exception {
doTest("idea/testData/stubs/MembersInLocalObject.kt");
}
@TestMetadata("NamedObject.kt")
public void testNamedObject() throws Exception {
doTest("idea/testData/stubs/NamedObject.kt");
@@ -136,6 +146,16 @@ public class StubBuilderTestGenerated extends AbstractStubBuilderTest {
doTest("idea/testData/stubs/NotStorePropertyFromInitializer.kt");
}
@TestMetadata("ObjectInInitializer.kt")
public void testObjectInInitializer() throws Exception {
doTest("idea/testData/stubs/ObjectInInitializer.kt");
}
@TestMetadata("ObjectInPropertyDelegate.kt")
public void testObjectInPropertyDelegate() throws Exception {
doTest("idea/testData/stubs/ObjectInPropertyDelegate.kt");
}
@TestMetadata("PackageProperty.kt")
public void testPackageProperty() throws Exception {
doTest("idea/testData/stubs/PackageProperty.kt");