very minor cleanup
get rid of uses of `syntax2` in AgentTypeChecker

this required a little reordering of phases. Optimizer used to run
before AgentTypeChecker, but Optimizer replaces primitives in the
code and the new primitive might have a different syntax than the
old prim, so it won't be valid for AgentTypeChecker to be looking
back at `syntax` instead of ahead at `syntax2`.

solution: put Optimizer last. we like this anyway because compilers
generally find correctness problems first, then do
correctness-preserving transformations later. but as a result we
needed to change Optimizer to copy `agentClassString` information over
when it makes new prims, since otherwise the agent type information
recorded there by agentClassString may be lost, making agent type
checks blow up at runtime instead of producing proper runtime
errors.
fixup: beef up testing of agent type checking
fixup: do AgentTypeChecker at the beginning of MiddleEnd

this is a necessary accompaniment to the change we made to AgentTypeChecker
where we look at core.syntax instead of nvm.syntax2.  it means we have
to do agent type checking before any of the visitors make changes to
the prims, since swapping one prim for another can mean the back-end syntax
no longer matches the front-end syntax
fixup AgentTypeChecker

amend last commit to do ReferenceVisitor first. otherwise
code like `O> diffuse pcolor 1` looks to AgentTypeChecker
as if the observer were trying to access a patch prim

sigh
fixup (add comment & whitespace)