Uast: constructors calls consistency for KtObjectLiteralExpression (KT-21409)

This commit is contained in:
Nicolay Mitropolsky
2017-11-27 13:11:20 +03:00
committed by xiexed
parent 1dbce18afc
commit 4db5ca66e3
5 changed files with 66 additions and 8 deletions
+10 -2
View File
@@ -21,5 +21,13 @@ class C : A {
object O : A("text")
val anon = object : A("textForAnon") {
fun bar() {}
}
fun bar() {
cons(object : A("inner literal"))
}
object innerObject : A("inner object")
inner class InnerClass : A("inner class")
}
fun cons(a: A) {}
+27
View File
@@ -7,8 +7,35 @@ UFile (package = )
UClass (name = null)
UAnnotationMethod (name = bar)
UBlockExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (cons))
USimpleNameReferenceExpression (identifier = cons)
UObjectLiteralExpression
ULiteralExpression (value = "inner literal")
UClass (name = null)
UAnnotationMethod (name = SuperCallsKt$anon$1$bar$1)
UAnnotationMethod (name = SuperCallsKt$anon$1)
UClass (name = innerObject)
UField (name = INSTANCE)
UAnnotation (fqName = null)
UAnnotationMethod (name = innerObject)
UBlockExpression
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
UIdentifier (Identifier (A))
USimpleNameReferenceExpression (identifier = <init>)
ULiteralExpression (value = "inner object")
UClass (name = InnerClass)
UAnnotationMethod (name = InnerClass)
UBlockExpression
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
UIdentifier (Identifier (A))
USimpleNameReferenceExpression (identifier = <init>)
ULiteralExpression (value = "inner class")
UAnnotationMethod (name = getAnon)
UAnnotationMethod (name = cons)
UParameter (name = a)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UBlockExpression
UClass (name = A)
UField (name = str)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
+9 -1
View File
@@ -1,8 +1,16 @@
public final class SuperCallsKt {
private static final var anon: A = anonymous object : A("textForAnon") {
fun bar() {}
fun bar() {
cons(object : A("inner literal"))
}
object innerObject : A("inner object")
inner class InnerClass : A("inner class")
}
public static final fun getAnon() : A = UastEmptyExpression
public static final fun cons(a: A) : void {
}
}
public class A {