cfengine/core — pull request #447 by baptr (2013-03-19 04:28:19+00:00)
Title: Expansion Rework

Given the refactoring work still underway, I don't expect this to actually get merged, but I wanted to post it in case it was useful to the effort.

If there is actual interest in merging, I can certainly rebase and squash.

This patch reworks MapIteratorsFromScalar to:
* recursively expand any *nested* variable references so that all lists that may be encountered during final expansion can be mapped to the iteration context
* map any remotely referenced scalars to local scope primarily so that a complex variable can reference a mapped list *and* a scalar
* rewrite "." -> "#" in place to more carefully ensure the proper "." is modified (could be a bit better still)
* avoid mapping explicit this.* variables (may need more thought)
* adds some tests and pulls a few that now pass from staging

Fixes [dev 2145](https://cfengine.com/dev/issues/2145) [dev 1333](https://cfengine.com/dev/issues/1333) [mantis 1128](https://cfengine.com/bugtracker/view.php?id=1128), and certainly others.