Add test for multiple references to a property in a template
Fix serious issue with tpl()

accessProp() was resetting the value of properties on objects
to undefined as it was iterating over them and accessing them.

Ensure that we don't set the value of a property we're accessing
by more stringent check for whether we're working in "set" mode.