diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-07-30 20:58:40 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-07-30 22:03:17 (GMT) |
commit | 6491270e0d3699f5151c08ef41dce84724f9ffc1 (patch) | |
tree | f4caa3b0bc5262e73352394a4bb0ed534a765133 /Source/cmFunctionCommand.cxx | |
parent | af24e4ef6e216184b8c207728d6b0312ce3c1525 (diff) | |
download | CMake-6491270e0d3699f5151c08ef41dce84724f9ffc1.zip CMake-6491270e0d3699f5151c08ef41dce84724f9ffc1.tar.gz CMake-6491270e0d3699f5151c08ef41dce84724f9ffc1.tar.bz2 |
cmFunctionBlocker: Move check for matching args
Diffstat (limited to 'Source/cmFunctionCommand.cxx')
-rw-r--r-- | Source/cmFunctionCommand.cxx | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 6a04196..dd0a5d0 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -113,29 +113,22 @@ public: cm::string_view StartCommandName() const override { return "function"_s; } cm::string_view EndCommandName() const override { return "endfunction"_s; } - bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override; + bool ArgumentsMatch(cmListFileFunction const&, + cmMakefile& mf) const override; + bool Replay(std::vector<cmListFileFunction> const& functions, cmExecutionStatus& status) override; std::vector<std::string> Args; }; -bool cmFunctionFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, - cmMakefile& mf) +bool cmFunctionFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff, + cmMakefile& mf) const { - if (lff.Name.Lower == "endfunction") { - std::vector<std::string> expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments, - this->GetStartingContext().FilePath.c_str()); - // if the endfunction has arguments then make sure - // they match the ones in the opening function command - if ((expandedArguments.empty() || - (expandedArguments[0] == this->Args[0]))) { - return true; - } - } - - return false; + std::vector<std::string> expandedArguments; + mf.ExpandArguments(lff.Arguments, expandedArguments, + this->GetStartingContext().FilePath.c_str()); + return expandedArguments.empty() || expandedArguments[0] == this->Args[0]; } bool cmFunctionFunctionBlocker::Replay( |