Ensure that program syntax nodes get deep-copied properly
The changes in
57c1139 prevented copies happening even when they should,
so the shared section got inserted into shader stages by reference. This
caused some funny business with the variable resolver and unused variable
locator.
Containers of nodes must have RefPtrs inside them, since insertions will
create some temporary copies of the element and with NodePtr that would
trigger copying the node as well. So the cloning of nodes is performed
when the container itself is copied.