Add shadowing support

Change-Id: I9f496fb31d92848c5ca9e6b4e32b8562ad614aa0
Reviewed-on: http://review.couchbase.org/44085
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Li Yang <lichenyang2@gmail.com>