More thoroughly avoiding side-effects when attributing (to) for Trees.getScope. Reviewed-by: mcimadamore