strongly type attributes

**please review**
the two `if`s can be merged with an `||`

also, why does this return `null`. I guess `null` encodes not-visited, but it seems ugly. We'll probably get to it along with the AST refactoring.