| 195 | } |
| 196 | |
| 197 | bool HandlePopBackCommand(std::vector<std::string> const& args, |
| 198 | cmExecutionStatus& status) |
| 199 | { |
| 200 | assert(args.size() >= 2); |
| 201 | |
| 202 | cmMakefile& makefile = status.GetMakefile(); |
| 203 | auto ai = args.cbegin(); |
| 204 | ++ai; // Skip subcommand name |
| 205 | std::string const& listName = *ai++; |
| 206 | auto list = GetList(listName, makefile); |
| 207 | |
| 208 | if (!list) { |
| 209 | // Can't get the list definition... undefine any vars given after. |
| 210 | for (; ai != args.cend(); ++ai) { |
| 211 | makefile.RemoveDefinition(*ai); |
| 212 | } |
| 213 | return true; |
| 214 | } |
| 215 | |
| 216 | if (!list->empty()) { |
| 217 | if (ai == args.cend()) { |
| 218 | // No variables are given... Just remove one element. |
| 219 | list->pop_back(); |
| 220 | } else { |
| 221 | // Ok, assign elements to be removed to the given variables |
| 222 | for (; !list->empty() && ai != args.cend(); ++ai) { |
| 223 | assert(!ai->empty()); |
| 224 | makefile.AddDefinition(*ai, list->back()); |
| 225 | list->pop_back(); |
| 226 | } |
| 227 | // Undefine the rest variables if the list gets empty earlier... |
| 228 | for (; ai != args.cend(); ++ai) { |
| 229 | makefile.RemoveDefinition(*ai); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | makefile.AddDefinition(listName, list->to_string()); |
| 234 | |
| 235 | } else if (ai != |
| 236 | args.cend()) { // The list is empty, but some args were given |
| 237 | // Need to *undefine* 'em all, cuz there are no items to assign... |
| 238 | for (; ai != args.cend(); ++ai) { |
| 239 | makefile.RemoveDefinition(*ai); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | return true; |
| 244 | } |
| 245 | |
| 246 | bool HandlePopFrontCommand(std::vector<std::string> const& args, |
| 247 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…