Skip to content

Commit

Permalink
Merge pull request #416 from Privado-Inc/patchInheritSemantic
Browse files Browse the repository at this point in the history
consider member of classes which inherit - in semantic generation
  • Loading branch information
pandurangpatil authored Mar 14, 2023
2 parents 10946dd + 15a7f74 commit 354aa71
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/scala/ai/privado/utility/Utilities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,13 @@ object Utilities {
val semanticList = ListBuffer[String]()

TaggerCache.typeDeclMemberCache.keys.foreach(typeDeclValue => {
val typeDeclNode = cpg.typeDecl.where(_.fullName(typeDeclValue)).l
val allMembers = typeDeclNode.member.name.toSet
val typeDeclNode = cpg.typeDecl.where(_.fullName(typeDeclValue)).l
// Need to considers members of classes which inherits via extends/implements, as hence are also a member
val inheritedMembers =
typeDeclNode.inheritsFromTypeFullName
.flatMap(inheritFullName => cpg.typeDecl.fullName(inheritFullName).member.name.toSet)
.toSet
val allMembers = typeDeclNode.member.name.toSet ++ inheritedMembers
val personalMembers = TaggerCache.typeDeclMemberCache(typeDeclValue).values.name.toSet
val nonPersonalMembers = allMembers.diff(personalMembers)

Expand Down

0 comments on commit 354aa71

Please sign in to comment.