diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2021-08-09 22:04:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-08-11 12:57:45 (GMT) |
commit | 4c1cdfd8f09182d8a6c87772b7fc0946c691e18b (patch) | |
tree | 6006f8d7cefbfee6772bfc63c26925ed5fee23b7 /Source/cmWhileCommand.cxx | |
parent | d22f68d01998ff3cbbdebaec2f1071148b82d588 (diff) | |
download | CMake-4c1cdfd8f09182d8a6c87772b7fc0946c691e18b.zip CMake-4c1cdfd8f09182d8a6c87772b7fc0946c691e18b.tar.gz CMake-4c1cdfd8f09182d8a6c87772b7fc0946c691e18b.tar.bz2 |
Refactor: Keep `cmWhileFunctionBlocker` members private
Particularly `Args`.
Diffstat (limited to 'Source/cmWhileCommand.cxx')
-rw-r--r-- | Source/cmWhileCommand.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 1285baf..7d9eec0 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -23,7 +23,7 @@ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: - cmWhileFunctionBlocker(cmMakefile* mf); + cmWhileFunctionBlocker(cmMakefile* mf, std::vector<cmListFileArgument> args); ~cmWhileFunctionBlocker() override; cm::string_view StartCommandName() const override { return "while"_s; } @@ -35,14 +35,15 @@ public: bool Replay(std::vector<cmListFileFunction> functions, cmExecutionStatus& inStatus) override; - std::vector<cmListFileArgument> Args; - private: cmMakefile* Makefile; + std::vector<cmListFileArgument> Args; }; -cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf) - : Makefile(mf) +cmWhileFunctionBlocker::cmWhileFunctionBlocker( + cmMakefile* const mf, std::vector<cmListFileArgument> args) + : Makefile{ mf } + , Args{ std::move(args) } { this->Makefile->PushLoopBlock(); } @@ -132,11 +133,9 @@ bool cmWhileCommand(std::vector<cmListFileArgument> const& args, } // create a function blocker - { - auto& makefile = status.GetMakefile(); - auto fb = cm::make_unique<cmWhileFunctionBlocker>(&makefile); - fb->Args = args; - makefile.AddFunctionBlocker(std::move(fb)); - } + auto& makefile = status.GetMakefile(); + makefile.AddFunctionBlocker( + cm::make_unique<cmWhileFunctionBlocker>(&makefile, args)); + return true; } |