Skip to content

Commit cec3344

Browse files
committed
changing the isecfn error message back to contain the fullExp
1 parent 19a82b3 commit cec3344

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/ng/parse.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ Parser.prototype = {
577577
},
578578

579579
assignment: function() {
580+
var parserText = this.text;
580581
var left = this.ternary();
581582
var right;
582583
var token;
@@ -587,7 +588,7 @@ Parser.prototype = {
587588
}
588589
right = this.ternary();
589590
return function $parseAssignment(scope, locals) {
590-
return left.assign(scope, right(scope, locals), locals);
591+
return left.assign(scope, right(scope, locals), locals, parserText);
591592
};
592593
}
593594
return left;
@@ -686,7 +687,7 @@ Parser.prototype = {
686687
}, {
687688
assign: function(scope, value, locals) {
688689
var o = object(scope, locals);
689-
if (!o) object.assign(scope, o = {});
690+
if (!o) object.assign(scope, o = {}, null, parserText);
690691
return setter(o, field, value, parserText);
691692
}
692693
});
@@ -712,7 +713,7 @@ Parser.prototype = {
712713
var key = ensureSafeMemberName(indexFn(self, locals), parserText);
713714
// prevent overwriting of Function.constructor which would break ensureSafeObject check
714715
var o = ensureSafeObject(obj(self, locals), parserText);
715-
if (!o) obj.assign(self, o = {});
716+
if (!o) obj.assign(self, o = {}, null, parserText);
716717
return o[key] = value;
717718
}
718719
});
@@ -926,8 +927,8 @@ function getterFn(path, options, fullExp) {
926927
var evaledFnGetter = new Function('s', 'l', code); // s=scope, l=locals
927928
/* jshint +W054 */
928929
evaledFnGetter.toString = valueFn(code);
929-
evaledFnGetter.assign = function(self, value) {
930-
return setter(self, path, value, path);
930+
evaledFnGetter.assign = function(self, value, locals, fullExp) {
931+
return setter(self, path, value, fullExp || path);
931932
};
932933

933934
fn = evaledFnGetter;

test/ng/parseSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ describe('parser', function() {
722722
scope.$eval('a.toString.constructor = 1', scope);
723723
}).toThrowMinErr(
724724
'$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
725-
'Expression: a.toString.constructor');
725+
'Expression: a.toString.constructor = 1');
726726
});
727727

728728

0 commit comments

Comments
 (0)