@@ -181,7 +181,7 @@ open class KotlinFileExtractor(
181
181
}
182
182
}
183
183
184
- fun extractTypeParameter (tp : IrTypeParameter , apparentIndex : Int , javaTypeParameter : JavaTypeParameter ? ): Label <out DbTypevariable >? {
184
+ private fun extractTypeParameter (tp : IrTypeParameter , apparentIndex : Int , javaTypeParameter : JavaTypeParameter ? ): Label <out DbTypevariable >? {
185
185
with (" type parameter" , tp) {
186
186
val parentId = getTypeParameterParentLabel(tp) ? : return null
187
187
val id = tw.getLabelFor<DbTypevariable >(getTypeParameterLabel(tp))
@@ -216,7 +216,7 @@ open class KotlinFileExtractor(
216
216
}
217
217
}
218
218
219
- fun extractVisibility (elementForLocation : IrElement , id : Label <out DbModifiable >, v : DescriptorVisibility ) {
219
+ private fun extractVisibility (elementForLocation : IrElement , id : Label <out DbModifiable >, v : DescriptorVisibility ) {
220
220
with (" visibility" , elementForLocation) {
221
221
when (v) {
222
222
DescriptorVisibilities .PRIVATE -> addModifiers(id, " private" )
@@ -250,7 +250,7 @@ open class KotlinFileExtractor(
250
250
}
251
251
}
252
252
253
- fun extractClassModifiers (c : IrClass , id : Label <out DbClassorinterface >) {
253
+ private fun extractClassModifiers (c : IrClass , id : Label <out DbClassorinterface >) {
254
254
with (" class modifiers" , c) {
255
255
when (c.modality) {
256
256
Modality .FINAL -> addModifiers(id, " final" )
@@ -371,7 +371,7 @@ open class KotlinFileExtractor(
371
371
tw.writeHasLocation(stmtId, locId)
372
372
}
373
373
374
- fun extractObinitFunction (c : IrClass , parentId : Label <out DbClassorinterface >) {
374
+ private fun extractObinitFunction (c : IrClass , parentId : Label <out DbClassorinterface >) {
375
375
// add method:
376
376
val obinitLabel = getObinitLabel(c)
377
377
val obinitId = tw.getLabelFor<DbMethod >(obinitLabel)
@@ -506,7 +506,7 @@ open class KotlinFileExtractor(
506
506
507
507
data class FieldResult (val id : Label <DbField >, val name : String )
508
508
509
- fun useCompanionObjectClassInstance (c : IrClass ): FieldResult ? {
509
+ private fun useCompanionObjectClassInstance (c : IrClass ): FieldResult ? {
510
510
val parent = c.parent
511
511
if (! c.isCompanion) {
512
512
logger.error(" Using companion instance for non-companion class" )
@@ -524,7 +524,7 @@ open class KotlinFileExtractor(
524
524
}
525
525
}
526
526
527
- fun useObjectClassInstance (c : IrClass ): FieldResult {
527
+ private fun useObjectClassInstance (c : IrClass ): FieldResult {
528
528
if (! c.isNonCompanionObject) {
529
529
logger.error(" Using instance for non-object class" )
530
530
}
@@ -719,13 +719,13 @@ open class KotlinFileExtractor(
719
719
}
720
720
}
721
721
722
- fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) =
722
+ private fun extractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) =
723
723
if (isFake(f))
724
724
null
725
725
else
726
726
forceExtractFunction(f, parentId, extractBody, extractMethodAndParameterTypeAccesses, typeSubstitution, classTypeArgsIncludingOuterClasses, null , null )
727
727
728
- fun forceExtractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? , idOverride : Label <DbMethod >? , locOverride : Label <DbLocation >? ): Label <out DbCallable > {
728
+ private fun forceExtractFunction (f : IrFunction , parentId : Label <out DbReftype >, extractBody : Boolean , extractMethodAndParameterTypeAccesses : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? , idOverride : Label <DbMethod >? , locOverride : Label <DbLocation >? ): Label <out DbCallable > {
729
729
with (" function" , f) {
730
730
DeclarationStackAdjuster (f).use {
731
731
@@ -828,7 +828,7 @@ open class KotlinFileExtractor(
828
828
&& f.symbol !is IrConstructorSymbol // not a constructor
829
829
}
830
830
831
- fun extractField (f : IrField , parentId : Label <out DbReftype >): Label <out DbField > {
831
+ private fun extractField (f : IrField , parentId : Label <out DbReftype >): Label <out DbField > {
832
832
with (" field" , f) {
833
833
DeclarationStackAdjuster (f).use {
834
834
declarationStack.push(f)
@@ -862,7 +862,7 @@ open class KotlinFileExtractor(
862
862
return id
863
863
}
864
864
865
- fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , extractFunctionBodies : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
865
+ private fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , extractFunctionBodies : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
866
866
with (" property" , p) {
867
867
if (isFake(p)) return
868
868
@@ -931,7 +931,7 @@ open class KotlinFileExtractor(
931
931
}
932
932
}
933
933
934
- fun extractEnumEntry (ee : IrEnumEntry , parentId : Label <out DbReftype >, extractTypeAccess : Boolean ) {
934
+ private fun extractEnumEntry (ee : IrEnumEntry , parentId : Label <out DbReftype >, extractTypeAccess : Boolean ) {
935
935
with (" enum entry" , ee) {
936
936
DeclarationStackAdjuster (ee).use {
937
937
val id = useEnumEntry(ee)
@@ -953,7 +953,7 @@ open class KotlinFileExtractor(
953
953
}
954
954
}
955
955
956
- fun extractTypeAlias (ta : IrTypeAlias ) {
956
+ private fun extractTypeAlias (ta : IrTypeAlias ) {
957
957
with (" type alias" , ta) {
958
958
if (ta.typeParameters.isNotEmpty()) {
959
959
// TODO: Extract this information
@@ -968,7 +968,7 @@ open class KotlinFileExtractor(
968
968
}
969
969
}
970
970
971
- fun extractBody (b : IrBody , callable : Label <out DbCallable >) {
971
+ private fun extractBody (b : IrBody , callable : Label <out DbCallable >) {
972
972
with (" body" , b) {
973
973
when (b) {
974
974
is IrBlockBody -> extractBlockBody(b, callable)
@@ -981,7 +981,7 @@ open class KotlinFileExtractor(
981
981
}
982
982
}
983
983
984
- fun extractBlockBody (b : IrBlockBody , callable : Label <out DbCallable >) {
984
+ private fun extractBlockBody (b : IrBlockBody , callable : Label <out DbCallable >) {
985
985
with (" block body" , b) {
986
986
val id = tw.getFreshIdLabel<DbBlock >()
987
987
val locId = tw.getLocation(b)
@@ -993,7 +993,7 @@ open class KotlinFileExtractor(
993
993
}
994
994
}
995
995
996
- fun extractSyntheticBody (b : IrSyntheticBody , callable : Label <out DbCallable >) {
996
+ private fun extractSyntheticBody (b : IrSyntheticBody , callable : Label <out DbCallable >) {
997
997
with (" synthetic body" , b) {
998
998
when (b.kind) {
999
999
IrSyntheticBodyKind .ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1 )
@@ -1002,7 +1002,7 @@ open class KotlinFileExtractor(
1002
1002
}
1003
1003
}
1004
1004
1005
- fun extractExpressionBody (b : IrExpressionBody , callable : Label <out DbCallable >) {
1005
+ private fun extractExpressionBody (b : IrExpressionBody , callable : Label <out DbCallable >) {
1006
1006
with (" expression body" , b) {
1007
1007
val blockId = tw.getFreshIdLabel<DbBlock >()
1008
1008
val locId = tw.getLocation(b)
@@ -1026,7 +1026,7 @@ open class KotlinFileExtractor(
1026
1026
return v
1027
1027
}
1028
1028
1029
- fun extractVariable (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1029
+ private fun extractVariable (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1030
1030
with (" variable" , v) {
1031
1031
val stmtId = tw.getFreshIdLabel<DbLocalvariabledeclstmt >()
1032
1032
val locId = tw.getLocation(getVariableLocationProvider(v))
@@ -1036,7 +1036,7 @@ open class KotlinFileExtractor(
1036
1036
}
1037
1037
}
1038
1038
1039
- fun extractVariableExpr (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
1039
+ private fun extractVariableExpr (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
1040
1040
with (" variable expr" , v) {
1041
1041
val varId = useVariable(v)
1042
1042
val exprId = tw.getFreshIdLabel<DbLocalvariabledeclexpr >()
@@ -1060,7 +1060,7 @@ open class KotlinFileExtractor(
1060
1060
}
1061
1061
}
1062
1062
1063
- fun extractStatement (s : IrStatement , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1063
+ private fun extractStatement (s : IrStatement , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1064
1064
with (" statement" , s) {
1065
1065
when (s) {
1066
1066
is IrExpression -> {
@@ -1399,15 +1399,15 @@ open class KotlinFileExtractor(
1399
1399
}
1400
1400
}
1401
1401
1402
- fun findFunction (cls : IrClass , name : String ): IrFunction ? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction ?
1402
+ private fun findFunction (cls : IrClass , name : String ): IrFunction ? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction ?
1403
1403
1404
1404
val jvmIntrinsicsClass by lazy {
1405
1405
val result = pluginContext.referenceClass(FqName (" kotlin.jvm.internal.Intrinsics" ))?.owner
1406
1406
result?.let { extractExternalClassLater(it) }
1407
1407
result
1408
1408
}
1409
1409
1410
- fun findJdkIntrinsicOrWarn (name : String , warnAgainstElement : IrElement ): IrFunction ? {
1410
+ private fun findJdkIntrinsicOrWarn (name : String , warnAgainstElement : IrElement ): IrFunction ? {
1411
1411
val result = jvmIntrinsicsClass?.let { findFunction(it, name) }
1412
1412
if (result == null ) {
1413
1413
logger.errorElement(" Couldn't find JVM intrinsic function $name " , warnAgainstElement)
@@ -1501,7 +1501,7 @@ open class KotlinFileExtractor(
1501
1501
result
1502
1502
}
1503
1503
1504
- fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , hasQuestionMark : Boolean? = false): Boolean {
1504
+ private fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , hasQuestionMark : Boolean? = false): Boolean {
1505
1505
val verbose = false
1506
1506
fun verboseln (s : String ) { if (verbose) println (s) }
1507
1507
verboseln(" Attempting match for $pkgName $classNameLogged $fName " )
@@ -1545,10 +1545,10 @@ open class KotlinFileExtractor(
1545
1545
return true
1546
1546
}
1547
1547
1548
- fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , hasQuestionMark : Boolean? = false) =
1548
+ private fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , hasQuestionMark : Boolean? = false) =
1549
1549
isFunction(target, pkgName, className, { it == className }, fName, hasQuestionMark)
1550
1550
1551
- fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
1551
+ private fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
1552
1552
return isFunction(target, " kotlin" , " Int" , fName) ||
1553
1553
isFunction(target, " kotlin" , " Byte" , fName) ||
1554
1554
isFunction(target, " kotlin" , " Short" , fName) ||
@@ -1557,7 +1557,7 @@ open class KotlinFileExtractor(
1557
1557
isFunction(target, " kotlin" , " Double" , fName)
1558
1558
}
1559
1559
1560
- fun isArrayType (typeName : String ) =
1560
+ private fun isArrayType (typeName : String ) =
1561
1561
when (typeName) {
1562
1562
" Array" -> true
1563
1563
" IntArray" -> true
@@ -1571,7 +1571,7 @@ open class KotlinFileExtractor(
1571
1571
else -> false
1572
1572
}
1573
1573
1574
- fun extractCall (c : IrCall , callable : Label <out DbCallable >, stmtExprParent : StmtExprParent ) {
1574
+ private fun extractCall (c : IrCall , callable : Label <out DbCallable >, stmtExprParent : StmtExprParent ) {
1575
1575
with (" call" , c) {
1576
1576
val target = tryReplaceSyntheticFunction(c.symbol.owner)
1577
1577
@@ -2250,7 +2250,7 @@ open class KotlinFileExtractor(
2250
2250
else -> null
2251
2251
}
2252
2252
2253
- fun getUpdateInPlaceRHS (origin : IrStatementOrigin ? , isExpectedLhs : (IrExpression ? ) -> Boolean , updateRhs : IrExpression ): IrExpression ? {
2253
+ private fun getUpdateInPlaceRHS (origin : IrStatementOrigin ? , isExpectedLhs : (IrExpression ? ) -> Boolean , updateRhs : IrExpression ): IrExpression ? {
2254
2254
// Check for a desugared in-place update operator, such as "v += e":
2255
2255
return getStatementOriginOperator(origin)?.let {
2256
2256
if (updateRhs is IrCall &&
@@ -2265,7 +2265,7 @@ open class KotlinFileExtractor(
2265
2265
}
2266
2266
}
2267
2267
2268
- fun writeUpdateInPlaceExpr (origin : IrStatementOrigin , tw : TrapWriter , id : Label <DbAssignexpr >, type : TypeResults , exprParent : ExprParent ): Boolean {
2268
+ private fun writeUpdateInPlaceExpr (origin : IrStatementOrigin , tw : TrapWriter , id : Label <DbAssignexpr >, type : TypeResults , exprParent : ExprParent ): Boolean {
2269
2269
when (origin) {
2270
2270
IrStatementOrigin .PLUSEQ -> tw.writeExprs_assignaddexpr(id.cast<DbAssignaddexpr >(), type.javaResult.id, exprParent.parent, exprParent.idx)
2271
2271
IrStatementOrigin .MINUSEQ -> tw.writeExprs_assignsubexpr(id.cast<DbAssignsubexpr >(), type.javaResult.id, exprParent.parent, exprParent.idx)
@@ -2277,7 +2277,7 @@ open class KotlinFileExtractor(
2277
2277
return true
2278
2278
}
2279
2279
2280
- fun tryExtractArrayUpdate (e : IrContainerExpression , callable : Label <out DbCallable >, parent : StmtExprParent ): Boolean {
2280
+ private fun tryExtractArrayUpdate (e : IrContainerExpression , callable : Label <out DbCallable >, parent : StmtExprParent ): Boolean {
2281
2281
/*
2282
2282
* We're expecting the pattern
2283
2283
* {
@@ -2348,15 +2348,15 @@ open class KotlinFileExtractor(
2348
2348
return false
2349
2349
}
2350
2350
2351
- fun extractExpressionStmt (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
2351
+ private fun extractExpressionStmt (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
2352
2352
extractExpression(e, callable, StmtParent (parent, idx))
2353
2353
}
2354
2354
2355
2355
fun extractExpressionExpr (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
2356
2356
extractExpression(e, callable, ExprParent (parent, idx, enclosingStmt))
2357
2357
}
2358
2358
2359
- fun extractExpression (e : IrExpression , callable : Label <out DbCallable >, parent : StmtExprParent ) {
2359
+ private fun extractExpression (e : IrExpression , callable : Label <out DbCallable >, parent : StmtExprParent ) {
2360
2360
with (" expression" , e) {
2361
2361
when (e) {
2362
2362
is IrDelegatingConstructorCall -> {
@@ -3819,7 +3819,7 @@ open class KotlinFileExtractor(
3819
3819
}
3820
3820
}
3821
3821
3822
- fun extractVarargElement (e : IrVarargElement , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
3822
+ private fun extractVarargElement (e : IrVarargElement , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
3823
3823
with (" vararg element" , e) {
3824
3824
val argExpr = when (e) {
3825
3825
is IrExpression -> e
@@ -4011,7 +4011,7 @@ open class KotlinFileExtractor(
4011
4011
return initId
4012
4012
}
4013
4013
4014
- fun extractTypeOperatorCall (e : IrTypeOperatorCall , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
4014
+ private fun extractTypeOperatorCall (e : IrTypeOperatorCall , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
4015
4015
with (" type operator call" , e) {
4016
4016
when (e.operator ) {
4017
4017
IrTypeOperator .CAST -> {
0 commit comments