[FIR]: Pass special origins for local functions (named and anonymous)
This commit is contained in:
@@ -217,7 +217,7 @@ class Fir2IrVisitor(
|
||||
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: Any?): IrElement {
|
||||
val irFunction = if (simpleFunction.visibility == Visibilities.Local) {
|
||||
declarationStorage.createIrFunction(
|
||||
simpleFunction, irParent = conversionScope.parent(), isLocal = true
|
||||
simpleFunction, irParent = conversionScope.parent(), origin = IrDeclarationOrigin.LOCAL_FUNCTION, isLocal = true
|
||||
)
|
||||
} else {
|
||||
declarationStorage.getCachedIrFunction(simpleFunction)!!
|
||||
@@ -236,7 +236,7 @@ class Fir2IrVisitor(
|
||||
override fun visitAnonymousFunction(anonymousFunction: FirAnonymousFunction, data: Any?): IrElement {
|
||||
return anonymousFunction.convertWithOffsets { startOffset, endOffset ->
|
||||
val irFunction = declarationStorage.createIrFunction(
|
||||
anonymousFunction, irParent = conversionScope.parent(), isLocal = true
|
||||
anonymousFunction, irParent = conversionScope.parent(), origin = IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA, isLocal = true
|
||||
)
|
||||
conversionScope.withFunction(irFunction) {
|
||||
memberGenerator.convertFunctionContent(irFunction, anonymousFunction, containingClass = null)
|
||||
|
||||
@@ -49,7 +49,7 @@ FILE fqName:<root> fileName:/noSymbolForIntRangeIterator.kt
|
||||
CONST Int type=kotlin.Int value=10
|
||||
VAR name:y type:kotlin.Int [val]
|
||||
CONST Int type=kotlin.Int value=10
|
||||
FUN name:localFunc visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
FUN LOCAL_FUNCTION name:localFunc visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit origin=FOR_LOOP
|
||||
VAR FOR_LOOP_ITERATOR name:tmp_1 type:kotlin.collections.IntIterator [val]
|
||||
|
||||
@@ -48,7 +48,7 @@ FILE fqName:<root> fileName:/lambdas.kt
|
||||
FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Function2<kotlin.Int, kotlin.Int, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function2<kotlin.Int, kotlin.Int, kotlin.Unit> origin=LAMBDA
|
||||
FUN name:<no name provided> visibility:local modality:FINAL <> (i:kotlin.Int, j:kotlin.Int) returnType:kotlin.Unit
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> (i:kotlin.Int, j:kotlin.Int) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:i index:0 type:kotlin.Int
|
||||
VALUE_PARAMETER name:j index:1 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@ FILE fqName:<root> fileName:/kt47245.kt
|
||||
CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
|
||||
$this: GET_VAR 'val tmp_0: kotlin.collections.IntIterator [val] declared in <root>.test' type=kotlin.collections.IntIterator origin=null
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
FUN name:x visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
FUN LOCAL_FUNCTION name:x visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ FILE fqName:<root> fileName:/variableAsFunctionCallWithGenerics.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-kt26531Val> <T> (): kotlin.Function0<T of <root>.<get-kt26531Val>> declared in <root>'
|
||||
FUN_EXPR type=kotlin.Function0<T of <root>.<get-kt26531Val>> origin=LAMBDA
|
||||
FUN name:<no name provided> visibility:local modality:FINAL <> () returnType:T of <root>.<get-kt26531Val>
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> () returnType:T of <root>.<get-kt26531Val>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (): T of <root>.<get-kt26531Val> declared in <root>.<get-kt26531Val>'
|
||||
GET_VAR '<this>: T of <root>.<get-kt26531Val> declared in <root>.<get-kt26531Val>' type=T of <root>.<get-kt26531Val> origin=null
|
||||
|
||||
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/anonymousFunction.kt
|
||||
FIELD PROPERTY_BACKING_FIELD name:anonymous type:kotlin.Function0<kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN name:<no name provided> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<no name provided> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun println (): kotlin.Unit [inline] declared in kotlin.io.ConsoleKt' type=kotlin.Unit origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-anonymous> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Unit>
|
||||
|
||||
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/localFunction.kt
|
||||
BLOCK_BODY
|
||||
VAR name:x type:kotlin.Int [var]
|
||||
CONST Int type=kotlin.Int value=0
|
||||
FUN name:local visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
FUN LOCAL_FUNCTION name:local visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
||||
GET_VAR 'var x: kotlin.Int [var] declared in <root>.outer' type=kotlin.Int origin=null
|
||||
|
||||
Reference in New Issue
Block a user