@@ -401,6 +401,102 @@ describe('variables are declared and used appropriately', () => {
401
401
) ;
402
402
} ) ;
403
403
404
+ it ( 'abstract closure rest parameters must be last' , async ( ) => {
405
+ await assertLint (
406
+ positioned `
407
+ <emu-clause id="sec-object.fromentries">
408
+ <h1>Object.fromEntries ( _obj_ )</h1>
409
+ <emu-alg>
410
+ 1. Let _closure_ be a new Abstract Closure with parameters (${ M } ..._x_, _y_) that captures nothing and performs the following steps when called:
411
+ 1. Do something with _x_.
412
+ 1. Return *undefined*.
413
+ 1. Return _closure_.
414
+ </emu-alg>
415
+ </emu-clause>
416
+ ` ,
417
+ {
418
+ ruleId : 'bad-ac' ,
419
+ nodeType : 'emu-alg' ,
420
+ message : 'expected rest param to come last' ,
421
+ } ,
422
+ ) ;
423
+
424
+ await assertLint (
425
+ positioned `
426
+ <emu-clause id="sec-object.fromentries">
427
+ <h1>Object.fromEntries ( _obj_ )</h1>
428
+ <emu-alg>
429
+ 1. Let _closure_ be a new Abstract Closure with parameters (${ M } ..._x_,) that captures nothing and performs the following steps when called:
430
+ 1. Do something with _x_.
431
+ 1. Return *undefined*.
432
+ 1. Return _closure_.
433
+ </emu-alg>
434
+ </emu-clause>
435
+ ` ,
436
+ {
437
+ ruleId : 'bad-ac' ,
438
+ nodeType : 'emu-alg' ,
439
+ message : 'expected rest param to come last' ,
440
+ } ,
441
+ ) ;
442
+ } ) ;
443
+
444
+ it ( 'abstract closure rest parameters must be variables' , async ( ) => {
445
+ await assertLint (
446
+ positioned `
447
+ <emu-clause id="sec-object.fromentries">
448
+ <h1>Object.fromEntries ( _obj_ )</h1>
449
+ <emu-alg>
450
+ 1. Let _closure_ be a new Abstract Closure with parameters (${ M } ...x) that captures nothing and performs the following steps when called:
451
+ 1. Do something with _x_.
452
+ 1. Return *undefined*.
453
+ 1. Return _closure_.
454
+ </emu-alg>
455
+ </emu-clause>
456
+ ` ,
457
+ {
458
+ ruleId : 'bad-ac' ,
459
+ nodeType : 'emu-alg' ,
460
+ message : 'expected to find a parameter name here' ,
461
+ } ,
462
+ ) ;
463
+
464
+ await assertLint (
465
+ positioned `
466
+ <emu-clause id="sec-object.fromentries">
467
+ <h1>Object.fromEntries ( _obj_ )</h1>
468
+ <emu-alg>
469
+ 1. Let _closure_ be a new Abstract Closure with parameters (${ M } ..._x_,) that captures nothing and performs the following steps when called:
470
+ 1. Do something with _x_.
471
+ 1. Return *undefined*.
472
+ 1. Return _closure_.
473
+ </emu-alg>
474
+ </emu-clause>
475
+ ` ,
476
+ {
477
+ ruleId : 'bad-ac' ,
478
+ nodeType : 'emu-alg' ,
479
+ message : 'expected rest param to come last' ,
480
+ } ,
481
+ ) ;
482
+ } ) ;
483
+
484
+ it ( 'abstract closure rest parameters are visible' , async ( ) => {
485
+ await assertLintFree (
486
+ `
487
+ <emu-clause id="sec-object.fromentries">
488
+ <h1>Object.fromEntries ( _obj_ )</h1>
489
+ <emu-alg>
490
+ 1. Let _closure_ be a new Abstract Closure with parameters (..._x_) that captures nothing and performs the following steps when called:
491
+ 1. Do something with _x_.
492
+ 1. Return *undefined*.
493
+ 1. Return _closure_.
494
+ </emu-alg>
495
+ </emu-clause>
496
+ ` ,
497
+ ) ;
498
+ } ) ;
499
+
404
500
it ( 'multiple declarations are visible' , async ( ) => {
405
501
await assertLintFree (
406
502
`
0 commit comments