@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
15
15
import org.jetbrains.kotlin.ir.declarations.IrVariable
16
16
import org.jetbrains.kotlin.ir.expressions.*
17
17
import org.jetbrains.kotlin.ir.symbols.*
18
+ import org.jetbrains.kotlin.ir.symbols.impl.IrFunctionFakeOverrideSymbol
18
19
import org.jetbrains.kotlin.ir.types.IrType
19
20
import org.jetbrains.kotlin.ir.util.*
20
21
@@ -784,7 +785,35 @@ fun IrWhileLoopImpl(
784
785
origin = origin,
785
786
)
786
787
788
+ private fun IrFunctionSymbol.getRealOwner (): IrFunction {
789
+ var symbol = this
790
+ if (this is IrFunctionFakeOverrideSymbol ) {
791
+ symbol = originalSymbol
792
+ }
793
+ return symbol.owner
794
+ }
795
+
787
796
fun IrCallImpl (
797
+ startOffset : Int ,
798
+ endOffset : Int ,
799
+ type : IrType ,
800
+ symbol : IrSimpleFunctionSymbol ,
801
+ typeArgumentsCount : Int = symbol.getRealOwner().typeParameters.size,
802
+ valueArgumentsCount : Int = symbol.getRealOwner().valueParameters.size,
803
+ origin : IrStatementOrigin ? = null,
804
+ superQualifierSymbol : IrClassSymbol ? = null,
805
+ ): IrCallImpl = IrCallImplWithShape (
806
+ startOffset = startOffset,
807
+ endOffset = endOffset,
808
+ type = type,
809
+ symbol = symbol,
810
+ typeArgumentsCount = typeArgumentsCount,
811
+ valueArgumentsCount = valueArgumentsCount,
812
+ origin = origin,
813
+ superQualifierSymbol = superQualifierSymbol,
814
+ )
815
+
816
+ fun IrCallImplWithShape (
788
817
startOffset : Int ,
789
818
endOffset : Int ,
790
819
type : IrType ,
@@ -806,6 +835,28 @@ fun IrCallImpl(
806
835
)
807
836
808
837
fun IrConstructorCallImpl (
838
+ startOffset : Int ,
839
+ endOffset : Int ,
840
+ type : IrType ,
841
+ symbol : IrConstructorSymbol ,
842
+ typeArgumentsCount : Int ,
843
+ constructorTypeArgumentsCount : Int ,
844
+ valueArgumentsCount : Int = symbol.owner.valueParameters.size,
845
+ origin : IrStatementOrigin ? = null,
846
+ source : SourceElement = SourceElement .NO_SOURCE ,
847
+ ): IrConstructorCallImpl = IrConstructorCallImplWithShape (
848
+ startOffset = startOffset,
849
+ endOffset = endOffset,
850
+ type = type,
851
+ symbol = symbol,
852
+ typeArgumentsCount = typeArgumentsCount,
853
+ constructorTypeArgumentsCount = constructorTypeArgumentsCount,
854
+ valueArgumentsCount = valueArgumentsCount,
855
+ origin = origin,
856
+ source = source
857
+ )
858
+
859
+ fun IrConstructorCallImplWithShape (
809
860
startOffset : Int ,
810
861
endOffset : Int ,
811
862
type : IrType ,
@@ -829,6 +880,22 @@ fun IrConstructorCallImpl(
829
880
)
830
881
831
882
fun IrDelegatingConstructorCallImpl (
883
+ startOffset : Int ,
884
+ endOffset : Int ,
885
+ type : IrType ,
886
+ symbol : IrConstructorSymbol ,
887
+ typeArgumentsCount : Int ,
888
+ valueArgumentsCount : Int = symbol.owner.valueParameters.size,
889
+ ): IrDelegatingConstructorCallImpl = IrDelegatingConstructorCallImplWithShape (
890
+ startOffset = startOffset,
891
+ endOffset = endOffset,
892
+ type = type,
893
+ symbol = symbol,
894
+ typeArgumentsCount = typeArgumentsCount,
895
+ valueArgumentsCount = valueArgumentsCount
896
+ )
897
+
898
+ fun IrDelegatingConstructorCallImplWithShape (
832
899
startOffset : Int ,
833
900
endOffset : Int ,
834
901
type : IrType ,
@@ -847,6 +914,22 @@ fun IrDelegatingConstructorCallImpl(
847
914
)
848
915
849
916
fun IrEnumConstructorCallImpl (
917
+ startOffset : Int ,
918
+ endOffset : Int ,
919
+ type : IrType ,
920
+ symbol : IrConstructorSymbol ,
921
+ typeArgumentsCount : Int ,
922
+ valueArgumentsCount : Int = symbol.owner.valueParameters.size,
923
+ ): IrEnumConstructorCallImpl = IrEnumConstructorCallImplWithShape (
924
+ startOffset = startOffset,
925
+ endOffset = endOffset,
926
+ type = type,
927
+ symbol = symbol,
928
+ typeArgumentsCount = typeArgumentsCount,
929
+ valueArgumentsCount = valueArgumentsCount
930
+ )
931
+
932
+ fun IrEnumConstructorCallImplWithShape (
850
933
startOffset : Int ,
851
934
endOffset : Int ,
852
935
type : IrType ,
@@ -865,6 +948,26 @@ fun IrEnumConstructorCallImpl(
865
948
)
866
949
867
950
fun IrFunctionReferenceImpl (
951
+ startOffset : Int ,
952
+ endOffset : Int ,
953
+ type : IrType ,
954
+ symbol : IrFunctionSymbol ,
955
+ typeArgumentsCount : Int ,
956
+ valueArgumentsCount : Int = symbol.getRealOwner().valueParameters.size,
957
+ reflectionTarget : IrFunctionSymbol ? = symbol,
958
+ origin : IrStatementOrigin ? = null,
959
+ ): IrFunctionReferenceImpl = IrFunctionReferenceImplWithShape (
960
+ startOffset = startOffset,
961
+ endOffset = endOffset,
962
+ type = type,
963
+ symbol = symbol,
964
+ typeArgumentsCount = typeArgumentsCount,
965
+ valueArgumentsCount = valueArgumentsCount,
966
+ reflectionTarget = reflectionTarget,
967
+ origin = origin,
968
+ )
969
+
970
+ fun IrFunctionReferenceImplWithShape (
868
971
startOffset : Int ,
869
972
endOffset : Int ,
870
973
type : IrType ,
@@ -944,7 +1047,7 @@ fun IrCallImpl.Companion.fromSymbolDescriptor(
944
1047
origin : IrStatementOrigin ? = null,
945
1048
superQualifierSymbol : IrClassSymbol ? = null,
946
1049
): IrCallImpl =
947
- IrCallImpl (startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount, origin, superQualifierSymbol)
1050
+ IrCallImplWithShape (startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount, origin, superQualifierSymbol)
948
1051
949
1052
fun IrCallImpl.Companion.fromSymbolOwner (
950
1053
startOffset : Int ,
@@ -987,7 +1090,7 @@ fun IrConstructorCallImpl.Companion.fromSymbolDescriptor(
987
1090
val classTypeParametersCount = constructorDescriptor.constructedClass.original.declaredTypeParameters.size
988
1091
val totalTypeParametersCount = constructorDescriptor.typeParameters.size
989
1092
val valueParametersCount = constructorDescriptor.valueParameters.size + constructorDescriptor.contextReceiverParameters.size
990
- return IrConstructorCallImpl (
1093
+ return IrConstructorCallImplWithShape (
991
1094
startOffset, endOffset,
992
1095
type,
993
1096
constructorSymbol,
@@ -1051,8 +1154,8 @@ fun IrEnumConstructorCallImpl.Companion.fromSymbolDescriptor(
1051
1154
endOffset : Int ,
1052
1155
type : IrType ,
1053
1156
symbol : IrConstructorSymbol ,
1054
- typeArgumentsCount : Int
1055
- ) = IrEnumConstructorCallImpl (startOffset, endOffset, type, symbol, typeArgumentsCount, symbol.descriptor.valueParameters.size)
1157
+ typeArgumentsCount : Int ,
1158
+ ) = IrEnumConstructorCallImplWithShape (startOffset, endOffset, type, symbol, typeArgumentsCount, symbol.descriptor.valueParameters.size)
1056
1159
1057
1160
1058
1161
@ObsoleteDescriptorBasedAPI
@@ -1064,7 +1167,7 @@ fun IrDelegatingConstructorCallImpl.Companion.fromSymbolDescriptor(
1064
1167
typeArgumentsCount : Int = symbol.descriptor.typeParametersCount,
1065
1168
valueArgumentsCount : Int = symbol.descriptor.valueParameters.size + symbol.descriptor.contextReceiverParameters.size,
1066
1169
): IrDelegatingConstructorCallImpl =
1067
- IrDelegatingConstructorCallImpl (startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount)
1170
+ IrDelegatingConstructorCallImplWithShape (startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount)
1068
1171
1069
1172
@UnsafeDuringIrConstructionAPI
1070
1173
fun IrDelegatingConstructorCallImpl.Companion.fromSymbolOwner (
@@ -1087,7 +1190,7 @@ fun IrFunctionReferenceImpl.Companion.fromSymbolDescriptor(
1087
1190
typeArgumentsCount : Int ,
1088
1191
reflectionTarget : IrFunctionSymbol ? ,
1089
1192
origin : IrStatementOrigin ? = null,
1090
- ): IrFunctionReferenceImpl = IrFunctionReferenceImpl (
1193
+ ): IrFunctionReferenceImpl = IrFunctionReferenceImplWithShape (
1091
1194
startOffset, endOffset,
1092
1195
type,
1093
1196
symbol,
0 commit comments