@@ -988,6 +988,9 @@ ASTCompiler.prototype = {
988
988
intoId = intoId || this . nextId ( ) ;
989
989
self . recurse ( ast . object , left , undefined , function ( ) {
990
990
self . if_ ( self . notNull ( left ) , function ( ) {
991
+ if ( create && create !== 1 ) {
992
+ self . addEnsureSafeAssignContext ( left ) ;
993
+ }
991
994
if ( ast . computed ) {
992
995
right = self . nextId ( ) ;
993
996
self . recurse ( ast . property , right ) ;
@@ -1602,8 +1605,11 @@ ASTInterpreter.prototype = {
1602
1605
rhs = right ( scope , locals , assign , inputs ) ;
1603
1606
rhs = getStringValue ( rhs ) ;
1604
1607
ensureSafeMemberName ( rhs , expression ) ;
1605
- if ( create && create !== 1 && lhs && ! ( lhs [ rhs ] ) ) {
1606
- lhs [ rhs ] = { } ;
1608
+ if ( create && create !== 1 ) {
1609
+ ensureSafeAssignContext ( lhs ) ;
1610
+ if ( lhs && ! ( lhs [ rhs ] ) ) {
1611
+ lhs [ rhs ] = { } ;
1612
+ }
1607
1613
}
1608
1614
value = lhs [ rhs ] ;
1609
1615
ensureSafeObject ( value , expression ) ;
@@ -1618,8 +1624,11 @@ ASTInterpreter.prototype = {
1618
1624
nonComputedMember : function ( left , right , expensiveChecks , context , create , expression ) {
1619
1625
return function ( scope , locals , assign , inputs ) {
1620
1626
var lhs = left ( scope , locals , assign , inputs ) ;
1621
- if ( create && create !== 1 && lhs && ! ( lhs [ right ] ) ) {
1622
- lhs [ right ] = { } ;
1627
+ if ( create && create !== 1 ) {
1628
+ ensureSafeAssignContext ( lhs ) ;
1629
+ if ( lhs && ! ( lhs [ right ] ) ) {
1630
+ lhs [ right ] = { } ;
1631
+ }
1623
1632
}
1624
1633
var value = lhs != null ? lhs [ right ] : undefined ;
1625
1634
if ( expensiveChecks || isPossiblyDangerousMemberName ( right ) ) {
0 commit comments