Fixed a bug in identifying enclosing nonanonymous classes.

This commit belongs to issue #41.