Skip to content

Commit

Permalink
refactor($parse): remove unused parameters and methods
Browse files Browse the repository at this point in the history
After removing the json and unwrapPromise mode, some parameters
and methods were no longer used.
  • Loading branch information
rodyhaddad committed Jun 4, 2014
1 parent 6fb121e commit ff03698
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ Lexer.prototype = {
this.text = text;
this.index = 0;
this.ch = undefined;
this.lastCh = ':'; // can start regexp
this.tokens = [];

while (this.index < this.text.length) {
Expand All @@ -141,7 +140,6 @@ Lexer.prototype = {
this.index++;
} else if (this.isWhitespace(this.ch)) {
this.index++;
continue;
} else {
var ch2 = this.ch + this.peek();
var ch3 = ch2 + this.peek(2);
Expand All @@ -165,7 +163,6 @@ Lexer.prototype = {
this.throwError('Unexpected next character ', this.index, this.index + 1);
}
}
this.lastCh = this.ch;
}
return this.tokens;
},
Expand All @@ -174,10 +171,6 @@ Lexer.prototype = {
return chars.indexOf(this.ch) !== -1;
},

was: function(chars) {
return chars.indexOf(this.lastCh) !== -1;
},

peek: function(i) {
var num = i || 1;
return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
Expand Down Expand Up @@ -300,7 +293,7 @@ Lexer.prototype = {
return (getter(self, locals));
}, {
assign: function(self, value) {
return setter(self, ident, value, parser.text, parser.options);
return setter(self, ident, value, parser.text);
}
});
}
Expand Down Expand Up @@ -672,7 +665,7 @@ Parser.prototype = {
return getter(self || object(scope, locals));
}, {
assign: function(scope, value, locals) {
return setter(object(scope, locals), field, value, parser.text, parser.options);
return setter(object(scope, locals), field, value, parser.text);
}
});
},
Expand All @@ -686,7 +679,7 @@ Parser.prototype = {
return extend(function(self, locals) {
var o = obj(self, locals),
i = indexFn(self, locals),
v, p;
v;

if (!o) return undefined;
v = ensureSafeObject(o[i], parser.text);
Expand Down Expand Up @@ -804,9 +797,7 @@ Parser.prototype = {
// Parser helper functions
//////////////////////////////////////////////////

function setter(obj, path, setValue, fullExp, options) {
//needed?
options = options || {};
function setter(obj, path, setValue, fullExp) {

var element = path.split('.'), key;
for (var i = 0; element.length > 1; i++) {
Expand All @@ -830,7 +821,7 @@ var getterFnCache = {};
* - http://jsperf.com/angularjs-parse-getter/4
* - http://jsperf.com/path-evaluation-simplified/7
*/
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp) {
ensureSafeMemberName(key0, fullExp);
ensureSafeMemberName(key1, fullExp);
ensureSafeMemberName(key2, fullExp);
Expand Down Expand Up @@ -903,14 +894,13 @@ function getterFn(path, options, fullExp) {
fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
} else if (options.csp) {
if (pathKeysLength < 6) {
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
options);
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp);
} else {
fn = function(scope, locals) {
var i = 0, val;
do {
val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],
pathKeys[i++], fullExp, options)(scope, locals);
pathKeys[i++], fullExp)(scope, locals);

locals = undefined; // clear after first iteration
scope = val;
Expand Down Expand Up @@ -1006,7 +996,7 @@ function $ParseProvider() {
};


this.$get = ['$filter', '$sniffer', '$log', function($filter, $sniffer, $log) {
this.$get = ['$filter', '$sniffer', function($filter, $sniffer) {
$parseOptions.csp = $sniffer.csp;

return function(exp) {
Expand Down

0 comments on commit ff03698

Please sign in to comment.