Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 75099e6

Browse files
committed
chore($parse): remove simpleGetter optimizations as they're no longer valid
Closes #8101
1 parent 172a409 commit 75099e6

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/ng/parse.js

+1-26
Original file line numberDiff line numberDiff line change
@@ -985,26 +985,6 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
985985
};
986986
}
987987

988-
function simpleGetterFn1(key0, fullExp) {
989-
ensureSafeMemberName(key0, fullExp);
990-
991-
return function simpleGetterFn1(scope, locals) {
992-
if (scope == null) return undefined;
993-
return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
994-
};
995-
}
996-
997-
function simpleGetterFn2(key0, key1, fullExp) {
998-
ensureSafeMemberName(key0, fullExp);
999-
ensureSafeMemberName(key1, fullExp);
1000-
1001-
return function simpleGetterFn2(scope, locals) {
1002-
if (scope == null) return undefined;
1003-
scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
1004-
return scope == null ? undefined : scope[key1];
1005-
};
1006-
}
1007-
1008988
function getterFn(path, options, fullExp) {
1009989
// Check whether the cache has this getter already.
1010990
// We can use hasOwnProperty directly on the cache because we ensure,
@@ -1017,13 +997,8 @@ function getterFn(path, options, fullExp) {
1017997
pathKeysLength = pathKeys.length,
1018998
fn;
1019999

1020-
// When we have only 1 or 2 tokens, use optimized special case closures.
10211000
// http://jsperf.com/angularjs-parse-getter/6
1022-
if (!options.unwrapPromises && pathKeysLength === 1) {
1023-
fn = simpleGetterFn1(pathKeys[0], fullExp);
1024-
} else if (!options.unwrapPromises && pathKeysLength === 2) {
1025-
fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
1026-
} else if (options.csp) {
1001+
if (options.csp) {
10271002
if (pathKeysLength < 6) {
10281003
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
10291004
options);

0 commit comments

Comments
 (0)