Skip to content

Commit ff03698

Browse files
committed
refactor($parse): remove unused parameters and methods
After removing the json and unwrapPromise mode, some parameters and methods were no longer used.
1 parent 6fb121e commit ff03698

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/ng/parse.js

+8-18
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ Lexer.prototype = {
122122
this.text = text;
123123
this.index = 0;
124124
this.ch = undefined;
125-
this.lastCh = ':'; // can start regexp
126125
this.tokens = [];
127126

128127
while (this.index < this.text.length) {
@@ -141,7 +140,6 @@ Lexer.prototype = {
141140
this.index++;
142141
} else if (this.isWhitespace(this.ch)) {
143142
this.index++;
144-
continue;
145143
} else {
146144
var ch2 = this.ch + this.peek();
147145
var ch3 = ch2 + this.peek(2);
@@ -165,7 +163,6 @@ Lexer.prototype = {
165163
this.throwError('Unexpected next character ', this.index, this.index + 1);
166164
}
167165
}
168-
this.lastCh = this.ch;
169166
}
170167
return this.tokens;
171168
},
@@ -174,10 +171,6 @@ Lexer.prototype = {
174171
return chars.indexOf(this.ch) !== -1;
175172
},
176173

177-
was: function(chars) {
178-
return chars.indexOf(this.lastCh) !== -1;
179-
},
180-
181174
peek: function(i) {
182175
var num = i || 1;
183176
return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
@@ -300,7 +293,7 @@ Lexer.prototype = {
300293
return (getter(self, locals));
301294
}, {
302295
assign: function(self, value) {
303-
return setter(self, ident, value, parser.text, parser.options);
296+
return setter(self, ident, value, parser.text);
304297
}
305298
});
306299
}
@@ -672,7 +665,7 @@ Parser.prototype = {
672665
return getter(self || object(scope, locals));
673666
}, {
674667
assign: function(scope, value, locals) {
675-
return setter(object(scope, locals), field, value, parser.text, parser.options);
668+
return setter(object(scope, locals), field, value, parser.text);
676669
}
677670
});
678671
},
@@ -686,7 +679,7 @@ Parser.prototype = {
686679
return extend(function(self, locals) {
687680
var o = obj(self, locals),
688681
i = indexFn(self, locals),
689-
v, p;
682+
v;
690683

691684
if (!o) return undefined;
692685
v = ensureSafeObject(o[i], parser.text);
@@ -804,9 +797,7 @@ Parser.prototype = {
804797
// Parser helper functions
805798
//////////////////////////////////////////////////
806799

807-
function setter(obj, path, setValue, fullExp, options) {
808-
//needed?
809-
options = options || {};
800+
function setter(obj, path, setValue, fullExp) {
810801

811802
var element = path.split('.'), key;
812803
for (var i = 0; element.length > 1; i++) {
@@ -830,7 +821,7 @@ var getterFnCache = {};
830821
* - http://jsperf.com/angularjs-parse-getter/4
831822
* - http://jsperf.com/path-evaluation-simplified/7
832823
*/
833-
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
824+
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp) {
834825
ensureSafeMemberName(key0, fullExp);
835826
ensureSafeMemberName(key1, fullExp);
836827
ensureSafeMemberName(key2, fullExp);
@@ -903,14 +894,13 @@ function getterFn(path, options, fullExp) {
903894
fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
904895
} else if (options.csp) {
905896
if (pathKeysLength < 6) {
906-
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
907-
options);
897+
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp);
908898
} else {
909899
fn = function(scope, locals) {
910900
var i = 0, val;
911901
do {
912902
val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],
913-
pathKeys[i++], fullExp, options)(scope, locals);
903+
pathKeys[i++], fullExp)(scope, locals);
914904

915905
locals = undefined; // clear after first iteration
916906
scope = val;
@@ -1006,7 +996,7 @@ function $ParseProvider() {
1006996
};
1007997

1008998

1009-
this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {
999+
this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
10101000
$parseOptions.csp = $sniffer.csp;
10111001

10121002
return function(exp) {

0 commit comments

Comments
 (0)