Don't mutate template AST in evaluate.  Fixes #1143