@@ -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
@@ -831,7 +831,7 @@ open class KotlinFileExtractor(
831
831
&& f.symbol !is IrConstructorSymbol // not a constructor
832
832
}
833
833
834
- fun extractField (f : IrField , parentId : Label <out DbReftype >): Label <out DbField > {
834
+ private fun extractField (f : IrField , parentId : Label <out DbReftype >): Label <out DbField > {
835
835
with (" field" , f) {
836
836
DeclarationStackAdjuster (f).use {
837
837
declarationStack.push(f)
@@ -865,7 +865,7 @@ open class KotlinFileExtractor(
865
865
return id
866
866
}
867
867
868
- fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , extractFunctionBodies : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
868
+ private fun extractProperty (p : IrProperty , parentId : Label <out DbReftype >, extractBackingField : Boolean , extractFunctionBodies : Boolean , typeSubstitution : TypeSubstitution ? , classTypeArgsIncludingOuterClasses : List <IrTypeArgument >? ) {
869
869
with (" property" , p) {
870
870
if (isFake(p)) return
871
871
@@ -940,7 +940,7 @@ open class KotlinFileExtractor(
940
940
}
941
941
}
942
942
943
- fun extractEnumEntry (ee : IrEnumEntry , parentId : Label <out DbReftype >, extractTypeAccess : Boolean ) {
943
+ private fun extractEnumEntry (ee : IrEnumEntry , parentId : Label <out DbReftype >, extractTypeAccess : Boolean ) {
944
944
with (" enum entry" , ee) {
945
945
DeclarationStackAdjuster (ee).use {
946
946
val id = useEnumEntry(ee)
@@ -962,7 +962,7 @@ open class KotlinFileExtractor(
962
962
}
963
963
}
964
964
965
- fun extractTypeAlias (ta : IrTypeAlias ) {
965
+ private fun extractTypeAlias (ta : IrTypeAlias ) {
966
966
with (" type alias" , ta) {
967
967
if (ta.typeParameters.isNotEmpty()) {
968
968
// TODO: Extract this information
@@ -977,7 +977,7 @@ open class KotlinFileExtractor(
977
977
}
978
978
}
979
979
980
- fun extractBody (b : IrBody , callable : Label <out DbCallable >) {
980
+ private fun extractBody (b : IrBody , callable : Label <out DbCallable >) {
981
981
with (" body" , b) {
982
982
when (b) {
983
983
is IrBlockBody -> extractBlockBody(b, callable)
@@ -990,7 +990,7 @@ open class KotlinFileExtractor(
990
990
}
991
991
}
992
992
993
- fun extractBlockBody (b : IrBlockBody , callable : Label <out DbCallable >) {
993
+ private fun extractBlockBody (b : IrBlockBody , callable : Label <out DbCallable >) {
994
994
with (" block body" , b) {
995
995
val id = tw.getFreshIdLabel<DbBlock >()
996
996
val locId = tw.getLocation(b)
@@ -1002,7 +1002,7 @@ open class KotlinFileExtractor(
1002
1002
}
1003
1003
}
1004
1004
1005
- fun extractSyntheticBody (b : IrSyntheticBody , callable : Label <out DbCallable >) {
1005
+ private fun extractSyntheticBody (b : IrSyntheticBody , callable : Label <out DbCallable >) {
1006
1006
with (" synthetic body" , b) {
1007
1007
when (b.kind) {
1008
1008
IrSyntheticBodyKind .ENUM_VALUES -> tw.writeKtSyntheticBody(callable, 1 )
@@ -1011,7 +1011,7 @@ open class KotlinFileExtractor(
1011
1011
}
1012
1012
}
1013
1013
1014
- fun extractExpressionBody (b : IrExpressionBody , callable : Label <out DbCallable >) {
1014
+ private fun extractExpressionBody (b : IrExpressionBody , callable : Label <out DbCallable >) {
1015
1015
with (" expression body" , b) {
1016
1016
val blockId = tw.getFreshIdLabel<DbBlock >()
1017
1017
val locId = tw.getLocation(b)
@@ -1035,7 +1035,7 @@ open class KotlinFileExtractor(
1035
1035
return v
1036
1036
}
1037
1037
1038
- fun extractVariable (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1038
+ private fun extractVariable (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1039
1039
with (" variable" , v) {
1040
1040
val stmtId = tw.getFreshIdLabel<DbLocalvariabledeclstmt >()
1041
1041
val locId = tw.getLocation(getVariableLocationProvider(v))
@@ -1045,7 +1045,7 @@ open class KotlinFileExtractor(
1045
1045
}
1046
1046
}
1047
1047
1048
- fun extractVariableExpr (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
1048
+ private fun extractVariableExpr (v : IrVariable , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
1049
1049
with (" variable expr" , v) {
1050
1050
val varId = useVariable(v)
1051
1051
val exprId = tw.getFreshIdLabel<DbLocalvariabledeclexpr >()
@@ -1069,7 +1069,7 @@ open class KotlinFileExtractor(
1069
1069
}
1070
1070
}
1071
1071
1072
- fun extractStatement (s : IrStatement , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1072
+ private fun extractStatement (s : IrStatement , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
1073
1073
with (" statement" , s) {
1074
1074
when (s) {
1075
1075
is IrExpression -> {
@@ -1408,15 +1408,15 @@ open class KotlinFileExtractor(
1408
1408
}
1409
1409
}
1410
1410
1411
- fun findFunction (cls : IrClass , name : String ): IrFunction ? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction ?
1411
+ private fun findFunction (cls : IrClass , name : String ): IrFunction ? = cls.declarations.find { it is IrFunction && it.name.asString() == name } as IrFunction ?
1412
1412
1413
1413
val jvmIntrinsicsClass by lazy {
1414
1414
val result = pluginContext.referenceClass(FqName (" kotlin.jvm.internal.Intrinsics" ))?.owner
1415
1415
result?.let { extractExternalClassLater(it) }
1416
1416
result
1417
1417
}
1418
1418
1419
- fun findJdkIntrinsicOrWarn (name : String , warnAgainstElement : IrElement ): IrFunction ? {
1419
+ private fun findJdkIntrinsicOrWarn (name : String , warnAgainstElement : IrElement ): IrFunction ? {
1420
1420
val result = jvmIntrinsicsClass?.let { findFunction(it, name) }
1421
1421
if (result == null ) {
1422
1422
logger.errorElement(" Couldn't find JVM intrinsic function $name " , warnAgainstElement)
@@ -1510,7 +1510,7 @@ open class KotlinFileExtractor(
1510
1510
result
1511
1511
}
1512
1512
1513
- fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , hasQuestionMark : Boolean? = false): Boolean {
1513
+ private fun isFunction (target : IrFunction , pkgName : String , classNameLogged : String , classNamePredicate : (String ) -> Boolean , fName : String , hasQuestionMark : Boolean? = false): Boolean {
1514
1514
val verbose = false
1515
1515
fun verboseln (s : String ) { if (verbose) println (s) }
1516
1516
verboseln(" Attempting match for $pkgName $classNameLogged $fName " )
@@ -1554,10 +1554,10 @@ open class KotlinFileExtractor(
1554
1554
return true
1555
1555
}
1556
1556
1557
- fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , hasQuestionMark : Boolean? = false) =
1557
+ private fun isFunction (target : IrFunction , pkgName : String , className : String , fName : String , hasQuestionMark : Boolean? = false) =
1558
1558
isFunction(target, pkgName, className, { it == className }, fName, hasQuestionMark)
1559
1559
1560
- fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
1560
+ private fun isNumericFunction (target : IrFunction , fName : String ): Boolean {
1561
1561
return isFunction(target, " kotlin" , " Int" , fName) ||
1562
1562
isFunction(target, " kotlin" , " Byte" , fName) ||
1563
1563
isFunction(target, " kotlin" , " Short" , fName) ||
@@ -1566,7 +1566,7 @@ open class KotlinFileExtractor(
1566
1566
isFunction(target, " kotlin" , " Double" , fName)
1567
1567
}
1568
1568
1569
- fun isArrayType (typeName : String ) =
1569
+ private fun isArrayType (typeName : String ) =
1570
1570
when (typeName) {
1571
1571
" Array" -> true
1572
1572
" IntArray" -> true
@@ -1580,7 +1580,7 @@ open class KotlinFileExtractor(
1580
1580
else -> false
1581
1581
}
1582
1582
1583
- fun extractCall (c : IrCall , callable : Label <out DbCallable >, stmtExprParent : StmtExprParent ) {
1583
+ private fun extractCall (c : IrCall , callable : Label <out DbCallable >, stmtExprParent : StmtExprParent ) {
1584
1584
with (" call" , c) {
1585
1585
val target = tryReplaceSyntheticFunction(c.symbol.owner)
1586
1586
@@ -2259,7 +2259,7 @@ open class KotlinFileExtractor(
2259
2259
else -> null
2260
2260
}
2261
2261
2262
- fun getUpdateInPlaceRHS (origin : IrStatementOrigin ? , isExpectedLhs : (IrExpression ? ) -> Boolean , updateRhs : IrExpression ): IrExpression ? {
2262
+ private fun getUpdateInPlaceRHS (origin : IrStatementOrigin ? , isExpectedLhs : (IrExpression ? ) -> Boolean , updateRhs : IrExpression ): IrExpression ? {
2263
2263
// Check for a desugared in-place update operator, such as "v += e":
2264
2264
return getStatementOriginOperator(origin)?.let {
2265
2265
if (updateRhs is IrCall &&
@@ -2274,7 +2274,7 @@ open class KotlinFileExtractor(
2274
2274
}
2275
2275
}
2276
2276
2277
- fun writeUpdateInPlaceExpr (origin : IrStatementOrigin , tw : TrapWriter , id : Label <DbAssignexpr >, type : TypeResults , exprParent : ExprParent ): Boolean {
2277
+ private fun writeUpdateInPlaceExpr (origin : IrStatementOrigin , tw : TrapWriter , id : Label <DbAssignexpr >, type : TypeResults , exprParent : ExprParent ): Boolean {
2278
2278
when (origin) {
2279
2279
IrStatementOrigin .PLUSEQ -> tw.writeExprs_assignaddexpr(id.cast<DbAssignaddexpr >(), type.javaResult.id, exprParent.parent, exprParent.idx)
2280
2280
IrStatementOrigin .MINUSEQ -> tw.writeExprs_assignsubexpr(id.cast<DbAssignsubexpr >(), type.javaResult.id, exprParent.parent, exprParent.idx)
@@ -2286,7 +2286,7 @@ open class KotlinFileExtractor(
2286
2286
return true
2287
2287
}
2288
2288
2289
- fun tryExtractArrayUpdate (e : IrContainerExpression , callable : Label <out DbCallable >, parent : StmtExprParent ): Boolean {
2289
+ private fun tryExtractArrayUpdate (e : IrContainerExpression , callable : Label <out DbCallable >, parent : StmtExprParent ): Boolean {
2290
2290
/*
2291
2291
* We're expecting the pattern
2292
2292
* {
@@ -2357,15 +2357,15 @@ open class KotlinFileExtractor(
2357
2357
return false
2358
2358
}
2359
2359
2360
- fun extractExpressionStmt (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
2360
+ private fun extractExpressionStmt (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbStmtparent >, idx : Int ) {
2361
2361
extractExpression(e, callable, StmtParent (parent, idx))
2362
2362
}
2363
2363
2364
2364
fun extractExpressionExpr (e : IrExpression , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
2365
2365
extractExpression(e, callable, ExprParent (parent, idx, enclosingStmt))
2366
2366
}
2367
2367
2368
- fun extractExpression (e : IrExpression , callable : Label <out DbCallable >, parent : StmtExprParent ) {
2368
+ private fun extractExpression (e : IrExpression , callable : Label <out DbCallable >, parent : StmtExprParent ) {
2369
2369
with (" expression" , e) {
2370
2370
when (e) {
2371
2371
is IrDelegatingConstructorCall -> {
@@ -3828,7 +3828,7 @@ open class KotlinFileExtractor(
3828
3828
}
3829
3829
}
3830
3830
3831
- fun extractVarargElement (e : IrVarargElement , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
3831
+ private fun extractVarargElement (e : IrVarargElement , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
3832
3832
with (" vararg element" , e) {
3833
3833
val argExpr = when (e) {
3834
3834
is IrExpression -> e
@@ -4020,7 +4020,7 @@ open class KotlinFileExtractor(
4020
4020
return initId
4021
4021
}
4022
4022
4023
- fun extractTypeOperatorCall (e : IrTypeOperatorCall , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
4023
+ private fun extractTypeOperatorCall (e : IrTypeOperatorCall , callable : Label <out DbCallable >, parent : Label <out DbExprparent >, idx : Int , enclosingStmt : Label <out DbStmt >) {
4024
4024
with (" type operator call" , e) {
4025
4025
when (e.operator ) {
4026
4026
IrTypeOperator .CAST -> {
0 commit comments