diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-08-05 08:55:32 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-08-22 14:25:53 (GMT) |
commit | 44a2f3f3324a608062eb7b88072c7640f80f4a5c (patch) | |
tree | bcb7ee5b371d05c71d76fb12214c0b82039fa2de /Source/cmListFileCache.cxx | |
parent | 604993248fdee0bec8ab8c74c1173c67496a7dfd (diff) | |
download | CMake-44a2f3f3324a608062eb7b88072c7640f80f4a5c.zip CMake-44a2f3f3324a608062eb7b88072c7640f80f4a5c.tar.gz CMake-44a2f3f3324a608062eb7b88072c7640f80f4a5c.tar.bz2 |
Add new flow-control commands for variables and policies scopes management
Add block() and endblock() commands offering the capability to create
new scopes for variables and/or policies.
Fixes: #20171
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r-- | Source/cmListFileCache.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 91157cb..6270c82 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -347,6 +347,7 @@ enum class NestingStateEnum Foreach, Function, Macro, + Block }; struct NestingState @@ -434,6 +435,16 @@ cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const return cmListFileContext::FromListFileFunction(func, this->FileName); } stack.pop_back(); + } else if (name == "block") { + stack.push_back({ + NestingStateEnum::Block, + cmListFileContext::FromListFileFunction(func, this->FileName), + }); + } else if (name == "endblock") { + if (!TopIs(stack, NestingStateEnum::Block)) { + return cmListFileContext::FromListFileFunction(func, this->FileName); + } + stack.pop_back(); } } |