angular/angular.js — pull request #1528 by mernen (2012-11-05 11:38:24+00:00)
Title: feat($parse+Scope): smarter handling of constant expressions

This patch adds two properties to functions returned by `$parse`: literal and constant.

* `literal` is set to true if the expression's top-level is a JavaScript
literal (number, string, boolean, null/undefined, array, object), even
if it contains non-literals inside.
* `constant` is set to true if the expression is known to be made
entirely of constant values, i.e., evaluating it will always yield the
same result.

A consequence is that a JSON expression is guaranteed to be both literal and constant.

Then, `Scope.prototype.$watch()` checks for `constant`, and won't keep it in the watchers list.

This solves issue #1376.