Expression caching

improved version of #9006 (which was an improved version of #8942)
The tests were also updated in the latest commit. Really I think all this test should do is...
```
expect($parse('{x: 1} | foo').constant).toBe(true);
```