add is_template() for class_definition

and memoize some member functions' results
do not visit the same class twice
cosmetic change; names

- recursive_walker -> w
- with_new_scope -> introduce_scope_and_walk