diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommands.cxx | 2 | ||||
-rw-r--r-- | Source/cmFunctionCommand.cxx | 11 | ||||
-rw-r--r-- | Source/cmFunctionCommand.h | 24 |
3 files changed, 10 insertions, 27 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index f4f4c4a..461ffdf 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -134,7 +134,7 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("find_program", cm::make_unique<cmFindProgramCommand>()); state->AddBuiltinCommand("foreach", cmForEachCommand); - state->AddBuiltinCommand("function", cm::make_unique<cmFunctionCommand>()); + state->AddBuiltinCommand("function", cmFunctionCommand); state->AddBuiltinCommand("get_cmake_property", cm::make_unique<cmGetCMakePropertyCommand>()); state->AddBuiltinCommand("get_directory_property", diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 610f516..f130e8d 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -5,6 +5,7 @@ #include <sstream> #include <utility> +#include "cm_memory.hxx" #include "cm_static_string_view.hxx" #include "cm_string_view.hxx" @@ -18,6 +19,7 @@ #include "cmState.h" #include "cmStringAlgorithms.h" +namespace { // define the class for function commands class cmFunctionHelperCommand { @@ -34,6 +36,7 @@ public: cmPolicies::PolicyMap Policies; std::string FilePath; }; +} bool cmFunctionHelperCommand::operator()( std::vector<cmListFileArgument> const& args, @@ -145,11 +148,11 @@ bool cmFunctionFunctionBlocker::Replay( return true; } -bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmFunctionCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.empty()) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } @@ -157,7 +160,7 @@ bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args, { auto fb = cm::make_unique<cmFunctionFunctionBlocker>(); cmAppend(fb->Args, args); - this->Makefile->AddFunctionBlocker(std::move(fb)); + status.GetMakefile().AddFunctionBlocker(std::move(fb)); } return true; } diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index b334525..d6b549c 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -8,30 +8,10 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; /// Starts function() ... endfunction() block -class cmFunctionCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmFunctionCommand>(); - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmFunctionCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif |