Implement Scope.prototype.declares, .lookup, and .getGlobalScope.

Scanning happens on-demand, so the scope isn't populated until you query
it via one of these methods.