Consider bulk-like data for argument accessors

This commit is contained in:
Benjamin Muskalla
2021-10-28 14:17:21 +02:00
parent 739fe75194
commit e2bd792fc2
4 changed files with 14 additions and 6 deletions

View File

@@ -228,10 +228,6 @@ predicate isRelevantType(Type t) {
)
}
predicate isPrimitiveTypeUsedForBulkData(Type t) {
t.getName().regexpMatch("byte|char|Byte|Character")
}
from TargetAPI api, string flow
where flow = captureFlow(api)
select flow order by flow

View File

@@ -102,10 +102,16 @@ private string typeAsModel(RefType type) {
}
string parameterAccess(Parameter p) {
if p.getType() instanceof Array
if
p.getType() instanceof Array and
not isPrimitiveTypeUsedForBulkData(p.getType().(Array).getElementType())
then result = "ArrayElement of Argument[" + p.getPosition() + "]"
else
if p.getType() instanceof ContainerType
then result = "Element of Argument[" + p.getPosition() + "]"
else result = "Argument[" + p.getPosition() + "]"
}
predicate isPrimitiveTypeUsedForBulkData(Type t) {
t.getName().regexpMatch("byte|char|Byte|Character")
}