mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-11 10:30:59 +00:00
revert: refactor($parse): only instantiate lex/parse once
This reverts commit 281feba4ca.
Since Lexer and Parser objects are stateful it is not safe
to reuse them for parsing of multiple expressions.
After recent refactoring into prototypical style, the instantiation
of these objects is so cheap that it's not a huge win to use
singletons here.
This commit is contained in:
parent
7a586e5c19
commit
670cd9c165
1 changed files with 2 additions and 2 deletions
|
|
@ -1043,8 +1043,6 @@ function $ParseProvider() {
|
|||
var cache = {};
|
||||
this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
|
||||
return function(exp) {
|
||||
var lexer = new Lexer($sniffer.csp);
|
||||
var parser = new Parser(lexer, $filter, $sniffer.csp);
|
||||
var parsedExpression;
|
||||
|
||||
switch (typeof exp) {
|
||||
|
|
@ -1053,6 +1051,8 @@ function $ParseProvider() {
|
|||
return cache[exp];
|
||||
}
|
||||
|
||||
var lexer = new Lexer($sniffer.csp);
|
||||
var parser = new Parser(lexer, $filter, $sniffer.csp);
|
||||
parsedExpression = parser.parse(exp, false);
|
||||
|
||||
if (exp !== 'hasOwnProperty') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue