Record Scope depth for easy comparison.

Might also want to store a reference to the global scope to determine if
two scopes descend from the same global scope, but haven't seen an urgent
use case yet.