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

Commit 10ae33b

Browse files
committed
fix($parse): fix parse errors on older Android WebViews which choke with reserved keywords
Closes #11455
1 parent c55a494 commit 10ae33b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/ng/parse.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ ASTCompiler.prototype = {
784784
self.state.computing = fnKey;
785785
var intoId = self.nextId();
786786
self.recurse(watch, intoId);
787-
self.return(intoId);
787+
self.return_(intoId);
788788
self.state.inputs.push(fnKey);
789789
watch.watchId = key;
790790
});
@@ -871,7 +871,7 @@ ASTCompiler.prototype = {
871871
recursionFn = recursionFn || noop;
872872
if (!skipWatchIdCheck && isDefined(ast.watchId)) {
873873
intoId = intoId || this.nextId();
874-
this.if('i',
874+
this.if_('i',
875875
this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
876876
this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
877877
);
@@ -884,7 +884,7 @@ ASTCompiler.prototype = {
884884
if (pos !== ast.body.length - 1) {
885885
self.current().body.push(right, ';');
886886
} else {
887-
self.return(right);
887+
self.return_(right);
888888
}
889889
});
890890
break;
@@ -915,13 +915,13 @@ ASTCompiler.prototype = {
915915
case AST.LogicalExpression:
916916
intoId = intoId || this.nextId();
917917
self.recurse(ast.left, intoId);
918-
self.if(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
918+
self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
919919
recursionFn(intoId);
920920
break;
921921
case AST.ConditionalExpression:
922922
intoId = intoId || this.nextId();
923923
self.recurse(ast.test, intoId);
924-
self.if(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
924+
self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
925925
recursionFn(intoId);
926926
break;
927927
case AST.Identifier:
@@ -932,11 +932,11 @@ ASTCompiler.prototype = {
932932
nameId.name = ast.name;
933933
}
934934
ensureSafeMemberName(ast.name);
935-
self.if(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
935+
self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
936936
function() {
937-
self.if(self.stage === 'inputs' || 's', function() {
937+
self.if_(self.stage === 'inputs' || 's', function() {
938938
if (create && create !== 1) {
939-
self.if(
939+
self.if_(
940940
self.not(self.nonComputedMember('s', ast.name)),
941941
self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
942942
}
@@ -953,13 +953,13 @@ ASTCompiler.prototype = {
953953
left = nameId && (nameId.context = this.nextId()) || this.nextId();
954954
intoId = intoId || this.nextId();
955955
self.recurse(ast.object, left, undefined, function() {
956-
self.if(self.notNull(left), function() {
956+
self.if_(self.notNull(left), function() {
957957
if (ast.computed) {
958958
right = self.nextId();
959959
self.recurse(ast.property, right);
960960
self.addEnsureSafeMemberName(right);
961961
if (create && create !== 1) {
962-
self.if(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
962+
self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
963963
}
964964
expression = self.ensureSafeObject(self.computedMember(left, right));
965965
self.assign(intoId, expression);
@@ -970,7 +970,7 @@ ASTCompiler.prototype = {
970970
} else {
971971
ensureSafeMemberName(ast.property.name);
972972
if (create && create !== 1) {
973-
self.if(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
973+
self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
974974
}
975975
expression = self.nonComputedMember(left, ast.property.name);
976976
if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
@@ -1004,7 +1004,7 @@ ASTCompiler.prototype = {
10041004
left = {};
10051005
args = [];
10061006
self.recurse(ast.callee, right, left, function() {
1007-
self.if(self.notNull(right), function() {
1007+
self.if_(self.notNull(right), function() {
10081008
self.addEnsureSafeFunction(right);
10091009
forEach(ast.arguments, function(expr) {
10101010
self.recurse(expr, self.nextId(), undefined, function(argument) {
@@ -1033,7 +1033,7 @@ ASTCompiler.prototype = {
10331033
throw $parseMinErr('lval', 'Trying to assing a value to a non l-value');
10341034
}
10351035
this.recurse(ast.left, undefined, left, function() {
1036-
self.if(self.notNull(left.context), function() {
1036+
self.if_(self.notNull(left.context), function() {
10371037
self.recurse(ast.right, right);
10381038
self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
10391039
expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
@@ -1108,11 +1108,11 @@ ASTCompiler.prototype = {
11081108
return 'plus(' + left + ',' + right + ')';
11091109
},
11101110

1111-
'return': function(id) {
1111+
return_: function(id) {
11121112
this.current().body.push('return ', id, ';');
11131113
},
11141114

1115-
'if': function(test, alternate, consequent) {
1115+
if_: function(test, alternate, consequent) {
11161116
if (test === true) {
11171117
alternate();
11181118
} else {

0 commit comments

Comments
 (0)