Uast: handling annotations on the property receiver (KT-40539)
This commit is contained in:
@@ -60,7 +60,13 @@ open class KotlinUMethod(
|
|||||||
.map { KotlinUAnnotation(it, this) }
|
.map { KotlinUAnnotation(it, this) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val receiver by lz { (sourcePsi as? KtCallableDeclaration)?.receiverTypeReference }
|
private val receiver by lz {
|
||||||
|
when (sourcePsi) {
|
||||||
|
is KtCallableDeclaration -> sourcePsi
|
||||||
|
is KtPropertyAccessor -> sourcePsi.property
|
||||||
|
else -> null
|
||||||
|
}?.receiverTypeReference
|
||||||
|
}
|
||||||
|
|
||||||
override val uastParameters by lz {
|
override val uastParameters by lz {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ UFile (package = )
|
|||||||
USimpleNameReferenceExpression (identifier = length)
|
USimpleNameReferenceExpression (identifier = length)
|
||||||
UMethod (name = getRx)
|
UMethod (name = getRx)
|
||||||
UParameter (name = $this$getRx)
|
UParameter (name = $this$getRx)
|
||||||
|
UAnnotation (fqName = MyReceiverAnnotation)
|
||||||
|
UNamedExpression (name = name)
|
||||||
|
ULiteralExpression (value = "RegExp")
|
||||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UReturnExpression
|
UReturnExpression
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ UFile (package = )
|
|||||||
USimpleNameReferenceExpression (identifier = length)
|
USimpleNameReferenceExpression (identifier = length)
|
||||||
UMethod (name = getRx)
|
UMethod (name = getRx)
|
||||||
UParameter (name = $this$rx)
|
UParameter (name = $this$rx)
|
||||||
|
UAnnotation (fqName = MyReceiverAnnotation)
|
||||||
|
UNamedExpression (name = name)
|
||||||
|
ULiteralExpression (value = "RegExp")
|
||||||
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
|
||||||
UBlockExpression
|
UBlockExpression
|
||||||
UReturnExpression
|
UReturnExpression
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ public final class ReceiverFunKt {
|
|||||||
public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int {
|
public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int {
|
||||||
return this.length
|
return this.length
|
||||||
}
|
}
|
||||||
public static final fun getRx(@org.jetbrains.annotations.NotNull $this$getRx: java.lang.String) : kotlin.text.Regex {
|
public static final fun getRx(@MyReceiverAnnotation(name = "RegExp") @org.jetbrains.annotations.NotNull $this$getRx: java.lang.String) : kotlin.text.Regex {
|
||||||
return toRegex()
|
return toRegex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ public final class ReceiverFunKt {
|
|||||||
public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int {
|
public static final fun foo(@MyReceiverAnnotation @org.jetbrains.annotations.NotNull $this$foo: java.lang.String) : int {
|
||||||
return this.length
|
return this.length
|
||||||
}
|
}
|
||||||
public static final fun getRx(@org.jetbrains.annotations.NotNull $this$rx: java.lang.String) : kotlin.text.Regex {
|
public static final fun getRx(@MyReceiverAnnotation(name = "RegExp") @org.jetbrains.annotations.NotNull $this$rx: java.lang.String) : kotlin.text.Regex {
|
||||||
return toRegex()
|
return toRegex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user