Skip to content

Commit 484050b

Browse files
remove duplicated code in AppendTypesSlow (#152)
1 parent 686fae1 commit 484050b

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -588,25 +588,22 @@ bool Cppyy::AppendTypesSlow(const std::string& name,
588588

589589
for (std::string& i : individual_types) {
590590
// Try going via Cppyy::GetType first.
591-
if (Cppyy::TCppType_t type = GetType(i, /*enable_slow_lookup=*/true)) {
592-
const char* integral_value = nullptr;
593-
if (is_integral(i))
594-
integral_value = strdup(i.c_str());
595-
types.emplace_back(type, integral_value);
596-
} else if (parent && (Cpp::IsNamespace(parent) || Cpp::IsClass(parent))) {
597-
if (Cppyy::TCppType_t type = Cppyy::GetTypeFromScope(Cppyy::GetNamed(name, parent))) {
598-
const char* integral_value = nullptr;
599-
if (is_integral(i))
600-
integral_value = strdup(i.c_str());
601-
types.emplace_back(type, integral_value);
602-
} else {
603-
types.clear();
604-
return true;
605-
}
606-
} else {
591+
const char* integral_value = nullptr;
592+
Cppyy::TCppType_t type = nullptr;
593+
594+
type = GetType(i, /*enable_slow_lookup=*/true);
595+
if (!type && parent && (Cpp::IsNamespace(parent) || Cpp::IsClass(parent))) {
596+
type = Cppyy::GetTypeFromScope(Cppyy::GetNamed(name, parent));
597+
}
598+
599+
if (!type) {
607600
types.clear();
608601
return true;
609602
}
603+
604+
if (is_integral(i))
605+
integral_value = strdup(i.c_str());
606+
types.emplace_back(type, integral_value);
610607
}
611608
return false;
612609
}

0 commit comments

Comments
 (0)