172: Revert "Uast: AbstractKotlinUVariable annotations now are retrieved from Kotlin Psi, not from compiled (KT-21025)"
This reverts commit ebbfc4a3845159ba8f0e3d94a5f70489c348c403.
This commit is contained in:
@@ -17,14 +17,12 @@
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.asJava.LightClassUtil
|
||||
import org.jetbrains.kotlin.asJava.toLightGetter
|
||||
import org.jetbrains.kotlin.asJava.toLightSetter
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.kotlin.expressions.KotlinUElvisExpression
|
||||
@@ -53,15 +51,6 @@ abstract class KotlinAbstractUElement(private val givenParent: UElement?) : UEle
|
||||
parent = (parentUnwrapped as? KtProperty)?.setter
|
||||
?: (parentUnwrapped as? KtParameter)?.toLightSetter()
|
||||
?: parent
|
||||
AnnotationUseSiteTarget.FIELD ->
|
||||
parent = (parentUnwrapped as? KtProperty)
|
||||
?: (parentUnwrapped as? KtParameter)
|
||||
?.takeIf { it.isPropertyParameter() }
|
||||
?.let(LightClassUtil::getLightClassBackingField)
|
||||
?: parent
|
||||
AnnotationUseSiteTarget.SETTER_PARAMETER ->
|
||||
parent = (parentUnwrapped as? KtParameter)
|
||||
?.toLightSetter()?.parameterList?.parameters?.firstOrNull() ?: parent
|
||||
}
|
||||
}
|
||||
if (psi is UastKotlinPsiVariable && parent != null) {
|
||||
|
||||
+6
-96
@@ -17,26 +17,19 @@
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.annotations.Nullable
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getType
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.typeUtil.TypeNullability
|
||||
import org.jetbrains.kotlin.types.typeUtil.nullability
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.internal.acceptList
|
||||
import org.jetbrains.uast.java.JavaAbstractUExpression
|
||||
import org.jetbrains.uast.java.JavaUAnnotation
|
||||
import org.jetbrains.uast.java.annotations
|
||||
import org.jetbrains.uast.kotlin.declarations.UastLightIdentifier
|
||||
import org.jetbrains.uast.kotlin.internal.KotlinUElementWithComments
|
||||
import org.jetbrains.uast.kotlin.psi.UastKotlinPsiParameter
|
||||
import org.jetbrains.uast.kotlin.psi.UastKotlinPsiVariable
|
||||
import org.jetbrains.uast.visitor.UastTypedVisitor
|
||||
import org.jetbrains.uast.visitor.UastVisitor
|
||||
|
||||
abstract class AbstractKotlinUVariable(givenParent: UElement?)
|
||||
@@ -79,19 +72,7 @@ abstract class AbstractKotlinUVariable(givenParent: UElement?)
|
||||
|
||||
override fun getContainingFile(): PsiFile = unwrapFakeFileForLightClass(psi.containingFile)
|
||||
|
||||
override val annotations by lz {
|
||||
val sourcePsi = sourcePsi ?: return@lz psi.annotations.map { WrappedUAnnotation(it, this) }
|
||||
val annotations = SmartList<UAnnotation>(KotlinNullabilityUAnnotation(sourcePsi, this))
|
||||
if (sourcePsi is KtModifierListOwner) {
|
||||
sourcePsi.annotationEntries.
|
||||
filter { acceptsAnnotationTarget(it.useSiteTarget?.getAnnotationUseSiteTarget()) }.
|
||||
mapTo(annotations) { KotlinUAnnotation(it, this) }
|
||||
}
|
||||
annotations
|
||||
}
|
||||
|
||||
|
||||
abstract protected fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean
|
||||
override val annotations: List<UAnnotation> by lz { psi.annotations.map { WrappedUAnnotation(it, this) } }
|
||||
|
||||
override val typeReference by lz { getLanguagePlugin().convertOpt<UTypeReferenceExpression>(psi.typeElement, this) }
|
||||
|
||||
@@ -141,8 +122,6 @@ class KotlinUVariable(
|
||||
|
||||
override val typeReference by lz { getLanguagePlugin().convertOpt<UTypeReferenceExpression>(psi.typeElement, this) }
|
||||
|
||||
override fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean = true
|
||||
|
||||
override fun getInitializer(): PsiExpression? {
|
||||
return super<AbstractKotlinUVariable>.getInitializer()
|
||||
}
|
||||
@@ -163,28 +142,14 @@ class KotlinUVariable(
|
||||
|
||||
open class KotlinUParameter(
|
||||
psi: PsiParameter,
|
||||
final override val sourcePsi: KtElement?,
|
||||
override val sourcePsi: KtElement?,
|
||||
givenParent: UElement?
|
||||
) : AbstractKotlinUVariable(givenParent), UParameter, PsiParameter by psi {
|
||||
|
||||
final override val javaPsi = unwrap<UParameter, PsiParameter>(psi)
|
||||
override val javaPsi = unwrap<UParameter, PsiParameter>(psi)
|
||||
|
||||
override val psi = javaPsi
|
||||
|
||||
private val isLightConstructorParam by lz { psi.getParentOfType<PsiMethod>(true)?.isConstructor }
|
||||
|
||||
private val isKtConstructorParam by lz { sourcePsi?.getParentOfType<KtCallableDeclaration>(true)?.let { it is KtConstructor<*> } }
|
||||
|
||||
override fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean {
|
||||
if (sourcePsi !is KtParameter) return false
|
||||
if (isKtConstructorParam == isLightConstructorParam && target == null) return true
|
||||
when (target) {
|
||||
AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER -> return isLightConstructorParam == true
|
||||
AnnotationUseSiteTarget.SETTER_PARAMETER -> return isLightConstructorParam != true
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInitializer(): PsiExpression? {
|
||||
return super<AbstractKotlinUVariable>.getInitializer()
|
||||
}
|
||||
@@ -202,67 +167,16 @@ open class KotlinUParameter(
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinNullabilityUAnnotation(val annotatedElement: PsiElement, override val uastParent: UElement) : UAnnotation, JvmDeclarationUElement {
|
||||
|
||||
private fun getTargetType(annotatedElement: PsiElement): KotlinType? {
|
||||
if (annotatedElement is KtCallableDeclaration) {
|
||||
annotatedElement.typeReference?.getType()?.let { return it }
|
||||
}
|
||||
if (annotatedElement is KtProperty) {
|
||||
annotatedElement.initializer?.let { it.getType(it.analyze()) }?.let { return it }
|
||||
annotatedElement.delegateExpression?.let { it.getType(it.analyze())?.arguments?.firstOrNull()?.type }?.let { return it }
|
||||
}
|
||||
annotatedElement.getParentOfType<KtProperty>(false)?.let {
|
||||
it.typeReference?.getType() ?: it.initializer?.let { it.getType(it.analyze()) }
|
||||
}?.let { return it }
|
||||
return null
|
||||
}
|
||||
|
||||
val nullability by lz { getTargetType(annotatedElement)?.nullability() }
|
||||
|
||||
override val attributeValues: List<UNamedExpression>
|
||||
get() = emptyList()
|
||||
override val psi: PsiElement?
|
||||
get() = null
|
||||
override val javaPsi: PsiAnnotation?
|
||||
get() = null
|
||||
override val sourcePsi: PsiElement?
|
||||
get() = null
|
||||
override val qualifiedName: String?
|
||||
get() = when (nullability) {
|
||||
TypeNullability.NOT_NULL -> NotNull::class.qualifiedName
|
||||
TypeNullability.NULLABLE -> Nullable::class.qualifiedName
|
||||
TypeNullability.FLEXIBLE -> null
|
||||
null -> null
|
||||
}
|
||||
|
||||
override fun findAttributeValue(name: String?): UExpression? = null
|
||||
|
||||
override fun findDeclaredAttributeValue(name: String?): UExpression? = null
|
||||
|
||||
override fun resolve(): PsiClass? = qualifiedName?.let {
|
||||
val project = annotatedElement.project
|
||||
JavaPsiFacade.getInstance(project).findClass(it, GlobalSearchScope.allScope(project))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class KotlinUField(
|
||||
psi: PsiField,
|
||||
override val sourcePsi: KtElement?,
|
||||
givenParent: UElement?
|
||||
) : AbstractKotlinUVariable(givenParent), UField, PsiField by psi {
|
||||
override fun getSourceElement() = sourcePsi ?: this
|
||||
|
||||
override val javaPsi = unwrap<UField, PsiField>(psi)
|
||||
|
||||
override val psi = javaPsi
|
||||
|
||||
override fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean =
|
||||
target == AnnotationUseSiteTarget.FIELD ||
|
||||
target == AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD ||
|
||||
(sourcePsi is KtProperty) && (target == null || target == AnnotationUseSiteTarget.PROPERTY)
|
||||
|
||||
override fun getInitializer(): PsiExpression? {
|
||||
return super<AbstractKotlinUVariable>.getInitializer()
|
||||
}
|
||||
@@ -300,8 +214,6 @@ open class KotlinULocalVariable(
|
||||
|
||||
override val javaPsi = unwrap<ULocalVariable, PsiLocalVariable>(psi)
|
||||
|
||||
override fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean = true
|
||||
|
||||
override val psi = javaPsi
|
||||
|
||||
override fun getInitializer(): PsiExpression? {
|
||||
@@ -355,8 +267,6 @@ open class KotlinUEnumConstant(
|
||||
|
||||
override val psi = javaPsi
|
||||
|
||||
override fun acceptsAnnotationTarget(target: AnnotationUseSiteTarget?): Boolean = true
|
||||
|
||||
override fun getContainingFile(): PsiFile {
|
||||
return super.getContainingFile()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
UFile (package = )
|
||||
UClass (name = DefaultParameterValuesKt)
|
||||
UAnnotationMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 1)
|
||||
UParameter (name = foo)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
|
||||
ULiteralExpression (value = null)
|
||||
UBlockExpression
|
||||
@@ -0,0 +1,4 @@
|
||||
public final class DefaultParameterValuesKt {
|
||||
public static final fun foo(@null a: int, @org.jetbrains.annotations.Nullable foo: java.lang.String) : void {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
UFile (package = )
|
||||
UClass (name = DestructuringDeclarationKt)
|
||||
UAnnotationMethod (name = foo)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var268d4034)
|
||||
UBinaryExpression (operator = <other>)
|
||||
ULiteralExpression (value = "foo")
|
||||
ULiteralExpression (value = 1)
|
||||
ULocalVariable (name = a)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var268d4034)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <anonymous class>)
|
||||
ULocalVariable (name = b)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var268d4034)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component2))
|
||||
USimpleNameReferenceExpression (identifier = <anonymous class>)
|
||||
@@ -0,0 +1,7 @@
|
||||
public final class DestructuringDeclarationKt {
|
||||
public static final fun foo() : void {
|
||||
var var268d4034: <ErrorType> = "foo" <other> 1
|
||||
var a: java.lang.String = var268d4034.<anonymous class>()
|
||||
var b: int = var268d4034.<anonymous class>()
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
UFile (package = )
|
||||
UClass (name = ElvisKt)
|
||||
UAnnotationMethod (name = foo)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = null)
|
||||
UAnnotationMethod (name = bar)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 42)
|
||||
UAnnotationMethod (name = baz)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UExpressionList (elvis)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var243c51a0)
|
||||
UExpressionList (elvis)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = varc4aef569)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (foo))
|
||||
USimpleNameReferenceExpression (identifier = foo)
|
||||
ULiteralExpression (value = "Lorem ipsum")
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = !=)
|
||||
USimpleNameReferenceExpression (identifier = varc4aef569)
|
||||
ULiteralExpression (value = null)
|
||||
USimpleNameReferenceExpression (identifier = varc4aef569)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (foo))
|
||||
USimpleNameReferenceExpression (identifier = foo)
|
||||
ULiteralExpression (value = "dolor sit amet")
|
||||
UIfExpression
|
||||
UBinaryExpression (operator = !=)
|
||||
USimpleNameReferenceExpression (identifier = var243c51a0)
|
||||
ULiteralExpression (value = null)
|
||||
USimpleNameReferenceExpression (identifier = var243c51a0)
|
||||
UQualifiedReferenceExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (bar))
|
||||
USimpleNameReferenceExpression (identifier = bar)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString)
|
||||
@@ -0,0 +1,17 @@
|
||||
public final class ElvisKt {
|
||||
public static final fun foo(@org.jetbrains.annotations.NotNull bar: java.lang.String) : java.lang.String {
|
||||
return null
|
||||
}
|
||||
public static final fun bar() : int {
|
||||
return 42
|
||||
}
|
||||
public static final fun baz() : java.lang.String {
|
||||
return elvis {
|
||||
var var243c51a0: java.lang.String = elvis {
|
||||
var varc4aef569: java.lang.String = foo("Lorem ipsum")
|
||||
if (varc4aef569 != null) varc4aef569 else foo("dolor sit amet")
|
||||
}
|
||||
if (var243c51a0 != null) var243c51a0 else bar().toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
UFile (package = )
|
||||
UClass (name = Style)
|
||||
UEnumConstant (name = SHEET)
|
||||
USimpleNameReferenceExpression (identifier = Style)
|
||||
UClass (name = null)
|
||||
UAnnotationMethod (name = getExitAnimation)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "bar")
|
||||
UAnnotationMethod (name = SHEET)
|
||||
UField (name = value)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotationMethod (name = getExitAnimation)
|
||||
UAnnotationMethod (name = getValue)
|
||||
UAnnotationMethod (name = Style)
|
||||
UParameter (name = value)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
@@ -0,0 +1,10 @@
|
||||
public enum Style {
|
||||
SHEET {
|
||||
public fun getExitAnimation() : java.lang.String = "bar"
|
||||
fun SHEET() = UastEmptyExpression
|
||||
}
|
||||
@org.jetbrains.annotations.NotNull private final var value: java.lang.String
|
||||
public abstract fun getExitAnimation() : java.lang.String = UastEmptyExpression
|
||||
public final fun getValue() : java.lang.String = UastEmptyExpression
|
||||
protected fun Style(@org.jetbrains.annotations.NotNull value: java.lang.String) = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
UFile (package = )
|
||||
UClass (name = Foo)
|
||||
UAnnotationMethod (name = Foo)
|
||||
UClass (name = Bar)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UField (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = getAPlusB)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = b)
|
||||
UAnnotationMethod (name = getA)
|
||||
UAnnotationMethod (name = getB)
|
||||
UAnnotationMethod (name = Bar)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
UClass (name = Baz)
|
||||
UAnnotationMethod (name = doNothing)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = Unit)
|
||||
UAnnotationMethod (name = Baz)
|
||||
@@ -0,0 +1,15 @@
|
||||
public final class Foo {
|
||||
public fun Foo() = UastEmptyExpression
|
||||
public static final class Bar {
|
||||
@null private final var a: int
|
||||
@null private final var b: int
|
||||
public final fun getAPlusB() : int = a + b
|
||||
public final fun getA() : int = UastEmptyExpression
|
||||
public final fun getB() : int = UastEmptyExpression
|
||||
public fun Bar(@null a: int, @null b: int) = UastEmptyExpression
|
||||
public static final class Baz {
|
||||
public final fun doNothing() : void = Unit
|
||||
public fun Baz() = UastEmptyExpression
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
UFile (package = )
|
||||
UClass (name = LocalDeclarationsKt)
|
||||
UAnnotationMethod (name = foo)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
UClass (name = Local)
|
||||
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local)
|
||||
UDeclarationsExpression
|
||||
UVariable (name = bar)
|
||||
ULambdaExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = baz)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
UDeclarationsExpression
|
||||
UVariable (name = someLocalFun)
|
||||
ULambdaExpression
|
||||
UParameter (name = text)
|
||||
ULiteralExpression (value = 42)
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = ==)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (bar))
|
||||
USimpleNameReferenceExpression (identifier = bar)
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0))
|
||||
UIdentifier (Identifier (Local))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
@@ -0,0 +1,17 @@
|
||||
public final class LocalDeclarationsKt {
|
||||
public static final fun foo() : boolean {
|
||||
public static final class Local {
|
||||
public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression
|
||||
}
|
||||
var bar: <ErrorType> = fun () {
|
||||
<init>()
|
||||
}
|
||||
var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {
|
||||
<init>()
|
||||
}
|
||||
var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (var text: java.lang.String) {
|
||||
42
|
||||
}
|
||||
return bar() == <init>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
UFile (package = ) [public final class LocalDeclarationsKt {...]
|
||||
UClass (name = LocalDeclarationsKt) [public final class LocalDeclarationsKt {...}]
|
||||
UAnnotationMethod (name = foo) [public static final fun foo() : boolean {...}]
|
||||
UBlockExpression [{...}] : PsiType:Void
|
||||
UDeclarationsExpression [public static final class Local {...}]
|
||||
UClass (name = Local) [public static final class Local {...}]
|
||||
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local) [public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression]
|
||||
UDeclarationsExpression [var bar: <ErrorType> = fun () {...}]
|
||||
UVariable (name = bar) [var bar: <ErrorType> = fun () {...}]
|
||||
ULambdaExpression [fun () {...}]
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
|
||||
UDeclarationsExpression [var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {...}]
|
||||
ULocalVariable (name = baz) [var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {...}]
|
||||
ULambdaExpression [fun () {...}]
|
||||
UBlockExpression [{...}] : PsiType:<ErrorType>
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
|
||||
UDeclarationsExpression [var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (var text: java.lang.String) {...}]
|
||||
UVariable (name = someLocalFun) [var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (var text: java.lang.String) {...}]
|
||||
ULambdaExpression [fun (var text: java.lang.String) {...}]
|
||||
UParameter (name = text) [var text: java.lang.String]
|
||||
ULiteralExpression (value = 42) [42] : PsiType:int
|
||||
UReturnExpression [return bar() == <init>()] : PsiType:Void
|
||||
UBinaryExpression (operator = ==) [bar() == <init>()] : PsiType:boolean
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))]
|
||||
USimpleNameReferenceExpression (identifier = bar) [bar] : PsiType:<ErrorType>
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] : PsiType:<ErrorType>
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:<ErrorType>
|
||||
@@ -0,0 +1,33 @@
|
||||
UFile (package = ) [public final class LocalDeclarationsKt {...]
|
||||
UClass (name = LocalDeclarationsKt) [public final class LocalDeclarationsKt {...}]
|
||||
UAnnotationMethod (name = foo) [public static final fun foo() : boolean {...}]
|
||||
UBlockExpression [{...}] = Nothing
|
||||
UDeclarationsExpression [public static final class Local {...}] = Undetermined
|
||||
UClass (name = Local) [public static final class Local {...}]
|
||||
UAnnotationMethod (name = LocalDeclarationsKt$foo$Local) [public fun LocalDeclarationsKt$foo$Local() = UastEmptyExpression]
|
||||
UDeclarationsExpression [var bar: <ErrorType> = fun () {...}] = Undetermined
|
||||
UVariable (name = bar) [var bar: <ErrorType> = fun () {...}]
|
||||
ULambdaExpression [fun () {...}] = Undetermined
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()()
|
||||
UDeclarationsExpression [var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {...}] = Undetermined
|
||||
ULocalVariable (name = baz) [var baz: kotlin.jvm.functions.Function0<? extends kotlin.Unit> = fun () {...}]
|
||||
ULambdaExpression [fun () {...}] = Undetermined
|
||||
UBlockExpression [{...}] = external <init>()()
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()()
|
||||
UDeclarationsExpression [var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (var text: java.lang.String) {...}] = Undetermined
|
||||
UVariable (name = someLocalFun) [var someLocalFun: kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.String,? extends java.lang.Integer> = fun (var text: java.lang.String) {...}]
|
||||
ULambdaExpression [fun (var text: java.lang.String) {...}] = Undetermined
|
||||
UParameter (name = text) [var text: java.lang.String]
|
||||
ULiteralExpression (value = 42) [42] = 42
|
||||
UReturnExpression [return bar() == <init>()] = Nothing
|
||||
UBinaryExpression (operator = ==) [bar() == <init>()] = Undetermined
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) [bar()] = external bar()()
|
||||
UIdentifier (Identifier (bar)) [UIdentifier (Identifier (bar))]
|
||||
USimpleNameReferenceExpression (identifier = bar) [bar] = external bar()()
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 0)) [<init>()] = external <init>()()
|
||||
UIdentifier (Identifier (Local)) [UIdentifier (Identifier (Local))]
|
||||
USimpleNameReferenceExpression (identifier = <init>) [<init>] = external <init>()()
|
||||
@@ -0,0 +1,31 @@
|
||||
UFile (package = )
|
||||
UClass (name = MyAnnotation)
|
||||
UClass (name = MyAnnotation2)
|
||||
UClass (name = MyAnnotation3)
|
||||
UClass (name = MyAnnotation4)
|
||||
UClass (name = MyAnnotation5)
|
||||
UClass (name = Test1)
|
||||
UField (name = bar)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = getBar)
|
||||
UAnnotationMethod (name = setBar)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = Test1)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = MyAnnotation)
|
||||
UAnnotation (fqName = null)
|
||||
UClass (name = Test2)
|
||||
UField (name = bar)
|
||||
UAnnotation (fqName = MyAnnotation5)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = getBar)
|
||||
UAnnotation (fqName = MyAnnotation)
|
||||
UAnnotationMethod (name = setBar)
|
||||
UAnnotation (fqName = MyAnnotation2)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = MyAnnotation3)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = Test2)
|
||||
UParameter (name = bar)
|
||||
UAnnotation (fqName = null)
|
||||
@@ -0,0 +1,30 @@
|
||||
public abstract annotation MyAnnotation {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation2 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation3 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation4 {
|
||||
}
|
||||
|
||||
public abstract annotation MyAnnotation5 {
|
||||
}
|
||||
|
||||
public final class Test1 {
|
||||
@null private var bar: int
|
||||
public final fun getBar() : int = UastEmptyExpression
|
||||
public final fun setBar(@null p: int) : void = UastEmptyExpression
|
||||
public fun Test1(@MyAnnotation @null bar: int) = UastEmptyExpression
|
||||
}
|
||||
|
||||
public final class Test2 {
|
||||
@MyAnnotation5 @null private var bar: int
|
||||
@MyAnnotation
|
||||
public final fun getBar() : int = UastEmptyExpression
|
||||
@MyAnnotation2
|
||||
public final fun setBar(@MyAnnotation3 @null p: int) : void = UastEmptyExpression
|
||||
public fun Test2(@null bar: int) = UastEmptyExpression
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
UFile (package = )
|
||||
UClass (name = ParametersWithDefaultValuesKt)
|
||||
UAnnotationMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UParameter (name = b)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UParameter (name = c)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 0)
|
||||
UParameter (name = flag)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = false)
|
||||
UBlockExpression
|
||||
@@ -0,0 +1,4 @@
|
||||
public final class ParametersWithDefaultValuesKt {
|
||||
public static final fun foo(@null a: int, @org.jetbrains.annotations.NotNull b: java.lang.String, @null c: int, @null flag: boolean) : void {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
val sdCardPath by lazy { "/sdcard" }
|
||||
|
||||
fun localPropertyTest() {
|
||||
val sdCardPathLocal by lazy { "/sdcard" }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
UFile (package = )
|
||||
UClass (name = PropertyDelegateKt)
|
||||
UField (name = sdCardPath$delegate)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (lazy))
|
||||
USimpleNameReferenceExpression (identifier = lazy)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
ULiteralExpression (value = "/sdcard")
|
||||
UAnnotationMethod (name = getSdCardPath)
|
||||
UAnnotationMethod (name = localPropertyTest)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = sdCardPathLocal)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (lazy))
|
||||
USimpleNameReferenceExpression (identifier = lazy)
|
||||
ULambdaExpression
|
||||
UBlockExpression
|
||||
ULiteralExpression (value = "/sdcard")
|
||||
@@ -0,0 +1,7 @@
|
||||
public final class PropertyDelegateKt {
|
||||
@org.jetbrains.annotations.NotNull private static final var sdCardPath$delegate: kotlin.Lazy
|
||||
public static final fun getSdCardPath() : java.lang.String = UastEmptyExpression
|
||||
public static final fun localPropertyTest() : void {
|
||||
var sdCardPathLocal: java.lang.String
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
UFile (package = )
|
||||
UClass (name = PropertyWithAnnotationKt)
|
||||
UField (name = prop1)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 0)
|
||||
UField (name = prop3)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 0)
|
||||
UAnnotationMethod (name = getProp1)
|
||||
UAnnotationMethod (name = getProp2)
|
||||
UAnnotation (fqName = TestAnnotation)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 0)
|
||||
UAnnotationMethod (name = getProp3)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = 0)
|
||||
UAnnotationMethod (name = setProp3)
|
||||
UAnnotation (fqName = TestAnnotation)
|
||||
UParameter (name = value)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UBinaryExpression (operator = =)
|
||||
USimpleNameReferenceExpression (identifier = field)
|
||||
USimpleNameReferenceExpression (identifier = value)
|
||||
UClass (name = TestAnnotation)
|
||||
@@ -0,0 +1,19 @@
|
||||
public final class PropertyWithAnnotationKt {
|
||||
@null private static final var prop1: int = 0
|
||||
@null private static var prop3: int = 0
|
||||
public static final fun getProp1() : int = UastEmptyExpression
|
||||
@TestAnnotation
|
||||
public static final fun getProp2() : int {
|
||||
return 0
|
||||
}
|
||||
public static final fun getProp3() : int {
|
||||
return 0
|
||||
}
|
||||
@TestAnnotation
|
||||
public static final fun setProp3(@null value: int) : void {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
public abstract annotation TestAnnotation {
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
UFile (package = )
|
||||
UClass (name = SimpleScript)
|
||||
UAnnotationMethod (name = getBarOrNull)
|
||||
UParameter (name = flag)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UIfExpression
|
||||
USimpleNameReferenceExpression (identifier = flag)
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (Bar))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
ULiteralExpression (value = 42)
|
||||
ULiteralExpression (value = null)
|
||||
UAnnotationMethod (name = SimpleScript)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println)
|
||||
ULiteralExpression (value = "Hello World!")
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (getBarOrNull))
|
||||
USimpleNameReferenceExpression (identifier = getBarOrNull)
|
||||
ULiteralExpression (value = true)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println)
|
||||
ULiteralExpression (value = "Goodbye World!")
|
||||
UClass (name = Bar)
|
||||
UField (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 0)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = getB)
|
||||
UAnnotationMethod (name = getAPlusB)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
UBinaryExpression (operator = +)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
USimpleNameReferenceExpression (identifier = b)
|
||||
UAnnotationMethod (name = getA)
|
||||
UAnnotationMethod (name = Bar)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UClass (name = Baz)
|
||||
UAnnotationMethod (name = doSomething)
|
||||
UBlockExpression
|
||||
UAnnotationMethod (name = Baz)
|
||||
@@ -1,5 +1,5 @@
|
||||
public class SimpleScript : kotlin.script.templates.standard.ScriptTemplateWithArgs {
|
||||
public final fun getBarOrNull(@org.jetbrains.annotations.NotNull flag: boolean) : SimpleScript.Bar {
|
||||
public final fun getBarOrNull(@null flag: boolean) : SimpleScript.Bar {
|
||||
return if (flag) <init>(42) else null
|
||||
}
|
||||
public fun SimpleScript(@null p: java.lang.String[]) {
|
||||
@@ -8,14 +8,14 @@ public class SimpleScript : kotlin.script.templates.standard.ScriptTemplateWithA
|
||||
println("Goodbye World!")
|
||||
}
|
||||
public static final class Bar {
|
||||
@org.jetbrains.annotations.NotNull private final var b: int = 0
|
||||
@org.jetbrains.annotations.NotNull private final var a: int
|
||||
@null private final var b: int = 0
|
||||
@null private final var a: int
|
||||
public final fun getB() : int = UastEmptyExpression
|
||||
public final fun getAPlusB() : int {
|
||||
return a + b
|
||||
}
|
||||
public final fun getA() : int = UastEmptyExpression
|
||||
public fun Bar(@org.jetbrains.annotations.NotNull a: int) = UastEmptyExpression
|
||||
public fun Bar(@null a: int) = UastEmptyExpression
|
||||
public static final class Baz {
|
||||
public final fun doSomething() : void {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
UFile (package = )
|
||||
UClass (name = StringTemplateComplexKt)
|
||||
UField (name = muchRecur)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
ULiteralExpression (value = "abc")
|
||||
UField (name = case4)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "a ")
|
||||
ULiteralExpression (value = "literal")
|
||||
ULiteralExpression (value = " z")
|
||||
UField (name = case5)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "a ")
|
||||
ULiteralExpression (value = "literal")
|
||||
ULiteralExpression (value = " ")
|
||||
ULiteralExpression (value = "literal")
|
||||
ULiteralExpression (value = " z")
|
||||
UField (name = literalInLiteral)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "a ")
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "literal")
|
||||
USimpleNameReferenceExpression (identifier = case4)
|
||||
ULiteralExpression (value = " z")
|
||||
UField (name = literalInLiteral2)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "a ")
|
||||
UQualifiedReferenceExpression
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = "literal")
|
||||
USimpleNameReferenceExpression (identifier = case4)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (repeat))
|
||||
USimpleNameReferenceExpression (identifier = repeat)
|
||||
ULiteralExpression (value = 4)
|
||||
ULiteralExpression (value = " z")
|
||||
UAnnotationMethod (name = getMuchRecur)
|
||||
UAnnotationMethod (name = getCase4)
|
||||
UAnnotationMethod (name = getCase5)
|
||||
UAnnotationMethod (name = getLiteralInLiteral)
|
||||
UAnnotationMethod (name = getLiteralInLiteral2)
|
||||
UAnnotationMethod (name = simpleForTemplate)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = null)
|
||||
ULiteralExpression (value = 0)
|
||||
UBlockExpression
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UAnnotationMethod (name = foo)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println)
|
||||
USimpleNameReferenceExpression (identifier = baz)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = template1)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (simpleForTemplate))
|
||||
USimpleNameReferenceExpression (identifier = simpleForTemplate)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = template2)
|
||||
UPolyadicExpression (operator = +)
|
||||
ULiteralExpression (value = ".")
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (simpleForTemplate))
|
||||
USimpleNameReferenceExpression (identifier = simpleForTemplate)
|
||||
@@ -0,0 +1,18 @@
|
||||
public final class StringTemplateComplexKt {
|
||||
@org.jetbrains.annotations.NotNull private static final var muchRecur: java.lang.String = "abc"
|
||||
@org.jetbrains.annotations.NotNull private static final var case4: java.lang.String = "a " + "literal" + " z"
|
||||
@org.jetbrains.annotations.NotNull private static final var case5: java.lang.String = "a " + "literal" + " " + "literal" + " z"
|
||||
@org.jetbrains.annotations.NotNull private static final var literalInLiteral: java.lang.String = "a " + "literal" + case4 + " z"
|
||||
@org.jetbrains.annotations.NotNull private static final var literalInLiteral2: java.lang.String = "a " + "literal" + case4.repeat(4) + " z"
|
||||
public static final fun getMuchRecur() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getCase4() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getCase5() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression
|
||||
public static final fun simpleForTemplate(@null i: int) : java.lang.String = i
|
||||
public static final fun foo() : void {
|
||||
println(baz)
|
||||
var template1: java.lang.String = simpleForTemplate()
|
||||
var template2: java.lang.String = "." + simpleForTemplate()
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
UFile (package = )
|
||||
UClass (name = SuperCallsKt)
|
||||
UField (name = anon)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UObjectLiteralExpression
|
||||
ULiteralExpression (value = "textForAnon")
|
||||
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)
|
||||
UAnnotationMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UAnnotationMethod (name = getStr)
|
||||
UAnnotationMethod (name = A)
|
||||
UParameter (name = str)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UAnnotationMethod (name = A)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (this))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (toString))
|
||||
USimpleNameReferenceExpression (identifier = toString)
|
||||
UClass (name = B)
|
||||
UAnnotationMethod (name = B)
|
||||
UParameter (name = param)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
USimpleNameReferenceExpression (identifier = param)
|
||||
UClass (name = C)
|
||||
UAnnotationMethod (name = foo)
|
||||
UParameter (name = a)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UQualifiedReferenceExpression
|
||||
USuperExpression (label = null)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||
UIdentifier (Identifier (foo))
|
||||
USimpleNameReferenceExpression (identifier = foo)
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
UAnnotationMethod (name = C)
|
||||
UParameter (name = p)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (super))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
USimpleNameReferenceExpression (identifier = p)
|
||||
UAnnotationMethod (name = C)
|
||||
UParameter (name = i)
|
||||
UAnnotation (fqName = null)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (super))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
USimpleNameReferenceExpression (identifier = i)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (println))
|
||||
USimpleNameReferenceExpression (identifier = println)
|
||||
UClass (name = O)
|
||||
UField (name = INSTANCE)
|
||||
UAnnotation (fqName = null)
|
||||
UAnnotationMethod (name = O)
|
||||
UBlockExpression
|
||||
UCallExpression (kind = UastCallKind(name='constructor_call'), argCount = 1))
|
||||
UIdentifier (Identifier (A))
|
||||
USimpleNameReferenceExpression (identifier = <init>)
|
||||
ULiteralExpression (value = "text")
|
||||
@@ -0,0 +1,51 @@
|
||||
public final class SuperCallsKt {
|
||||
@org.jetbrains.annotations.NotNull private static final var anon: A = anonymous object : A("textForAnon") {
|
||||
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(@org.jetbrains.annotations.NotNull a: A) : void {
|
||||
}
|
||||
}
|
||||
|
||||
public class A {
|
||||
@org.jetbrains.annotations.NotNull private final var str: java.lang.String
|
||||
public fun foo(@null a: long) : void {
|
||||
}
|
||||
public final fun getStr() : java.lang.String = UastEmptyExpression
|
||||
public fun A(@org.jetbrains.annotations.NotNull str: java.lang.String) = UastEmptyExpression
|
||||
public fun A(@null i: int) {
|
||||
<init>(i.toString())
|
||||
}
|
||||
}
|
||||
|
||||
public final class B : A {
|
||||
public fun B(@org.jetbrains.annotations.NotNull param: java.lang.String) {
|
||||
<init>(param)
|
||||
}
|
||||
}
|
||||
|
||||
public final class C : A {
|
||||
public fun foo(@null a: long) : void {
|
||||
super.foo(a)
|
||||
}
|
||||
public fun C(@org.jetbrains.annotations.NotNull p: java.lang.String) {
|
||||
<init>(p)
|
||||
}
|
||||
public fun C(@null i: int) {
|
||||
<init>(i)
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
public final class O : A {
|
||||
@null public static final var INSTANCE: O
|
||||
private fun O() {
|
||||
<init>("text")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
UFile (package = )
|
||||
UClass (name = WhenAndDestructingKt)
|
||||
UAnnotationMethod (name = getElementsAdditionalResolve)
|
||||
UParameter (name = string)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||
UBlockExpression
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = arr)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2))
|
||||
UIdentifier (Identifier (listOf))
|
||||
USimpleNameReferenceExpression (identifier = listOf)
|
||||
ULiteralExpression (value = "1")
|
||||
ULiteralExpression (value = "2")
|
||||
USwitchExpression
|
||||
USimpleNameReferenceExpression (identifier = string)
|
||||
UExpressionList (when)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "aaaa")
|
||||
UExpressionList (when_entry)
|
||||
UReturnExpression
|
||||
ULiteralExpression (value = "bindingContext")
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
UExpressionList (when_entry)
|
||||
UDeclarationsExpression
|
||||
ULocalVariable (name = var837f1e82)
|
||||
USimpleNameReferenceExpression (identifier = arr)
|
||||
ULocalVariable (name = bindingContext)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var837f1e82)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component1))
|
||||
USimpleNameReferenceExpression (identifier = <anonymous class>)
|
||||
ULocalVariable (name = statementFilter)
|
||||
UQualifiedReferenceExpression
|
||||
USimpleNameReferenceExpression (identifier = var837f1e82)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (component2))
|
||||
USimpleNameReferenceExpression (identifier = <anonymous class>)
|
||||
UReturnExpression
|
||||
USimpleNameReferenceExpression (identifier = bindingContext)
|
||||
UBreakExpression (label = null)
|
||||
@@ -0,0 +1,21 @@
|
||||
public final class WhenAndDestructingKt {
|
||||
public static final fun getElementsAdditionalResolve(@org.jetbrains.annotations.NotNull string: java.lang.String) : java.lang.String {
|
||||
var arr: java.util.List<? extends java.lang.String> = listOf("1", "2")
|
||||
switch (string) {
|
||||
"aaaa" -> {
|
||||
return "bindingContext"
|
||||
break
|
||||
}
|
||||
|
||||
-> {
|
||||
var var837f1e82: <ErrorType> = arr
|
||||
var bindingContext: java.lang.String = var837f1e82.<anonymous class>()
|
||||
var statementFilter: java.lang.String = var837f1e82.<anonymous class>()
|
||||
return bindingContext
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
UFile (package = )
|
||||
UClass (name = WhenStringLiteralKt)
|
||||
UField (name = a)
|
||||
UAnnotation (fqName = org.jetbrains.annotations.Nullable)
|
||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||
UIdentifier (Identifier (readLine))
|
||||
USimpleNameReferenceExpression (identifier = readLine)
|
||||
UField (name = b)
|
||||
UAnnotation (fqName = null)
|
||||
USwitchExpression
|
||||
USimpleNameReferenceExpression (identifier = a)
|
||||
UExpressionList (when)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "abc")
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 1)
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
ULiteralExpression (value = "def")
|
||||
ULiteralExpression (value = "ghi")
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 2)
|
||||
UBreakExpression (label = null)
|
||||
USwitchClauseExpressionWithBody
|
||||
UExpressionList (when_entry)
|
||||
ULiteralExpression (value = 3)
|
||||
UBreakExpression (label = null)
|
||||
UAnnotationMethod (name = getA)
|
||||
UAnnotationMethod (name = getB)
|
||||
UAnnotationMethod (name = <no name provided>)
|
||||
UBlockExpression
|
||||
ULiteralExpression (value = "abc1")
|
||||
ULiteralExpression (value = "def1")
|
||||
@@ -0,0 +1,27 @@
|
||||
public final class WhenStringLiteralKt {
|
||||
@org.jetbrains.annotations.Nullable private static final var a: java.lang.String = readLine()
|
||||
@null private static final var b: int = switch (a) {
|
||||
"abc" -> {
|
||||
1
|
||||
break
|
||||
}
|
||||
|
||||
"def", "ghi" -> {
|
||||
2
|
||||
break
|
||||
}
|
||||
|
||||
-> {
|
||||
3
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final fun getA() : java.lang.String = UastEmptyExpression
|
||||
public static final fun getB() : int = UastEmptyExpression
|
||||
public static final fun <no name provided>() : void {
|
||||
"abc1"
|
||||
"def1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user