FIR2IR: convert annotations on local variables

This commit is contained in:
Mikhail Glukhikh
2021-05-31 13:53:27 +03:00
committed by teamcityserver
parent 77dd0ad396
commit 491267b4f7
4 changed files with 3 additions and 47 deletions
@@ -265,6 +265,7 @@ class Fir2IrVisitor(
convertToIrExpression(initializer).cast(initializer, initializer.typeRef, variable.returnTypeRef)
}
}
annotationGenerator.generate(irVariable, variable)
return irVariable
}
@@ -1,12 +0,0 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
fun foo() {
val testVal: String = "testVal"
var testVar: String = "testVar"
}
@@ -1,35 +0,0 @@
FILE fqName:<root> fileName:/variablesWithAnnotations.kt
CLASS ANNOTATION_CLASS name:TestAnn modality:FINAL visibility:public superTypes:[kotlin.Annotation]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestAnn
CONSTRUCTOR visibility:public <> (x:kotlin.String) returnType:<root>.TestAnn [primary]
VALUE_PARAMETER name:x index:0 type:kotlin.String
PROPERTY name:x visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private [final]
EXPRESSION_BODY
GET_VAR 'x: kotlin.String declared in <root>.TestAnn.<init>' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.TestAnn) returnType:kotlin.String
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.TestAnn
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-x> (): kotlin.String declared in <root>.TestAnn'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.TestAnn declared in <root>.TestAnn.<get-x>' type=<root>.TestAnn origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:testVal type:kotlin.String [val]
CONST String type=kotlin.String value="testVal"
VAR name:testVar type:kotlin.String [var]
CONST String type=kotlin.String value="testVar"
@@ -1,3 +1,5 @@
// FIR_IDENTICAL
annotation class TestAnn(val x: String)
fun foo() {