summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-07-23 21:50:33 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-07-30 22:03:17 (GMT)
commitef38ff22f71ad0ffe83db42d903d26d4a41f4114 (patch)
tree91700b2676898bbb638b19c574e4ad77425f7c3b /Source/cmFunctionCommand.cxx
parentb51fba6298012c3b697c461486ce06c9e5c97c16 (diff)
downloadCMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.zip
CMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.tar.gz
CMake-ef38ff22f71ad0ffe83db42d903d26d4a41f4114.tar.bz2
cm*FunctionBlocker: Extract function Replay
Diffstat (limited to 'Source/cmFunctionCommand.cxx')
-rw-r--r--Source/cmFunctionCommand.cxx30
1 files changed, 19 insertions, 11 deletions
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index f8230f1..51b6970 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -110,6 +110,8 @@ public:
bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile& mf,
cmExecutionStatus&) override;
bool ShouldRemove(const cmListFileFunction&, cmMakefile& mf) override;
+ bool Replay(std::vector<cmListFileFunction> const& functions,
+ cmExecutionStatus& status);
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
@@ -117,7 +119,7 @@ public:
};
bool cmFunctionFunctionBlocker::IsFunctionBlocked(
- const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus&)
+ const cmListFileFunction& lff, cmMakefile& mf, cmExecutionStatus& status)
{
// record commands until we hit the ENDFUNCTION
// at the ENDFUNCTION call we shift gears and start looking for invocations
@@ -126,16 +128,8 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked(
} else if (lff.Name.Lower == "endfunction") {
// if this is the endfunction for this function then execute
if (!this->Depth) {
- // create a new command and add it to cmake
- cmFunctionHelperCommand f;
- f.Args = this->Args;
- f.Functions = this->Functions;
- f.FilePath = this->GetStartingContext().FilePath;
- mf.RecordPolicies(f.Policies);
- mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
- // remove the function blocker now that the function is defined
- mf.RemoveFunctionBlocker(this, lff);
- return true;
+ auto self = mf.RemoveFunctionBlocker(this, lff);
+ return this->Replay(this->Functions, status);
}
// decrement for each nested function that ends
this->Depth--;
@@ -165,6 +159,20 @@ bool cmFunctionFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
return false;
}
+bool cmFunctionFunctionBlocker::Replay(
+ std::vector<cmListFileFunction> const& functions, cmExecutionStatus& status)
+{
+ cmMakefile& mf = status.GetMakefile();
+ // create a new command and add it to cmake
+ cmFunctionHelperCommand f;
+ f.Args = this->Args;
+ f.Functions = functions;
+ f.FilePath = this->GetStartingContext().FilePath;
+ mf.RecordPolicies(f.Policies);
+ mf.GetState()->AddScriptedCommand(this->Args[0], std::move(f));
+ return true;
+}
+
bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{