File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 11
11
#define V8_MAJOR_VERSION 5
12
12
#define V8_MINOR_VERSION 0
13
13
#define V8_BUILD_NUMBER 71
14
- #define V8_PATCH_LEVEL 33
14
+ #define V8_PATCH_LEVEL 34
15
15
16
16
// Use 1 for candidates and 0 otherwise.
17
17
// (Boolean macro values are not supported by all preprocessors.)
Original file line number Diff line number Diff line change @@ -77,7 +77,11 @@ bool Parser::PatternRewriter::IsBindingContext(PatternContext c) const {
77
77
Parser::PatternRewriter::PatternContext
78
78
Parser::PatternRewriter::SetAssignmentContextIfNeeded (Expression* node) {
79
79
PatternContext old_context = context ();
80
- if (node->IsAssignment () && node->AsAssignment ()->op () == Token::ASSIGN) {
80
+ // AssignmentExpressions may occur in the Initializer position of a
81
+ // SingleNameBinding. Such expressions should not prompt a change in the
82
+ // pattern's context.
83
+ if (node->IsAssignment () && node->AsAssignment ()->op () == Token::ASSIGN &&
84
+ !IsInitializerContext ()) {
81
85
set_context (ASSIGNMENT);
82
86
}
83
87
return old_context;
Original file line number Diff line number Diff line change 263
263
} ( ) ) ;
264
264
265
265
266
+ ( function TestAssignmentExprInInitializers ( ) {
267
+ {
268
+ let x , y ;
269
+ {
270
+ let { x = y = 1 } = { } ;
271
+ assertSame ( x , 1 ) ;
272
+ assertSame ( y , 1 ) ;
273
+ }
274
+ assertSame ( undefined , x ) ;
275
+ assertSame ( 1 , y ) ;
276
+ }
277
+
278
+ {
279
+ let x , y ;
280
+ {
281
+ let { x : x = y = 1 } = { } ;
282
+ assertSame ( 1 , x ) ;
283
+ assertSame ( 1 , y ) ;
284
+ }
285
+ assertSame ( undefined , x ) ;
286
+ assertSame ( 1 , y ) ;
287
+ }
288
+
289
+ {
290
+ let x , y ;
291
+ {
292
+ let [ x = y = 1 ] = [ ] ;
293
+ assertSame ( 1 , x ) ;
294
+ assertSame ( 1 , y ) ;
295
+ }
296
+ assertSame ( undefined , x ) ;
297
+ assertSame ( 1 , y ) ;
298
+ }
299
+
300
+ {
301
+ let x , y ;
302
+ ( function ( { x = y = 1 } ) { } ( { } ) ) ;
303
+ assertSame ( undefined , x ) ;
304
+ assertSame ( 1 , y ) ;
305
+ }
306
+
307
+ {
308
+ let x , y ;
309
+ ( function ( { x : x = y = 1 } ) { } ( { } ) ) ;
310
+ assertSame ( undefined , x ) ;
311
+ assertSame ( 1 , y ) ;
312
+ }
313
+
314
+ {
315
+ let x , y ;
316
+ ( function ( [ x = y = 1 ] ) { } ( [ ] ) ) ;
317
+ assertSame ( undefined , x ) ;
318
+ assertSame ( 1 , y ) ;
319
+ }
320
+ } ( ) ) ;
321
+
322
+
266
323
( function TestMultipleAccesses ( ) {
267
324
assertThrows (
268
325
"'use strict';" +
You can’t perform that action at this time.
0 commit comments