angular/angular.js — pull request #8901 by jbedard (2014-09-03 08:19:27+00:00)
Title: $parse performance/style

c074181 might be the only one worth merging to allow the Parser/Lexer objects to be GCed.

f4ea3c9 addresses a TODO although I didn't notice any major improvements (even though the removed wrapper method is often ~10% when profiling...). Unfortunately the wrapper method is still needed for the expressions returned from `$parse`, but use of `getterFn`s within other expressions don't have the wrapper. This also required a minor error message change.

f4ea3c9 could be expanded in other ways though. Maybe allowing `$parse`ed methods to return something such as a `$$watchFn` property that can be watched instead of the full expression being watched. The simple case would be returning the raw `getterFn` instead of the wrapper for simple `foo.bar` expressions. A more complicated case would be expressions such as `myVar % 2 === 0` returning only the `myVar` `getterFn` to be watched (and then a special watch delegate to see if the full expression actually changed, which makes it more complicated...). Or only watching the input+args to filters etc. Not sure how common or useful those would be though...

The rest are mostly style/simplifying but I thought I'd leave them in there.