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

Commit cc16340

Browse files
committed
refactor($parse): small readability improvements
1 parent fecfc5b commit cc16340

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/ng/parse.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ Parser.prototype = {
713713
});
714714
},
715715

716-
functionCall: function(fn, contextGetter) {
716+
functionCall: function(fnGetter, contextGetter) {
717717
var argsFn = [];
718718
if (this.peekToken().text !== ')') {
719719
do {
@@ -722,29 +722,28 @@ Parser.prototype = {
722722
}
723723
this.consume(')');
724724

725-
var parser = this;
725+
var expressionText = this.text;
726726
var args = []; // we can safely reuse the array
727727

728728
return function(scope, locals) {
729729
var context = contextGetter ? contextGetter(scope, locals) : scope;
730+
var fn = fnGetter(scope, locals, context) || noop;
730731

731732

732733
var i = argsFn.length;
733734
while (i--) {
734735
args[i] = argsFn[i](scope, locals);
735736
}
736737

737-
var fnPtr = fn(scope, locals, context) || noop;
738-
739-
ensureSafeObject(context, parser.text);
740-
ensureSafeFunction(fnPtr, parser.text);
738+
ensureSafeObject(context, expressionText);
739+
ensureSafeFunction(fn, expressionText);
741740

742741
// IE stupidity! (IE doesn't have apply for some native functions)
743-
var v = fnPtr.apply
744-
? fnPtr.apply(context, args)
745-
: fnPtr(args[0], args[1], args[2], args[3], args[4]);
742+
var v = fn.apply
743+
? fn.apply(context, args)
744+
: fn(args[0], args[1], args[2], args[3], args[4]);
746745

747-
return ensureSafeObject(v, parser.text);
746+
return ensureSafeObject(v, expressionText);
748747
};
749748
},
750749

0 commit comments

Comments
 (0)