Skip to content

Commit a22b054

Browse files
committed
skip class with private array
1 parent 9a6391d commit a22b054

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

server/src/FeaturesFilter.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,53 @@ void FeaturesFilter::filter(utbot::SettingsContext const &settingsContext,
9696
return true;
9797
}
9898

99+
for (const auto &param: method.params) {
100+
if (typesHandler.isStruct(param.type)) {
101+
for (const auto &field: typesHandler.getStructInfo(param.type).fields) {
102+
if (field.type.isArray() && field.accessSpecifier != types::Field::AS_pubic) {
103+
std::stringstream message;
104+
message
105+
<< "Method '" << method.name
106+
<< "' was skipped, as class '" << param.type.typeName()
107+
<< "' has private array member '" << field.name << "'";
108+
LOG_S(DEBUG) << message.str();
109+
tests.commentBlocks.push_back(message.str());
110+
return true;
111+
}
112+
}
113+
}
114+
}
115+
116+
if (typesHandler.isStruct(method.returnType)) {
117+
for (const auto &field: typesHandler.getStructInfo(method.returnType).fields) {
118+
if (field.type.isArray() && field.accessSpecifier != types::Field::AS_pubic) {
119+
std::stringstream message;
120+
message
121+
<< "Method '" << method.name
122+
<< "' was skipped, as class '" << method.returnType.typeName()
123+
<< "' has private array member '" << field.name << "'";
124+
LOG_S(DEBUG) << message.str();
125+
tests.commentBlocks.push_back(message.str());
126+
return true;
127+
}
128+
}
129+
}
130+
131+
if (method.isClassMethod()) {
132+
for (const auto &field : typesHandler.getStructInfo(method.classObj->type).fields) {
133+
if (field.type.isArray() && field.accessSpecifier != types::Field::AS_pubic) {
134+
std::stringstream message;
135+
message
136+
<< "Method '" << method.name
137+
<< "' was skipped, as class '" << method.getClassName().value()
138+
<< "' has private array member '" << field.name << "'";
139+
LOG_S(DEBUG) << message.str();
140+
tests.commentBlocks.push_back(message.str());
141+
return true;
142+
}
143+
}
144+
}
145+
99146
unsupportedStatistics["passed features filter"]++;
100147

101148
return false;

server/src/printers/Printer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ namespace printer {
609609
if (!checkedOnPrivate.count(type.getId()) && typesHandler->isStruct(type)) {
610610
checkedOnPrivate.insert(type.getId());
611611
for (const auto& field : typesHandler->getStructInfo(type).fields) {
612-
if (field.accessSpecifier != types::Field::AS_pubic) {
612+
if (field.accessSpecifier != types::Field::AS_pubic && !field.type.isArray()) {
613613
ss << StringUtils::stringFormat("ACCESS_PRIVATE_FIELD(%s, %s, %s)",
614614
type.typeName(),
615615
field.type.typeName(),

0 commit comments

Comments
 (0)