Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6cbcdc

Browse files
tamasvajkigfoo
authored andcommitted
Extract type access expression for parameter types
1 parent f557719 commit d6cbcdc

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ open class KotlinFileExtractor(
503503
private fun extractValueParameter(vp: IrValueParameter, parent: Label<out DbCallable>, idx: Int, typeSubstitution: TypeSubstitution?, parentSourceDeclaration: Label<out DbCallable>, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?): TypeResults {
504504
with("value parameter", vp) {
505505
val location = getLocation(vp, classTypeArgsIncludingOuterClasses)
506-
return extractValueParameter(useValueParameter(vp, parent), vp.type, vp.name.asString(), location, parent, idx, typeSubstitution, useValueParameter(vp, parentSourceDeclaration), vp.isVararg)
506+
val id = useValueParameter(vp, parent)
507+
if (!isExternalDeclaration(vp)) {
508+
extractTypeAccessRecursive(vp.type, location, id, -1)
509+
}
510+
return extractValueParameter(id, vp.type, vp.name.asString(), location, parent, idx, typeSubstitution, useValueParameter(vp, parentSourceDeclaration), vp.isVararg)
507511
}
508512
}
509513

java/ql/test/kotlin/library-tests/exprs_typeaccess/PrintAst.expected

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ A.kt:
4949
# 16| 0: [TypeAccess] Integer
5050
#-----| 4: (Parameters)
5151
# 16| 0: [Parameter] i
52+
# 16| 0: [TypeAccess] C<C<Integer>>
53+
# 16| 0: [TypeAccess] C<Integer>
54+
# 16| 0: [TypeAccess] Integer
5255
# 16| 5: [BlockStmt] { ... }
5356
# 16| 0: [ReturnStmt] return ...
5457
# 16| 0: [VarAccess] i
5558
# 17| 10: [Method] fn
5659
# 17| 3: [TypeAccess] int
5760
#-----| 4: (Parameters)
5861
# 17| 0: [Parameter] i
62+
# 17| 0: [TypeAccess] int
5963
# 17| 5: [BlockStmt] { ... }
6064
# 18| 0: [LocalVariableDeclStmt] var ...;
6165
# 18| 1: [LocalVariableDeclExpr] x
@@ -75,6 +79,7 @@ A.kt:
7579
# 0| 3: [TypeAccess] Enu
7680
#-----| 4: (Parameters)
7781
# 0| 0: [Parameter] value
82+
# 0| 0: [TypeAccess] String
7883
# 23| 3: [Constructor] Enu
7984
# 23| 5: [BlockStmt] { ... }
8085
# 23| 0: [ExprStmt] <Expr>;

0 commit comments

Comments
 (0)