Skip to content

Commit

Permalink
Fix used extension check false positive from usused object or behavio…
Browse files Browse the repository at this point in the history
…r events (#7331)

- Don't show in changelog
  • Loading branch information
D8H authored Jan 22, 2025
1 parent 994f6bf commit cb24f19
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions Core/GDCore/IDE/Events/UsedExtensionsFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,16 @@ bool UsedExtensionsFinder::DoVisitInstruction(gd::Instruction& instruction,
project.GetCurrentPlatform(), instruction.GetType())
: gd::MetadataProvider::GetExtensionAndActionMetadata(
project.GetCurrentPlatform(), instruction.GetType());
result.AddUsedExtension(metadata.GetExtension());
for (auto&& includeFile : metadata.GetMetadata().GetIncludeFiles()) {
result.AddUsedIncludeFiles(includeFile);
// Unused event-based objects or events-based behaviors may use object and
// behavior instructions that should not be detected as extension usage.
// The extension of actually used objects and behaviors will be detected on
// scene objects. This is why object or behavior instructions usually don't
// have any import.
if (!metadata.GetMetadata().GetIncludeFiles().empty()) {
result.AddUsedExtension(metadata.GetExtension());
for (auto &&includeFile : metadata.GetMetadata().GetIncludeFiles()) {
result.AddUsedIncludeFiles(includeFile);
}
}

gd::ParameterMetadataTools::IterateOverParameters(
Expand Down Expand Up @@ -199,9 +206,16 @@ void UsedExtensionsFinder::OnVisitFunctionCallNode(FunctionCallNode& node) {
return;
}

result.AddUsedExtension(metadata.GetExtension());
for (auto&& includeFile : metadata.GetMetadata().GetIncludeFiles()) {
result.AddUsedIncludeFiles(includeFile);
// Unused event-based objects or events-based behaviors may use object and
// behavior expressions that should not be detected as extension usage.
// The extension of actually used objects and behaviors will be detected on
// scene objects. This is why object or behavior expressions usually don't
// have any import.
if (!metadata.GetMetadata().GetIncludeFiles().empty()) {
result.AddUsedExtension(metadata.GetExtension());
for (auto &&includeFile : metadata.GetMetadata().GetIncludeFiles()) {
result.AddUsedIncludeFiles(includeFile);
}
}
};

Expand Down

0 comments on commit cb24f19

Please sign in to comment.