Skip to content

Commit 5f6b378

Browse files
committed
chore($parse): remove simpleGetter optimizations as they're no longer valid
Closes angular#8101
1 parent 20b0c24 commit 5f6b378

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
@@ -875,26 +875,6 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp) {
875875
};
876876
}
877877

878-
function simpleGetterFn1(key0, fullExp) {
879-
ensureSafeMemberName(key0, fullExp);
880-
881-
return function simpleGetterFn1(scope, locals) {
882-
if (scope == null) return undefined;
883-
return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
884-
};
885-
}
886-
887-
function simpleGetterFn2(key0, key1, fullExp) {
888-
ensureSafeMemberName(key0, fullExp);
889-
ensureSafeMemberName(key1, fullExp);
890-
891-
return function simpleGetterFn2(scope, locals) {
892-
if (scope == null) return undefined;
893-
scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
894-
return scope == null ? undefined : scope[key1];
895-
};
896-
}
897-
898878
function getterFn(path, options, fullExp) {
899879
// Check whether the cache has this getter already.
900880
// We can use hasOwnProperty directly on the cache because we ensure,
@@ -907,13 +887,8 @@ function getterFn(path, options, fullExp) {
907887
pathKeysLength = pathKeys.length,
908888
fn;
909889

910-
// When we have only 1 or 2 tokens, use optimized special case closures.
911890
// http://jsperf.com/angularjs-parse-getter/6
912-
if (pathKeysLength === 1) {
913-
fn = simpleGetterFn1(pathKeys[0], fullExp);
914-
} else if (pathKeysLength === 2) {
915-
fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
916-
} else if (options.csp) {
891+
if (options.csp) {
917892
if (pathKeysLength < 6) {
918893
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp);
919894
} else {

0 commit comments

Comments
 (0)