@@ -2548,6 +2548,263 @@ data = {
25482548 }
25492549 } ,
25502550
2551+ 'Harmony object pattern, singleline, 1 property: RestElement' : {
2552+ 'const {...foo} = {};' : {
2553+ generateFrom : {
2554+ type : 'Program' ,
2555+ body : [
2556+ {
2557+ type : 'VariableDeclaration' ,
2558+ declarations : [
2559+ {
2560+ type : 'VariableDeclarator' ,
2561+ id : {
2562+ type : 'ObjectPattern' ,
2563+ properties : [
2564+ {
2565+ type : 'RestElement' ,
2566+ 'argument' : {
2567+ type : 'Identifier' ,
2568+ name : 'foo'
2569+ }
2570+ }
2571+ ]
2572+ } ,
2573+ init : {
2574+ type : 'ObjectExpression' ,
2575+ properties : [ ]
2576+ }
2577+ }
2578+ ] ,
2579+ kind : 'const'
2580+ }
2581+ ] ,
2582+ sourceType : "script"
2583+ }
2584+ }
2585+ } ,
2586+
2587+ 'Harmony object pattern, singleline, 2 properties: Property, Property' : {
2588+ 'const {foo, bar} = {};' : {
2589+ generateFrom : {
2590+ type : 'Program' ,
2591+ body : [
2592+ {
2593+ type : 'VariableDeclaration' ,
2594+ declarations : [
2595+ {
2596+ type : 'VariableDeclarator' ,
2597+ id : {
2598+ type : 'ObjectPattern' ,
2599+ properties : [
2600+ {
2601+ type : 'Property' ,
2602+ method : false ,
2603+ shorthand : true ,
2604+ computed : false ,
2605+ key : {
2606+ type : 'Identifier' ,
2607+ name : 'foo'
2608+ } ,
2609+ kind : 'init' ,
2610+ value : {
2611+ type : 'Identifier' ,
2612+ name : 'foo'
2613+ }
2614+ } ,
2615+ {
2616+ type : 'Property' ,
2617+ method : false ,
2618+ shorthand : true ,
2619+ computed : false ,
2620+ key : {
2621+ type : 'Identifier' ,
2622+ name : 'bar'
2623+ } ,
2624+ kind : 'init' ,
2625+ value : {
2626+ type : 'Identifier' ,
2627+ name : 'bar'
2628+ }
2629+ } ,
2630+ ]
2631+ } ,
2632+ init : {
2633+ type : 'ObjectExpression' ,
2634+ properties : [ ]
2635+ }
2636+ }
2637+ ] ,
2638+ kind : 'const'
2639+ }
2640+ ] ,
2641+ sourceType : "script"
2642+ }
2643+ }
2644+ } ,
2645+
2646+ 'Harmony object pattern, singleline, 2 properties: Property, RestElement' : {
2647+ 'const {foo, ...bar} = {};' : {
2648+ generateFrom : {
2649+ type : 'Program' ,
2650+ body : [
2651+ {
2652+ type : 'VariableDeclaration' ,
2653+ declarations : [
2654+ {
2655+ type : 'VariableDeclarator' ,
2656+ id : {
2657+ type : 'ObjectPattern' ,
2658+ properties : [
2659+ {
2660+ type : 'Property' ,
2661+ method : false ,
2662+ shorthand : true ,
2663+ computed : false ,
2664+ key : {
2665+ type : 'Identifier' ,
2666+ name : 'foo'
2667+ } ,
2668+ kind : 'init' ,
2669+ value : {
2670+ type : 'Identifier' ,
2671+ name : 'foo'
2672+ }
2673+ } ,
2674+ {
2675+ type : 'RestElement' ,
2676+ 'argument' : {
2677+ type : 'Identifier' ,
2678+ name : 'bar'
2679+ }
2680+ }
2681+ ]
2682+ } ,
2683+ init : {
2684+ type : 'ObjectExpression' ,
2685+ properties : [ ]
2686+ }
2687+ }
2688+ ] ,
2689+ kind : 'const'
2690+ }
2691+ ] ,
2692+ sourceType : "script"
2693+ }
2694+ }
2695+ } ,
2696+
2697+ 'Harmony object pattern, multiline, 1 property: Property' : {
2698+ 'const {\n foo = 1\n} = {};' : {
2699+ generateFrom : {
2700+ type : 'Program' ,
2701+ body : [
2702+ {
2703+ type : 'VariableDeclaration' ,
2704+ declarations : [
2705+ {
2706+ type : 'VariableDeclarator' ,
2707+ id : {
2708+ type : 'ObjectPattern' ,
2709+ properties : [
2710+ {
2711+ type : 'Property' ,
2712+ method : false ,
2713+ shorthand : true ,
2714+ computed : false ,
2715+ key : {
2716+ type : 'Identifier' ,
2717+ name : 'foo'
2718+ } ,
2719+ kind : 'init' ,
2720+ value : {
2721+ type : 'AssignmentPattern' ,
2722+ left : {
2723+ type : 'Identifier' ,
2724+ name : 'foo'
2725+ } ,
2726+ right : {
2727+ type : 'Literal' ,
2728+ value : 1 ,
2729+ raw : '1'
2730+ }
2731+ }
2732+ }
2733+ ]
2734+ } ,
2735+ init : {
2736+ type : 'ObjectExpression' ,
2737+ properties : [ ]
2738+ }
2739+ }
2740+ ] ,
2741+ kind : 'const'
2742+ }
2743+ ] ,
2744+ sourceType : "script"
2745+ }
2746+ }
2747+ } ,
2748+
2749+ 'Harmony object pattern, multiline, 2 properties: Property, Property' : {
2750+ 'const {\n foo: bar,\n baz\n} = {};' : {
2751+ generateFrom : {
2752+ type : 'Program' ,
2753+ body : [
2754+ {
2755+ type : 'VariableDeclaration' ,
2756+ declarations : [
2757+ {
2758+ type : 'VariableDeclarator' ,
2759+ id : {
2760+ type : 'ObjectPattern' ,
2761+ properties : [
2762+ {
2763+ type : 'Property' ,
2764+ method : false ,
2765+ shorthand : false ,
2766+ computed : false ,
2767+ key : {
2768+ type : 'Identifier' ,
2769+ name : 'foo'
2770+ } ,
2771+ kind : 'init' ,
2772+ value : {
2773+ type : 'Identifier' ,
2774+ name : 'bar'
2775+ }
2776+ } ,
2777+ {
2778+ type : 'Property' ,
2779+ method : false ,
2780+ shorthand : true ,
2781+ computed : false ,
2782+ key : {
2783+ type : 'Identifier' ,
2784+ name : 'baz'
2785+ } ,
2786+ kind : 'init' ,
2787+ value : {
2788+ type : 'Identifier' ,
2789+ name : 'baz'
2790+ }
2791+ } ,
2792+ ]
2793+ } ,
2794+ init : {
2795+ type : 'ObjectExpression' ,
2796+ properties : [ ]
2797+ }
2798+ }
2799+ ] ,
2800+ kind : 'const'
2801+ }
2802+ ] ,
2803+ sourceType : "script"
2804+ }
2805+ }
2806+ } ,
2807+
25512808 'Harmony method property' : {
25522809 'var obj = { test() { } }' : {
25532810 type : 'Program' ,
0 commit comments