1 |
|
2 |
|
3 |
|
4 | if (typeof exports != "undefined") {
|
5 | var test = require("./driver.js").test;
|
6 | var testFail = require("./driver.js").testFail;
|
7 | var testAssert = require("./driver.js").testAssert;
|
8 | }
|
9 |
|
10 | test("this\n", {
|
11 | type: "Program",
|
12 | body: [
|
13 | {
|
14 | type: "ExpressionStatement",
|
15 | expression: {
|
16 | type: "ThisExpression",
|
17 | loc: {
|
18 | start: {
|
19 | line: 1,
|
20 | column: 0
|
21 | },
|
22 | end: {
|
23 | line: 1,
|
24 | column: 4
|
25 | }
|
26 | }
|
27 | },
|
28 | loc: {
|
29 | start: {
|
30 | line: 1,
|
31 | column: 0
|
32 | },
|
33 | end: {
|
34 | line: 1,
|
35 | column: 4
|
36 | }
|
37 | }
|
38 | }
|
39 | ],
|
40 | loc: {
|
41 | start: {
|
42 | line: 1,
|
43 | column: 0
|
44 | },
|
45 | end: {
|
46 | line: 1,
|
47 | column: 4
|
48 | }
|
49 | }
|
50 | });
|
51 |
|
52 | test("null\n", {
|
53 | type: "Program",
|
54 | body: [
|
55 | {
|
56 | type: "ExpressionStatement",
|
57 | expression: {
|
58 | type: "Literal",
|
59 | value: null,
|
60 | loc: {
|
61 | start: {
|
62 | line: 1,
|
63 | column: 0
|
64 | },
|
65 | end: {
|
66 | line: 1,
|
67 | column: 4
|
68 | }
|
69 | }
|
70 | },
|
71 | loc: {
|
72 | start: {
|
73 | line: 1,
|
74 | column: 0
|
75 | },
|
76 | end: {
|
77 | line: 1,
|
78 | column: 4
|
79 | }
|
80 | }
|
81 | }
|
82 | ],
|
83 | loc: {
|
84 | start: {
|
85 | line: 1,
|
86 | column: 0
|
87 | },
|
88 | end: {
|
89 | line: 1,
|
90 | column: 4
|
91 | }
|
92 | }
|
93 | });
|
94 |
|
95 | test("\n 42\n\n", {
|
96 | type: "Program",
|
97 | body: [
|
98 | {
|
99 | type: "ExpressionStatement",
|
100 | expression: {
|
101 | type: "Literal",
|
102 | value: 42,
|
103 | loc: {
|
104 | start: {
|
105 | line: 2,
|
106 | column: 4
|
107 | },
|
108 | end: {
|
109 | line: 2,
|
110 | column: 6
|
111 | }
|
112 | }
|
113 | },
|
114 | loc: {
|
115 | start: {
|
116 | line: 2,
|
117 | column: 4
|
118 | },
|
119 | end: {
|
120 | line: 2,
|
121 | column: 6
|
122 | }
|
123 | }
|
124 | }
|
125 | ],
|
126 | loc: {
|
127 | start: {
|
128 | line: 2,
|
129 | column: 4
|
130 | },
|
131 | end: {
|
132 | line: 2,
|
133 | column: 6
|
134 | }
|
135 | }
|
136 | });
|
137 |
|
138 | test("(1 + 2 ) * 3", {
|
139 | type: "Program",
|
140 | body: [
|
141 | {
|
142 | type: "ExpressionStatement",
|
143 | expression: {
|
144 | type: "BinaryExpression",
|
145 | left: {
|
146 | type: "BinaryExpression",
|
147 | left: {
|
148 | type: "Literal",
|
149 | value: 1,
|
150 | loc: {
|
151 | start: {
|
152 | line: 1,
|
153 | column: 1
|
154 | },
|
155 | end: {
|
156 | line: 1,
|
157 | column: 2
|
158 | }
|
159 | }
|
160 | },
|
161 | operator: "+",
|
162 | right: {
|
163 | type: "Literal",
|
164 | value: 2,
|
165 | loc: {
|
166 | start: {
|
167 | line: 1,
|
168 | column: 5
|
169 | },
|
170 | end: {
|
171 | line: 1,
|
172 | column: 6
|
173 | }
|
174 | }
|
175 | },
|
176 | loc: {
|
177 | start: {
|
178 | line: 1,
|
179 | column: 0
|
180 | },
|
181 | end: {
|
182 | line: 1,
|
183 | column: 8
|
184 | }
|
185 | }
|
186 | },
|
187 | operator: "*",
|
188 | right: {
|
189 | type: "Literal",
|
190 | value: 3,
|
191 | loc: {
|
192 | start: {
|
193 | line: 1,
|
194 | column: 11
|
195 | },
|
196 | end: {
|
197 | line: 1,
|
198 | column: 12
|
199 | }
|
200 | }
|
201 | },
|
202 | loc: {
|
203 | start: {
|
204 | line: 1,
|
205 | column: 0
|
206 | },
|
207 | end: {
|
208 | line: 1,
|
209 | column: 12
|
210 | }
|
211 | }
|
212 | },
|
213 | loc: {
|
214 | start: {
|
215 | line: 1,
|
216 | column: 0
|
217 | },
|
218 | end: {
|
219 | line: 1,
|
220 | column: 12
|
221 | }
|
222 | }
|
223 | }
|
224 | ],
|
225 | loc: {
|
226 | start: {
|
227 | line: 1,
|
228 | column: 0
|
229 | },
|
230 | end: {
|
231 | line: 1,
|
232 | column: 12
|
233 | }
|
234 | }
|
235 | });
|
236 |
|
237 | test("x = []", {
|
238 | type: "Program",
|
239 | body: [
|
240 | {
|
241 | type: "ExpressionStatement",
|
242 | expression: {
|
243 | type: "AssignmentExpression",
|
244 | operator: "=",
|
245 | left: {
|
246 | type: "Identifier",
|
247 | name: "x",
|
248 | loc: {
|
249 | start: {
|
250 | line: 1,
|
251 | column: 0
|
252 | },
|
253 | end: {
|
254 | line: 1,
|
255 | column: 1
|
256 | }
|
257 | }
|
258 | },
|
259 | right: {
|
260 | type: "ArrayExpression",
|
261 | elements: [],
|
262 | loc: {
|
263 | start: {
|
264 | line: 1,
|
265 | column: 4
|
266 | },
|
267 | end: {
|
268 | line: 1,
|
269 | column: 6
|
270 | }
|
271 | }
|
272 | },
|
273 | loc: {
|
274 | start: {
|
275 | line: 1,
|
276 | column: 0
|
277 | },
|
278 | end: {
|
279 | line: 1,
|
280 | column: 6
|
281 | }
|
282 | }
|
283 | },
|
284 | loc: {
|
285 | start: {
|
286 | line: 1,
|
287 | column: 0
|
288 | },
|
289 | end: {
|
290 | line: 1,
|
291 | column: 6
|
292 | }
|
293 | }
|
294 | }
|
295 | ],
|
296 | loc: {
|
297 | start: {
|
298 | line: 1,
|
299 | column: 0
|
300 | },
|
301 | end: {
|
302 | line: 1,
|
303 | column: 6
|
304 | }
|
305 | }
|
306 | });
|
307 |
|
308 | test("x = [ ]", {
|
309 | type: "Program",
|
310 | body: [
|
311 | {
|
312 | type: "ExpressionStatement",
|
313 | expression: {
|
314 | type: "AssignmentExpression",
|
315 | operator: "=",
|
316 | left: {
|
317 | type: "Identifier",
|
318 | name: "x",
|
319 | loc: {
|
320 | start: {
|
321 | line: 1,
|
322 | column: 0
|
323 | },
|
324 | end: {
|
325 | line: 1,
|
326 | column: 1
|
327 | }
|
328 | }
|
329 | },
|
330 | right: {
|
331 | type: "ArrayExpression",
|
332 | elements: [],
|
333 | loc: {
|
334 | start: {
|
335 | line: 1,
|
336 | column: 4
|
337 | },
|
338 | end: {
|
339 | line: 1,
|
340 | column: 7
|
341 | }
|
342 | }
|
343 | },
|
344 | loc: {
|
345 | start: {
|
346 | line: 1,
|
347 | column: 0
|
348 | },
|
349 | end: {
|
350 | line: 1,
|
351 | column: 7
|
352 | }
|
353 | }
|
354 | },
|
355 | loc: {
|
356 | start: {
|
357 | line: 1,
|
358 | column: 0
|
359 | },
|
360 | end: {
|
361 | line: 1,
|
362 | column: 7
|
363 | }
|
364 | }
|
365 | }
|
366 | ],
|
367 | loc: {
|
368 | start: {
|
369 | line: 1,
|
370 | column: 0
|
371 | },
|
372 | end: {
|
373 | line: 1,
|
374 | column: 7
|
375 | }
|
376 | }
|
377 | });
|
378 |
|
379 | test("x = [ 42 ]", {
|
380 | type: "Program",
|
381 | body: [
|
382 | {
|
383 | type: "ExpressionStatement",
|
384 | expression: {
|
385 | type: "AssignmentExpression",
|
386 | operator: "=",
|
387 | left: {
|
388 | type: "Identifier",
|
389 | name: "x",
|
390 | loc: {
|
391 | start: {
|
392 | line: 1,
|
393 | column: 0
|
394 | },
|
395 | end: {
|
396 | line: 1,
|
397 | column: 1
|
398 | }
|
399 | }
|
400 | },
|
401 | right: {
|
402 | type: "ArrayExpression",
|
403 | elements: [
|
404 | {
|
405 | type: "Literal",
|
406 | value: 42,
|
407 | loc: {
|
408 | start: {
|
409 | line: 1,
|
410 | column: 6
|
411 | },
|
412 | end: {
|
413 | line: 1,
|
414 | column: 8
|
415 | }
|
416 | }
|
417 | }
|
418 | ],
|
419 | loc: {
|
420 | start: {
|
421 | line: 1,
|
422 | column: 4
|
423 | },
|
424 | end: {
|
425 | line: 1,
|
426 | column: 10
|
427 | }
|
428 | }
|
429 | },
|
430 | loc: {
|
431 | start: {
|
432 | line: 1,
|
433 | column: 0
|
434 | },
|
435 | end: {
|
436 | line: 1,
|
437 | column: 10
|
438 | }
|
439 | }
|
440 | },
|
441 | loc: {
|
442 | start: {
|
443 | line: 1,
|
444 | column: 0
|
445 | },
|
446 | end: {
|
447 | line: 1,
|
448 | column: 10
|
449 | }
|
450 | }
|
451 | }
|
452 | ],
|
453 | loc: {
|
454 | start: {
|
455 | line: 1,
|
456 | column: 0
|
457 | },
|
458 | end: {
|
459 | line: 1,
|
460 | column: 10
|
461 | }
|
462 | }
|
463 | });
|
464 |
|
465 | test("x = [ 42, ]", {
|
466 | type: "Program",
|
467 | body: [
|
468 | {
|
469 | type: "ExpressionStatement",
|
470 | expression: {
|
471 | type: "AssignmentExpression",
|
472 | operator: "=",
|
473 | left: {
|
474 | type: "Identifier",
|
475 | name: "x",
|
476 | loc: {
|
477 | start: {
|
478 | line: 1,
|
479 | column: 0
|
480 | },
|
481 | end: {
|
482 | line: 1,
|
483 | column: 1
|
484 | }
|
485 | }
|
486 | },
|
487 | right: {
|
488 | type: "ArrayExpression",
|
489 | elements: [
|
490 | {
|
491 | type: "Literal",
|
492 | value: 42,
|
493 | loc: {
|
494 | start: {
|
495 | line: 1,
|
496 | column: 6
|
497 | },
|
498 | end: {
|
499 | line: 1,
|
500 | column: 8
|
501 | }
|
502 | }
|
503 | }
|
504 | ],
|
505 | loc: {
|
506 | start: {
|
507 | line: 1,
|
508 | column: 4
|
509 | },
|
510 | end: {
|
511 | line: 1,
|
512 | column: 11
|
513 | }
|
514 | }
|
515 | },
|
516 | loc: {
|
517 | start: {
|
518 | line: 1,
|
519 | column: 0
|
520 | },
|
521 | end: {
|
522 | line: 1,
|
523 | column: 11
|
524 | }
|
525 | }
|
526 | },
|
527 | loc: {
|
528 | start: {
|
529 | line: 1,
|
530 | column: 0
|
531 | },
|
532 | end: {
|
533 | line: 1,
|
534 | column: 11
|
535 | }
|
536 | }
|
537 | }
|
538 | ],
|
539 | loc: {
|
540 | start: {
|
541 | line: 1,
|
542 | column: 0
|
543 | },
|
544 | end: {
|
545 | line: 1,
|
546 | column: 11
|
547 | }
|
548 | }
|
549 | });
|
550 |
|
551 | test("x = [ ,, 42 ]", {
|
552 | type: "Program",
|
553 | body: [
|
554 | {
|
555 | type: "ExpressionStatement",
|
556 | expression: {
|
557 | type: "AssignmentExpression",
|
558 | operator: "=",
|
559 | left: {
|
560 | type: "Identifier",
|
561 | name: "x",
|
562 | loc: {
|
563 | start: {
|
564 | line: 1,
|
565 | column: 0
|
566 | },
|
567 | end: {
|
568 | line: 1,
|
569 | column: 1
|
570 | }
|
571 | }
|
572 | },
|
573 | right: {
|
574 | type: "ArrayExpression",
|
575 | elements: [
|
576 | null,
|
577 | null,
|
578 | {
|
579 | type: "Literal",
|
580 | value: 42,
|
581 | loc: {
|
582 | start: {
|
583 | line: 1,
|
584 | column: 9
|
585 | },
|
586 | end: {
|
587 | line: 1,
|
588 | column: 11
|
589 | }
|
590 | }
|
591 | }
|
592 | ],
|
593 | loc: {
|
594 | start: {
|
595 | line: 1,
|
596 | column: 4
|
597 | },
|
598 | end: {
|
599 | line: 1,
|
600 | column: 13
|
601 | }
|
602 | }
|
603 | },
|
604 | loc: {
|
605 | start: {
|
606 | line: 1,
|
607 | column: 0
|
608 | },
|
609 | end: {
|
610 | line: 1,
|
611 | column: 13
|
612 | }
|
613 | }
|
614 | },
|
615 | loc: {
|
616 | start: {
|
617 | line: 1,
|
618 | column: 0
|
619 | },
|
620 | end: {
|
621 | line: 1,
|
622 | column: 13
|
623 | }
|
624 | }
|
625 | }
|
626 | ],
|
627 | loc: {
|
628 | start: {
|
629 | line: 1,
|
630 | column: 0
|
631 | },
|
632 | end: {
|
633 | line: 1,
|
634 | column: 13
|
635 | }
|
636 | }
|
637 | });
|
638 |
|
639 | test("x = [ 1, 2, 3, ]", {
|
640 | type: "Program",
|
641 | body: [
|
642 | {
|
643 | type: "ExpressionStatement",
|
644 | expression: {
|
645 | type: "AssignmentExpression",
|
646 | operator: "=",
|
647 | left: {
|
648 | type: "Identifier",
|
649 | name: "x",
|
650 | loc: {
|
651 | start: {
|
652 | line: 1,
|
653 | column: 0
|
654 | },
|
655 | end: {
|
656 | line: 1,
|
657 | column: 1
|
658 | }
|
659 | }
|
660 | },
|
661 | right: {
|
662 | type: "ArrayExpression",
|
663 | elements: [
|
664 | {
|
665 | type: "Literal",
|
666 | value: 1,
|
667 | loc: {
|
668 | start: {
|
669 | line: 1,
|
670 | column: 6
|
671 | },
|
672 | end: {
|
673 | line: 1,
|
674 | column: 7
|
675 | }
|
676 | }
|
677 | },
|
678 | {
|
679 | type: "Literal",
|
680 | value: 2,
|
681 | loc: {
|
682 | start: {
|
683 | line: 1,
|
684 | column: 9
|
685 | },
|
686 | end: {
|
687 | line: 1,
|
688 | column: 10
|
689 | }
|
690 | }
|
691 | },
|
692 | {
|
693 | type: "Literal",
|
694 | value: 3,
|
695 | loc: {
|
696 | start: {
|
697 | line: 1,
|
698 | column: 12
|
699 | },
|
700 | end: {
|
701 | line: 1,
|
702 | column: 13
|
703 | }
|
704 | }
|
705 | }
|
706 | ],
|
707 | loc: {
|
708 | start: {
|
709 | line: 1,
|
710 | column: 4
|
711 | },
|
712 | end: {
|
713 | line: 1,
|
714 | column: 16
|
715 | }
|
716 | }
|
717 | },
|
718 | loc: {
|
719 | start: {
|
720 | line: 1,
|
721 | column: 0
|
722 | },
|
723 | end: {
|
724 | line: 1,
|
725 | column: 16
|
726 | }
|
727 | }
|
728 | },
|
729 | loc: {
|
730 | start: {
|
731 | line: 1,
|
732 | column: 0
|
733 | },
|
734 | end: {
|
735 | line: 1,
|
736 | column: 16
|
737 | }
|
738 | }
|
739 | }
|
740 | ],
|
741 | loc: {
|
742 | start: {
|
743 | line: 1,
|
744 | column: 0
|
745 | },
|
746 | end: {
|
747 | line: 1,
|
748 | column: 16
|
749 | }
|
750 | }
|
751 | });
|
752 |
|
753 | test("x = [ 1, 2,, 3, ]", {
|
754 | type: "Program",
|
755 | body: [
|
756 | {
|
757 | type: "ExpressionStatement",
|
758 | expression: {
|
759 | type: "AssignmentExpression",
|
760 | operator: "=",
|
761 | left: {
|
762 | type: "Identifier",
|
763 | name: "x",
|
764 | loc: {
|
765 | start: {
|
766 | line: 1,
|
767 | column: 0
|
768 | },
|
769 | end: {
|
770 | line: 1,
|
771 | column: 1
|
772 | }
|
773 | }
|
774 | },
|
775 | right: {
|
776 | type: "ArrayExpression",
|
777 | elements: [
|
778 | {
|
779 | type: "Literal",
|
780 | value: 1,
|
781 | loc: {
|
782 | start: {
|
783 | line: 1,
|
784 | column: 6
|
785 | },
|
786 | end: {
|
787 | line: 1,
|
788 | column: 7
|
789 | }
|
790 | }
|
791 | },
|
792 | {
|
793 | type: "Literal",
|
794 | value: 2,
|
795 | loc: {
|
796 | start: {
|
797 | line: 1,
|
798 | column: 9
|
799 | },
|
800 | end: {
|
801 | line: 1,
|
802 | column: 10
|
803 | }
|
804 | }
|
805 | },
|
806 | null,
|
807 | {
|
808 | type: "Literal",
|
809 | value: 3,
|
810 | loc: {
|
811 | start: {
|
812 | line: 1,
|
813 | column: 13
|
814 | },
|
815 | end: {
|
816 | line: 1,
|
817 | column: 14
|
818 | }
|
819 | }
|
820 | }
|
821 | ],
|
822 | loc: {
|
823 | start: {
|
824 | line: 1,
|
825 | column: 4
|
826 | },
|
827 | end: {
|
828 | line: 1,
|
829 | column: 17
|
830 | }
|
831 | }
|
832 | },
|
833 | loc: {
|
834 | start: {
|
835 | line: 1,
|
836 | column: 0
|
837 | },
|
838 | end: {
|
839 | line: 1,
|
840 | column: 17
|
841 | }
|
842 | }
|
843 | },
|
844 | loc: {
|
845 | start: {
|
846 | line: 1,
|
847 | column: 0
|
848 | },
|
849 | end: {
|
850 | line: 1,
|
851 | column: 17
|
852 | }
|
853 | }
|
854 | }
|
855 | ],
|
856 | loc: {
|
857 | start: {
|
858 | line: 1,
|
859 | column: 0
|
860 | },
|
861 | end: {
|
862 | line: 1,
|
863 | column: 17
|
864 | }
|
865 | }
|
866 | });
|
867 |
|
868 | test("日本語 = []", {
|
869 | type: "Program",
|
870 | body: [
|
871 | {
|
872 | type: "ExpressionStatement",
|
873 | expression: {
|
874 | type: "AssignmentExpression",
|
875 | operator: "=",
|
876 | left: {
|
877 | type: "Identifier",
|
878 | name: "日本語",
|
879 | loc: {
|
880 | start: {
|
881 | line: 1,
|
882 | column: 0
|
883 | },
|
884 | end: {
|
885 | line: 1,
|
886 | column: 3
|
887 | }
|
888 | }
|
889 | },
|
890 | right: {
|
891 | type: "ArrayExpression",
|
892 | elements: [],
|
893 | loc: {
|
894 | start: {
|
895 | line: 1,
|
896 | column: 6
|
897 | },
|
898 | end: {
|
899 | line: 1,
|
900 | column: 8
|
901 | }
|
902 | }
|
903 | },
|
904 | loc: {
|
905 | start: {
|
906 | line: 1,
|
907 | column: 0
|
908 | },
|
909 | end: {
|
910 | line: 1,
|
911 | column: 8
|
912 | }
|
913 | }
|
914 | },
|
915 | loc: {
|
916 | start: {
|
917 | line: 1,
|
918 | column: 0
|
919 | },
|
920 | end: {
|
921 | line: 1,
|
922 | column: 8
|
923 | }
|
924 | }
|
925 | }
|
926 | ],
|
927 | loc: {
|
928 | start: {
|
929 | line: 1,
|
930 | column: 0
|
931 | },
|
932 | end: {
|
933 | line: 1,
|
934 | column: 8
|
935 | }
|
936 | }
|
937 | });
|
938 |
|
939 | test("T‿ = []", {
|
940 | type: "Program",
|
941 | body: [
|
942 | {
|
943 | type: "ExpressionStatement",
|
944 | expression: {
|
945 | type: "AssignmentExpression",
|
946 | operator: "=",
|
947 | left: {
|
948 | type: "Identifier",
|
949 | name: "T‿",
|
950 | loc: {
|
951 | start: {
|
952 | line: 1,
|
953 | column: 0
|
954 | },
|
955 | end: {
|
956 | line: 1,
|
957 | column: 2
|
958 | }
|
959 | }
|
960 | },
|
961 | right: {
|
962 | type: "ArrayExpression",
|
963 | elements: [],
|
964 | loc: {
|
965 | start: {
|
966 | line: 1,
|
967 | column: 5
|
968 | },
|
969 | end: {
|
970 | line: 1,
|
971 | column: 7
|
972 | }
|
973 | }
|
974 | },
|
975 | loc: {
|
976 | start: {
|
977 | line: 1,
|
978 | column: 0
|
979 | },
|
980 | end: {
|
981 | line: 1,
|
982 | column: 7
|
983 | }
|
984 | }
|
985 | },
|
986 | loc: {
|
987 | start: {
|
988 | line: 1,
|
989 | column: 0
|
990 | },
|
991 | end: {
|
992 | line: 1,
|
993 | column: 7
|
994 | }
|
995 | }
|
996 | }
|
997 | ],
|
998 | loc: {
|
999 | start: {
|
1000 | line: 1,
|
1001 | column: 0
|
1002 | },
|
1003 | end: {
|
1004 | line: 1,
|
1005 | column: 7
|
1006 | }
|
1007 | }
|
1008 | });
|
1009 |
|
1010 | test("T = []", {
|
1011 | type: "Program",
|
1012 | body: [
|
1013 | {
|
1014 | type: "ExpressionStatement",
|
1015 | expression: {
|
1016 | type: "AssignmentExpression",
|
1017 | operator: "=",
|
1018 | left: {
|
1019 | type: "Identifier",
|
1020 | name: "T",
|
1021 | loc: {
|
1022 | start: {
|
1023 | line: 1,
|
1024 | column: 0
|
1025 | },
|
1026 | end: {
|
1027 | line: 1,
|
1028 | column: 2
|
1029 | }
|
1030 | }
|
1031 | },
|
1032 | right: {
|
1033 | type: "ArrayExpression",
|
1034 | elements: [],
|
1035 | loc: {
|
1036 | start: {
|
1037 | line: 1,
|
1038 | column: 5
|
1039 | },
|
1040 | end: {
|
1041 | line: 1,
|
1042 | column: 7
|
1043 | }
|
1044 | }
|
1045 | },
|
1046 | loc: {
|
1047 | start: {
|
1048 | line: 1,
|
1049 | column: 0
|
1050 | },
|
1051 | end: {
|
1052 | line: 1,
|
1053 | column: 7
|
1054 | }
|
1055 | }
|
1056 | },
|
1057 | loc: {
|
1058 | start: {
|
1059 | line: 1,
|
1060 | column: 0
|
1061 | },
|
1062 | end: {
|
1063 | line: 1,
|
1064 | column: 7
|
1065 | }
|
1066 | }
|
1067 | }
|
1068 | ],
|
1069 | loc: {
|
1070 | start: {
|
1071 | line: 1,
|
1072 | column: 0
|
1073 | },
|
1074 | end: {
|
1075 | line: 1,
|
1076 | column: 7
|
1077 | }
|
1078 | }
|
1079 | });
|
1080 |
|
1081 | test("T = []", {
|
1082 | type: "Program",
|
1083 | body: [
|
1084 | {
|
1085 | type: "ExpressionStatement",
|
1086 | expression: {
|
1087 | type: "AssignmentExpression",
|
1088 | operator: "=",
|
1089 | left: {
|
1090 | type: "Identifier",
|
1091 | name: "T",
|
1092 | loc: {
|
1093 | start: {
|
1094 | line: 1,
|
1095 | column: 0
|
1096 | },
|
1097 | end: {
|
1098 | line: 1,
|
1099 | column: 2
|
1100 | }
|
1101 | }
|
1102 | },
|
1103 | right: {
|
1104 | type: "ArrayExpression",
|
1105 | elements: [],
|
1106 | loc: {
|
1107 | start: {
|
1108 | line: 1,
|
1109 | column: 5
|
1110 | },
|
1111 | end: {
|
1112 | line: 1,
|
1113 | column: 7
|
1114 | }
|
1115 | }
|
1116 | },
|
1117 | loc: {
|
1118 | start: {
|
1119 | line: 1,
|
1120 | column: 0
|
1121 | },
|
1122 | end: {
|
1123 | line: 1,
|
1124 | column: 7
|
1125 | }
|
1126 | }
|
1127 | },
|
1128 | loc: {
|
1129 | start: {
|
1130 | line: 1,
|
1131 | column: 0
|
1132 | },
|
1133 | end: {
|
1134 | line: 1,
|
1135 | column: 7
|
1136 | }
|
1137 | }
|
1138 | }
|
1139 | ],
|
1140 | loc: {
|
1141 | start: {
|
1142 | line: 1,
|
1143 | column: 0
|
1144 | },
|
1145 | end: {
|
1146 | line: 1,
|
1147 | column: 7
|
1148 | }
|
1149 | }
|
1150 | });
|
1151 |
|
1152 | test("ⅣⅡ = []", {
|
1153 | type: "Program",
|
1154 | body: [
|
1155 | {
|
1156 | type: "ExpressionStatement",
|
1157 | expression: {
|
1158 | type: "AssignmentExpression",
|
1159 | operator: "=",
|
1160 | left: {
|
1161 | type: "Identifier",
|
1162 | name: "ⅣⅡ",
|
1163 | loc: {
|
1164 | start: {
|
1165 | line: 1,
|
1166 | column: 0
|
1167 | },
|
1168 | end: {
|
1169 | line: 1,
|
1170 | column: 2
|
1171 | }
|
1172 | }
|
1173 | },
|
1174 | right: {
|
1175 | type: "ArrayExpression",
|
1176 | elements: [],
|
1177 | loc: {
|
1178 | start: {
|
1179 | line: 1,
|
1180 | column: 5
|
1181 | },
|
1182 | end: {
|
1183 | line: 1,
|
1184 | column: 7
|
1185 | }
|
1186 | }
|
1187 | },
|
1188 | loc: {
|
1189 | start: {
|
1190 | line: 1,
|
1191 | column: 0
|
1192 | },
|
1193 | end: {
|
1194 | line: 1,
|
1195 | column: 7
|
1196 | }
|
1197 | }
|
1198 | },
|
1199 | loc: {
|
1200 | start: {
|
1201 | line: 1,
|
1202 | column: 0
|
1203 | },
|
1204 | end: {
|
1205 | line: 1,
|
1206 | column: 7
|
1207 | }
|
1208 | }
|
1209 | }
|
1210 | ],
|
1211 | loc: {
|
1212 | start: {
|
1213 | line: 1,
|
1214 | column: 0
|
1215 | },
|
1216 | end: {
|
1217 | line: 1,
|
1218 | column: 7
|
1219 | }
|
1220 | }
|
1221 | });
|
1222 |
|
1223 | test("ⅣⅡ = []", {
|
1224 | type: "Program",
|
1225 | body: [
|
1226 | {
|
1227 | type: "ExpressionStatement",
|
1228 | expression: {
|
1229 | type: "AssignmentExpression",
|
1230 | operator: "=",
|
1231 | left: {
|
1232 | type: "Identifier",
|
1233 | name: "ⅣⅡ",
|
1234 | loc: {
|
1235 | start: {
|
1236 | line: 1,
|
1237 | column: 0
|
1238 | },
|
1239 | end: {
|
1240 | line: 1,
|
1241 | column: 2
|
1242 | }
|
1243 | }
|
1244 | },
|
1245 | right: {
|
1246 | type: "ArrayExpression",
|
1247 | elements: [],
|
1248 | loc: {
|
1249 | start: {
|
1250 | line: 1,
|
1251 | column: 5
|
1252 | },
|
1253 | end: {
|
1254 | line: 1,
|
1255 | column: 7
|
1256 | }
|
1257 | }
|
1258 | },
|
1259 | loc: {
|
1260 | start: {
|
1261 | line: 1,
|
1262 | column: 0
|
1263 | },
|
1264 | end: {
|
1265 | line: 1,
|
1266 | column: 7
|
1267 | }
|
1268 | }
|
1269 | },
|
1270 | loc: {
|
1271 | start: {
|
1272 | line: 1,
|
1273 | column: 0
|
1274 | },
|
1275 | end: {
|
1276 | line: 1,
|
1277 | column: 7
|
1278 | }
|
1279 | }
|
1280 | }
|
1281 | ],
|
1282 | loc: {
|
1283 | start: {
|
1284 | line: 1,
|
1285 | column: 0
|
1286 | },
|
1287 | end: {
|
1288 | line: 1,
|
1289 | column: 7
|
1290 | }
|
1291 | }
|
1292 | });
|
1293 |
|
1294 | test("x = {}", {
|
1295 | type: "Program",
|
1296 | body: [
|
1297 | {
|
1298 | type: "ExpressionStatement",
|
1299 | expression: {
|
1300 | type: "AssignmentExpression",
|
1301 | operator: "=",
|
1302 | left: {
|
1303 | type: "Identifier",
|
1304 | name: "x",
|
1305 | loc: {
|
1306 | start: {
|
1307 | line: 1,
|
1308 | column: 0
|
1309 | },
|
1310 | end: {
|
1311 | line: 1,
|
1312 | column: 1
|
1313 | }
|
1314 | }
|
1315 | },
|
1316 | right: {
|
1317 | type: "ObjectExpression",
|
1318 | properties: [],
|
1319 | loc: {
|
1320 | start: {
|
1321 | line: 1,
|
1322 | column: 4
|
1323 | },
|
1324 | end: {
|
1325 | line: 1,
|
1326 | column: 6
|
1327 | }
|
1328 | }
|
1329 | },
|
1330 | loc: {
|
1331 | start: {
|
1332 | line: 1,
|
1333 | column: 0
|
1334 | },
|
1335 | end: {
|
1336 | line: 1,
|
1337 | column: 6
|
1338 | }
|
1339 | }
|
1340 | },
|
1341 | loc: {
|
1342 | start: {
|
1343 | line: 1,
|
1344 | column: 0
|
1345 | },
|
1346 | end: {
|
1347 | line: 1,
|
1348 | column: 6
|
1349 | }
|
1350 | }
|
1351 | }
|
1352 | ],
|
1353 | loc: {
|
1354 | start: {
|
1355 | line: 1,
|
1356 | column: 0
|
1357 | },
|
1358 | end: {
|
1359 | line: 1,
|
1360 | column: 6
|
1361 | }
|
1362 | }
|
1363 | });
|
1364 |
|
1365 | test("x = { }", {
|
1366 | type: "Program",
|
1367 | body: [
|
1368 | {
|
1369 | type: "ExpressionStatement",
|
1370 | expression: {
|
1371 | type: "AssignmentExpression",
|
1372 | operator: "=",
|
1373 | left: {
|
1374 | type: "Identifier",
|
1375 | name: "x",
|
1376 | loc: {
|
1377 | start: {
|
1378 | line: 1,
|
1379 | column: 0
|
1380 | },
|
1381 | end: {
|
1382 | line: 1,
|
1383 | column: 1
|
1384 | }
|
1385 | }
|
1386 | },
|
1387 | right: {
|
1388 | type: "ObjectExpression",
|
1389 | properties: [],
|
1390 | loc: {
|
1391 | start: {
|
1392 | line: 1,
|
1393 | column: 4
|
1394 | },
|
1395 | end: {
|
1396 | line: 1,
|
1397 | column: 7
|
1398 | }
|
1399 | }
|
1400 | },
|
1401 | loc: {
|
1402 | start: {
|
1403 | line: 1,
|
1404 | column: 0
|
1405 | },
|
1406 | end: {
|
1407 | line: 1,
|
1408 | column: 7
|
1409 | }
|
1410 | }
|
1411 | },
|
1412 | loc: {
|
1413 | start: {
|
1414 | line: 1,
|
1415 | column: 0
|
1416 | },
|
1417 | end: {
|
1418 | line: 1,
|
1419 | column: 7
|
1420 | }
|
1421 | }
|
1422 | }
|
1423 | ],
|
1424 | loc: {
|
1425 | start: {
|
1426 | line: 1,
|
1427 | column: 0
|
1428 | },
|
1429 | end: {
|
1430 | line: 1,
|
1431 | column: 7
|
1432 | }
|
1433 | }
|
1434 | });
|
1435 |
|
1436 | test("x = { answer: 42 }", {
|
1437 | type: "Program",
|
1438 | body: [
|
1439 | {
|
1440 | type: "ExpressionStatement",
|
1441 | expression: {
|
1442 | type: "AssignmentExpression",
|
1443 | operator: "=",
|
1444 | left: {
|
1445 | type: "Identifier",
|
1446 | name: "x",
|
1447 | loc: {
|
1448 | start: {
|
1449 | line: 1,
|
1450 | column: 0
|
1451 | },
|
1452 | end: {
|
1453 | line: 1,
|
1454 | column: 1
|
1455 | }
|
1456 | }
|
1457 | },
|
1458 | right: {
|
1459 | type: "ObjectExpression",
|
1460 | properties: [
|
1461 | {
|
1462 | key: {
|
1463 | type: "Identifier",
|
1464 | name: "answer",
|
1465 | loc: {
|
1466 | start: {
|
1467 | line: 1,
|
1468 | column: 6
|
1469 | },
|
1470 | end: {
|
1471 | line: 1,
|
1472 | column: 12
|
1473 | }
|
1474 | }
|
1475 | },
|
1476 | value: {
|
1477 | type: "Literal",
|
1478 | value: 42,
|
1479 | loc: {
|
1480 | start: {
|
1481 | line: 1,
|
1482 | column: 14
|
1483 | },
|
1484 | end: {
|
1485 | line: 1,
|
1486 | column: 16
|
1487 | }
|
1488 | }
|
1489 | },
|
1490 | kind: "init"
|
1491 | }
|
1492 | ],
|
1493 | loc: {
|
1494 | start: {
|
1495 | line: 1,
|
1496 | column: 4
|
1497 | },
|
1498 | end: {
|
1499 | line: 1,
|
1500 | column: 18
|
1501 | }
|
1502 | }
|
1503 | },
|
1504 | loc: {
|
1505 | start: {
|
1506 | line: 1,
|
1507 | column: 0
|
1508 | },
|
1509 | end: {
|
1510 | line: 1,
|
1511 | column: 18
|
1512 | }
|
1513 | }
|
1514 | },
|
1515 | loc: {
|
1516 | start: {
|
1517 | line: 1,
|
1518 | column: 0
|
1519 | },
|
1520 | end: {
|
1521 | line: 1,
|
1522 | column: 18
|
1523 | }
|
1524 | }
|
1525 | }
|
1526 | ],
|
1527 | loc: {
|
1528 | start: {
|
1529 | line: 1,
|
1530 | column: 0
|
1531 | },
|
1532 | end: {
|
1533 | line: 1,
|
1534 | column: 18
|
1535 | }
|
1536 | }
|
1537 | });
|
1538 |
|
1539 | test("x = { if: 42 }", {
|
1540 | type: "Program",
|
1541 | body: [
|
1542 | {
|
1543 | type: "ExpressionStatement",
|
1544 | expression: {
|
1545 | type: "AssignmentExpression",
|
1546 | operator: "=",
|
1547 | left: {
|
1548 | type: "Identifier",
|
1549 | name: "x",
|
1550 | loc: {
|
1551 | start: {
|
1552 | line: 1,
|
1553 | column: 0
|
1554 | },
|
1555 | end: {
|
1556 | line: 1,
|
1557 | column: 1
|
1558 | }
|
1559 | }
|
1560 | },
|
1561 | right: {
|
1562 | type: "ObjectExpression",
|
1563 | properties: [
|
1564 | {
|
1565 | key: {
|
1566 | type: "Identifier",
|
1567 | name: "if",
|
1568 | loc: {
|
1569 | start: {
|
1570 | line: 1,
|
1571 | column: 6
|
1572 | },
|
1573 | end: {
|
1574 | line: 1,
|
1575 | column: 8
|
1576 | }
|
1577 | }
|
1578 | },
|
1579 | value: {
|
1580 | type: "Literal",
|
1581 | value: 42,
|
1582 | loc: {
|
1583 | start: {
|
1584 | line: 1,
|
1585 | column: 10
|
1586 | },
|
1587 | end: {
|
1588 | line: 1,
|
1589 | column: 12
|
1590 | }
|
1591 | }
|
1592 | },
|
1593 | kind: "init"
|
1594 | }
|
1595 | ],
|
1596 | loc: {
|
1597 | start: {
|
1598 | line: 1,
|
1599 | column: 4
|
1600 | },
|
1601 | end: {
|
1602 | line: 1,
|
1603 | column: 14
|
1604 | }
|
1605 | }
|
1606 | },
|
1607 | loc: {
|
1608 | start: {
|
1609 | line: 1,
|
1610 | column: 0
|
1611 | },
|
1612 | end: {
|
1613 | line: 1,
|
1614 | column: 14
|
1615 | }
|
1616 | }
|
1617 | },
|
1618 | loc: {
|
1619 | start: {
|
1620 | line: 1,
|
1621 | column: 0
|
1622 | },
|
1623 | end: {
|
1624 | line: 1,
|
1625 | column: 14
|
1626 | }
|
1627 | }
|
1628 | }
|
1629 | ],
|
1630 | loc: {
|
1631 | start: {
|
1632 | line: 1,
|
1633 | column: 0
|
1634 | },
|
1635 | end: {
|
1636 | line: 1,
|
1637 | column: 14
|
1638 | }
|
1639 | }
|
1640 | });
|
1641 |
|
1642 | test("x = { true: 42 }", {
|
1643 | type: "Program",
|
1644 | body: [
|
1645 | {
|
1646 | type: "ExpressionStatement",
|
1647 | expression: {
|
1648 | type: "AssignmentExpression",
|
1649 | operator: "=",
|
1650 | left: {
|
1651 | type: "Identifier",
|
1652 | name: "x",
|
1653 | loc: {
|
1654 | start: {
|
1655 | line: 1,
|
1656 | column: 0
|
1657 | },
|
1658 | end: {
|
1659 | line: 1,
|
1660 | column: 1
|
1661 | }
|
1662 | }
|
1663 | },
|
1664 | right: {
|
1665 | type: "ObjectExpression",
|
1666 | properties: [
|
1667 | {
|
1668 | key: {
|
1669 | type: "Identifier",
|
1670 | name: "true",
|
1671 | loc: {
|
1672 | start: {
|
1673 | line: 1,
|
1674 | column: 6
|
1675 | },
|
1676 | end: {
|
1677 | line: 1,
|
1678 | column: 10
|
1679 | }
|
1680 | }
|
1681 | },
|
1682 | value: {
|
1683 | type: "Literal",
|
1684 | value: 42,
|
1685 | loc: {
|
1686 | start: {
|
1687 | line: 1,
|
1688 | column: 12
|
1689 | },
|
1690 | end: {
|
1691 | line: 1,
|
1692 | column: 14
|
1693 | }
|
1694 | }
|
1695 | },
|
1696 | kind: "init"
|
1697 | }
|
1698 | ],
|
1699 | loc: {
|
1700 | start: {
|
1701 | line: 1,
|
1702 | column: 4
|
1703 | },
|
1704 | end: {
|
1705 | line: 1,
|
1706 | column: 16
|
1707 | }
|
1708 | }
|
1709 | },
|
1710 | loc: {
|
1711 | start: {
|
1712 | line: 1,
|
1713 | column: 0
|
1714 | },
|
1715 | end: {
|
1716 | line: 1,
|
1717 | column: 16
|
1718 | }
|
1719 | }
|
1720 | },
|
1721 | loc: {
|
1722 | start: {
|
1723 | line: 1,
|
1724 | column: 0
|
1725 | },
|
1726 | end: {
|
1727 | line: 1,
|
1728 | column: 16
|
1729 | }
|
1730 | }
|
1731 | }
|
1732 | ],
|
1733 | loc: {
|
1734 | start: {
|
1735 | line: 1,
|
1736 | column: 0
|
1737 | },
|
1738 | end: {
|
1739 | line: 1,
|
1740 | column: 16
|
1741 | }
|
1742 | }
|
1743 | });
|
1744 |
|
1745 | test("x = { false: 42 }", {
|
1746 | type: "Program",
|
1747 | body: [
|
1748 | {
|
1749 | type: "ExpressionStatement",
|
1750 | expression: {
|
1751 | type: "AssignmentExpression",
|
1752 | operator: "=",
|
1753 | left: {
|
1754 | type: "Identifier",
|
1755 | name: "x",
|
1756 | loc: {
|
1757 | start: {
|
1758 | line: 1,
|
1759 | column: 0
|
1760 | },
|
1761 | end: {
|
1762 | line: 1,
|
1763 | column: 1
|
1764 | }
|
1765 | }
|
1766 | },
|
1767 | right: {
|
1768 | type: "ObjectExpression",
|
1769 | properties: [
|
1770 | {
|
1771 | key: {
|
1772 | type: "Identifier",
|
1773 | name: "false",
|
1774 | loc: {
|
1775 | start: {
|
1776 | line: 1,
|
1777 | column: 6
|
1778 | },
|
1779 | end: {
|
1780 | line: 1,
|
1781 | column: 11
|
1782 | }
|
1783 | }
|
1784 | },
|
1785 | value: {
|
1786 | type: "Literal",
|
1787 | value: 42,
|
1788 | loc: {
|
1789 | start: {
|
1790 | line: 1,
|
1791 | column: 13
|
1792 | },
|
1793 | end: {
|
1794 | line: 1,
|
1795 | column: 15
|
1796 | }
|
1797 | }
|
1798 | },
|
1799 | kind: "init"
|
1800 | }
|
1801 | ],
|
1802 | loc: {
|
1803 | start: {
|
1804 | line: 1,
|
1805 | column: 4
|
1806 | },
|
1807 | end: {
|
1808 | line: 1,
|
1809 | column: 17
|
1810 | }
|
1811 | }
|
1812 | },
|
1813 | loc: {
|
1814 | start: {
|
1815 | line: 1,
|
1816 | column: 0
|
1817 | },
|
1818 | end: {
|
1819 | line: 1,
|
1820 | column: 17
|
1821 | }
|
1822 | }
|
1823 | },
|
1824 | loc: {
|
1825 | start: {
|
1826 | line: 1,
|
1827 | column: 0
|
1828 | },
|
1829 | end: {
|
1830 | line: 1,
|
1831 | column: 17
|
1832 | }
|
1833 | }
|
1834 | }
|
1835 | ],
|
1836 | loc: {
|
1837 | start: {
|
1838 | line: 1,
|
1839 | column: 0
|
1840 | },
|
1841 | end: {
|
1842 | line: 1,
|
1843 | column: 17
|
1844 | }
|
1845 | }
|
1846 | });
|
1847 |
|
1848 | test("x = { null: 42 }", {
|
1849 | type: "Program",
|
1850 | body: [
|
1851 | {
|
1852 | type: "ExpressionStatement",
|
1853 | expression: {
|
1854 | type: "AssignmentExpression",
|
1855 | operator: "=",
|
1856 | left: {
|
1857 | type: "Identifier",
|
1858 | name: "x",
|
1859 | loc: {
|
1860 | start: {
|
1861 | line: 1,
|
1862 | column: 0
|
1863 | },
|
1864 | end: {
|
1865 | line: 1,
|
1866 | column: 1
|
1867 | }
|
1868 | }
|
1869 | },
|
1870 | right: {
|
1871 | type: "ObjectExpression",
|
1872 | properties: [
|
1873 | {
|
1874 | key: {
|
1875 | type: "Identifier",
|
1876 | name: "null",
|
1877 | loc: {
|
1878 | start: {
|
1879 | line: 1,
|
1880 | column: 6
|
1881 | },
|
1882 | end: {
|
1883 | line: 1,
|
1884 | column: 10
|
1885 | }
|
1886 | }
|
1887 | },
|
1888 | value: {
|
1889 | type: "Literal",
|
1890 | value: 42,
|
1891 | loc: {
|
1892 | start: {
|
1893 | line: 1,
|
1894 | column: 12
|
1895 | },
|
1896 | end: {
|
1897 | line: 1,
|
1898 | column: 14
|
1899 | }
|
1900 | }
|
1901 | },
|
1902 | kind: "init"
|
1903 | }
|
1904 | ],
|
1905 | loc: {
|
1906 | start: {
|
1907 | line: 1,
|
1908 | column: 4
|
1909 | },
|
1910 | end: {
|
1911 | line: 1,
|
1912 | column: 16
|
1913 | }
|
1914 | }
|
1915 | },
|
1916 | loc: {
|
1917 | start: {
|
1918 | line: 1,
|
1919 | column: 0
|
1920 | },
|
1921 | end: {
|
1922 | line: 1,
|
1923 | column: 16
|
1924 | }
|
1925 | }
|
1926 | },
|
1927 | loc: {
|
1928 | start: {
|
1929 | line: 1,
|
1930 | column: 0
|
1931 | },
|
1932 | end: {
|
1933 | line: 1,
|
1934 | column: 16
|
1935 | }
|
1936 | }
|
1937 | }
|
1938 | ],
|
1939 | loc: {
|
1940 | start: {
|
1941 | line: 1,
|
1942 | column: 0
|
1943 | },
|
1944 | end: {
|
1945 | line: 1,
|
1946 | column: 16
|
1947 | }
|
1948 | }
|
1949 | });
|
1950 |
|
1951 | test("x = { \"answer\": 42 }", {
|
1952 | type: "Program",
|
1953 | body: [
|
1954 | {
|
1955 | type: "ExpressionStatement",
|
1956 | expression: {
|
1957 | type: "AssignmentExpression",
|
1958 | operator: "=",
|
1959 | left: {
|
1960 | type: "Identifier",
|
1961 | name: "x",
|
1962 | loc: {
|
1963 | start: {
|
1964 | line: 1,
|
1965 | column: 0
|
1966 | },
|
1967 | end: {
|
1968 | line: 1,
|
1969 | column: 1
|
1970 | }
|
1971 | }
|
1972 | },
|
1973 | right: {
|
1974 | type: "ObjectExpression",
|
1975 | properties: [
|
1976 | {
|
1977 | key: {
|
1978 | type: "Literal",
|
1979 | value: "answer",
|
1980 | loc: {
|
1981 | start: {
|
1982 | line: 1,
|
1983 | column: 6
|
1984 | },
|
1985 | end: {
|
1986 | line: 1,
|
1987 | column: 14
|
1988 | }
|
1989 | }
|
1990 | },
|
1991 | value: {
|
1992 | type: "Literal",
|
1993 | value: 42,
|
1994 | loc: {
|
1995 | start: {
|
1996 | line: 1,
|
1997 | column: 16
|
1998 | },
|
1999 | end: {
|
2000 | line: 1,
|
2001 | column: 18
|
2002 | }
|
2003 | }
|
2004 | },
|
2005 | kind: "init"
|
2006 | }
|
2007 | ],
|
2008 | loc: {
|
2009 | start: {
|
2010 | line: 1,
|
2011 | column: 4
|
2012 | },
|
2013 | end: {
|
2014 | line: 1,
|
2015 | column: 20
|
2016 | }
|
2017 | }
|
2018 | },
|
2019 | loc: {
|
2020 | start: {
|
2021 | line: 1,
|
2022 | column: 0
|
2023 | },
|
2024 | end: {
|
2025 | line: 1,
|
2026 | column: 20
|
2027 | }
|
2028 | }
|
2029 | },
|
2030 | loc: {
|
2031 | start: {
|
2032 | line: 1,
|
2033 | column: 0
|
2034 | },
|
2035 | end: {
|
2036 | line: 1,
|
2037 | column: 20
|
2038 | }
|
2039 | }
|
2040 | }
|
2041 | ],
|
2042 | loc: {
|
2043 | start: {
|
2044 | line: 1,
|
2045 | column: 0
|
2046 | },
|
2047 | end: {
|
2048 | line: 1,
|
2049 | column: 20
|
2050 | }
|
2051 | }
|
2052 | });
|
2053 |
|
2054 | test("x = { x: 1, x: 2 }", {
|
2055 | type: "Program",
|
2056 | body: [
|
2057 | {
|
2058 | type: "ExpressionStatement",
|
2059 | expression: {
|
2060 | type: "AssignmentExpression",
|
2061 | operator: "=",
|
2062 | left: {
|
2063 | type: "Identifier",
|
2064 | name: "x",
|
2065 | loc: {
|
2066 | start: {
|
2067 | line: 1,
|
2068 | column: 0
|
2069 | },
|
2070 | end: {
|
2071 | line: 1,
|
2072 | column: 1
|
2073 | }
|
2074 | }
|
2075 | },
|
2076 | right: {
|
2077 | type: "ObjectExpression",
|
2078 | properties: [
|
2079 | {
|
2080 | key: {
|
2081 | type: "Identifier",
|
2082 | name: "x",
|
2083 | loc: {
|
2084 | start: {
|
2085 | line: 1,
|
2086 | column: 6
|
2087 | },
|
2088 | end: {
|
2089 | line: 1,
|
2090 | column: 7
|
2091 | }
|
2092 | }
|
2093 | },
|
2094 | value: {
|
2095 | type: "Literal",
|
2096 | value: 1,
|
2097 | loc: {
|
2098 | start: {
|
2099 | line: 1,
|
2100 | column: 9
|
2101 | },
|
2102 | end: {
|
2103 | line: 1,
|
2104 | column: 10
|
2105 | }
|
2106 | }
|
2107 | },
|
2108 | kind: "init"
|
2109 | },
|
2110 | {
|
2111 | key: {
|
2112 | type: "Identifier",
|
2113 | name: "x",
|
2114 | loc: {
|
2115 | start: {
|
2116 | line: 1,
|
2117 | column: 12
|
2118 | },
|
2119 | end: {
|
2120 | line: 1,
|
2121 | column: 13
|
2122 | }
|
2123 | }
|
2124 | },
|
2125 | value: {
|
2126 | type: "Literal",
|
2127 | value: 2,
|
2128 | loc: {
|
2129 | start: {
|
2130 | line: 1,
|
2131 | column: 15
|
2132 | },
|
2133 | end: {
|
2134 | line: 1,
|
2135 | column: 16
|
2136 | }
|
2137 | }
|
2138 | },
|
2139 | kind: "init"
|
2140 | }
|
2141 | ],
|
2142 | loc: {
|
2143 | start: {
|
2144 | line: 1,
|
2145 | column: 4
|
2146 | },
|
2147 | end: {
|
2148 | line: 1,
|
2149 | column: 18
|
2150 | }
|
2151 | }
|
2152 | },
|
2153 | loc: {
|
2154 | start: {
|
2155 | line: 1,
|
2156 | column: 0
|
2157 | },
|
2158 | end: {
|
2159 | line: 1,
|
2160 | column: 18
|
2161 | }
|
2162 | }
|
2163 | },
|
2164 | loc: {
|
2165 | start: {
|
2166 | line: 1,
|
2167 | column: 0
|
2168 | },
|
2169 | end: {
|
2170 | line: 1,
|
2171 | column: 18
|
2172 | }
|
2173 | }
|
2174 | }
|
2175 | ],
|
2176 | loc: {
|
2177 | start: {
|
2178 | line: 1,
|
2179 | column: 0
|
2180 | },
|
2181 | end: {
|
2182 | line: 1,
|
2183 | column: 18
|
2184 | }
|
2185 | }
|
2186 | });
|
2187 |
|
2188 | test("x = { get width() { return m_width } }", {
|
2189 | type: "Program",
|
2190 | body: [
|
2191 | {
|
2192 | type: "ExpressionStatement",
|
2193 | expression: {
|
2194 | type: "AssignmentExpression",
|
2195 | operator: "=",
|
2196 | left: {
|
2197 | type: "Identifier",
|
2198 | name: "x",
|
2199 | loc: {
|
2200 | start: {
|
2201 | line: 1,
|
2202 | column: 0
|
2203 | },
|
2204 | end: {
|
2205 | line: 1,
|
2206 | column: 1
|
2207 | }
|
2208 | }
|
2209 | },
|
2210 | right: {
|
2211 | type: "ObjectExpression",
|
2212 | properties: [
|
2213 | {
|
2214 | key: {
|
2215 | type: "Identifier",
|
2216 | name: "width",
|
2217 | loc: {
|
2218 | start: {
|
2219 | line: 1,
|
2220 | column: 10
|
2221 | },
|
2222 | end: {
|
2223 | line: 1,
|
2224 | column: 15
|
2225 | }
|
2226 | }
|
2227 | },
|
2228 | kind: "get",
|
2229 | value: {
|
2230 | type: "FunctionExpression",
|
2231 | id: null,
|
2232 | params: [],
|
2233 | body: {
|
2234 | type: "BlockStatement",
|
2235 | body: [
|
2236 | {
|
2237 | type: "ReturnStatement",
|
2238 | argument: {
|
2239 | type: "Identifier",
|
2240 | name: "m_width",
|
2241 | loc: {
|
2242 | start: {
|
2243 | line: 1,
|
2244 | column: 27
|
2245 | },
|
2246 | end: {
|
2247 | line: 1,
|
2248 | column: 34
|
2249 | }
|
2250 | }
|
2251 | },
|
2252 | loc: {
|
2253 | start: {
|
2254 | line: 1,
|
2255 | column: 20
|
2256 | },
|
2257 | end: {
|
2258 | line: 1,
|
2259 | column: 34
|
2260 | }
|
2261 | }
|
2262 | }
|
2263 | ],
|
2264 | loc: {
|
2265 | start: {
|
2266 | line: 1,
|
2267 | column: 18
|
2268 | },
|
2269 | end: {
|
2270 | line: 1,
|
2271 | column: 36
|
2272 | }
|
2273 | }
|
2274 | },
|
2275 | loc: {
|
2276 | start: {
|
2277 | line: 1,
|
2278 | column: 15
|
2279 | },
|
2280 | end: {
|
2281 | line: 1,
|
2282 | column: 36
|
2283 | }
|
2284 | }
|
2285 | }
|
2286 | }
|
2287 | ],
|
2288 | loc: {
|
2289 | start: {
|
2290 | line: 1,
|
2291 | column: 4
|
2292 | },
|
2293 | end: {
|
2294 | line: 1,
|
2295 | column: 38
|
2296 | }
|
2297 | }
|
2298 | },
|
2299 | loc: {
|
2300 | start: {
|
2301 | line: 1,
|
2302 | column: 0
|
2303 | },
|
2304 | end: {
|
2305 | line: 1,
|
2306 | column: 38
|
2307 | }
|
2308 | }
|
2309 | },
|
2310 | loc: {
|
2311 | start: {
|
2312 | line: 1,
|
2313 | column: 0
|
2314 | },
|
2315 | end: {
|
2316 | line: 1,
|
2317 | column: 38
|
2318 | }
|
2319 | }
|
2320 | }
|
2321 | ],
|
2322 | loc: {
|
2323 | start: {
|
2324 | line: 1,
|
2325 | column: 0
|
2326 | },
|
2327 | end: {
|
2328 | line: 1,
|
2329 | column: 38
|
2330 | }
|
2331 | }
|
2332 | });
|
2333 |
|
2334 | test("x = { get undef() {} }", {
|
2335 | type: "Program",
|
2336 | body: [
|
2337 | {
|
2338 | type: "ExpressionStatement",
|
2339 | expression: {
|
2340 | type: "AssignmentExpression",
|
2341 | operator: "=",
|
2342 | left: {
|
2343 | type: "Identifier",
|
2344 | name: "x",
|
2345 | loc: {
|
2346 | start: {
|
2347 | line: 1,
|
2348 | column: 0
|
2349 | },
|
2350 | end: {
|
2351 | line: 1,
|
2352 | column: 1
|
2353 | }
|
2354 | }
|
2355 | },
|
2356 | right: {
|
2357 | type: "ObjectExpression",
|
2358 | properties: [
|
2359 | {
|
2360 | key: {
|
2361 | type: "Identifier",
|
2362 | name: "undef",
|
2363 | loc: {
|
2364 | start: {
|
2365 | line: 1,
|
2366 | column: 10
|
2367 | },
|
2368 | end: {
|
2369 | line: 1,
|
2370 | column: 15
|
2371 | }
|
2372 | }
|
2373 | },
|
2374 | kind: "get",
|
2375 | value: {
|
2376 | type: "FunctionExpression",
|
2377 | id: null,
|
2378 | params: [],
|
2379 | body: {
|
2380 | type: "BlockStatement",
|
2381 | body: [],
|
2382 | loc: {
|
2383 | start: {
|
2384 | line: 1,
|
2385 | column: 18
|
2386 | },
|
2387 | end: {
|
2388 | line: 1,
|
2389 | column: 20
|
2390 | }
|
2391 | }
|
2392 | },
|
2393 | loc: {
|
2394 | start: {
|
2395 | line: 1,
|
2396 | column: 15
|
2397 | },
|
2398 | end: {
|
2399 | line: 1,
|
2400 | column: 20
|
2401 | }
|
2402 | }
|
2403 | }
|
2404 | }
|
2405 | ],
|
2406 | loc: {
|
2407 | start: {
|
2408 | line: 1,
|
2409 | column: 4
|
2410 | },
|
2411 | end: {
|
2412 | line: 1,
|
2413 | column: 22
|
2414 | }
|
2415 | }
|
2416 | },
|
2417 | loc: {
|
2418 | start: {
|
2419 | line: 1,
|
2420 | column: 0
|
2421 | },
|
2422 | end: {
|
2423 | line: 1,
|
2424 | column: 22
|
2425 | }
|
2426 | }
|
2427 | },
|
2428 | loc: {
|
2429 | start: {
|
2430 | line: 1,
|
2431 | column: 0
|
2432 | },
|
2433 | end: {
|
2434 | line: 1,
|
2435 | column: 22
|
2436 | }
|
2437 | }
|
2438 | }
|
2439 | ],
|
2440 | loc: {
|
2441 | start: {
|
2442 | line: 1,
|
2443 | column: 0
|
2444 | },
|
2445 | end: {
|
2446 | line: 1,
|
2447 | column: 22
|
2448 | }
|
2449 | }
|
2450 | });
|
2451 |
|
2452 | test("x = { get if() {} }", {
|
2453 | type: "Program",
|
2454 | body: [
|
2455 | {
|
2456 | type: "ExpressionStatement",
|
2457 | expression: {
|
2458 | type: "AssignmentExpression",
|
2459 | operator: "=",
|
2460 | left: {
|
2461 | type: "Identifier",
|
2462 | name: "x",
|
2463 | loc: {
|
2464 | start: {
|
2465 | line: 1,
|
2466 | column: 0
|
2467 | },
|
2468 | end: {
|
2469 | line: 1,
|
2470 | column: 1
|
2471 | }
|
2472 | }
|
2473 | },
|
2474 | right: {
|
2475 | type: "ObjectExpression",
|
2476 | properties: [
|
2477 | {
|
2478 | key: {
|
2479 | type: "Identifier",
|
2480 | name: "if",
|
2481 | loc: {
|
2482 | start: {
|
2483 | line: 1,
|
2484 | column: 10
|
2485 | },
|
2486 | end: {
|
2487 | line: 1,
|
2488 | column: 12
|
2489 | }
|
2490 | }
|
2491 | },
|
2492 | kind: "get",
|
2493 | value: {
|
2494 | type: "FunctionExpression",
|
2495 | id: null,
|
2496 | params: [],
|
2497 | body: {
|
2498 | type: "BlockStatement",
|
2499 | body: [],
|
2500 | loc: {
|
2501 | start: {
|
2502 | line: 1,
|
2503 | column: 15
|
2504 | },
|
2505 | end: {
|
2506 | line: 1,
|
2507 | column: 17
|
2508 | }
|
2509 | }
|
2510 | },
|
2511 | loc: {
|
2512 | start: {
|
2513 | line: 1,
|
2514 | column: 12
|
2515 | },
|
2516 | end: {
|
2517 | line: 1,
|
2518 | column: 17
|
2519 | }
|
2520 | }
|
2521 | }
|
2522 | }
|
2523 | ],
|
2524 | loc: {
|
2525 | start: {
|
2526 | line: 1,
|
2527 | column: 4
|
2528 | },
|
2529 | end: {
|
2530 | line: 1,
|
2531 | column: 19
|
2532 | }
|
2533 | }
|
2534 | },
|
2535 | loc: {
|
2536 | start: {
|
2537 | line: 1,
|
2538 | column: 0
|
2539 | },
|
2540 | end: {
|
2541 | line: 1,
|
2542 | column: 19
|
2543 | }
|
2544 | }
|
2545 | },
|
2546 | loc: {
|
2547 | start: {
|
2548 | line: 1,
|
2549 | column: 0
|
2550 | },
|
2551 | end: {
|
2552 | line: 1,
|
2553 | column: 19
|
2554 | }
|
2555 | }
|
2556 | }
|
2557 | ],
|
2558 | loc: {
|
2559 | start: {
|
2560 | line: 1,
|
2561 | column: 0
|
2562 | },
|
2563 | end: {
|
2564 | line: 1,
|
2565 | column: 19
|
2566 | }
|
2567 | }
|
2568 | });
|
2569 |
|
2570 | test("x = { get true() {} }", {
|
2571 | type: "Program",
|
2572 | body: [
|
2573 | {
|
2574 | type: "ExpressionStatement",
|
2575 | expression: {
|
2576 | type: "AssignmentExpression",
|
2577 | operator: "=",
|
2578 | left: {
|
2579 | type: "Identifier",
|
2580 | name: "x",
|
2581 | loc: {
|
2582 | start: {
|
2583 | line: 1,
|
2584 | column: 0
|
2585 | },
|
2586 | end: {
|
2587 | line: 1,
|
2588 | column: 1
|
2589 | }
|
2590 | }
|
2591 | },
|
2592 | right: {
|
2593 | type: "ObjectExpression",
|
2594 | properties: [
|
2595 | {
|
2596 | key: {
|
2597 | type: "Identifier",
|
2598 | name: "true",
|
2599 | loc: {
|
2600 | start: {
|
2601 | line: 1,
|
2602 | column: 10
|
2603 | },
|
2604 | end: {
|
2605 | line: 1,
|
2606 | column: 14
|
2607 | }
|
2608 | }
|
2609 | },
|
2610 | kind: "get",
|
2611 | value: {
|
2612 | type: "FunctionExpression",
|
2613 | id: null,
|
2614 | params: [],
|
2615 | body: {
|
2616 | type: "BlockStatement",
|
2617 | body: [],
|
2618 | loc: {
|
2619 | start: {
|
2620 | line: 1,
|
2621 | column: 17
|
2622 | },
|
2623 | end: {
|
2624 | line: 1,
|
2625 | column: 19
|
2626 | }
|
2627 | }
|
2628 | },
|
2629 | loc: {
|
2630 | start: {
|
2631 | line: 1,
|
2632 | column: 14
|
2633 | },
|
2634 | end: {
|
2635 | line: 1,
|
2636 | column: 19
|
2637 | }
|
2638 | }
|
2639 | }
|
2640 | }
|
2641 | ],
|
2642 | loc: {
|
2643 | start: {
|
2644 | line: 1,
|
2645 | column: 4
|
2646 | },
|
2647 | end: {
|
2648 | line: 1,
|
2649 | column: 21
|
2650 | }
|
2651 | }
|
2652 | },
|
2653 | loc: {
|
2654 | start: {
|
2655 | line: 1,
|
2656 | column: 0
|
2657 | },
|
2658 | end: {
|
2659 | line: 1,
|
2660 | column: 21
|
2661 | }
|
2662 | }
|
2663 | },
|
2664 | loc: {
|
2665 | start: {
|
2666 | line: 1,
|
2667 | column: 0
|
2668 | },
|
2669 | end: {
|
2670 | line: 1,
|
2671 | column: 21
|
2672 | }
|
2673 | }
|
2674 | }
|
2675 | ],
|
2676 | loc: {
|
2677 | start: {
|
2678 | line: 1,
|
2679 | column: 0
|
2680 | },
|
2681 | end: {
|
2682 | line: 1,
|
2683 | column: 21
|
2684 | }
|
2685 | }
|
2686 | });
|
2687 |
|
2688 | test("x = { get false() {} }", {
|
2689 | type: "Program",
|
2690 | body: [
|
2691 | {
|
2692 | type: "ExpressionStatement",
|
2693 | expression: {
|
2694 | type: "AssignmentExpression",
|
2695 | operator: "=",
|
2696 | left: {
|
2697 | type: "Identifier",
|
2698 | name: "x",
|
2699 | loc: {
|
2700 | start: {
|
2701 | line: 1,
|
2702 | column: 0
|
2703 | },
|
2704 | end: {
|
2705 | line: 1,
|
2706 | column: 1
|
2707 | }
|
2708 | }
|
2709 | },
|
2710 | right: {
|
2711 | type: "ObjectExpression",
|
2712 | properties: [
|
2713 | {
|
2714 | key: {
|
2715 | type: "Identifier",
|
2716 | name: "false",
|
2717 | loc: {
|
2718 | start: {
|
2719 | line: 1,
|
2720 | column: 10
|
2721 | },
|
2722 | end: {
|
2723 | line: 1,
|
2724 | column: 15
|
2725 | }
|
2726 | }
|
2727 | },
|
2728 | kind: "get",
|
2729 | value: {
|
2730 | type: "FunctionExpression",
|
2731 | id: null,
|
2732 | params: [],
|
2733 | body: {
|
2734 | type: "BlockStatement",
|
2735 | body: [],
|
2736 | loc: {
|
2737 | start: {
|
2738 | line: 1,
|
2739 | column: 18
|
2740 | },
|
2741 | end: {
|
2742 | line: 1,
|
2743 | column: 20
|
2744 | }
|
2745 | }
|
2746 | },
|
2747 | loc: {
|
2748 | start: {
|
2749 | line: 1,
|
2750 | column: 15
|
2751 | },
|
2752 | end: {
|
2753 | line: 1,
|
2754 | column: 20
|
2755 | }
|
2756 | }
|
2757 | }
|
2758 | }
|
2759 | ],
|
2760 | loc: {
|
2761 | start: {
|
2762 | line: 1,
|
2763 | column: 4
|
2764 | },
|
2765 | end: {
|
2766 | line: 1,
|
2767 | column: 22
|
2768 | }
|
2769 | }
|
2770 | },
|
2771 | loc: {
|
2772 | start: {
|
2773 | line: 1,
|
2774 | column: 0
|
2775 | },
|
2776 | end: {
|
2777 | line: 1,
|
2778 | column: 22
|
2779 | }
|
2780 | }
|
2781 | },
|
2782 | loc: {
|
2783 | start: {
|
2784 | line: 1,
|
2785 | column: 0
|
2786 | },
|
2787 | end: {
|
2788 | line: 1,
|
2789 | column: 22
|
2790 | }
|
2791 | }
|
2792 | }
|
2793 | ],
|
2794 | loc: {
|
2795 | start: {
|
2796 | line: 1,
|
2797 | column: 0
|
2798 | },
|
2799 | end: {
|
2800 | line: 1,
|
2801 | column: 22
|
2802 | }
|
2803 | }
|
2804 | });
|
2805 |
|
2806 | test("x = { get null() {} }", {
|
2807 | type: "Program",
|
2808 | body: [
|
2809 | {
|
2810 | type: "ExpressionStatement",
|
2811 | expression: {
|
2812 | type: "AssignmentExpression",
|
2813 | operator: "=",
|
2814 | left: {
|
2815 | type: "Identifier",
|
2816 | name: "x",
|
2817 | loc: {
|
2818 | start: {
|
2819 | line: 1,
|
2820 | column: 0
|
2821 | },
|
2822 | end: {
|
2823 | line: 1,
|
2824 | column: 1
|
2825 | }
|
2826 | }
|
2827 | },
|
2828 | right: {
|
2829 | type: "ObjectExpression",
|
2830 | properties: [
|
2831 | {
|
2832 | key: {
|
2833 | type: "Identifier",
|
2834 | name: "null",
|
2835 | loc: {
|
2836 | start: {
|
2837 | line: 1,
|
2838 | column: 10
|
2839 | },
|
2840 | end: {
|
2841 | line: 1,
|
2842 | column: 14
|
2843 | }
|
2844 | }
|
2845 | },
|
2846 | kind: "get",
|
2847 | value: {
|
2848 | type: "FunctionExpression",
|
2849 | id: null,
|
2850 | params: [],
|
2851 | body: {
|
2852 | type: "BlockStatement",
|
2853 | body: [],
|
2854 | loc: {
|
2855 | start: {
|
2856 | line: 1,
|
2857 | column: 17
|
2858 | },
|
2859 | end: {
|
2860 | line: 1,
|
2861 | column: 19
|
2862 | }
|
2863 | }
|
2864 | },
|
2865 | loc: {
|
2866 | start: {
|
2867 | line: 1,
|
2868 | column: 14
|
2869 | },
|
2870 | end: {
|
2871 | line: 1,
|
2872 | column: 19
|
2873 | }
|
2874 | }
|
2875 | }
|
2876 | }
|
2877 | ],
|
2878 | loc: {
|
2879 | start: {
|
2880 | line: 1,
|
2881 | column: 4
|
2882 | },
|
2883 | end: {
|
2884 | line: 1,
|
2885 | column: 21
|
2886 | }
|
2887 | }
|
2888 | },
|
2889 | loc: {
|
2890 | start: {
|
2891 | line: 1,
|
2892 | column: 0
|
2893 | },
|
2894 | end: {
|
2895 | line: 1,
|
2896 | column: 21
|
2897 | }
|
2898 | }
|
2899 | },
|
2900 | loc: {
|
2901 | start: {
|
2902 | line: 1,
|
2903 | column: 0
|
2904 | },
|
2905 | end: {
|
2906 | line: 1,
|
2907 | column: 21
|
2908 | }
|
2909 | }
|
2910 | }
|
2911 | ],
|
2912 | loc: {
|
2913 | start: {
|
2914 | line: 1,
|
2915 | column: 0
|
2916 | },
|
2917 | end: {
|
2918 | line: 1,
|
2919 | column: 21
|
2920 | }
|
2921 | }
|
2922 | });
|
2923 |
|
2924 | test("x = { get \"undef\"() {} }", {
|
2925 | type: "Program",
|
2926 | body: [
|
2927 | {
|
2928 | type: "ExpressionStatement",
|
2929 | expression: {
|
2930 | type: "AssignmentExpression",
|
2931 | operator: "=",
|
2932 | left: {
|
2933 | type: "Identifier",
|
2934 | name: "x",
|
2935 | loc: {
|
2936 | start: {
|
2937 | line: 1,
|
2938 | column: 0
|
2939 | },
|
2940 | end: {
|
2941 | line: 1,
|
2942 | column: 1
|
2943 | }
|
2944 | }
|
2945 | },
|
2946 | right: {
|
2947 | type: "ObjectExpression",
|
2948 | properties: [
|
2949 | {
|
2950 | key: {
|
2951 | type: "Literal",
|
2952 | value: "undef",
|
2953 | loc: {
|
2954 | start: {
|
2955 | line: 1,
|
2956 | column: 10
|
2957 | },
|
2958 | end: {
|
2959 | line: 1,
|
2960 | column: 17
|
2961 | }
|
2962 | }
|
2963 | },
|
2964 | kind: "get",
|
2965 | value: {
|
2966 | type: "FunctionExpression",
|
2967 | id: null,
|
2968 | params: [],
|
2969 | body: {
|
2970 | type: "BlockStatement",
|
2971 | body: [],
|
2972 | loc: {
|
2973 | start: {
|
2974 | line: 1,
|
2975 | column: 20
|
2976 | },
|
2977 | end: {
|
2978 | line: 1,
|
2979 | column: 22
|
2980 | }
|
2981 | }
|
2982 | },
|
2983 | loc: {
|
2984 | start: {
|
2985 | line: 1,
|
2986 | column: 17
|
2987 | },
|
2988 | end: {
|
2989 | line: 1,
|
2990 | column: 22
|
2991 | }
|
2992 | }
|
2993 | }
|
2994 | }
|
2995 | ],
|
2996 | loc: {
|
2997 | start: {
|
2998 | line: 1,
|
2999 | column: 4
|
3000 | },
|
3001 | end: {
|
3002 | line: 1,
|
3003 | column: 24
|
3004 | }
|
3005 | }
|
3006 | },
|
3007 | loc: {
|
3008 | start: {
|
3009 | line: 1,
|
3010 | column: 0
|
3011 | },
|
3012 | end: {
|
3013 | line: 1,
|
3014 | column: 24
|
3015 | }
|
3016 | }
|
3017 | },
|
3018 | loc: {
|
3019 | start: {
|
3020 | line: 1,
|
3021 | column: 0
|
3022 | },
|
3023 | end: {
|
3024 | line: 1,
|
3025 | column: 24
|
3026 | }
|
3027 | }
|
3028 | }
|
3029 | ],
|
3030 | loc: {
|
3031 | start: {
|
3032 | line: 1,
|
3033 | column: 0
|
3034 | },
|
3035 | end: {
|
3036 | line: 1,
|
3037 | column: 24
|
3038 | }
|
3039 | }
|
3040 | });
|
3041 |
|
3042 | test("x = { get 10() {} }", {
|
3043 | type: "Program",
|
3044 | body: [
|
3045 | {
|
3046 | type: "ExpressionStatement",
|
3047 | expression: {
|
3048 | type: "AssignmentExpression",
|
3049 | operator: "=",
|
3050 | left: {
|
3051 | type: "Identifier",
|
3052 | name: "x",
|
3053 | loc: {
|
3054 | start: {
|
3055 | line: 1,
|
3056 | column: 0
|
3057 | },
|
3058 | end: {
|
3059 | line: 1,
|
3060 | column: 1
|
3061 | }
|
3062 | }
|
3063 | },
|
3064 | right: {
|
3065 | type: "ObjectExpression",
|
3066 | properties: [
|
3067 | {
|
3068 | key: {
|
3069 | type: "Literal",
|
3070 | value: 10,
|
3071 | loc: {
|
3072 | start: {
|
3073 | line: 1,
|
3074 | column: 10
|
3075 | },
|
3076 | end: {
|
3077 | line: 1,
|
3078 | column: 12
|
3079 | }
|
3080 | }
|
3081 | },
|
3082 | kind: "get",
|
3083 | value: {
|
3084 | type: "FunctionExpression",
|
3085 | id: null,
|
3086 | params: [],
|
3087 | body: {
|
3088 | type: "BlockStatement",
|
3089 | body: [],
|
3090 | loc: {
|
3091 | start: {
|
3092 | line: 1,
|
3093 | column: 15
|
3094 | },
|
3095 | end: {
|
3096 | line: 1,
|
3097 | column: 17
|
3098 | }
|
3099 | }
|
3100 | },
|
3101 | loc: {
|
3102 | start: {
|
3103 | line: 1,
|
3104 | column: 12
|
3105 | },
|
3106 | end: {
|
3107 | line: 1,
|
3108 | column: 17
|
3109 | }
|
3110 | }
|
3111 | }
|
3112 | }
|
3113 | ],
|
3114 | loc: {
|
3115 | start: {
|
3116 | line: 1,
|
3117 | column: 4
|
3118 | },
|
3119 | end: {
|
3120 | line: 1,
|
3121 | column: 19
|
3122 | }
|
3123 | }
|
3124 | },
|
3125 | loc: {
|
3126 | start: {
|
3127 | line: 1,
|
3128 | column: 0
|
3129 | },
|
3130 | end: {
|
3131 | line: 1,
|
3132 | column: 19
|
3133 | }
|
3134 | }
|
3135 | },
|
3136 | loc: {
|
3137 | start: {
|
3138 | line: 1,
|
3139 | column: 0
|
3140 | },
|
3141 | end: {
|
3142 | line: 1,
|
3143 | column: 19
|
3144 | }
|
3145 | }
|
3146 | }
|
3147 | ],
|
3148 | loc: {
|
3149 | start: {
|
3150 | line: 1,
|
3151 | column: 0
|
3152 | },
|
3153 | end: {
|
3154 | line: 1,
|
3155 | column: 19
|
3156 | }
|
3157 | }
|
3158 | });
|
3159 |
|
3160 | test("x = { set width(w) { m_width = w } }", {
|
3161 | type: "Program",
|
3162 | body: [
|
3163 | {
|
3164 | type: "ExpressionStatement",
|
3165 | expression: {
|
3166 | type: "AssignmentExpression",
|
3167 | operator: "=",
|
3168 | left: {
|
3169 | type: "Identifier",
|
3170 | name: "x",
|
3171 | loc: {
|
3172 | start: {
|
3173 | line: 1,
|
3174 | column: 0
|
3175 | },
|
3176 | end: {
|
3177 | line: 1,
|
3178 | column: 1
|
3179 | }
|
3180 | }
|
3181 | },
|
3182 | right: {
|
3183 | type: "ObjectExpression",
|
3184 | properties: [
|
3185 | {
|
3186 | key: {
|
3187 | type: "Identifier",
|
3188 | name: "width",
|
3189 | loc: {
|
3190 | start: {
|
3191 | line: 1,
|
3192 | column: 10
|
3193 | },
|
3194 | end: {
|
3195 | line: 1,
|
3196 | column: 15
|
3197 | }
|
3198 | }
|
3199 | },
|
3200 | kind: "set",
|
3201 | value: {
|
3202 | type: "FunctionExpression",
|
3203 | id: null,
|
3204 | params: [
|
3205 | {
|
3206 | type: "Identifier",
|
3207 | name: "w",
|
3208 | loc: {
|
3209 | start: {
|
3210 | line: 1,
|
3211 | column: 16
|
3212 | },
|
3213 | end: {
|
3214 | line: 1,
|
3215 | column: 17
|
3216 | }
|
3217 | }
|
3218 | }
|
3219 | ],
|
3220 | body: {
|
3221 | type: "BlockStatement",
|
3222 | body: [
|
3223 | {
|
3224 | type: "ExpressionStatement",
|
3225 | expression: {
|
3226 | type: "AssignmentExpression",
|
3227 | operator: "=",
|
3228 | left: {
|
3229 | type: "Identifier",
|
3230 | name: "m_width",
|
3231 | loc: {
|
3232 | start: {
|
3233 | line: 1,
|
3234 | column: 21
|
3235 | },
|
3236 | end: {
|
3237 | line: 1,
|
3238 | column: 28
|
3239 | }
|
3240 | }
|
3241 | },
|
3242 | right: {
|
3243 | type: "Identifier",
|
3244 | name: "w",
|
3245 | loc: {
|
3246 | start: {
|
3247 | line: 1,
|
3248 | column: 31
|
3249 | },
|
3250 | end: {
|
3251 | line: 1,
|
3252 | column: 32
|
3253 | }
|
3254 | }
|
3255 | },
|
3256 | loc: {
|
3257 | start: {
|
3258 | line: 1,
|
3259 | column: 21
|
3260 | },
|
3261 | end: {
|
3262 | line: 1,
|
3263 | column: 32
|
3264 | }
|
3265 | }
|
3266 | },
|
3267 | loc: {
|
3268 | start: {
|
3269 | line: 1,
|
3270 | column: 21
|
3271 | },
|
3272 | end: {
|
3273 | line: 1,
|
3274 | column: 32
|
3275 | }
|
3276 | }
|
3277 | }
|
3278 | ],
|
3279 | loc: {
|
3280 | start: {
|
3281 | line: 1,
|
3282 | column: 19
|
3283 | },
|
3284 | end: {
|
3285 | line: 1,
|
3286 | column: 34
|
3287 | }
|
3288 | }
|
3289 | },
|
3290 | loc: {
|
3291 | start: {
|
3292 | line: 1,
|
3293 | column: 15
|
3294 | },
|
3295 | end: {
|
3296 | line: 1,
|
3297 | column: 34
|
3298 | }
|
3299 | }
|
3300 | }
|
3301 | }
|
3302 | ],
|
3303 | loc: {
|
3304 | start: {
|
3305 | line: 1,
|
3306 | column: 4
|
3307 | },
|
3308 | end: {
|
3309 | line: 1,
|
3310 | column: 36
|
3311 | }
|
3312 | }
|
3313 | },
|
3314 | loc: {
|
3315 | start: {
|
3316 | line: 1,
|
3317 | column: 0
|
3318 | },
|
3319 | end: {
|
3320 | line: 1,
|
3321 | column: 36
|
3322 | }
|
3323 | }
|
3324 | },
|
3325 | loc: {
|
3326 | start: {
|
3327 | line: 1,
|
3328 | column: 0
|
3329 | },
|
3330 | end: {
|
3331 | line: 1,
|
3332 | column: 36
|
3333 | }
|
3334 | }
|
3335 | }
|
3336 | ],
|
3337 | loc: {
|
3338 | start: {
|
3339 | line: 1,
|
3340 | column: 0
|
3341 | },
|
3342 | end: {
|
3343 | line: 1,
|
3344 | column: 36
|
3345 | }
|
3346 | }
|
3347 | });
|
3348 |
|
3349 | test("x = { set if(w) { m_if = w } }", {
|
3350 | type: "Program",
|
3351 | body: [
|
3352 | {
|
3353 | type: "ExpressionStatement",
|
3354 | expression: {
|
3355 | type: "AssignmentExpression",
|
3356 | operator: "=",
|
3357 | left: {
|
3358 | type: "Identifier",
|
3359 | name: "x",
|
3360 | loc: {
|
3361 | start: {
|
3362 | line: 1,
|
3363 | column: 0
|
3364 | },
|
3365 | end: {
|
3366 | line: 1,
|
3367 | column: 1
|
3368 | }
|
3369 | }
|
3370 | },
|
3371 | right: {
|
3372 | type: "ObjectExpression",
|
3373 | properties: [
|
3374 | {
|
3375 | key: {
|
3376 | type: "Identifier",
|
3377 | name: "if",
|
3378 | loc: {
|
3379 | start: {
|
3380 | line: 1,
|
3381 | column: 10
|
3382 | },
|
3383 | end: {
|
3384 | line: 1,
|
3385 | column: 12
|
3386 | }
|
3387 | }
|
3388 | },
|
3389 | kind: "set",
|
3390 | value: {
|
3391 | type: "FunctionExpression",
|
3392 | id: null,
|
3393 | params: [
|
3394 | {
|
3395 | type: "Identifier",
|
3396 | name: "w",
|
3397 | loc: {
|
3398 | start: {
|
3399 | line: 1,
|
3400 | column: 13
|
3401 | },
|
3402 | end: {
|
3403 | line: 1,
|
3404 | column: 14
|
3405 | }
|
3406 | }
|
3407 | }
|
3408 | ],
|
3409 | body: {
|
3410 | type: "BlockStatement",
|
3411 | body: [
|
3412 | {
|
3413 | type: "ExpressionStatement",
|
3414 | expression: {
|
3415 | type: "AssignmentExpression",
|
3416 | operator: "=",
|
3417 | left: {
|
3418 | type: "Identifier",
|
3419 | name: "m_if",
|
3420 | loc: {
|
3421 | start: {
|
3422 | line: 1,
|
3423 | column: 18
|
3424 | },
|
3425 | end: {
|
3426 | line: 1,
|
3427 | column: 22
|
3428 | }
|
3429 | }
|
3430 | },
|
3431 | right: {
|
3432 | type: "Identifier",
|
3433 | name: "w",
|
3434 | loc: {
|
3435 | start: {
|
3436 | line: 1,
|
3437 | column: 25
|
3438 | },
|
3439 | end: {
|
3440 | line: 1,
|
3441 | column: 26
|
3442 | }
|
3443 | }
|
3444 | },
|
3445 | loc: {
|
3446 | start: {
|
3447 | line: 1,
|
3448 | column: 18
|
3449 | },
|
3450 | end: {
|
3451 | line: 1,
|
3452 | column: 26
|
3453 | }
|
3454 | }
|
3455 | },
|
3456 | loc: {
|
3457 | start: {
|
3458 | line: 1,
|
3459 | column: 18
|
3460 | },
|
3461 | end: {
|
3462 | line: 1,
|
3463 | column: 26
|
3464 | }
|
3465 | }
|
3466 | }
|
3467 | ],
|
3468 | loc: {
|
3469 | start: {
|
3470 | line: 1,
|
3471 | column: 16
|
3472 | },
|
3473 | end: {
|
3474 | line: 1,
|
3475 | column: 28
|
3476 | }
|
3477 | }
|
3478 | },
|
3479 | loc: {
|
3480 | start: {
|
3481 | line: 1,
|
3482 | column: 12
|
3483 | },
|
3484 | end: {
|
3485 | line: 1,
|
3486 | column: 28
|
3487 | }
|
3488 | }
|
3489 | }
|
3490 | }
|
3491 | ],
|
3492 | loc: {
|
3493 | start: {
|
3494 | line: 1,
|
3495 | column: 4
|
3496 | },
|
3497 | end: {
|
3498 | line: 1,
|
3499 | column: 30
|
3500 | }
|
3501 | }
|
3502 | },
|
3503 | loc: {
|
3504 | start: {
|
3505 | line: 1,
|
3506 | column: 0
|
3507 | },
|
3508 | end: {
|
3509 | line: 1,
|
3510 | column: 30
|
3511 | }
|
3512 | }
|
3513 | },
|
3514 | loc: {
|
3515 | start: {
|
3516 | line: 1,
|
3517 | column: 0
|
3518 | },
|
3519 | end: {
|
3520 | line: 1,
|
3521 | column: 30
|
3522 | }
|
3523 | }
|
3524 | }
|
3525 | ],
|
3526 | loc: {
|
3527 | start: {
|
3528 | line: 1,
|
3529 | column: 0
|
3530 | },
|
3531 | end: {
|
3532 | line: 1,
|
3533 | column: 30
|
3534 | }
|
3535 | }
|
3536 | });
|
3537 |
|
3538 | test("x = { set true(w) { m_true = w } }", {
|
3539 | type: "Program",
|
3540 | body: [
|
3541 | {
|
3542 | type: "ExpressionStatement",
|
3543 | expression: {
|
3544 | type: "AssignmentExpression",
|
3545 | operator: "=",
|
3546 | left: {
|
3547 | type: "Identifier",
|
3548 | name: "x",
|
3549 | loc: {
|
3550 | start: {
|
3551 | line: 1,
|
3552 | column: 0
|
3553 | },
|
3554 | end: {
|
3555 | line: 1,
|
3556 | column: 1
|
3557 | }
|
3558 | }
|
3559 | },
|
3560 | right: {
|
3561 | type: "ObjectExpression",
|
3562 | properties: [
|
3563 | {
|
3564 | key: {
|
3565 | type: "Identifier",
|
3566 | name: "true",
|
3567 | loc: {
|
3568 | start: {
|
3569 | line: 1,
|
3570 | column: 10
|
3571 | },
|
3572 | end: {
|
3573 | line: 1,
|
3574 | column: 14
|
3575 | }
|
3576 | }
|
3577 | },
|
3578 | kind: "set",
|
3579 | value: {
|
3580 | type: "FunctionExpression",
|
3581 | id: null,
|
3582 | params: [
|
3583 | {
|
3584 | type: "Identifier",
|
3585 | name: "w",
|
3586 | loc: {
|
3587 | start: {
|
3588 | line: 1,
|
3589 | column: 15
|
3590 | },
|
3591 | end: {
|
3592 | line: 1,
|
3593 | column: 16
|
3594 | }
|
3595 | }
|
3596 | }
|
3597 | ],
|
3598 | body: {
|
3599 | type: "BlockStatement",
|
3600 | body: [
|
3601 | {
|
3602 | type: "ExpressionStatement",
|
3603 | expression: {
|
3604 | type: "AssignmentExpression",
|
3605 | operator: "=",
|
3606 | left: {
|
3607 | type: "Identifier",
|
3608 | name: "m_true",
|
3609 | loc: {
|
3610 | start: {
|
3611 | line: 1,
|
3612 | column: 20
|
3613 | },
|
3614 | end: {
|
3615 | line: 1,
|
3616 | column: 26
|
3617 | }
|
3618 | }
|
3619 | },
|
3620 | right: {
|
3621 | type: "Identifier",
|
3622 | name: "w",
|
3623 | loc: {
|
3624 | start: {
|
3625 | line: 1,
|
3626 | column: 29
|
3627 | },
|
3628 | end: {
|
3629 | line: 1,
|
3630 | column: 30
|
3631 | }
|
3632 | }
|
3633 | },
|
3634 | loc: {
|
3635 | start: {
|
3636 | line: 1,
|
3637 | column: 20
|
3638 | },
|
3639 | end: {
|
3640 | line: 1,
|
3641 | column: 30
|
3642 | }
|
3643 | }
|
3644 | },
|
3645 | loc: {
|
3646 | start: {
|
3647 | line: 1,
|
3648 | column: 20
|
3649 | },
|
3650 | end: {
|
3651 | line: 1,
|
3652 | column: 30
|
3653 | }
|
3654 | }
|
3655 | }
|
3656 | ],
|
3657 | loc: {
|
3658 | start: {
|
3659 | line: 1,
|
3660 | column: 18
|
3661 | },
|
3662 | end: {
|
3663 | line: 1,
|
3664 | column: 32
|
3665 | }
|
3666 | }
|
3667 | },
|
3668 | loc: {
|
3669 | start: {
|
3670 | line: 1,
|
3671 | column: 14
|
3672 | },
|
3673 | end: {
|
3674 | line: 1,
|
3675 | column: 32
|
3676 | }
|
3677 | }
|
3678 | }
|
3679 | }
|
3680 | ],
|
3681 | loc: {
|
3682 | start: {
|
3683 | line: 1,
|
3684 | column: 4
|
3685 | },
|
3686 | end: {
|
3687 | line: 1,
|
3688 | column: 34
|
3689 | }
|
3690 | }
|
3691 | },
|
3692 | loc: {
|
3693 | start: {
|
3694 | line: 1,
|
3695 | column: 0
|
3696 | },
|
3697 | end: {
|
3698 | line: 1,
|
3699 | column: 34
|
3700 | }
|
3701 | }
|
3702 | },
|
3703 | loc: {
|
3704 | start: {
|
3705 | line: 1,
|
3706 | column: 0
|
3707 | },
|
3708 | end: {
|
3709 | line: 1,
|
3710 | column: 34
|
3711 | }
|
3712 | }
|
3713 | }
|
3714 | ],
|
3715 | loc: {
|
3716 | start: {
|
3717 | line: 1,
|
3718 | column: 0
|
3719 | },
|
3720 | end: {
|
3721 | line: 1,
|
3722 | column: 34
|
3723 | }
|
3724 | }
|
3725 | });
|
3726 |
|
3727 | test("x = { set false(w) { m_false = w } }", {
|
3728 | type: "Program",
|
3729 | body: [
|
3730 | {
|
3731 | type: "ExpressionStatement",
|
3732 | expression: {
|
3733 | type: "AssignmentExpression",
|
3734 | operator: "=",
|
3735 | left: {
|
3736 | type: "Identifier",
|
3737 | name: "x",
|
3738 | loc: {
|
3739 | start: {
|
3740 | line: 1,
|
3741 | column: 0
|
3742 | },
|
3743 | end: {
|
3744 | line: 1,
|
3745 | column: 1
|
3746 | }
|
3747 | }
|
3748 | },
|
3749 | right: {
|
3750 | type: "ObjectExpression",
|
3751 | properties: [
|
3752 | {
|
3753 | key: {
|
3754 | type: "Identifier",
|
3755 | name: "false",
|
3756 | loc: {
|
3757 | start: {
|
3758 | line: 1,
|
3759 | column: 10
|
3760 | },
|
3761 | end: {
|
3762 | line: 1,
|
3763 | column: 15
|
3764 | }
|
3765 | }
|
3766 | },
|
3767 | kind: "set",
|
3768 | value: {
|
3769 | type: "FunctionExpression",
|
3770 | id: null,
|
3771 | params: [
|
3772 | {
|
3773 | type: "Identifier",
|
3774 | name: "w",
|
3775 | loc: {
|
3776 | start: {
|
3777 | line: 1,
|
3778 | column: 16
|
3779 | },
|
3780 | end: {
|
3781 | line: 1,
|
3782 | column: 17
|
3783 | }
|
3784 | }
|
3785 | }
|
3786 | ],
|
3787 | body: {
|
3788 | type: "BlockStatement",
|
3789 | body: [
|
3790 | {
|
3791 | type: "ExpressionStatement",
|
3792 | expression: {
|
3793 | type: "AssignmentExpression",
|
3794 | operator: "=",
|
3795 | left: {
|
3796 | type: "Identifier",
|
3797 | name: "m_false",
|
3798 | loc: {
|
3799 | start: {
|
3800 | line: 1,
|
3801 | column: 21
|
3802 | },
|
3803 | end: {
|
3804 | line: 1,
|
3805 | column: 28
|
3806 | }
|
3807 | }
|
3808 | },
|
3809 | right: {
|
3810 | type: "Identifier",
|
3811 | name: "w",
|
3812 | loc: {
|
3813 | start: {
|
3814 | line: 1,
|
3815 | column: 31
|
3816 | },
|
3817 | end: {
|
3818 | line: 1,
|
3819 | column: 32
|
3820 | }
|
3821 | }
|
3822 | },
|
3823 | loc: {
|
3824 | start: {
|
3825 | line: 1,
|
3826 | column: 21
|
3827 | },
|
3828 | end: {
|
3829 | line: 1,
|
3830 | column: 32
|
3831 | }
|
3832 | }
|
3833 | },
|
3834 | loc: {
|
3835 | start: {
|
3836 | line: 1,
|
3837 | column: 21
|
3838 | },
|
3839 | end: {
|
3840 | line: 1,
|
3841 | column: 32
|
3842 | }
|
3843 | }
|
3844 | }
|
3845 | ],
|
3846 | loc: {
|
3847 | start: {
|
3848 | line: 1,
|
3849 | column: 19
|
3850 | },
|
3851 | end: {
|
3852 | line: 1,
|
3853 | column: 34
|
3854 | }
|
3855 | }
|
3856 | },
|
3857 | loc: {
|
3858 | start: {
|
3859 | line: 1,
|
3860 | column: 15
|
3861 | },
|
3862 | end: {
|
3863 | line: 1,
|
3864 | column: 34
|
3865 | }
|
3866 | }
|
3867 | }
|
3868 | }
|
3869 | ],
|
3870 | loc: {
|
3871 | start: {
|
3872 | line: 1,
|
3873 | column: 4
|
3874 | },
|
3875 | end: {
|
3876 | line: 1,
|
3877 | column: 36
|
3878 | }
|
3879 | }
|
3880 | },
|
3881 | loc: {
|
3882 | start: {
|
3883 | line: 1,
|
3884 | column: 0
|
3885 | },
|
3886 | end: {
|
3887 | line: 1,
|
3888 | column: 36
|
3889 | }
|
3890 | }
|
3891 | },
|
3892 | loc: {
|
3893 | start: {
|
3894 | line: 1,
|
3895 | column: 0
|
3896 | },
|
3897 | end: {
|
3898 | line: 1,
|
3899 | column: 36
|
3900 | }
|
3901 | }
|
3902 | }
|
3903 | ],
|
3904 | loc: {
|
3905 | start: {
|
3906 | line: 1,
|
3907 | column: 0
|
3908 | },
|
3909 | end: {
|
3910 | line: 1,
|
3911 | column: 36
|
3912 | }
|
3913 | }
|
3914 | });
|
3915 |
|
3916 | test("x = { set null(w) { m_null = w } }", {
|
3917 | type: "Program",
|
3918 | body: [
|
3919 | {
|
3920 | type: "ExpressionStatement",
|
3921 | expression: {
|
3922 | type: "AssignmentExpression",
|
3923 | operator: "=",
|
3924 | left: {
|
3925 | type: "Identifier",
|
3926 | name: "x",
|
3927 | loc: {
|
3928 | start: {
|
3929 | line: 1,
|
3930 | column: 0
|
3931 | },
|
3932 | end: {
|
3933 | line: 1,
|
3934 | column: 1
|
3935 | }
|
3936 | }
|
3937 | },
|
3938 | right: {
|
3939 | type: "ObjectExpression",
|
3940 | properties: [
|
3941 | {
|
3942 | key: {
|
3943 | type: "Identifier",
|
3944 | name: "null",
|
3945 | loc: {
|
3946 | start: {
|
3947 | line: 1,
|
3948 | column: 10
|
3949 | },
|
3950 | end: {
|
3951 | line: 1,
|
3952 | column: 14
|
3953 | }
|
3954 | }
|
3955 | },
|
3956 | kind: "set",
|
3957 | value: {
|
3958 | type: "FunctionExpression",
|
3959 | id: null,
|
3960 | params: [
|
3961 | {
|
3962 | type: "Identifier",
|
3963 | name: "w",
|
3964 | loc: {
|
3965 | start: {
|
3966 | line: 1,
|
3967 | column: 15
|
3968 | },
|
3969 | end: {
|
3970 | line: 1,
|
3971 | column: 16
|
3972 | }
|
3973 | }
|
3974 | }
|
3975 | ],
|
3976 | body: {
|
3977 | type: "BlockStatement",
|
3978 | body: [
|
3979 | {
|
3980 | type: "ExpressionStatement",
|
3981 | expression: {
|
3982 | type: "AssignmentExpression",
|
3983 | operator: "=",
|
3984 | left: {
|
3985 | type: "Identifier",
|
3986 | name: "m_null",
|
3987 | loc: {
|
3988 | start: {
|
3989 | line: 1,
|
3990 | column: 20
|
3991 | },
|
3992 | end: {
|
3993 | line: 1,
|
3994 | column: 26
|
3995 | }
|
3996 | }
|
3997 | },
|
3998 | right: {
|
3999 | type: "Identifier",
|
4000 | name: "w",
|
4001 | loc: {
|
4002 | start: {
|
4003 | line: 1,
|
4004 | column: 29
|
4005 | },
|
4006 | end: {
|
4007 | line: 1,
|
4008 | column: 30
|
4009 | }
|
4010 | }
|
4011 | },
|
4012 | loc: {
|
4013 | start: {
|
4014 | line: 1,
|
4015 | column: 20
|
4016 | },
|
4017 | end: {
|
4018 | line: 1,
|
4019 | column: 30
|
4020 | }
|
4021 | }
|
4022 | },
|
4023 | loc: {
|
4024 | start: {
|
4025 | line: 1,
|
4026 | column: 20
|
4027 | },
|
4028 | end: {
|
4029 | line: 1,
|
4030 | column: 30
|
4031 | }
|
4032 | }
|
4033 | }
|
4034 | ],
|
4035 | loc: {
|
4036 | start: {
|
4037 | line: 1,
|
4038 | column: 18
|
4039 | },
|
4040 | end: {
|
4041 | line: 1,
|
4042 | column: 32
|
4043 | }
|
4044 | }
|
4045 | },
|
4046 | loc: {
|
4047 | start: {
|
4048 | line: 1,
|
4049 | column: 14
|
4050 | },
|
4051 | end: {
|
4052 | line: 1,
|
4053 | column: 32
|
4054 | }
|
4055 | }
|
4056 | }
|
4057 | }
|
4058 | ],
|
4059 | loc: {
|
4060 | start: {
|
4061 | line: 1,
|
4062 | column: 4
|
4063 | },
|
4064 | end: {
|
4065 | line: 1,
|
4066 | column: 34
|
4067 | }
|
4068 | }
|
4069 | },
|
4070 | loc: {
|
4071 | start: {
|
4072 | line: 1,
|
4073 | column: 0
|
4074 | },
|
4075 | end: {
|
4076 | line: 1,
|
4077 | column: 34
|
4078 | }
|
4079 | }
|
4080 | },
|
4081 | loc: {
|
4082 | start: {
|
4083 | line: 1,
|
4084 | column: 0
|
4085 | },
|
4086 | end: {
|
4087 | line: 1,
|
4088 | column: 34
|
4089 | }
|
4090 | }
|
4091 | }
|
4092 | ],
|
4093 | loc: {
|
4094 | start: {
|
4095 | line: 1,
|
4096 | column: 0
|
4097 | },
|
4098 | end: {
|
4099 | line: 1,
|
4100 | column: 34
|
4101 | }
|
4102 | }
|
4103 | });
|
4104 |
|
4105 | test("x = { set \"null\"(w) { m_null = w } }", {
|
4106 | type: "Program",
|
4107 | body: [
|
4108 | {
|
4109 | type: "ExpressionStatement",
|
4110 | expression: {
|
4111 | type: "AssignmentExpression",
|
4112 | operator: "=",
|
4113 | left: {
|
4114 | type: "Identifier",
|
4115 | name: "x",
|
4116 | loc: {
|
4117 | start: {
|
4118 | line: 1,
|
4119 | column: 0
|
4120 | },
|
4121 | end: {
|
4122 | line: 1,
|
4123 | column: 1
|
4124 | }
|
4125 | }
|
4126 | },
|
4127 | right: {
|
4128 | type: "ObjectExpression",
|
4129 | properties: [
|
4130 | {
|
4131 | key: {
|
4132 | type: "Literal",
|
4133 | value: "null",
|
4134 | loc: {
|
4135 | start: {
|
4136 | line: 1,
|
4137 | column: 10
|
4138 | },
|
4139 | end: {
|
4140 | line: 1,
|
4141 | column: 16
|
4142 | }
|
4143 | }
|
4144 | },
|
4145 | kind: "set",
|
4146 | value: {
|
4147 | type: "FunctionExpression",
|
4148 | id: null,
|
4149 | params: [
|
4150 | {
|
4151 | type: "Identifier",
|
4152 | name: "w",
|
4153 | loc: {
|
4154 | start: {
|
4155 | line: 1,
|
4156 | column: 17
|
4157 | },
|
4158 | end: {
|
4159 | line: 1,
|
4160 | column: 18
|
4161 | }
|
4162 | }
|
4163 | }
|
4164 | ],
|
4165 | body: {
|
4166 | type: "BlockStatement",
|
4167 | body: [
|
4168 | {
|
4169 | type: "ExpressionStatement",
|
4170 | expression: {
|
4171 | type: "AssignmentExpression",
|
4172 | operator: "=",
|
4173 | left: {
|
4174 | type: "Identifier",
|
4175 | name: "m_null",
|
4176 | loc: {
|
4177 | start: {
|
4178 | line: 1,
|
4179 | column: 22
|
4180 | },
|
4181 | end: {
|
4182 | line: 1,
|
4183 | column: 28
|
4184 | }
|
4185 | }
|
4186 | },
|
4187 | right: {
|
4188 | type: "Identifier",
|
4189 | name: "w",
|
4190 | loc: {
|
4191 | start: {
|
4192 | line: 1,
|
4193 | column: 31
|
4194 | },
|
4195 | end: {
|
4196 | line: 1,
|
4197 | column: 32
|
4198 | }
|
4199 | }
|
4200 | },
|
4201 | loc: {
|
4202 | start: {
|
4203 | line: 1,
|
4204 | column: 22
|
4205 | },
|
4206 | end: {
|
4207 | line: 1,
|
4208 | column: 32
|
4209 | }
|
4210 | }
|
4211 | },
|
4212 | loc: {
|
4213 | start: {
|
4214 | line: 1,
|
4215 | column: 22
|
4216 | },
|
4217 | end: {
|
4218 | line: 1,
|
4219 | column: 32
|
4220 | }
|
4221 | }
|
4222 | }
|
4223 | ],
|
4224 | loc: {
|
4225 | start: {
|
4226 | line: 1,
|
4227 | column: 20
|
4228 | },
|
4229 | end: {
|
4230 | line: 1,
|
4231 | column: 34
|
4232 | }
|
4233 | }
|
4234 | },
|
4235 | loc: {
|
4236 | start: {
|
4237 | line: 1,
|
4238 | column: 16
|
4239 | },
|
4240 | end: {
|
4241 | line: 1,
|
4242 | column: 34
|
4243 | }
|
4244 | }
|
4245 | }
|
4246 | }
|
4247 | ],
|
4248 | loc: {
|
4249 | start: {
|
4250 | line: 1,
|
4251 | column: 4
|
4252 | },
|
4253 | end: {
|
4254 | line: 1,
|
4255 | column: 36
|
4256 | }
|
4257 | }
|
4258 | },
|
4259 | loc: {
|
4260 | start: {
|
4261 | line: 1,
|
4262 | column: 0
|
4263 | },
|
4264 | end: {
|
4265 | line: 1,
|
4266 | column: 36
|
4267 | }
|
4268 | }
|
4269 | },
|
4270 | loc: {
|
4271 | start: {
|
4272 | line: 1,
|
4273 | column: 0
|
4274 | },
|
4275 | end: {
|
4276 | line: 1,
|
4277 | column: 36
|
4278 | }
|
4279 | }
|
4280 | }
|
4281 | ],
|
4282 | loc: {
|
4283 | start: {
|
4284 | line: 1,
|
4285 | column: 0
|
4286 | },
|
4287 | end: {
|
4288 | line: 1,
|
4289 | column: 36
|
4290 | }
|
4291 | }
|
4292 | });
|
4293 |
|
4294 | test("x = { set 10(w) { m_null = w } }", {
|
4295 | type: "Program",
|
4296 | body: [
|
4297 | {
|
4298 | type: "ExpressionStatement",
|
4299 | expression: {
|
4300 | type: "AssignmentExpression",
|
4301 | operator: "=",
|
4302 | left: {
|
4303 | type: "Identifier",
|
4304 | name: "x",
|
4305 | loc: {
|
4306 | start: {
|
4307 | line: 1,
|
4308 | column: 0
|
4309 | },
|
4310 | end: {
|
4311 | line: 1,
|
4312 | column: 1
|
4313 | }
|
4314 | }
|
4315 | },
|
4316 | right: {
|
4317 | type: "ObjectExpression",
|
4318 | properties: [
|
4319 | {
|
4320 | key: {
|
4321 | type: "Literal",
|
4322 | value: 10,
|
4323 | loc: {
|
4324 | start: {
|
4325 | line: 1,
|
4326 | column: 10
|
4327 | },
|
4328 | end: {
|
4329 | line: 1,
|
4330 | column: 12
|
4331 | }
|
4332 | }
|
4333 | },
|
4334 | kind: "set",
|
4335 | value: {
|
4336 | type: "FunctionExpression",
|
4337 | id: null,
|
4338 | params: [
|
4339 | {
|
4340 | type: "Identifier",
|
4341 | name: "w",
|
4342 | loc: {
|
4343 | start: {
|
4344 | line: 1,
|
4345 | column: 13
|
4346 | },
|
4347 | end: {
|
4348 | line: 1,
|
4349 | column: 14
|
4350 | }
|
4351 | }
|
4352 | }
|
4353 | ],
|
4354 | body: {
|
4355 | type: "BlockStatement",
|
4356 | body: [
|
4357 | {
|
4358 | type: "ExpressionStatement",
|
4359 | expression: {
|
4360 | type: "AssignmentExpression",
|
4361 | operator: "=",
|
4362 | left: {
|
4363 | type: "Identifier",
|
4364 | name: "m_null",
|
4365 | loc: {
|
4366 | start: {
|
4367 | line: 1,
|
4368 | column: 18
|
4369 | },
|
4370 | end: {
|
4371 | line: 1,
|
4372 | column: 24
|
4373 | }
|
4374 | }
|
4375 | },
|
4376 | right: {
|
4377 | type: "Identifier",
|
4378 | name: "w",
|
4379 | loc: {
|
4380 | start: {
|
4381 | line: 1,
|
4382 | column: 27
|
4383 | },
|
4384 | end: {
|
4385 | line: 1,
|
4386 | column: 28
|
4387 | }
|
4388 | }
|
4389 | },
|
4390 | loc: {
|
4391 | start: {
|
4392 | line: 1,
|
4393 | column: 18
|
4394 | },
|
4395 | end: {
|
4396 | line: 1,
|
4397 | column: 28
|
4398 | }
|
4399 | }
|
4400 | },
|
4401 | loc: {
|
4402 | start: {
|
4403 | line: 1,
|
4404 | column: 18
|
4405 | },
|
4406 | end: {
|
4407 | line: 1,
|
4408 | column: 28
|
4409 | }
|
4410 | }
|
4411 | }
|
4412 | ],
|
4413 | loc: {
|
4414 | start: {
|
4415 | line: 1,
|
4416 | column: 16
|
4417 | },
|
4418 | end: {
|
4419 | line: 1,
|
4420 | column: 30
|
4421 | }
|
4422 | }
|
4423 | },
|
4424 | loc: {
|
4425 | start: {
|
4426 | line: 1,
|
4427 | column: 12
|
4428 | },
|
4429 | end: {
|
4430 | line: 1,
|
4431 | column: 30
|
4432 | }
|
4433 | }
|
4434 | }
|
4435 | }
|
4436 | ],
|
4437 | loc: {
|
4438 | start: {
|
4439 | line: 1,
|
4440 | column: 4
|
4441 | },
|
4442 | end: {
|
4443 | line: 1,
|
4444 | column: 32
|
4445 | }
|
4446 | }
|
4447 | },
|
4448 | loc: {
|
4449 | start: {
|
4450 | line: 1,
|
4451 | column: 0
|
4452 | },
|
4453 | end: {
|
4454 | line: 1,
|
4455 | column: 32
|
4456 | }
|
4457 | }
|
4458 | },
|
4459 | loc: {
|
4460 | start: {
|
4461 | line: 1,
|
4462 | column: 0
|
4463 | },
|
4464 | end: {
|
4465 | line: 1,
|
4466 | column: 32
|
4467 | }
|
4468 | }
|
4469 | }
|
4470 | ],
|
4471 | loc: {
|
4472 | start: {
|
4473 | line: 1,
|
4474 | column: 0
|
4475 | },
|
4476 | end: {
|
4477 | line: 1,
|
4478 | column: 32
|
4479 | }
|
4480 | }
|
4481 | });
|
4482 |
|
4483 | test("x = { get: 42 }", {
|
4484 | type: "Program",
|
4485 | body: [
|
4486 | {
|
4487 | type: "ExpressionStatement",
|
4488 | expression: {
|
4489 | type: "AssignmentExpression",
|
4490 | operator: "=",
|
4491 | left: {
|
4492 | type: "Identifier",
|
4493 | name: "x",
|
4494 | loc: {
|
4495 | start: {
|
4496 | line: 1,
|
4497 | column: 0
|
4498 | },
|
4499 | end: {
|
4500 | line: 1,
|
4501 | column: 1
|
4502 | }
|
4503 | }
|
4504 | },
|
4505 | right: {
|
4506 | type: "ObjectExpression",
|
4507 | properties: [
|
4508 | {
|
4509 | key: {
|
4510 | type: "Identifier",
|
4511 | name: "get",
|
4512 | loc: {
|
4513 | start: {
|
4514 | line: 1,
|
4515 | column: 6
|
4516 | },
|
4517 | end: {
|
4518 | line: 1,
|
4519 | column: 9
|
4520 | }
|
4521 | }
|
4522 | },
|
4523 | value: {
|
4524 | type: "Literal",
|
4525 | value: 42,
|
4526 | loc: {
|
4527 | start: {
|
4528 | line: 1,
|
4529 | column: 11
|
4530 | },
|
4531 | end: {
|
4532 | line: 1,
|
4533 | column: 13
|
4534 | }
|
4535 | }
|
4536 | },
|
4537 | kind: "init"
|
4538 | }
|
4539 | ],
|
4540 | loc: {
|
4541 | start: {
|
4542 | line: 1,
|
4543 | column: 4
|
4544 | },
|
4545 | end: {
|
4546 | line: 1,
|
4547 | column: 15
|
4548 | }
|
4549 | }
|
4550 | },
|
4551 | loc: {
|
4552 | start: {
|
4553 | line: 1,
|
4554 | column: 0
|
4555 | },
|
4556 | end: {
|
4557 | line: 1,
|
4558 | column: 15
|
4559 | }
|
4560 | }
|
4561 | },
|
4562 | loc: {
|
4563 | start: {
|
4564 | line: 1,
|
4565 | column: 0
|
4566 | },
|
4567 | end: {
|
4568 | line: 1,
|
4569 | column: 15
|
4570 | }
|
4571 | }
|
4572 | }
|
4573 | ],
|
4574 | loc: {
|
4575 | start: {
|
4576 | line: 1,
|
4577 | column: 0
|
4578 | },
|
4579 | end: {
|
4580 | line: 1,
|
4581 | column: 15
|
4582 | }
|
4583 | }
|
4584 | });
|
4585 |
|
4586 | test("x = { set: 43 }", {
|
4587 | type: "Program",
|
4588 | body: [
|
4589 | {
|
4590 | type: "ExpressionStatement",
|
4591 | expression: {
|
4592 | type: "AssignmentExpression",
|
4593 | operator: "=",
|
4594 | left: {
|
4595 | type: "Identifier",
|
4596 | name: "x",
|
4597 | loc: {
|
4598 | start: {
|
4599 | line: 1,
|
4600 | column: 0
|
4601 | },
|
4602 | end: {
|
4603 | line: 1,
|
4604 | column: 1
|
4605 | }
|
4606 | }
|
4607 | },
|
4608 | right: {
|
4609 | type: "ObjectExpression",
|
4610 | properties: [
|
4611 | {
|
4612 | key: {
|
4613 | type: "Identifier",
|
4614 | name: "set",
|
4615 | loc: {
|
4616 | start: {
|
4617 | line: 1,
|
4618 | column: 6
|
4619 | },
|
4620 | end: {
|
4621 | line: 1,
|
4622 | column: 9
|
4623 | }
|
4624 | }
|
4625 | },
|
4626 | value: {
|
4627 | type: "Literal",
|
4628 | value: 43,
|
4629 | loc: {
|
4630 | start: {
|
4631 | line: 1,
|
4632 | column: 11
|
4633 | },
|
4634 | end: {
|
4635 | line: 1,
|
4636 | column: 13
|
4637 | }
|
4638 | }
|
4639 | },
|
4640 | kind: "init"
|
4641 | }
|
4642 | ],
|
4643 | loc: {
|
4644 | start: {
|
4645 | line: 1,
|
4646 | column: 4
|
4647 | },
|
4648 | end: {
|
4649 | line: 1,
|
4650 | column: 15
|
4651 | }
|
4652 | }
|
4653 | },
|
4654 | loc: {
|
4655 | start: {
|
4656 | line: 1,
|
4657 | column: 0
|
4658 | },
|
4659 | end: {
|
4660 | line: 1,
|
4661 | column: 15
|
4662 | }
|
4663 | }
|
4664 | },
|
4665 | loc: {
|
4666 | start: {
|
4667 | line: 1,
|
4668 | column: 0
|
4669 | },
|
4670 | end: {
|
4671 | line: 1,
|
4672 | column: 15
|
4673 | }
|
4674 | }
|
4675 | }
|
4676 | ],
|
4677 | loc: {
|
4678 | start: {
|
4679 | line: 1,
|
4680 | column: 0
|
4681 | },
|
4682 | end: {
|
4683 | line: 1,
|
4684 | column: 15
|
4685 | }
|
4686 | }
|
4687 | });
|
4688 |
|
4689 | test("/* block comment */ 42", {
|
4690 | type: "Program",
|
4691 | body: [
|
4692 | {
|
4693 | type: "ExpressionStatement",
|
4694 | expression: {
|
4695 | type: "Literal",
|
4696 | value: 42,
|
4697 | loc: {
|
4698 | start: {
|
4699 | line: 1,
|
4700 | column: 20
|
4701 | },
|
4702 | end: {
|
4703 | line: 1,
|
4704 | column: 22
|
4705 | }
|
4706 | }
|
4707 | },
|
4708 | loc: {
|
4709 | start: {
|
4710 | line: 1,
|
4711 | column: 20
|
4712 | },
|
4713 | end: {
|
4714 | line: 1,
|
4715 | column: 22
|
4716 | }
|
4717 | }
|
4718 | }
|
4719 | ],
|
4720 | loc: {
|
4721 | start: {
|
4722 | line: 1,
|
4723 | column: 20
|
4724 | },
|
4725 | end: {
|
4726 | line: 1,
|
4727 | column: 22
|
4728 | }
|
4729 | }
|
4730 | });
|
4731 |
|
4732 | test("42 /*The*/ /*Answer*/", {
|
4733 | type: "Program",
|
4734 | body: [
|
4735 | {
|
4736 | type: "ExpressionStatement",
|
4737 | expression: {
|
4738 | type: "Literal",
|
4739 | value: 42,
|
4740 | loc: {
|
4741 | start: {
|
4742 | line: 1,
|
4743 | column: 0
|
4744 | },
|
4745 | end: {
|
4746 | line: 1,
|
4747 | column: 2
|
4748 | }
|
4749 | }
|
4750 | },
|
4751 | loc: {
|
4752 | start: {
|
4753 | line: 1,
|
4754 | column: 0
|
4755 | },
|
4756 | end: {
|
4757 | line: 1,
|
4758 | column: 2
|
4759 | }
|
4760 | }
|
4761 | }
|
4762 | ],
|
4763 | loc: {
|
4764 | start: {
|
4765 | line: 1,
|
4766 | column: 0
|
4767 | },
|
4768 | end: {
|
4769 | line: 1,
|
4770 | column: 2
|
4771 | }
|
4772 | }
|
4773 | });
|
4774 |
|
4775 | test("42 /*the*/ /*answer*/", {
|
4776 | type: "Program",
|
4777 | body: [
|
4778 | {
|
4779 | type: "ExpressionStatement",
|
4780 | expression: {
|
4781 | type: "Literal",
|
4782 | value: 42,
|
4783 | loc: {
|
4784 | start: {
|
4785 | line: 1,
|
4786 | column: 0
|
4787 | },
|
4788 | end: {
|
4789 | line: 1,
|
4790 | column: 2
|
4791 | }
|
4792 | }
|
4793 | },
|
4794 | loc: {
|
4795 | start: {
|
4796 | line: 1,
|
4797 | column: 0
|
4798 | },
|
4799 | end: {
|
4800 | line: 1,
|
4801 | column: 2
|
4802 | }
|
4803 | }
|
4804 | }
|
4805 | ],
|
4806 | loc: {
|
4807 | start: {
|
4808 | line: 1,
|
4809 | column: 0
|
4810 | },
|
4811 | end: {
|
4812 | line: 1,
|
4813 | column: 2
|
4814 | }
|
4815 | }
|
4816 | });
|
4817 |
|
4818 | test("/* multiline\ncomment\nshould\nbe\nignored */ 42", {
|
4819 | type: "Program",
|
4820 | body: [
|
4821 | {
|
4822 | type: "ExpressionStatement",
|
4823 | expression: {
|
4824 | type: "Literal",
|
4825 | value: 42,
|
4826 | loc: {
|
4827 | start: {
|
4828 | line: 5,
|
4829 | column: 11
|
4830 | },
|
4831 | end: {
|
4832 | line: 5,
|
4833 | column: 13
|
4834 | }
|
4835 | }
|
4836 | },
|
4837 | loc: {
|
4838 | start: {
|
4839 | line: 5,
|
4840 | column: 11
|
4841 | },
|
4842 | end: {
|
4843 | line: 5,
|
4844 | column: 13
|
4845 | }
|
4846 | }
|
4847 | }
|
4848 | ],
|
4849 | loc: {
|
4850 | start: {
|
4851 | line: 5,
|
4852 | column: 11
|
4853 | },
|
4854 | end: {
|
4855 | line: 5,
|
4856 | column: 13
|
4857 | }
|
4858 | }
|
4859 | });
|
4860 |
|
4861 | test("/*a\r\nb*/ 42", {
|
4862 | type: "Program",
|
4863 | body: [
|
4864 | {
|
4865 | type: "ExpressionStatement",
|
4866 | expression: {
|
4867 | type: "Literal",
|
4868 | value: 42,
|
4869 | loc: {
|
4870 | start: {
|
4871 | line: 2,
|
4872 | column: 4
|
4873 | },
|
4874 | end: {
|
4875 | line: 2,
|
4876 | column: 6
|
4877 | }
|
4878 | }
|
4879 | },
|
4880 | loc: {
|
4881 | start: {
|
4882 | line: 2,
|
4883 | column: 4
|
4884 | },
|
4885 | end: {
|
4886 | line: 2,
|
4887 | column: 6
|
4888 | }
|
4889 | }
|
4890 | }
|
4891 | ],
|
4892 | loc: {
|
4893 | start: {
|
4894 | line: 2,
|
4895 | column: 4
|
4896 | },
|
4897 | end: {
|
4898 | line: 2,
|
4899 | column: 6
|
4900 | }
|
4901 | }
|
4902 | });
|
4903 |
|
4904 | test("/*a\rb*/ 42", {
|
4905 | type: "Program",
|
4906 | body: [
|
4907 | {
|
4908 | type: "ExpressionStatement",
|
4909 | expression: {
|
4910 | type: "Literal",
|
4911 | value: 42,
|
4912 | loc: {
|
4913 | start: {
|
4914 | line: 2,
|
4915 | column: 4
|
4916 | },
|
4917 | end: {
|
4918 | line: 2,
|
4919 | column: 6
|
4920 | }
|
4921 | }
|
4922 | },
|
4923 | loc: {
|
4924 | start: {
|
4925 | line: 2,
|
4926 | column: 4
|
4927 | },
|
4928 | end: {
|
4929 | line: 2,
|
4930 | column: 6
|
4931 | }
|
4932 | }
|
4933 | }
|
4934 | ],
|
4935 | loc: {
|
4936 | start: {
|
4937 | line: 2,
|
4938 | column: 4
|
4939 | },
|
4940 | end: {
|
4941 | line: 2,
|
4942 | column: 6
|
4943 | }
|
4944 | }
|
4945 | });
|
4946 |
|
4947 | test("/*a\nb*/ 42", {
|
4948 | type: "Program",
|
4949 | body: [
|
4950 | {
|
4951 | type: "ExpressionStatement",
|
4952 | expression: {
|
4953 | type: "Literal",
|
4954 | value: 42,
|
4955 | loc: {
|
4956 | start: {
|
4957 | line: 2,
|
4958 | column: 4
|
4959 | },
|
4960 | end: {
|
4961 | line: 2,
|
4962 | column: 6
|
4963 | }
|
4964 | }
|
4965 | },
|
4966 | loc: {
|
4967 | start: {
|
4968 | line: 2,
|
4969 | column: 4
|
4970 | },
|
4971 | end: {
|
4972 | line: 2,
|
4973 | column: 6
|
4974 | }
|
4975 | }
|
4976 | }
|
4977 | ],
|
4978 | loc: {
|
4979 | start: {
|
4980 | line: 2,
|
4981 | column: 4
|
4982 | },
|
4983 | end: {
|
4984 | line: 2,
|
4985 | column: 6
|
4986 | }
|
4987 | }
|
4988 | });
|
4989 |
|
4990 | test("/*a\nc*/ 42", {
|
4991 | type: "Program",
|
4992 | body: [
|
4993 | {
|
4994 | type: "ExpressionStatement",
|
4995 | expression: {
|
4996 | type: "Literal",
|
4997 | value: 42,
|
4998 | loc: {
|
4999 | start: {
|
5000 | line: 2,
|
5001 | column: 4
|
5002 | },
|
5003 | end: {
|
5004 | line: 2,
|
5005 | column: 6
|
5006 | }
|
5007 | }
|
5008 | },
|
5009 | loc: {
|
5010 | start: {
|
5011 | line: 2,
|
5012 | column: 4
|
5013 | },
|
5014 | end: {
|
5015 | line: 2,
|
5016 | column: 6
|
5017 | }
|
5018 | }
|
5019 | }
|
5020 | ],
|
5021 | loc: {
|
5022 | start: {
|
5023 | line: 2,
|
5024 | column: 4
|
5025 | },
|
5026 | end: {
|
5027 | line: 2,
|
5028 | column: 6
|
5029 | }
|
5030 | }
|
5031 | });
|
5032 |
|
5033 | test("// line comment\n42", {
|
5034 | type: "Program",
|
5035 | body: [
|
5036 | {
|
5037 | type: "ExpressionStatement",
|
5038 | expression: {
|
5039 | type: "Literal",
|
5040 | value: 42,
|
5041 | loc: {
|
5042 | start: {
|
5043 | line: 2,
|
5044 | column: 0
|
5045 | },
|
5046 | end: {
|
5047 | line: 2,
|
5048 | column: 2
|
5049 | }
|
5050 | }
|
5051 | },
|
5052 | loc: {
|
5053 | start: {
|
5054 | line: 2,
|
5055 | column: 0
|
5056 | },
|
5057 | end: {
|
5058 | line: 2,
|
5059 | column: 2
|
5060 | }
|
5061 | }
|
5062 | }
|
5063 | ],
|
5064 | loc: {
|
5065 | start: {
|
5066 | line: 2,
|
5067 | column: 0
|
5068 | },
|
5069 | end: {
|
5070 | line: 2,
|
5071 | column: 2
|
5072 | }
|
5073 | }
|
5074 | });
|
5075 |
|
5076 | test("42 // line comment", {
|
5077 | type: "Program",
|
5078 | body: [
|
5079 | {
|
5080 | type: "ExpressionStatement",
|
5081 | expression: {
|
5082 | type: "Literal",
|
5083 | value: 42,
|
5084 | loc: {
|
5085 | start: {
|
5086 | line: 1,
|
5087 | column: 0
|
5088 | },
|
5089 | end: {
|
5090 | line: 1,
|
5091 | column: 2
|
5092 | }
|
5093 | }
|
5094 | },
|
5095 | loc: {
|
5096 | start: {
|
5097 | line: 1,
|
5098 | column: 0
|
5099 | },
|
5100 | end: {
|
5101 | line: 1,
|
5102 | column: 2
|
5103 | }
|
5104 | }
|
5105 | }
|
5106 | ],
|
5107 | loc: {
|
5108 | start: {
|
5109 | line: 1,
|
5110 | column: 0
|
5111 | },
|
5112 | end: {
|
5113 | line: 1,
|
5114 | column: 2
|
5115 | }
|
5116 | }
|
5117 | });
|
5118 |
|
5119 | test("// Hello, world!\n42", {
|
5120 | type: "Program",
|
5121 | body: [
|
5122 | {
|
5123 | type: "ExpressionStatement",
|
5124 | expression: {
|
5125 | type: "Literal",
|
5126 | value: 42,
|
5127 | loc: {
|
5128 | start: {
|
5129 | line: 2,
|
5130 | column: 0
|
5131 | },
|
5132 | end: {
|
5133 | line: 2,
|
5134 | column: 2
|
5135 | }
|
5136 | }
|
5137 | },
|
5138 | loc: {
|
5139 | start: {
|
5140 | line: 2,
|
5141 | column: 0
|
5142 | },
|
5143 | end: {
|
5144 | line: 2,
|
5145 | column: 2
|
5146 | }
|
5147 | }
|
5148 | }
|
5149 | ],
|
5150 | loc: {
|
5151 | start: {
|
5152 | line: 2,
|
5153 | column: 0
|
5154 | },
|
5155 | end: {
|
5156 | line: 2,
|
5157 | column: 2
|
5158 | }
|
5159 | }
|
5160 | });
|
5161 |
|
5162 | test("// Hello, world!\n", {
|
5163 | type: "Program",
|
5164 | body: [],
|
5165 | loc: {
|
5166 | start: {
|
5167 | line: 2,
|
5168 | column: 0
|
5169 | },
|
5170 | end: {
|
5171 | line: 2,
|
5172 | column: 0
|
5173 | }
|
5174 | }
|
5175 | });
|
5176 |
|
5177 | test("// Hallo, world!\n", {
|
5178 | type: "Program",
|
5179 | body: [],
|
5180 | loc: {
|
5181 | start: {
|
5182 | line: 2,
|
5183 | column: 0
|
5184 | },
|
5185 | end: {
|
5186 | line: 2,
|
5187 | column: 0
|
5188 | }
|
5189 | }
|
5190 | });
|
5191 |
|
5192 | test("//\n42", {
|
5193 | type: "Program",
|
5194 | body: [
|
5195 | {
|
5196 | type: "ExpressionStatement",
|
5197 | expression: {
|
5198 | type: "Literal",
|
5199 | value: 42,
|
5200 | loc: {
|
5201 | start: {
|
5202 | line: 2,
|
5203 | column: 0
|
5204 | },
|
5205 | end: {
|
5206 | line: 2,
|
5207 | column: 2
|
5208 | }
|
5209 | }
|
5210 | },
|
5211 | loc: {
|
5212 | start: {
|
5213 | line: 2,
|
5214 | column: 0
|
5215 | },
|
5216 | end: {
|
5217 | line: 2,
|
5218 | column: 2
|
5219 | }
|
5220 | }
|
5221 | }
|
5222 | ],
|
5223 | loc: {
|
5224 | start: {
|
5225 | line: 2,
|
5226 | column: 0
|
5227 | },
|
5228 | end: {
|
5229 | line: 2,
|
5230 | column: 2
|
5231 | }
|
5232 | }
|
5233 | });
|
5234 |
|
5235 | test("//", {
|
5236 | type: "Program",
|
5237 | body: [],
|
5238 | loc: {
|
5239 | start: {
|
5240 | line: 1,
|
5241 | column: 2
|
5242 | },
|
5243 | end: {
|
5244 | line: 1,
|
5245 | column: 2
|
5246 | }
|
5247 | }
|
5248 | });
|
5249 |
|
5250 | test("// ", {
|
5251 | type: "Program",
|
5252 | body: [],
|
5253 | loc: {
|
5254 | start: {
|
5255 | line: 1,
|
5256 | column: 3
|
5257 | },
|
5258 | end: {
|
5259 | line: 1,
|
5260 | column: 3
|
5261 | }
|
5262 | }
|
5263 | });
|
5264 |
|
5265 | test("/**/42", {
|
5266 | type: "Program",
|
5267 | body: [
|
5268 | {
|
5269 | type: "ExpressionStatement",
|
5270 | expression: {
|
5271 | type: "Literal",
|
5272 | value: 42,
|
5273 | loc: {
|
5274 | start: {
|
5275 | line: 1,
|
5276 | column: 4
|
5277 | },
|
5278 | end: {
|
5279 | line: 1,
|
5280 | column: 6
|
5281 | }
|
5282 | }
|
5283 | },
|
5284 | loc: {
|
5285 | start: {
|
5286 | line: 1,
|
5287 | column: 4
|
5288 | },
|
5289 | end: {
|
5290 | line: 1,
|
5291 | column: 6
|
5292 | }
|
5293 | }
|
5294 | }
|
5295 | ],
|
5296 | loc: {
|
5297 | start: {
|
5298 | line: 1,
|
5299 | column: 4
|
5300 | },
|
5301 | end: {
|
5302 | line: 1,
|
5303 | column: 6
|
5304 | }
|
5305 | }
|
5306 | });
|
5307 |
|
5308 | test("// Hello, world!\n\n// Another hello\n42", {
|
5309 | type: "Program",
|
5310 | body: [
|
5311 | {
|
5312 | type: "ExpressionStatement",
|
5313 | expression: {
|
5314 | type: "Literal",
|
5315 | value: 42,
|
5316 | loc: {
|
5317 | start: {
|
5318 | line: 4,
|
5319 | column: 0
|
5320 | },
|
5321 | end: {
|
5322 | line: 4,
|
5323 | column: 2
|
5324 | }
|
5325 | }
|
5326 | },
|
5327 | loc: {
|
5328 | start: {
|
5329 | line: 4,
|
5330 | column: 0
|
5331 | },
|
5332 | end: {
|
5333 | line: 4,
|
5334 | column: 2
|
5335 | }
|
5336 | }
|
5337 | }
|
5338 | ],
|
5339 | loc: {
|
5340 | start: {
|
5341 | line: 4,
|
5342 | column: 0
|
5343 | },
|
5344 | end: {
|
5345 | line: 4,
|
5346 | column: 2
|
5347 | }
|
5348 | }
|
5349 | });
|
5350 |
|
5351 | test("if (x) { // Some comment\ndoThat(); }", {
|
5352 | type: "Program",
|
5353 | body: [
|
5354 | {
|
5355 | type: "IfStatement",
|
5356 | test: {
|
5357 | type: "Identifier",
|
5358 | name: "x",
|
5359 | loc: {
|
5360 | start: {
|
5361 | line: 1,
|
5362 | column: 4
|
5363 | },
|
5364 | end: {
|
5365 | line: 1,
|
5366 | column: 5
|
5367 | }
|
5368 | }
|
5369 | },
|
5370 | consequent: {
|
5371 | type: "BlockStatement",
|
5372 | body: [
|
5373 | {
|
5374 | type: "ExpressionStatement",
|
5375 | expression: {
|
5376 | type: "CallExpression",
|
5377 | callee: {
|
5378 | type: "Identifier",
|
5379 | name: "doThat",
|
5380 | loc: {
|
5381 | start: {
|
5382 | line: 2,
|
5383 | column: 0
|
5384 | },
|
5385 | end: {
|
5386 | line: 2,
|
5387 | column: 6
|
5388 | }
|
5389 | }
|
5390 | },
|
5391 | arguments: [],
|
5392 | loc: {
|
5393 | start: {
|
5394 | line: 2,
|
5395 | column: 0
|
5396 | },
|
5397 | end: {
|
5398 | line: 2,
|
5399 | column: 8
|
5400 | }
|
5401 | }
|
5402 | },
|
5403 | loc: {
|
5404 | start: {
|
5405 | line: 2,
|
5406 | column: 0
|
5407 | },
|
5408 | end: {
|
5409 | line: 2,
|
5410 | column: 9
|
5411 | }
|
5412 | }
|
5413 | }
|
5414 | ],
|
5415 | loc: {
|
5416 | start: {
|
5417 | line: 1,
|
5418 | column: 7
|
5419 | },
|
5420 | end: {
|
5421 | line: 2,
|
5422 | column: 11
|
5423 | }
|
5424 | }
|
5425 | },
|
5426 | alternate: null,
|
5427 | loc: {
|
5428 | start: {
|
5429 | line: 1,
|
5430 | column: 0
|
5431 | },
|
5432 | end: {
|
5433 | line: 2,
|
5434 | column: 11
|
5435 | }
|
5436 | }
|
5437 | }
|
5438 | ],
|
5439 | loc: {
|
5440 | start: {
|
5441 | line: 1,
|
5442 | column: 0
|
5443 | },
|
5444 | end: {
|
5445 | line: 2,
|
5446 | column: 11
|
5447 | }
|
5448 | }
|
5449 | });
|
5450 |
|
5451 | test("switch (answer) { case 42: /* perfect */ bingo() }", {
|
5452 | type: "Program",
|
5453 | body: [
|
5454 | {
|
5455 | type: "SwitchStatement",
|
5456 | discriminant: {
|
5457 | type: "Identifier",
|
5458 | name: "answer",
|
5459 | loc: {
|
5460 | start: {
|
5461 | line: 1,
|
5462 | column: 8
|
5463 | },
|
5464 | end: {
|
5465 | line: 1,
|
5466 | column: 14
|
5467 | }
|
5468 | }
|
5469 | },
|
5470 | cases: [
|
5471 | {
|
5472 | type: "SwitchCase",
|
5473 | consequent: [
|
5474 | {
|
5475 | type: "ExpressionStatement",
|
5476 | expression: {
|
5477 | type: "CallExpression",
|
5478 | callee: {
|
5479 | type: "Identifier",
|
5480 | name: "bingo",
|
5481 | loc: {
|
5482 | start: {
|
5483 | line: 1,
|
5484 | column: 41
|
5485 | },
|
5486 | end: {
|
5487 | line: 1,
|
5488 | column: 46
|
5489 | }
|
5490 | }
|
5491 | },
|
5492 | arguments: [],
|
5493 | loc: {
|
5494 | start: {
|
5495 | line: 1,
|
5496 | column: 41
|
5497 | },
|
5498 | end: {
|
5499 | line: 1,
|
5500 | column: 48
|
5501 | }
|
5502 | }
|
5503 | },
|
5504 | loc: {
|
5505 | start: {
|
5506 | line: 1,
|
5507 | column: 41
|
5508 | },
|
5509 | end: {
|
5510 | line: 1,
|
5511 | column: 48
|
5512 | }
|
5513 | }
|
5514 | }
|
5515 | ],
|
5516 | test: {
|
5517 | type: "Literal",
|
5518 | value: 42,
|
5519 | loc: {
|
5520 | start: {
|
5521 | line: 1,
|
5522 | column: 23
|
5523 | },
|
5524 | end: {
|
5525 | line: 1,
|
5526 | column: 25
|
5527 | }
|
5528 | }
|
5529 | },
|
5530 | loc: {
|
5531 | start: {
|
5532 | line: 1,
|
5533 | column: 18
|
5534 | },
|
5535 | end: {
|
5536 | line: 1,
|
5537 | column: 48
|
5538 | }
|
5539 | }
|
5540 | }
|
5541 | ],
|
5542 | loc: {
|
5543 | start: {
|
5544 | line: 1,
|
5545 | column: 0
|
5546 | },
|
5547 | end: {
|
5548 | line: 1,
|
5549 | column: 50
|
5550 | }
|
5551 | }
|
5552 | }
|
5553 | ],
|
5554 | loc: {
|
5555 | start: {
|
5556 | line: 1,
|
5557 | column: 0
|
5558 | },
|
5559 | end: {
|
5560 | line: 1,
|
5561 | column: 50
|
5562 | }
|
5563 | }
|
5564 | });
|
5565 |
|
5566 | test("0", {
|
5567 | type: "Program",
|
5568 | body: [
|
5569 | {
|
5570 | type: "ExpressionStatement",
|
5571 | expression: {
|
5572 | type: "Literal",
|
5573 | value: 0,
|
5574 | loc: {
|
5575 | start: {
|
5576 | line: 1,
|
5577 | column: 0
|
5578 | },
|
5579 | end: {
|
5580 | line: 1,
|
5581 | column: 1
|
5582 | }
|
5583 | }
|
5584 | },
|
5585 | loc: {
|
5586 | start: {
|
5587 | line: 1,
|
5588 | column: 0
|
5589 | },
|
5590 | end: {
|
5591 | line: 1,
|
5592 | column: 1
|
5593 | }
|
5594 | }
|
5595 | }
|
5596 | ],
|
5597 | loc: {
|
5598 | start: {
|
5599 | line: 1,
|
5600 | column: 0
|
5601 | },
|
5602 | end: {
|
5603 | line: 1,
|
5604 | column: 1
|
5605 | }
|
5606 | }
|
5607 | });
|
5608 |
|
5609 | test("3", {
|
5610 | type: "Program",
|
5611 | body: [
|
5612 | {
|
5613 | type: "ExpressionStatement",
|
5614 | expression: {
|
5615 | type: "Literal",
|
5616 | value: 3,
|
5617 | loc: {
|
5618 | start: {
|
5619 | line: 1,
|
5620 | column: 0
|
5621 | },
|
5622 | end: {
|
5623 | line: 1,
|
5624 | column: 1
|
5625 | }
|
5626 | }
|
5627 | },
|
5628 | loc: {
|
5629 | start: {
|
5630 | line: 1,
|
5631 | column: 0
|
5632 | },
|
5633 | end: {
|
5634 | line: 1,
|
5635 | column: 1
|
5636 | }
|
5637 | }
|
5638 | }
|
5639 | ],
|
5640 | loc: {
|
5641 | start: {
|
5642 | line: 1,
|
5643 | column: 0
|
5644 | },
|
5645 | end: {
|
5646 | line: 1,
|
5647 | column: 1
|
5648 | }
|
5649 | }
|
5650 | });
|
5651 |
|
5652 | test("5", {
|
5653 | type: "Program",
|
5654 | body: [
|
5655 | {
|
5656 | type: "ExpressionStatement",
|
5657 | expression: {
|
5658 | type: "Literal",
|
5659 | value: 5,
|
5660 | loc: {
|
5661 | start: {
|
5662 | line: 1,
|
5663 | column: 0
|
5664 | },
|
5665 | end: {
|
5666 | line: 1,
|
5667 | column: 1
|
5668 | }
|
5669 | }
|
5670 | },
|
5671 | loc: {
|
5672 | start: {
|
5673 | line: 1,
|
5674 | column: 0
|
5675 | },
|
5676 | end: {
|
5677 | line: 1,
|
5678 | column: 1
|
5679 | }
|
5680 | }
|
5681 | }
|
5682 | ],
|
5683 | loc: {
|
5684 | start: {
|
5685 | line: 1,
|
5686 | column: 0
|
5687 | },
|
5688 | end: {
|
5689 | line: 1,
|
5690 | column: 1
|
5691 | }
|
5692 | }
|
5693 | });
|
5694 |
|
5695 | test("42", {
|
5696 | type: "Program",
|
5697 | body: [
|
5698 | {
|
5699 | type: "ExpressionStatement",
|
5700 | expression: {
|
5701 | type: "Literal",
|
5702 | value: 42,
|
5703 | loc: {
|
5704 | start: {
|
5705 | line: 1,
|
5706 | column: 0
|
5707 | },
|
5708 | end: {
|
5709 | line: 1,
|
5710 | column: 2
|
5711 | }
|
5712 | }
|
5713 | },
|
5714 | loc: {
|
5715 | start: {
|
5716 | line: 1,
|
5717 | column: 0
|
5718 | },
|
5719 | end: {
|
5720 | line: 1,
|
5721 | column: 2
|
5722 | }
|
5723 | }
|
5724 | }
|
5725 | ],
|
5726 | loc: {
|
5727 | start: {
|
5728 | line: 1,
|
5729 | column: 0
|
5730 | },
|
5731 | end: {
|
5732 | line: 1,
|
5733 | column: 2
|
5734 | }
|
5735 | }
|
5736 | });
|
5737 |
|
5738 | test(".14", {
|
5739 | type: "Program",
|
5740 | body: [
|
5741 | {
|
5742 | type: "ExpressionStatement",
|
5743 | expression: {
|
5744 | type: "Literal",
|
5745 | value: 0.14,
|
5746 | loc: {
|
5747 | start: {
|
5748 | line: 1,
|
5749 | column: 0
|
5750 | },
|
5751 | end: {
|
5752 | line: 1,
|
5753 | column: 3
|
5754 | }
|
5755 | }
|
5756 | },
|
5757 | loc: {
|
5758 | start: {
|
5759 | line: 1,
|
5760 | column: 0
|
5761 | },
|
5762 | end: {
|
5763 | line: 1,
|
5764 | column: 3
|
5765 | }
|
5766 | }
|
5767 | }
|
5768 | ],
|
5769 | loc: {
|
5770 | start: {
|
5771 | line: 1,
|
5772 | column: 0
|
5773 | },
|
5774 | end: {
|
5775 | line: 1,
|
5776 | column: 3
|
5777 | }
|
5778 | }
|
5779 | });
|
5780 |
|
5781 | test("3.14159", {
|
5782 | type: "Program",
|
5783 | body: [
|
5784 | {
|
5785 | type: "ExpressionStatement",
|
5786 | expression: {
|
5787 | type: "Literal",
|
5788 | value: 3.14159,
|
5789 | loc: {
|
5790 | start: {
|
5791 | line: 1,
|
5792 | column: 0
|
5793 | },
|
5794 | end: {
|
5795 | line: 1,
|
5796 | column: 7
|
5797 | }
|
5798 | }
|
5799 | },
|
5800 | loc: {
|
5801 | start: {
|
5802 | line: 1,
|
5803 | column: 0
|
5804 | },
|
5805 | end: {
|
5806 | line: 1,
|
5807 | column: 7
|
5808 | }
|
5809 | }
|
5810 | }
|
5811 | ],
|
5812 | loc: {
|
5813 | start: {
|
5814 | line: 1,
|
5815 | column: 0
|
5816 | },
|
5817 | end: {
|
5818 | line: 1,
|
5819 | column: 7
|
5820 | }
|
5821 | }
|
5822 | });
|
5823 |
|
5824 | test("6.02214179e+23", {
|
5825 | type: "Program",
|
5826 | body: [
|
5827 | {
|
5828 | type: "ExpressionStatement",
|
5829 | expression: {
|
5830 | type: "Literal",
|
5831 | value: 6.02214179e+23,
|
5832 | loc: {
|
5833 | start: {
|
5834 | line: 1,
|
5835 | column: 0
|
5836 | },
|
5837 | end: {
|
5838 | line: 1,
|
5839 | column: 14
|
5840 | }
|
5841 | }
|
5842 | },
|
5843 | loc: {
|
5844 | start: {
|
5845 | line: 1,
|
5846 | column: 0
|
5847 | },
|
5848 | end: {
|
5849 | line: 1,
|
5850 | column: 14
|
5851 | }
|
5852 | }
|
5853 | }
|
5854 | ],
|
5855 | loc: {
|
5856 | start: {
|
5857 | line: 1,
|
5858 | column: 0
|
5859 | },
|
5860 | end: {
|
5861 | line: 1,
|
5862 | column: 14
|
5863 | }
|
5864 | }
|
5865 | });
|
5866 |
|
5867 | test("1.492417830e-10", {
|
5868 | type: "Program",
|
5869 | body: [
|
5870 | {
|
5871 | type: "ExpressionStatement",
|
5872 | expression: {
|
5873 | type: "Literal",
|
5874 | value: 1.49241783e-10,
|
5875 | loc: {
|
5876 | start: {
|
5877 | line: 1,
|
5878 | column: 0
|
5879 | },
|
5880 | end: {
|
5881 | line: 1,
|
5882 | column: 15
|
5883 | }
|
5884 | }
|
5885 | },
|
5886 | loc: {
|
5887 | start: {
|
5888 | line: 1,
|
5889 | column: 0
|
5890 | },
|
5891 | end: {
|
5892 | line: 1,
|
5893 | column: 15
|
5894 | }
|
5895 | }
|
5896 | }
|
5897 | ],
|
5898 | loc: {
|
5899 | start: {
|
5900 | line: 1,
|
5901 | column: 0
|
5902 | },
|
5903 | end: {
|
5904 | line: 1,
|
5905 | column: 15
|
5906 | }
|
5907 | }
|
5908 | });
|
5909 |
|
5910 | test("0x0", {
|
5911 | type: "Program",
|
5912 | body: [
|
5913 | {
|
5914 | type: "ExpressionStatement",
|
5915 | expression: {
|
5916 | type: "Literal",
|
5917 | value: 0,
|
5918 | loc: {
|
5919 | start: {
|
5920 | line: 1,
|
5921 | column: 0
|
5922 | },
|
5923 | end: {
|
5924 | line: 1,
|
5925 | column: 3
|
5926 | }
|
5927 | }
|
5928 | },
|
5929 | loc: {
|
5930 | start: {
|
5931 | line: 1,
|
5932 | column: 0
|
5933 | },
|
5934 | end: {
|
5935 | line: 1,
|
5936 | column: 3
|
5937 | }
|
5938 | }
|
5939 | }
|
5940 | ],
|
5941 | loc: {
|
5942 | start: {
|
5943 | line: 1,
|
5944 | column: 0
|
5945 | },
|
5946 | end: {
|
5947 | line: 1,
|
5948 | column: 3
|
5949 | }
|
5950 | }
|
5951 | });
|
5952 |
|
5953 | test("0e+100", {
|
5954 | type: "Program",
|
5955 | body: [
|
5956 | {
|
5957 | type: "ExpressionStatement",
|
5958 | expression: {
|
5959 | type: "Literal",
|
5960 | value: 0,
|
5961 | loc: {
|
5962 | start: {
|
5963 | line: 1,
|
5964 | column: 0
|
5965 | },
|
5966 | end: {
|
5967 | line: 1,
|
5968 | column: 6
|
5969 | }
|
5970 | }
|
5971 | },
|
5972 | loc: {
|
5973 | start: {
|
5974 | line: 1,
|
5975 | column: 0
|
5976 | },
|
5977 | end: {
|
5978 | line: 1,
|
5979 | column: 6
|
5980 | }
|
5981 | }
|
5982 | }
|
5983 | ],
|
5984 | loc: {
|
5985 | start: {
|
5986 | line: 1,
|
5987 | column: 0
|
5988 | },
|
5989 | end: {
|
5990 | line: 1,
|
5991 | column: 6
|
5992 | }
|
5993 | }
|
5994 | });
|
5995 |
|
5996 | test("0xabc", {
|
5997 | type: "Program",
|
5998 | body: [
|
5999 | {
|
6000 | type: "ExpressionStatement",
|
6001 | expression: {
|
6002 | type: "Literal",
|
6003 | value: 2748,
|
6004 | loc: {
|
6005 | start: {
|
6006 | line: 1,
|
6007 | column: 0
|
6008 | },
|
6009 | end: {
|
6010 | line: 1,
|
6011 | column: 5
|
6012 | }
|
6013 | }
|
6014 | },
|
6015 | loc: {
|
6016 | start: {
|
6017 | line: 1,
|
6018 | column: 0
|
6019 | },
|
6020 | end: {
|
6021 | line: 1,
|
6022 | column: 5
|
6023 | }
|
6024 | }
|
6025 | }
|
6026 | ],
|
6027 | loc: {
|
6028 | start: {
|
6029 | line: 1,
|
6030 | column: 0
|
6031 | },
|
6032 | end: {
|
6033 | line: 1,
|
6034 | column: 5
|
6035 | }
|
6036 | }
|
6037 | });
|
6038 |
|
6039 | test("0xdef", {
|
6040 | type: "Program",
|
6041 | body: [
|
6042 | {
|
6043 | type: "ExpressionStatement",
|
6044 | expression: {
|
6045 | type: "Literal",
|
6046 | value: 3567,
|
6047 | loc: {
|
6048 | start: {
|
6049 | line: 1,
|
6050 | column: 0
|
6051 | },
|
6052 | end: {
|
6053 | line: 1,
|
6054 | column: 5
|
6055 | }
|
6056 | }
|
6057 | },
|
6058 | loc: {
|
6059 | start: {
|
6060 | line: 1,
|
6061 | column: 0
|
6062 | },
|
6063 | end: {
|
6064 | line: 1,
|
6065 | column: 5
|
6066 | }
|
6067 | }
|
6068 | }
|
6069 | ],
|
6070 | loc: {
|
6071 | start: {
|
6072 | line: 1,
|
6073 | column: 0
|
6074 | },
|
6075 | end: {
|
6076 | line: 1,
|
6077 | column: 5
|
6078 | }
|
6079 | }
|
6080 | });
|
6081 |
|
6082 | test("0X1A", {
|
6083 | type: "Program",
|
6084 | body: [
|
6085 | {
|
6086 | type: "ExpressionStatement",
|
6087 | expression: {
|
6088 | type: "Literal",
|
6089 | value: 26,
|
6090 | loc: {
|
6091 | start: {
|
6092 | line: 1,
|
6093 | column: 0
|
6094 | },
|
6095 | end: {
|
6096 | line: 1,
|
6097 | column: 4
|
6098 | }
|
6099 | }
|
6100 | },
|
6101 | loc: {
|
6102 | start: {
|
6103 | line: 1,
|
6104 | column: 0
|
6105 | },
|
6106 | end: {
|
6107 | line: 1,
|
6108 | column: 4
|
6109 | }
|
6110 | }
|
6111 | }
|
6112 | ],
|
6113 | loc: {
|
6114 | start: {
|
6115 | line: 1,
|
6116 | column: 0
|
6117 | },
|
6118 | end: {
|
6119 | line: 1,
|
6120 | column: 4
|
6121 | }
|
6122 | }
|
6123 | });
|
6124 |
|
6125 | test("0x10", {
|
6126 | type: "Program",
|
6127 | body: [
|
6128 | {
|
6129 | type: "ExpressionStatement",
|
6130 | expression: {
|
6131 | type: "Literal",
|
6132 | value: 16,
|
6133 | loc: {
|
6134 | start: {
|
6135 | line: 1,
|
6136 | column: 0
|
6137 | },
|
6138 | end: {
|
6139 | line: 1,
|
6140 | column: 4
|
6141 | }
|
6142 | }
|
6143 | },
|
6144 | loc: {
|
6145 | start: {
|
6146 | line: 1,
|
6147 | column: 0
|
6148 | },
|
6149 | end: {
|
6150 | line: 1,
|
6151 | column: 4
|
6152 | }
|
6153 | }
|
6154 | }
|
6155 | ],
|
6156 | loc: {
|
6157 | start: {
|
6158 | line: 1,
|
6159 | column: 0
|
6160 | },
|
6161 | end: {
|
6162 | line: 1,
|
6163 | column: 4
|
6164 | }
|
6165 | }
|
6166 | });
|
6167 |
|
6168 | test("0x100", {
|
6169 | type: "Program",
|
6170 | body: [
|
6171 | {
|
6172 | type: "ExpressionStatement",
|
6173 | expression: {
|
6174 | type: "Literal",
|
6175 | value: 256,
|
6176 | loc: {
|
6177 | start: {
|
6178 | line: 1,
|
6179 | column: 0
|
6180 | },
|
6181 | end: {
|
6182 | line: 1,
|
6183 | column: 5
|
6184 | }
|
6185 | }
|
6186 | },
|
6187 | loc: {
|
6188 | start: {
|
6189 | line: 1,
|
6190 | column: 0
|
6191 | },
|
6192 | end: {
|
6193 | line: 1,
|
6194 | column: 5
|
6195 | }
|
6196 | }
|
6197 | }
|
6198 | ],
|
6199 | loc: {
|
6200 | start: {
|
6201 | line: 1,
|
6202 | column: 0
|
6203 | },
|
6204 | end: {
|
6205 | line: 1,
|
6206 | column: 5
|
6207 | }
|
6208 | }
|
6209 | });
|
6210 |
|
6211 | test("0X04", {
|
6212 | type: "Program",
|
6213 | body: [
|
6214 | {
|
6215 | type: "ExpressionStatement",
|
6216 | expression: {
|
6217 | type: "Literal",
|
6218 | value: 4,
|
6219 | loc: {
|
6220 | start: {
|
6221 | line: 1,
|
6222 | column: 0
|
6223 | },
|
6224 | end: {
|
6225 | line: 1,
|
6226 | column: 4
|
6227 | }
|
6228 | }
|
6229 | },
|
6230 | loc: {
|
6231 | start: {
|
6232 | line: 1,
|
6233 | column: 0
|
6234 | },
|
6235 | end: {
|
6236 | line: 1,
|
6237 | column: 4
|
6238 | }
|
6239 | }
|
6240 | }
|
6241 | ],
|
6242 | loc: {
|
6243 | start: {
|
6244 | line: 1,
|
6245 | column: 0
|
6246 | },
|
6247 | end: {
|
6248 | line: 1,
|
6249 | column: 4
|
6250 | }
|
6251 | }
|
6252 | });
|
6253 |
|
6254 | test("02", {
|
6255 | type: "Program",
|
6256 | body: [
|
6257 | {
|
6258 | type: "ExpressionStatement",
|
6259 | expression: {
|
6260 | type: "Literal",
|
6261 | value: 2,
|
6262 | loc: {
|
6263 | start: {
|
6264 | line: 1,
|
6265 | column: 0
|
6266 | },
|
6267 | end: {
|
6268 | line: 1,
|
6269 | column: 2
|
6270 | }
|
6271 | }
|
6272 | },
|
6273 | loc: {
|
6274 | start: {
|
6275 | line: 1,
|
6276 | column: 0
|
6277 | },
|
6278 | end: {
|
6279 | line: 1,
|
6280 | column: 2
|
6281 | }
|
6282 | }
|
6283 | }
|
6284 | ],
|
6285 | loc: {
|
6286 | start: {
|
6287 | line: 1,
|
6288 | column: 0
|
6289 | },
|
6290 | end: {
|
6291 | line: 1,
|
6292 | column: 2
|
6293 | }
|
6294 | }
|
6295 | });
|
6296 |
|
6297 | test("012", {
|
6298 | type: "Program",
|
6299 | body: [
|
6300 | {
|
6301 | type: "ExpressionStatement",
|
6302 | expression: {
|
6303 | type: "Literal",
|
6304 | value: 10,
|
6305 | loc: {
|
6306 | start: {
|
6307 | line: 1,
|
6308 | column: 0
|
6309 | },
|
6310 | end: {
|
6311 | line: 1,
|
6312 | column: 3
|
6313 | }
|
6314 | }
|
6315 | },
|
6316 | loc: {
|
6317 | start: {
|
6318 | line: 1,
|
6319 | column: 0
|
6320 | },
|
6321 | end: {
|
6322 | line: 1,
|
6323 | column: 3
|
6324 | }
|
6325 | }
|
6326 | }
|
6327 | ],
|
6328 | loc: {
|
6329 | start: {
|
6330 | line: 1,
|
6331 | column: 0
|
6332 | },
|
6333 | end: {
|
6334 | line: 1,
|
6335 | column: 3
|
6336 | }
|
6337 | }
|
6338 | });
|
6339 |
|
6340 | test("0012", {
|
6341 | type: "Program",
|
6342 | body: [
|
6343 | {
|
6344 | type: "ExpressionStatement",
|
6345 | expression: {
|
6346 | type: "Literal",
|
6347 | value: 10,
|
6348 | loc: {
|
6349 | start: {
|
6350 | line: 1,
|
6351 | column: 0
|
6352 | },
|
6353 | end: {
|
6354 | line: 1,
|
6355 | column: 4
|
6356 | }
|
6357 | }
|
6358 | },
|
6359 | loc: {
|
6360 | start: {
|
6361 | line: 1,
|
6362 | column: 0
|
6363 | },
|
6364 | end: {
|
6365 | line: 1,
|
6366 | column: 4
|
6367 | }
|
6368 | }
|
6369 | }
|
6370 | ],
|
6371 | loc: {
|
6372 | start: {
|
6373 | line: 1,
|
6374 | column: 0
|
6375 | },
|
6376 | end: {
|
6377 | line: 1,
|
6378 | column: 4
|
6379 | }
|
6380 | }
|
6381 | });
|
6382 |
|
6383 | test("\"Hello\"", {
|
6384 | type: "Program",
|
6385 | body: [
|
6386 | {
|
6387 | type: "ExpressionStatement",
|
6388 | expression: {
|
6389 | type: "Literal",
|
6390 | value: "Hello",
|
6391 | loc: {
|
6392 | start: {
|
6393 | line: 1,
|
6394 | column: 0
|
6395 | },
|
6396 | end: {
|
6397 | line: 1,
|
6398 | column: 7
|
6399 | }
|
6400 | }
|
6401 | },
|
6402 | loc: {
|
6403 | start: {
|
6404 | line: 1,
|
6405 | column: 0
|
6406 | },
|
6407 | end: {
|
6408 | line: 1,
|
6409 | column: 7
|
6410 | }
|
6411 | }
|
6412 | }
|
6413 | ],
|
6414 | loc: {
|
6415 | start: {
|
6416 | line: 1,
|
6417 | column: 0
|
6418 | },
|
6419 | end: {
|
6420 | line: 1,
|
6421 | column: 7
|
6422 | }
|
6423 | }
|
6424 | });
|
6425 |
|
6426 | test("\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", {
|
6427 | type: "Program",
|
6428 | body: [
|
6429 | {
|
6430 | type: "ExpressionStatement",
|
6431 | expression: {
|
6432 | type: "Literal",
|
6433 | value: "\n\r\t\u000b\b\f\\'\"\u0000",
|
6434 | loc: {
|
6435 | start: {
|
6436 | line: 1,
|
6437 | column: 0
|
6438 | },
|
6439 | end: {
|
6440 | line: 1,
|
6441 | column: 22
|
6442 | }
|
6443 | }
|
6444 | },
|
6445 | loc: {
|
6446 | start: {
|
6447 | line: 1,
|
6448 | column: 0
|
6449 | },
|
6450 | end: {
|
6451 | line: 1,
|
6452 | column: 22
|
6453 | }
|
6454 | }
|
6455 | }
|
6456 | ],
|
6457 | loc: {
|
6458 | start: {
|
6459 | line: 1,
|
6460 | column: 0
|
6461 | },
|
6462 | end: {
|
6463 | line: 1,
|
6464 | column: 22
|
6465 | }
|
6466 | }
|
6467 | });
|
6468 |
|
6469 | test("\"\\u0061\"", {
|
6470 | type: "Program",
|
6471 | body: [
|
6472 | {
|
6473 | type: "ExpressionStatement",
|
6474 | expression: {
|
6475 | type: "Literal",
|
6476 | value: "a",
|
6477 | loc: {
|
6478 | start: {
|
6479 | line: 1,
|
6480 | column: 0
|
6481 | },
|
6482 | end: {
|
6483 | line: 1,
|
6484 | column: 8
|
6485 | }
|
6486 | }
|
6487 | },
|
6488 | loc: {
|
6489 | start: {
|
6490 | line: 1,
|
6491 | column: 0
|
6492 | },
|
6493 | end: {
|
6494 | line: 1,
|
6495 | column: 8
|
6496 | }
|
6497 | }
|
6498 | }
|
6499 | ],
|
6500 | loc: {
|
6501 | start: {
|
6502 | line: 1,
|
6503 | column: 0
|
6504 | },
|
6505 | end: {
|
6506 | line: 1,
|
6507 | column: 8
|
6508 | }
|
6509 | }
|
6510 | });
|
6511 |
|
6512 | test("\"\\x61\"", {
|
6513 | type: "Program",
|
6514 | body: [
|
6515 | {
|
6516 | type: "ExpressionStatement",
|
6517 | expression: {
|
6518 | type: "Literal",
|
6519 | value: "a",
|
6520 | loc: {
|
6521 | start: {
|
6522 | line: 1,
|
6523 | column: 0
|
6524 | },
|
6525 | end: {
|
6526 | line: 1,
|
6527 | column: 6
|
6528 | }
|
6529 | }
|
6530 | },
|
6531 | loc: {
|
6532 | start: {
|
6533 | line: 1,
|
6534 | column: 0
|
6535 | },
|
6536 | end: {
|
6537 | line: 1,
|
6538 | column: 6
|
6539 | }
|
6540 | }
|
6541 | }
|
6542 | ],
|
6543 | loc: {
|
6544 | start: {
|
6545 | line: 1,
|
6546 | column: 0
|
6547 | },
|
6548 | end: {
|
6549 | line: 1,
|
6550 | column: 6
|
6551 | }
|
6552 | }
|
6553 | });
|
6554 |
|
6555 | test("\"Hello\\nworld\"", {
|
6556 | type: "Program",
|
6557 | body: [
|
6558 | {
|
6559 | type: "ExpressionStatement",
|
6560 | expression: {
|
6561 | type: "Literal",
|
6562 | value: "Hello\nworld",
|
6563 | loc: {
|
6564 | start: {
|
6565 | line: 1,
|
6566 | column: 0
|
6567 | },
|
6568 | end: {
|
6569 | line: 1,
|
6570 | column: 14
|
6571 | }
|
6572 | }
|
6573 | },
|
6574 | loc: {
|
6575 | start: {
|
6576 | line: 1,
|
6577 | column: 0
|
6578 | },
|
6579 | end: {
|
6580 | line: 1,
|
6581 | column: 14
|
6582 | }
|
6583 | }
|
6584 | }
|
6585 | ],
|
6586 | loc: {
|
6587 | start: {
|
6588 | line: 1,
|
6589 | column: 0
|
6590 | },
|
6591 | end: {
|
6592 | line: 1,
|
6593 | column: 14
|
6594 | }
|
6595 | }
|
6596 | });
|
6597 |
|
6598 | test("\"Hello\\\nworld\"", {
|
6599 | type: "Program",
|
6600 | body: [
|
6601 | {
|
6602 | type: "ExpressionStatement",
|
6603 | expression: {
|
6604 | type: "Literal",
|
6605 | value: "Helloworld",
|
6606 | loc: {
|
6607 | start: {
|
6608 | line: 1,
|
6609 | column: 0
|
6610 | },
|
6611 | end: {
|
6612 | line: 2,
|
6613 | column: 6
|
6614 | }
|
6615 | }
|
6616 | },
|
6617 | loc: {
|
6618 | start: {
|
6619 | line: 1,
|
6620 | column: 0
|
6621 | },
|
6622 | end: {
|
6623 | line: 2,
|
6624 | column: 6
|
6625 | }
|
6626 | }
|
6627 | }
|
6628 | ],
|
6629 | loc: {
|
6630 | start: {
|
6631 | line: 1,
|
6632 | column: 0
|
6633 | },
|
6634 | end: {
|
6635 | line: 2,
|
6636 | column: 6
|
6637 | }
|
6638 | }
|
6639 | });
|
6640 |
|
6641 | test("\"Hello\\02World\"", {
|
6642 | type: "Program",
|
6643 | body: [
|
6644 | {
|
6645 | type: "ExpressionStatement",
|
6646 | expression: {
|
6647 | type: "Literal",
|
6648 | value: "Hello\u0002World",
|
6649 | loc: {
|
6650 | start: {
|
6651 | line: 1,
|
6652 | column: 0
|
6653 | },
|
6654 | end: {
|
6655 | line: 1,
|
6656 | column: 15
|
6657 | }
|
6658 | }
|
6659 | },
|
6660 | loc: {
|
6661 | start: {
|
6662 | line: 1,
|
6663 | column: 0
|
6664 | },
|
6665 | end: {
|
6666 | line: 1,
|
6667 | column: 15
|
6668 | }
|
6669 | }
|
6670 | }
|
6671 | ],
|
6672 | loc: {
|
6673 | start: {
|
6674 | line: 1,
|
6675 | column: 0
|
6676 | },
|
6677 | end: {
|
6678 | line: 1,
|
6679 | column: 15
|
6680 | }
|
6681 | }
|
6682 | });
|
6683 |
|
6684 | test("\"Hello\\012World\"", {
|
6685 | type: "Program",
|
6686 | body: [
|
6687 | {
|
6688 | type: "ExpressionStatement",
|
6689 | expression: {
|
6690 | type: "Literal",
|
6691 | value: "Hello\nWorld",
|
6692 | loc: {
|
6693 | start: {
|
6694 | line: 1,
|
6695 | column: 0
|
6696 | },
|
6697 | end: {
|
6698 | line: 1,
|
6699 | column: 16
|
6700 | }
|
6701 | }
|
6702 | },
|
6703 | loc: {
|
6704 | start: {
|
6705 | line: 1,
|
6706 | column: 0
|
6707 | },
|
6708 | end: {
|
6709 | line: 1,
|
6710 | column: 16
|
6711 | }
|
6712 | }
|
6713 | }
|
6714 | ],
|
6715 | loc: {
|
6716 | start: {
|
6717 | line: 1,
|
6718 | column: 0
|
6719 | },
|
6720 | end: {
|
6721 | line: 1,
|
6722 | column: 16
|
6723 | }
|
6724 | }
|
6725 | });
|
6726 |
|
6727 | test("\"Hello\\122World\"", {
|
6728 | type: "Program",
|
6729 | body: [
|
6730 | {
|
6731 | type: "ExpressionStatement",
|
6732 | expression: {
|
6733 | type: "Literal",
|
6734 | value: "HelloRWorld",
|
6735 | loc: {
|
6736 | start: {
|
6737 | line: 1,
|
6738 | column: 0
|
6739 | },
|
6740 | end: {
|
6741 | line: 1,
|
6742 | column: 16
|
6743 | }
|
6744 | }
|
6745 | },
|
6746 | loc: {
|
6747 | start: {
|
6748 | line: 1,
|
6749 | column: 0
|
6750 | },
|
6751 | end: {
|
6752 | line: 1,
|
6753 | column: 16
|
6754 | }
|
6755 | }
|
6756 | }
|
6757 | ],
|
6758 | loc: {
|
6759 | start: {
|
6760 | line: 1,
|
6761 | column: 0
|
6762 | },
|
6763 | end: {
|
6764 | line: 1,
|
6765 | column: 16
|
6766 | }
|
6767 | }
|
6768 | });
|
6769 |
|
6770 | test("\"Hello\\0122World\"", {
|
6771 | type: "Program",
|
6772 | body: [
|
6773 | {
|
6774 | type: "ExpressionStatement",
|
6775 | expression: {
|
6776 | type: "Literal",
|
6777 | value: "Hello\n2World",
|
6778 | loc: {
|
6779 | start: {
|
6780 | line: 1,
|
6781 | column: 0
|
6782 | },
|
6783 | end: {
|
6784 | line: 1,
|
6785 | column: 17
|
6786 | }
|
6787 | }
|
6788 | },
|
6789 | loc: {
|
6790 | start: {
|
6791 | line: 1,
|
6792 | column: 0
|
6793 | },
|
6794 | end: {
|
6795 | line: 1,
|
6796 | column: 17
|
6797 | }
|
6798 | }
|
6799 | }
|
6800 | ],
|
6801 | loc: {
|
6802 | start: {
|
6803 | line: 1,
|
6804 | column: 0
|
6805 | },
|
6806 | end: {
|
6807 | line: 1,
|
6808 | column: 17
|
6809 | }
|
6810 | }
|
6811 | });
|
6812 |
|
6813 | test("\"Hello\\312World\"", {
|
6814 | type: "Program",
|
6815 | body: [
|
6816 | {
|
6817 | type: "ExpressionStatement",
|
6818 | expression: {
|
6819 | type: "Literal",
|
6820 | value: "HelloÊWorld",
|
6821 | loc: {
|
6822 | start: {
|
6823 | line: 1,
|
6824 | column: 0
|
6825 | },
|
6826 | end: {
|
6827 | line: 1,
|
6828 | column: 16
|
6829 | }
|
6830 | }
|
6831 | },
|
6832 | loc: {
|
6833 | start: {
|
6834 | line: 1,
|
6835 | column: 0
|
6836 | },
|
6837 | end: {
|
6838 | line: 1,
|
6839 | column: 16
|
6840 | }
|
6841 | }
|
6842 | }
|
6843 | ],
|
6844 | loc: {
|
6845 | start: {
|
6846 | line: 1,
|
6847 | column: 0
|
6848 | },
|
6849 | end: {
|
6850 | line: 1,
|
6851 | column: 16
|
6852 | }
|
6853 | }
|
6854 | });
|
6855 |
|
6856 | test("\"Hello\\412World\"", {
|
6857 | type: "Program",
|
6858 | body: [
|
6859 | {
|
6860 | type: "ExpressionStatement",
|
6861 | expression: {
|
6862 | type: "Literal",
|
6863 | value: "Hello!2World",
|
6864 | loc: {
|
6865 | start: {
|
6866 | line: 1,
|
6867 | column: 0
|
6868 | },
|
6869 | end: {
|
6870 | line: 1,
|
6871 | column: 16
|
6872 | }
|
6873 | }
|
6874 | },
|
6875 | loc: {
|
6876 | start: {
|
6877 | line: 1,
|
6878 | column: 0
|
6879 | },
|
6880 | end: {
|
6881 | line: 1,
|
6882 | column: 16
|
6883 | }
|
6884 | }
|
6885 | }
|
6886 | ],
|
6887 | loc: {
|
6888 | start: {
|
6889 | line: 1,
|
6890 | column: 0
|
6891 | },
|
6892 | end: {
|
6893 | line: 1,
|
6894 | column: 16
|
6895 | }
|
6896 | }
|
6897 | });
|
6898 |
|
6899 | test("\"Hello\\812World\"", {
|
6900 | type: "Program",
|
6901 | body: [
|
6902 | {
|
6903 | type: "ExpressionStatement",
|
6904 | expression: {
|
6905 | type: "Literal",
|
6906 | value: "Hello812World",
|
6907 | loc: {
|
6908 | start: {
|
6909 | line: 1,
|
6910 | column: 0
|
6911 | },
|
6912 | end: {
|
6913 | line: 1,
|
6914 | column: 16
|
6915 | }
|
6916 | }
|
6917 | },
|
6918 | loc: {
|
6919 | start: {
|
6920 | line: 1,
|
6921 | column: 0
|
6922 | },
|
6923 | end: {
|
6924 | line: 1,
|
6925 | column: 16
|
6926 | }
|
6927 | }
|
6928 | }
|
6929 | ],
|
6930 | loc: {
|
6931 | start: {
|
6932 | line: 1,
|
6933 | column: 0
|
6934 | },
|
6935 | end: {
|
6936 | line: 1,
|
6937 | column: 16
|
6938 | }
|
6939 | }
|
6940 | });
|
6941 |
|
6942 | test("\"Hello\\712World\"", {
|
6943 | type: "Program",
|
6944 | body: [
|
6945 | {
|
6946 | type: "ExpressionStatement",
|
6947 | expression: {
|
6948 | type: "Literal",
|
6949 | value: "Hello92World",
|
6950 | loc: {
|
6951 | start: {
|
6952 | line: 1,
|
6953 | column: 0
|
6954 | },
|
6955 | end: {
|
6956 | line: 1,
|
6957 | column: 16
|
6958 | }
|
6959 | }
|
6960 | },
|
6961 | loc: {
|
6962 | start: {
|
6963 | line: 1,
|
6964 | column: 0
|
6965 | },
|
6966 | end: {
|
6967 | line: 1,
|
6968 | column: 16
|
6969 | }
|
6970 | }
|
6971 | }
|
6972 | ],
|
6973 | loc: {
|
6974 | start: {
|
6975 | line: 1,
|
6976 | column: 0
|
6977 | },
|
6978 | end: {
|
6979 | line: 1,
|
6980 | column: 16
|
6981 | }
|
6982 | }
|
6983 | });
|
6984 |
|
6985 | test("\"Hello\\0World\"", {
|
6986 | type: "Program",
|
6987 | body: [
|
6988 | {
|
6989 | type: "ExpressionStatement",
|
6990 | expression: {
|
6991 | type: "Literal",
|
6992 | value: "Hello\u0000World",
|
6993 | loc: {
|
6994 | start: {
|
6995 | line: 1,
|
6996 | column: 0
|
6997 | },
|
6998 | end: {
|
6999 | line: 1,
|
7000 | column: 14
|
7001 | }
|
7002 | }
|
7003 | },
|
7004 | loc: {
|
7005 | start: {
|
7006 | line: 1,
|
7007 | column: 0
|
7008 | },
|
7009 | end: {
|
7010 | line: 1,
|
7011 | column: 14
|
7012 | }
|
7013 | }
|
7014 | }
|
7015 | ],
|
7016 | loc: {
|
7017 | start: {
|
7018 | line: 1,
|
7019 | column: 0
|
7020 | },
|
7021 | end: {
|
7022 | line: 1,
|
7023 | column: 14
|
7024 | }
|
7025 | }
|
7026 | });
|
7027 |
|
7028 | test("\"Hello\\\r\nworld\"", {
|
7029 | type: "Program",
|
7030 | body: [
|
7031 | {
|
7032 | type: "ExpressionStatement",
|
7033 | expression: {
|
7034 | type: "Literal",
|
7035 | value: "Helloworld",
|
7036 | loc: {
|
7037 | start: {
|
7038 | line: 1,
|
7039 | column: 0
|
7040 | },
|
7041 | end: {
|
7042 | line: 2,
|
7043 | column: 6
|
7044 | }
|
7045 | }
|
7046 | },
|
7047 | loc: {
|
7048 | start: {
|
7049 | line: 1,
|
7050 | column: 0
|
7051 | },
|
7052 | end: {
|
7053 | line: 2,
|
7054 | column: 6
|
7055 | }
|
7056 | }
|
7057 | }
|
7058 | ],
|
7059 | loc: {
|
7060 | start: {
|
7061 | line: 1,
|
7062 | column: 0
|
7063 | },
|
7064 | end: {
|
7065 | line: 2,
|
7066 | column: 6
|
7067 | }
|
7068 | }
|
7069 | });
|
7070 |
|
7071 | test("\"Hello\\1World\"", {
|
7072 | type: "Program",
|
7073 | body: [
|
7074 | {
|
7075 | type: "ExpressionStatement",
|
7076 | expression: {
|
7077 | type: "Literal",
|
7078 | value: "Hello\u0001World",
|
7079 | loc: {
|
7080 | start: {
|
7081 | line: 1,
|
7082 | column: 0
|
7083 | },
|
7084 | end: {
|
7085 | line: 1,
|
7086 | column: 14
|
7087 | }
|
7088 | }
|
7089 | },
|
7090 | loc: {
|
7091 | start: {
|
7092 | line: 1,
|
7093 | column: 0
|
7094 | },
|
7095 | end: {
|
7096 | line: 1,
|
7097 | column: 14
|
7098 | }
|
7099 | }
|
7100 | }
|
7101 | ],
|
7102 | loc: {
|
7103 | start: {
|
7104 | line: 1,
|
7105 | column: 0
|
7106 | },
|
7107 | end: {
|
7108 | line: 1,
|
7109 | column: 14
|
7110 | }
|
7111 | }
|
7112 | });
|
7113 |
|
7114 | test("var x = /[a-z]/i", {
|
7115 | type: "Program",
|
7116 | body: [
|
7117 | {
|
7118 | type: "VariableDeclaration",
|
7119 | declarations: [
|
7120 | {
|
7121 | type: "VariableDeclarator",
|
7122 | id: {
|
7123 | type: "Identifier",
|
7124 | name: "x",
|
7125 | loc: {
|
7126 | start: {
|
7127 | line: 1,
|
7128 | column: 4
|
7129 | },
|
7130 | end: {
|
7131 | line: 1,
|
7132 | column: 5
|
7133 | }
|
7134 | }
|
7135 | },
|
7136 | init: {
|
7137 | type: "Literal",
|
7138 | value: {},
|
7139 | loc: {
|
7140 | start: {
|
7141 | line: 1,
|
7142 | column: 8
|
7143 | },
|
7144 | end: {
|
7145 | line: 1,
|
7146 | column: 16
|
7147 | }
|
7148 | }
|
7149 | },
|
7150 | loc: {
|
7151 | start: {
|
7152 | line: 1,
|
7153 | column: 4
|
7154 | },
|
7155 | end: {
|
7156 | line: 1,
|
7157 | column: 16
|
7158 | }
|
7159 | }
|
7160 | }
|
7161 | ],
|
7162 | kind: "var",
|
7163 | loc: {
|
7164 | start: {
|
7165 | line: 1,
|
7166 | column: 0
|
7167 | },
|
7168 | end: {
|
7169 | line: 1,
|
7170 | column: 16
|
7171 | }
|
7172 | }
|
7173 | }
|
7174 | ],
|
7175 | loc: {
|
7176 | start: {
|
7177 | line: 1,
|
7178 | column: 0
|
7179 | },
|
7180 | end: {
|
7181 | line: 1,
|
7182 | column: 16
|
7183 | }
|
7184 | }
|
7185 | });
|
7186 |
|
7187 | test("var x = /[x-z]/i", {
|
7188 | type: "Program",
|
7189 | body: [
|
7190 | {
|
7191 | type: "VariableDeclaration",
|
7192 | declarations: [
|
7193 | {
|
7194 | type: "VariableDeclarator",
|
7195 | id: {
|
7196 | type: "Identifier",
|
7197 | name: "x",
|
7198 | loc: {
|
7199 | start: {
|
7200 | line: 1,
|
7201 | column: 4
|
7202 | },
|
7203 | end: {
|
7204 | line: 1,
|
7205 | column: 5
|
7206 | }
|
7207 | }
|
7208 | },
|
7209 | init: {
|
7210 | type: "Literal",
|
7211 | value: {},
|
7212 | loc: {
|
7213 | start: {
|
7214 | line: 1,
|
7215 | column: 8
|
7216 | },
|
7217 | end: {
|
7218 | line: 1,
|
7219 | column: 16
|
7220 | }
|
7221 | }
|
7222 | },
|
7223 | loc: {
|
7224 | start: {
|
7225 | line: 1,
|
7226 | column: 4
|
7227 | },
|
7228 | end: {
|
7229 | line: 1,
|
7230 | column: 16
|
7231 | }
|
7232 | }
|
7233 | }
|
7234 | ],
|
7235 | kind: "var",
|
7236 | loc: {
|
7237 | start: {
|
7238 | line: 1,
|
7239 | column: 0
|
7240 | },
|
7241 | end: {
|
7242 | line: 1,
|
7243 | column: 16
|
7244 | }
|
7245 | }
|
7246 | }
|
7247 | ],
|
7248 | loc: {
|
7249 | start: {
|
7250 | line: 1,
|
7251 | column: 0
|
7252 | },
|
7253 | end: {
|
7254 | line: 1,
|
7255 | column: 16
|
7256 | }
|
7257 | }
|
7258 | });
|
7259 |
|
7260 | test("var x = /[a-c]/i", {
|
7261 | type: "Program",
|
7262 | body: [
|
7263 | {
|
7264 | type: "VariableDeclaration",
|
7265 | declarations: [
|
7266 | {
|
7267 | type: "VariableDeclarator",
|
7268 | id: {
|
7269 | type: "Identifier",
|
7270 | name: "x",
|
7271 | loc: {
|
7272 | start: {
|
7273 | line: 1,
|
7274 | column: 4
|
7275 | },
|
7276 | end: {
|
7277 | line: 1,
|
7278 | column: 5
|
7279 | }
|
7280 | }
|
7281 | },
|
7282 | init: {
|
7283 | type: "Literal",
|
7284 | value: {},
|
7285 | loc: {
|
7286 | start: {
|
7287 | line: 1,
|
7288 | column: 8
|
7289 | },
|
7290 | end: {
|
7291 | line: 1,
|
7292 | column: 16
|
7293 | }
|
7294 | }
|
7295 | },
|
7296 | loc: {
|
7297 | start: {
|
7298 | line: 1,
|
7299 | column: 4
|
7300 | },
|
7301 | end: {
|
7302 | line: 1,
|
7303 | column: 16
|
7304 | }
|
7305 | }
|
7306 | }
|
7307 | ],
|
7308 | kind: "var",
|
7309 | loc: {
|
7310 | start: {
|
7311 | line: 1,
|
7312 | column: 0
|
7313 | },
|
7314 | end: {
|
7315 | line: 1,
|
7316 | column: 16
|
7317 | }
|
7318 | }
|
7319 | }
|
7320 | ],
|
7321 | loc: {
|
7322 | start: {
|
7323 | line: 1,
|
7324 | column: 0
|
7325 | },
|
7326 | end: {
|
7327 | line: 1,
|
7328 | column: 16
|
7329 | }
|
7330 | }
|
7331 | });
|
7332 |
|
7333 | test("var x = /[P QR]/i", {
|
7334 | type: "Program",
|
7335 | body: [
|
7336 | {
|
7337 | type: "VariableDeclaration",
|
7338 | declarations: [
|
7339 | {
|
7340 | type: "VariableDeclarator",
|
7341 | id: {
|
7342 | type: "Identifier",
|
7343 | name: "x",
|
7344 | loc: {
|
7345 | start: {
|
7346 | line: 1,
|
7347 | column: 4
|
7348 | },
|
7349 | end: {
|
7350 | line: 1,
|
7351 | column: 5
|
7352 | }
|
7353 | }
|
7354 | },
|
7355 | init: {
|
7356 | type: "Literal",
|
7357 | value: {},
|
7358 | loc: {
|
7359 | start: {
|
7360 | line: 1,
|
7361 | column: 8
|
7362 | },
|
7363 | end: {
|
7364 | line: 1,
|
7365 | column: 17
|
7366 | }
|
7367 | }
|
7368 | },
|
7369 | loc: {
|
7370 | start: {
|
7371 | line: 1,
|
7372 | column: 4
|
7373 | },
|
7374 | end: {
|
7375 | line: 1,
|
7376 | column: 17
|
7377 | }
|
7378 | }
|
7379 | }
|
7380 | ],
|
7381 | kind: "var",
|
7382 | loc: {
|
7383 | start: {
|
7384 | line: 1,
|
7385 | column: 0
|
7386 | },
|
7387 | end: {
|
7388 | line: 1,
|
7389 | column: 17
|
7390 | }
|
7391 | }
|
7392 | }
|
7393 | ],
|
7394 | loc: {
|
7395 | start: {
|
7396 | line: 1,
|
7397 | column: 0
|
7398 | },
|
7399 | end: {
|
7400 | line: 1,
|
7401 | column: 17
|
7402 | }
|
7403 | }
|
7404 | });
|
7405 |
|
7406 | test("var x = /foo\\/bar/", {
|
7407 | type: "Program",
|
7408 | body: [
|
7409 | {
|
7410 | type: "VariableDeclaration",
|
7411 | declarations: [
|
7412 | {
|
7413 | type: "VariableDeclarator",
|
7414 | id: {
|
7415 | type: "Identifier",
|
7416 | name: "x",
|
7417 | loc: {
|
7418 | start: {
|
7419 | line: 1,
|
7420 | column: 4
|
7421 | },
|
7422 | end: {
|
7423 | line: 1,
|
7424 | column: 5
|
7425 | }
|
7426 | }
|
7427 | },
|
7428 | init: {
|
7429 | type: "Literal",
|
7430 | value: {},
|
7431 | loc: {
|
7432 | start: {
|
7433 | line: 1,
|
7434 | column: 8
|
7435 | },
|
7436 | end: {
|
7437 | line: 1,
|
7438 | column: 18
|
7439 | }
|
7440 | }
|
7441 | },
|
7442 | loc: {
|
7443 | start: {
|
7444 | line: 1,
|
7445 | column: 4
|
7446 | },
|
7447 | end: {
|
7448 | line: 1,
|
7449 | column: 18
|
7450 | }
|
7451 | }
|
7452 | }
|
7453 | ],
|
7454 | kind: "var",
|
7455 | loc: {
|
7456 | start: {
|
7457 | line: 1,
|
7458 | column: 0
|
7459 | },
|
7460 | end: {
|
7461 | line: 1,
|
7462 | column: 18
|
7463 | }
|
7464 | }
|
7465 | }
|
7466 | ],
|
7467 | loc: {
|
7468 | start: {
|
7469 | line: 1,
|
7470 | column: 0
|
7471 | },
|
7472 | end: {
|
7473 | line: 1,
|
7474 | column: 18
|
7475 | }
|
7476 | }
|
7477 | });
|
7478 |
|
7479 | test("var x = /=([^=\\s])+/g", {
|
7480 | type: "Program",
|
7481 | body: [
|
7482 | {
|
7483 | type: "VariableDeclaration",
|
7484 | declarations: [
|
7485 | {
|
7486 | type: "VariableDeclarator",
|
7487 | id: {
|
7488 | type: "Identifier",
|
7489 | name: "x",
|
7490 | loc: {
|
7491 | start: {
|
7492 | line: 1,
|
7493 | column: 4
|
7494 | },
|
7495 | end: {
|
7496 | line: 1,
|
7497 | column: 5
|
7498 | }
|
7499 | }
|
7500 | },
|
7501 | init: {
|
7502 | type: "Literal",
|
7503 | value: {},
|
7504 | loc: {
|
7505 | start: {
|
7506 | line: 1,
|
7507 | column: 8
|
7508 | },
|
7509 | end: {
|
7510 | line: 1,
|
7511 | column: 21
|
7512 | }
|
7513 | }
|
7514 | },
|
7515 | loc: {
|
7516 | start: {
|
7517 | line: 1,
|
7518 | column: 4
|
7519 | },
|
7520 | end: {
|
7521 | line: 1,
|
7522 | column: 21
|
7523 | }
|
7524 | }
|
7525 | }
|
7526 | ],
|
7527 | kind: "var",
|
7528 | loc: {
|
7529 | start: {
|
7530 | line: 1,
|
7531 | column: 0
|
7532 | },
|
7533 | end: {
|
7534 | line: 1,
|
7535 | column: 21
|
7536 | }
|
7537 | }
|
7538 | }
|
7539 | ],
|
7540 | loc: {
|
7541 | start: {
|
7542 | line: 1,
|
7543 | column: 0
|
7544 | },
|
7545 | end: {
|
7546 | line: 1,
|
7547 | column: 21
|
7548 | }
|
7549 | }
|
7550 | });
|
7551 |
|
7552 | test("var x = /[P QR]/\\u0067", {
|
7553 | type: "Program",
|
7554 | body: [
|
7555 | {
|
7556 | type: "VariableDeclaration",
|
7557 | declarations: [
|
7558 | {
|
7559 | type: "VariableDeclarator",
|
7560 | id: {
|
7561 | type: "Identifier",
|
7562 | name: "x",
|
7563 | loc: {
|
7564 | start: {
|
7565 | line: 1,
|
7566 | column: 4
|
7567 | },
|
7568 | end: {
|
7569 | line: 1,
|
7570 | column: 5
|
7571 | }
|
7572 | }
|
7573 | },
|
7574 | init: {
|
7575 | type: "Literal",
|
7576 | value: {},
|
7577 | loc: {
|
7578 | start: {
|
7579 | line: 1,
|
7580 | column: 8
|
7581 | },
|
7582 | end: {
|
7583 | line: 1,
|
7584 | column: 22
|
7585 | }
|
7586 | }
|
7587 | },
|
7588 | loc: {
|
7589 | start: {
|
7590 | line: 1,
|
7591 | column: 4
|
7592 | },
|
7593 | end: {
|
7594 | line: 1,
|
7595 | column: 22
|
7596 | }
|
7597 | }
|
7598 | }
|
7599 | ],
|
7600 | kind: "var",
|
7601 | loc: {
|
7602 | start: {
|
7603 | line: 1,
|
7604 | column: 0
|
7605 | },
|
7606 | end: {
|
7607 | line: 1,
|
7608 | column: 22
|
7609 | }
|
7610 | }
|
7611 | }
|
7612 | ],
|
7613 | loc: {
|
7614 | start: {
|
7615 | line: 1,
|
7616 | column: 0
|
7617 | },
|
7618 | end: {
|
7619 | line: 1,
|
7620 | column: 22
|
7621 | }
|
7622 | }
|
7623 | });
|
7624 |
|
7625 | test("new Button", {
|
7626 | type: "Program",
|
7627 | body: [
|
7628 | {
|
7629 | type: "ExpressionStatement",
|
7630 | expression: {
|
7631 | type: "NewExpression",
|
7632 | callee: {
|
7633 | type: "Identifier",
|
7634 | name: "Button",
|
7635 | loc: {
|
7636 | start: {
|
7637 | line: 1,
|
7638 | column: 4
|
7639 | },
|
7640 | end: {
|
7641 | line: 1,
|
7642 | column: 10
|
7643 | }
|
7644 | }
|
7645 | },
|
7646 | arguments: [],
|
7647 | loc: {
|
7648 | start: {
|
7649 | line: 1,
|
7650 | column: 0
|
7651 | },
|
7652 | end: {
|
7653 | line: 1,
|
7654 | column: 10
|
7655 | }
|
7656 | }
|
7657 | },
|
7658 | loc: {
|
7659 | start: {
|
7660 | line: 1,
|
7661 | column: 0
|
7662 | },
|
7663 | end: {
|
7664 | line: 1,
|
7665 | column: 10
|
7666 | }
|
7667 | }
|
7668 | }
|
7669 | ],
|
7670 | loc: {
|
7671 | start: {
|
7672 | line: 1,
|
7673 | column: 0
|
7674 | },
|
7675 | end: {
|
7676 | line: 1,
|
7677 | column: 10
|
7678 | }
|
7679 | }
|
7680 | });
|
7681 |
|
7682 | test("new Button()", {
|
7683 | type: "Program",
|
7684 | body: [
|
7685 | {
|
7686 | type: "ExpressionStatement",
|
7687 | expression: {
|
7688 | type: "NewExpression",
|
7689 | callee: {
|
7690 | type: "Identifier",
|
7691 | name: "Button",
|
7692 | loc: {
|
7693 | start: {
|
7694 | line: 1,
|
7695 | column: 4
|
7696 | },
|
7697 | end: {
|
7698 | line: 1,
|
7699 | column: 10
|
7700 | }
|
7701 | }
|
7702 | },
|
7703 | arguments: [],
|
7704 | loc: {
|
7705 | start: {
|
7706 | line: 1,
|
7707 | column: 0
|
7708 | },
|
7709 | end: {
|
7710 | line: 1,
|
7711 | column: 12
|
7712 | }
|
7713 | }
|
7714 | },
|
7715 | loc: {
|
7716 | start: {
|
7717 | line: 1,
|
7718 | column: 0
|
7719 | },
|
7720 | end: {
|
7721 | line: 1,
|
7722 | column: 12
|
7723 | }
|
7724 | }
|
7725 | }
|
7726 | ],
|
7727 | loc: {
|
7728 | start: {
|
7729 | line: 1,
|
7730 | column: 0
|
7731 | },
|
7732 | end: {
|
7733 | line: 1,
|
7734 | column: 12
|
7735 | }
|
7736 | }
|
7737 | });
|
7738 |
|
7739 | test("new new foo", {
|
7740 | type: "Program",
|
7741 | body: [
|
7742 | {
|
7743 | type: "ExpressionStatement",
|
7744 | expression: {
|
7745 | type: "NewExpression",
|
7746 | callee: {
|
7747 | type: "NewExpression",
|
7748 | callee: {
|
7749 | type: "Identifier",
|
7750 | name: "foo",
|
7751 | loc: {
|
7752 | start: {
|
7753 | line: 1,
|
7754 | column: 8
|
7755 | },
|
7756 | end: {
|
7757 | line: 1,
|
7758 | column: 11
|
7759 | }
|
7760 | }
|
7761 | },
|
7762 | arguments: [],
|
7763 | loc: {
|
7764 | start: {
|
7765 | line: 1,
|
7766 | column: 4
|
7767 | },
|
7768 | end: {
|
7769 | line: 1,
|
7770 | column: 11
|
7771 | }
|
7772 | }
|
7773 | },
|
7774 | arguments: [],
|
7775 | loc: {
|
7776 | start: {
|
7777 | line: 1,
|
7778 | column: 0
|
7779 | },
|
7780 | end: {
|
7781 | line: 1,
|
7782 | column: 11
|
7783 | }
|
7784 | }
|
7785 | },
|
7786 | loc: {
|
7787 | start: {
|
7788 | line: 1,
|
7789 | column: 0
|
7790 | },
|
7791 | end: {
|
7792 | line: 1,
|
7793 | column: 11
|
7794 | }
|
7795 | }
|
7796 | }
|
7797 | ],
|
7798 | loc: {
|
7799 | start: {
|
7800 | line: 1,
|
7801 | column: 0
|
7802 | },
|
7803 | end: {
|
7804 | line: 1,
|
7805 | column: 11
|
7806 | }
|
7807 | }
|
7808 | });
|
7809 |
|
7810 | test("new new foo()", {
|
7811 | type: "Program",
|
7812 | body: [
|
7813 | {
|
7814 | type: "ExpressionStatement",
|
7815 | expression: {
|
7816 | type: "NewExpression",
|
7817 | callee: {
|
7818 | type: "NewExpression",
|
7819 | callee: {
|
7820 | type: "Identifier",
|
7821 | name: "foo",
|
7822 | loc: {
|
7823 | start: {
|
7824 | line: 1,
|
7825 | column: 8
|
7826 | },
|
7827 | end: {
|
7828 | line: 1,
|
7829 | column: 11
|
7830 | }
|
7831 | }
|
7832 | },
|
7833 | arguments: [],
|
7834 | loc: {
|
7835 | start: {
|
7836 | line: 1,
|
7837 | column: 4
|
7838 | },
|
7839 | end: {
|
7840 | line: 1,
|
7841 | column: 13
|
7842 | }
|
7843 | }
|
7844 | },
|
7845 | arguments: [],
|
7846 | loc: {
|
7847 | start: {
|
7848 | line: 1,
|
7849 | column: 0
|
7850 | },
|
7851 | end: {
|
7852 | line: 1,
|
7853 | column: 13
|
7854 | }
|
7855 | }
|
7856 | },
|
7857 | loc: {
|
7858 | start: {
|
7859 | line: 1,
|
7860 | column: 0
|
7861 | },
|
7862 | end: {
|
7863 | line: 1,
|
7864 | column: 13
|
7865 | }
|
7866 | }
|
7867 | }
|
7868 | ],
|
7869 | loc: {
|
7870 | start: {
|
7871 | line: 1,
|
7872 | column: 0
|
7873 | },
|
7874 | end: {
|
7875 | line: 1,
|
7876 | column: 13
|
7877 | }
|
7878 | }
|
7879 | });
|
7880 |
|
7881 | test("new foo().bar()", {
|
7882 | type: "Program",
|
7883 | body: [
|
7884 | {
|
7885 | type: "ExpressionStatement",
|
7886 | expression: {
|
7887 | type: "CallExpression",
|
7888 | callee: {
|
7889 | type: "MemberExpression",
|
7890 | object: {
|
7891 | type: "NewExpression",
|
7892 | callee: {
|
7893 | type: "Identifier",
|
7894 | name: "foo",
|
7895 | loc: {
|
7896 | start: {
|
7897 | line: 1,
|
7898 | column: 4
|
7899 | },
|
7900 | end: {
|
7901 | line: 1,
|
7902 | column: 7
|
7903 | }
|
7904 | }
|
7905 | },
|
7906 | arguments: [],
|
7907 | loc: {
|
7908 | start: {
|
7909 | line: 1,
|
7910 | column: 0
|
7911 | },
|
7912 | end: {
|
7913 | line: 1,
|
7914 | column: 9
|
7915 | }
|
7916 | }
|
7917 | },
|
7918 | property: {
|
7919 | type: "Identifier",
|
7920 | name: "bar",
|
7921 | loc: {
|
7922 | start: {
|
7923 | line: 1,
|
7924 | column: 10
|
7925 | },
|
7926 | end: {
|
7927 | line: 1,
|
7928 | column: 13
|
7929 | }
|
7930 | }
|
7931 | },
|
7932 | computed: false,
|
7933 | loc: {
|
7934 | start: {
|
7935 | line: 1,
|
7936 | column: 0
|
7937 | },
|
7938 | end: {
|
7939 | line: 1,
|
7940 | column: 13
|
7941 | }
|
7942 | }
|
7943 | },
|
7944 | arguments: [],
|
7945 | loc: {
|
7946 | start: {
|
7947 | line: 1,
|
7948 | column: 0
|
7949 | },
|
7950 | end: {
|
7951 | line: 1,
|
7952 | column: 15
|
7953 | }
|
7954 | }
|
7955 | },
|
7956 | loc: {
|
7957 | start: {
|
7958 | line: 1,
|
7959 | column: 0
|
7960 | },
|
7961 | end: {
|
7962 | line: 1,
|
7963 | column: 15
|
7964 | }
|
7965 | }
|
7966 | }
|
7967 | ],
|
7968 | loc: {
|
7969 | start: {
|
7970 | line: 1,
|
7971 | column: 0
|
7972 | },
|
7973 | end: {
|
7974 | line: 1,
|
7975 | column: 15
|
7976 | }
|
7977 | }
|
7978 | });
|
7979 |
|
7980 | test("new foo[bar]", {
|
7981 | type: "Program",
|
7982 | body: [
|
7983 | {
|
7984 | type: "ExpressionStatement",
|
7985 | expression: {
|
7986 | type: "NewExpression",
|
7987 | callee: {
|
7988 | type: "MemberExpression",
|
7989 | object: {
|
7990 | type: "Identifier",
|
7991 | name: "foo",
|
7992 | loc: {
|
7993 | start: {
|
7994 | line: 1,
|
7995 | column: 4
|
7996 | },
|
7997 | end: {
|
7998 | line: 1,
|
7999 | column: 7
|
8000 | }
|
8001 | }
|
8002 | },
|
8003 | property: {
|
8004 | type: "Identifier",
|
8005 | name: "bar",
|
8006 | loc: {
|
8007 | start: {
|
8008 | line: 1,
|
8009 | column: 8
|
8010 | },
|
8011 | end: {
|
8012 | line: 1,
|
8013 | column: 11
|
8014 | }
|
8015 | }
|
8016 | },
|
8017 | computed: true,
|
8018 | loc: {
|
8019 | start: {
|
8020 | line: 1,
|
8021 | column: 4
|
8022 | },
|
8023 | end: {
|
8024 | line: 1,
|
8025 | column: 12
|
8026 | }
|
8027 | }
|
8028 | },
|
8029 | arguments: [],
|
8030 | loc: {
|
8031 | start: {
|
8032 | line: 1,
|
8033 | column: 0
|
8034 | },
|
8035 | end: {
|
8036 | line: 1,
|
8037 | column: 12
|
8038 | }
|
8039 | }
|
8040 | },
|
8041 | loc: {
|
8042 | start: {
|
8043 | line: 1,
|
8044 | column: 0
|
8045 | },
|
8046 | end: {
|
8047 | line: 1,
|
8048 | column: 12
|
8049 | }
|
8050 | }
|
8051 | }
|
8052 | ],
|
8053 | loc: {
|
8054 | start: {
|
8055 | line: 1,
|
8056 | column: 0
|
8057 | },
|
8058 | end: {
|
8059 | line: 1,
|
8060 | column: 12
|
8061 | }
|
8062 | }
|
8063 | });
|
8064 |
|
8065 | test("new foo.bar()", {
|
8066 | type: "Program",
|
8067 | body: [
|
8068 | {
|
8069 | type: "ExpressionStatement",
|
8070 | expression: {
|
8071 | type: "NewExpression",
|
8072 | callee: {
|
8073 | type: "MemberExpression",
|
8074 | object: {
|
8075 | type: "Identifier",
|
8076 | name: "foo",
|
8077 | loc: {
|
8078 | start: {
|
8079 | line: 1,
|
8080 | column: 4
|
8081 | },
|
8082 | end: {
|
8083 | line: 1,
|
8084 | column: 7
|
8085 | }
|
8086 | }
|
8087 | },
|
8088 | property: {
|
8089 | type: "Identifier",
|
8090 | name: "bar",
|
8091 | loc: {
|
8092 | start: {
|
8093 | line: 1,
|
8094 | column: 8
|
8095 | },
|
8096 | end: {
|
8097 | line: 1,
|
8098 | column: 11
|
8099 | }
|
8100 | }
|
8101 | },
|
8102 | computed: false,
|
8103 | loc: {
|
8104 | start: {
|
8105 | line: 1,
|
8106 | column: 4
|
8107 | },
|
8108 | end: {
|
8109 | line: 1,
|
8110 | column: 11
|
8111 | }
|
8112 | }
|
8113 | },
|
8114 | arguments: [],
|
8115 | loc: {
|
8116 | start: {
|
8117 | line: 1,
|
8118 | column: 0
|
8119 | },
|
8120 | end: {
|
8121 | line: 1,
|
8122 | column: 13
|
8123 | }
|
8124 | }
|
8125 | },
|
8126 | loc: {
|
8127 | start: {
|
8128 | line: 1,
|
8129 | column: 0
|
8130 | },
|
8131 | end: {
|
8132 | line: 1,
|
8133 | column: 13
|
8134 | }
|
8135 | }
|
8136 | }
|
8137 | ],
|
8138 | loc: {
|
8139 | start: {
|
8140 | line: 1,
|
8141 | column: 0
|
8142 | },
|
8143 | end: {
|
8144 | line: 1,
|
8145 | column: 13
|
8146 | }
|
8147 | }
|
8148 | });
|
8149 |
|
8150 | test("( new foo).bar()", {
|
8151 | type: "Program",
|
8152 | body: [
|
8153 | {
|
8154 | type: "ExpressionStatement",
|
8155 | expression: {
|
8156 | type: "CallExpression",
|
8157 | callee: {
|
8158 | type: "MemberExpression",
|
8159 | object: {
|
8160 | type: "NewExpression",
|
8161 | callee: {
|
8162 | type: "Identifier",
|
8163 | name: "foo",
|
8164 | loc: {
|
8165 | start: {
|
8166 | line: 1,
|
8167 | column: 6
|
8168 | },
|
8169 | end: {
|
8170 | line: 1,
|
8171 | column: 9
|
8172 | }
|
8173 | }
|
8174 | },
|
8175 | arguments: [],
|
8176 | loc: {
|
8177 | start: {
|
8178 | line: 1,
|
8179 | column: 0
|
8180 | },
|
8181 | end: {
|
8182 | line: 1,
|
8183 | column: 10
|
8184 | }
|
8185 | }
|
8186 | },
|
8187 | property: {
|
8188 | type: "Identifier",
|
8189 | name: "bar",
|
8190 | loc: {
|
8191 | start: {
|
8192 | line: 1,
|
8193 | column: 11
|
8194 | },
|
8195 | end: {
|
8196 | line: 1,
|
8197 | column: 14
|
8198 | }
|
8199 | }
|
8200 | },
|
8201 | computed: false,
|
8202 | loc: {
|
8203 | start: {
|
8204 | line: 1,
|
8205 | column: 0
|
8206 | },
|
8207 | end: {
|
8208 | line: 1,
|
8209 | column: 14
|
8210 | }
|
8211 | }
|
8212 | },
|
8213 | arguments: [],
|
8214 | loc: {
|
8215 | start: {
|
8216 | line: 1,
|
8217 | column: 0
|
8218 | },
|
8219 | end: {
|
8220 | line: 1,
|
8221 | column: 16
|
8222 | }
|
8223 | }
|
8224 | },
|
8225 | loc: {
|
8226 | start: {
|
8227 | line: 1,
|
8228 | column: 0
|
8229 | },
|
8230 | end: {
|
8231 | line: 1,
|
8232 | column: 16
|
8233 | }
|
8234 | }
|
8235 | }
|
8236 | ],
|
8237 | loc: {
|
8238 | start: {
|
8239 | line: 1,
|
8240 | column: 0
|
8241 | },
|
8242 | end: {
|
8243 | line: 1,
|
8244 | column: 16
|
8245 | }
|
8246 | }
|
8247 | });
|
8248 |
|
8249 | test("foo(bar, baz)", {
|
8250 | type: "Program",
|
8251 | body: [
|
8252 | {
|
8253 | type: "ExpressionStatement",
|
8254 | expression: {
|
8255 | type: "CallExpression",
|
8256 | callee: {
|
8257 | type: "Identifier",
|
8258 | name: "foo",
|
8259 | loc: {
|
8260 | start: {
|
8261 | line: 1,
|
8262 | column: 0
|
8263 | },
|
8264 | end: {
|
8265 | line: 1,
|
8266 | column: 3
|
8267 | }
|
8268 | }
|
8269 | },
|
8270 | arguments: [
|
8271 | {
|
8272 | type: "Identifier",
|
8273 | name: "bar",
|
8274 | loc: {
|
8275 | start: {
|
8276 | line: 1,
|
8277 | column: 4
|
8278 | },
|
8279 | end: {
|
8280 | line: 1,
|
8281 | column: 7
|
8282 | }
|
8283 | }
|
8284 | },
|
8285 | {
|
8286 | type: "Identifier",
|
8287 | name: "baz",
|
8288 | loc: {
|
8289 | start: {
|
8290 | line: 1,
|
8291 | column: 9
|
8292 | },
|
8293 | end: {
|
8294 | line: 1,
|
8295 | column: 12
|
8296 | }
|
8297 | }
|
8298 | }
|
8299 | ],
|
8300 | loc: {
|
8301 | start: {
|
8302 | line: 1,
|
8303 | column: 0
|
8304 | },
|
8305 | end: {
|
8306 | line: 1,
|
8307 | column: 13
|
8308 | }
|
8309 | }
|
8310 | },
|
8311 | loc: {
|
8312 | start: {
|
8313 | line: 1,
|
8314 | column: 0
|
8315 | },
|
8316 | end: {
|
8317 | line: 1,
|
8318 | column: 13
|
8319 | }
|
8320 | }
|
8321 | }
|
8322 | ],
|
8323 | loc: {
|
8324 | start: {
|
8325 | line: 1,
|
8326 | column: 0
|
8327 | },
|
8328 | end: {
|
8329 | line: 1,
|
8330 | column: 13
|
8331 | }
|
8332 | }
|
8333 | });
|
8334 |
|
8335 | test("( foo )()", {
|
8336 | type: "Program",
|
8337 | body: [
|
8338 | {
|
8339 | type: "ExpressionStatement",
|
8340 | expression: {
|
8341 | type: "CallExpression",
|
8342 | callee: {
|
8343 | type: "Identifier",
|
8344 | name: "foo",
|
8345 | loc: {
|
8346 | start: {
|
8347 | line: 1,
|
8348 | column: 0
|
8349 | },
|
8350 | end: {
|
8351 | line: 1,
|
8352 | column: 11
|
8353 | }
|
8354 | }
|
8355 | },
|
8356 | arguments: [],
|
8357 | loc: {
|
8358 | start: {
|
8359 | line: 1,
|
8360 | column: 0
|
8361 | },
|
8362 | end: {
|
8363 | line: 1,
|
8364 | column: 13
|
8365 | }
|
8366 | }
|
8367 | },
|
8368 | loc: {
|
8369 | start: {
|
8370 | line: 1,
|
8371 | column: 0
|
8372 | },
|
8373 | end: {
|
8374 | line: 1,
|
8375 | column: 13
|
8376 | }
|
8377 | }
|
8378 | }
|
8379 | ],
|
8380 | loc: {
|
8381 | start: {
|
8382 | line: 1,
|
8383 | column: 0
|
8384 | },
|
8385 | end: {
|
8386 | line: 1,
|
8387 | column: 13
|
8388 | }
|
8389 | }
|
8390 | });
|
8391 |
|
8392 | test("universe.milkyway", {
|
8393 | type: "Program",
|
8394 | body: [
|
8395 | {
|
8396 | type: "ExpressionStatement",
|
8397 | expression: {
|
8398 | type: "MemberExpression",
|
8399 | object: {
|
8400 | type: "Identifier",
|
8401 | name: "universe",
|
8402 | loc: {
|
8403 | start: {
|
8404 | line: 1,
|
8405 | column: 0
|
8406 | },
|
8407 | end: {
|
8408 | line: 1,
|
8409 | column: 8
|
8410 | }
|
8411 | }
|
8412 | },
|
8413 | property: {
|
8414 | type: "Identifier",
|
8415 | name: "milkyway",
|
8416 | loc: {
|
8417 | start: {
|
8418 | line: 1,
|
8419 | column: 9
|
8420 | },
|
8421 | end: {
|
8422 | line: 1,
|
8423 | column: 17
|
8424 | }
|
8425 | }
|
8426 | },
|
8427 | computed: false,
|
8428 | loc: {
|
8429 | start: {
|
8430 | line: 1,
|
8431 | column: 0
|
8432 | },
|
8433 | end: {
|
8434 | line: 1,
|
8435 | column: 17
|
8436 | }
|
8437 | }
|
8438 | },
|
8439 | loc: {
|
8440 | start: {
|
8441 | line: 1,
|
8442 | column: 0
|
8443 | },
|
8444 | end: {
|
8445 | line: 1,
|
8446 | column: 17
|
8447 | }
|
8448 | }
|
8449 | }
|
8450 | ],
|
8451 | loc: {
|
8452 | start: {
|
8453 | line: 1,
|
8454 | column: 0
|
8455 | },
|
8456 | end: {
|
8457 | line: 1,
|
8458 | column: 17
|
8459 | }
|
8460 | }
|
8461 | });
|
8462 |
|
8463 | test("universe.milkyway.solarsystem", {
|
8464 | type: "Program",
|
8465 | body: [
|
8466 | {
|
8467 | type: "ExpressionStatement",
|
8468 | expression: {
|
8469 | type: "MemberExpression",
|
8470 | object: {
|
8471 | type: "MemberExpression",
|
8472 | object: {
|
8473 | type: "Identifier",
|
8474 | name: "universe",
|
8475 | loc: {
|
8476 | start: {
|
8477 | line: 1,
|
8478 | column: 0
|
8479 | },
|
8480 | end: {
|
8481 | line: 1,
|
8482 | column: 8
|
8483 | }
|
8484 | }
|
8485 | },
|
8486 | property: {
|
8487 | type: "Identifier",
|
8488 | name: "milkyway",
|
8489 | loc: {
|
8490 | start: {
|
8491 | line: 1,
|
8492 | column: 9
|
8493 | },
|
8494 | end: {
|
8495 | line: 1,
|
8496 | column: 17
|
8497 | }
|
8498 | }
|
8499 | },
|
8500 | computed: false,
|
8501 | loc: {
|
8502 | start: {
|
8503 | line: 1,
|
8504 | column: 0
|
8505 | },
|
8506 | end: {
|
8507 | line: 1,
|
8508 | column: 17
|
8509 | }
|
8510 | }
|
8511 | },
|
8512 | property: {
|
8513 | type: "Identifier",
|
8514 | name: "solarsystem",
|
8515 | loc: {
|
8516 | start: {
|
8517 | line: 1,
|
8518 | column: 18
|
8519 | },
|
8520 | end: {
|
8521 | line: 1,
|
8522 | column: 29
|
8523 | }
|
8524 | }
|
8525 | },
|
8526 | computed: false,
|
8527 | loc: {
|
8528 | start: {
|
8529 | line: 1,
|
8530 | column: 0
|
8531 | },
|
8532 | end: {
|
8533 | line: 1,
|
8534 | column: 29
|
8535 | }
|
8536 | }
|
8537 | },
|
8538 | loc: {
|
8539 | start: {
|
8540 | line: 1,
|
8541 | column: 0
|
8542 | },
|
8543 | end: {
|
8544 | line: 1,
|
8545 | column: 29
|
8546 | }
|
8547 | }
|
8548 | }
|
8549 | ],
|
8550 | loc: {
|
8551 | start: {
|
8552 | line: 1,
|
8553 | column: 0
|
8554 | },
|
8555 | end: {
|
8556 | line: 1,
|
8557 | column: 29
|
8558 | }
|
8559 | }
|
8560 | });
|
8561 |
|
8562 | test("universe.milkyway.solarsystem.Earth", {
|
8563 | type: "Program",
|
8564 | body: [
|
8565 | {
|
8566 | type: "ExpressionStatement",
|
8567 | expression: {
|
8568 | type: "MemberExpression",
|
8569 | object: {
|
8570 | type: "MemberExpression",
|
8571 | object: {
|
8572 | type: "MemberExpression",
|
8573 | object: {
|
8574 | type: "Identifier",
|
8575 | name: "universe",
|
8576 | loc: {
|
8577 | start: {
|
8578 | line: 1,
|
8579 | column: 0
|
8580 | },
|
8581 | end: {
|
8582 | line: 1,
|
8583 | column: 8
|
8584 | }
|
8585 | }
|
8586 | },
|
8587 | property: {
|
8588 | type: "Identifier",
|
8589 | name: "milkyway",
|
8590 | loc: {
|
8591 | start: {
|
8592 | line: 1,
|
8593 | column: 9
|
8594 | },
|
8595 | end: {
|
8596 | line: 1,
|
8597 | column: 17
|
8598 | }
|
8599 | }
|
8600 | },
|
8601 | computed: false,
|
8602 | loc: {
|
8603 | start: {
|
8604 | line: 1,
|
8605 | column: 0
|
8606 | },
|
8607 | end: {
|
8608 | line: 1,
|
8609 | column: 17
|
8610 | }
|
8611 | }
|
8612 | },
|
8613 | property: {
|
8614 | type: "Identifier",
|
8615 | name: "solarsystem",
|
8616 | loc: {
|
8617 | start: {
|
8618 | line: 1,
|
8619 | column: 18
|
8620 | },
|
8621 | end: {
|
8622 | line: 1,
|
8623 | column: 29
|
8624 | }
|
8625 | }
|
8626 | },
|
8627 | computed: false,
|
8628 | loc: {
|
8629 | start: {
|
8630 | line: 1,
|
8631 | column: 0
|
8632 | },
|
8633 | end: {
|
8634 | line: 1,
|
8635 | column: 29
|
8636 | }
|
8637 | }
|
8638 | },
|
8639 | property: {
|
8640 | type: "Identifier",
|
8641 | name: "Earth",
|
8642 | loc: {
|
8643 | start: {
|
8644 | line: 1,
|
8645 | column: 30
|
8646 | },
|
8647 | end: {
|
8648 | line: 1,
|
8649 | column: 35
|
8650 | }
|
8651 | }
|
8652 | },
|
8653 | computed: false,
|
8654 | loc: {
|
8655 | start: {
|
8656 | line: 1,
|
8657 | column: 0
|
8658 | },
|
8659 | end: {
|
8660 | line: 1,
|
8661 | column: 35
|
8662 | }
|
8663 | }
|
8664 | },
|
8665 | loc: {
|
8666 | start: {
|
8667 | line: 1,
|
8668 | column: 0
|
8669 | },
|
8670 | end: {
|
8671 | line: 1,
|
8672 | column: 35
|
8673 | }
|
8674 | }
|
8675 | }
|
8676 | ],
|
8677 | loc: {
|
8678 | start: {
|
8679 | line: 1,
|
8680 | column: 0
|
8681 | },
|
8682 | end: {
|
8683 | line: 1,
|
8684 | column: 35
|
8685 | }
|
8686 | }
|
8687 | });
|
8688 |
|
8689 | test("universe[galaxyName, otherUselessName]", {
|
8690 | type: "Program",
|
8691 | body: [
|
8692 | {
|
8693 | type: "ExpressionStatement",
|
8694 | expression: {
|
8695 | type: "MemberExpression",
|
8696 | object: {
|
8697 | type: "Identifier",
|
8698 | name: "universe",
|
8699 | loc: {
|
8700 | start: {
|
8701 | line: 1,
|
8702 | column: 0
|
8703 | },
|
8704 | end: {
|
8705 | line: 1,
|
8706 | column: 8
|
8707 | }
|
8708 | }
|
8709 | },
|
8710 | property: {
|
8711 | type: "SequenceExpression",
|
8712 | expressions: [
|
8713 | {
|
8714 | type: "Identifier",
|
8715 | name: "galaxyName",
|
8716 | loc: {
|
8717 | start: {
|
8718 | line: 1,
|
8719 | column: 9
|
8720 | },
|
8721 | end: {
|
8722 | line: 1,
|
8723 | column: 19
|
8724 | }
|
8725 | }
|
8726 | },
|
8727 | {
|
8728 | type: "Identifier",
|
8729 | name: "otherUselessName",
|
8730 | loc: {
|
8731 | start: {
|
8732 | line: 1,
|
8733 | column: 21
|
8734 | },
|
8735 | end: {
|
8736 | line: 1,
|
8737 | column: 37
|
8738 | }
|
8739 | }
|
8740 | }
|
8741 | ],
|
8742 | loc: {
|
8743 | start: {
|
8744 | line: 1,
|
8745 | column: 9
|
8746 | },
|
8747 | end: {
|
8748 | line: 1,
|
8749 | column: 37
|
8750 | }
|
8751 | }
|
8752 | },
|
8753 | computed: true,
|
8754 | loc: {
|
8755 | start: {
|
8756 | line: 1,
|
8757 | column: 0
|
8758 | },
|
8759 | end: {
|
8760 | line: 1,
|
8761 | column: 38
|
8762 | }
|
8763 | }
|
8764 | },
|
8765 | loc: {
|
8766 | start: {
|
8767 | line: 1,
|
8768 | column: 0
|
8769 | },
|
8770 | end: {
|
8771 | line: 1,
|
8772 | column: 38
|
8773 | }
|
8774 | }
|
8775 | }
|
8776 | ],
|
8777 | loc: {
|
8778 | start: {
|
8779 | line: 1,
|
8780 | column: 0
|
8781 | },
|
8782 | end: {
|
8783 | line: 1,
|
8784 | column: 38
|
8785 | }
|
8786 | }
|
8787 | });
|
8788 |
|
8789 | test("universe[galaxyName]", {
|
8790 | type: "Program",
|
8791 | body: [
|
8792 | {
|
8793 | type: "ExpressionStatement",
|
8794 | expression: {
|
8795 | type: "MemberExpression",
|
8796 | object: {
|
8797 | type: "Identifier",
|
8798 | name: "universe",
|
8799 | loc: {
|
8800 | start: {
|
8801 | line: 1,
|
8802 | column: 0
|
8803 | },
|
8804 | end: {
|
8805 | line: 1,
|
8806 | column: 8
|
8807 | }
|
8808 | }
|
8809 | },
|
8810 | property: {
|
8811 | type: "Identifier",
|
8812 | name: "galaxyName",
|
8813 | loc: {
|
8814 | start: {
|
8815 | line: 1,
|
8816 | column: 9
|
8817 | },
|
8818 | end: {
|
8819 | line: 1,
|
8820 | column: 19
|
8821 | }
|
8822 | }
|
8823 | },
|
8824 | computed: true,
|
8825 | loc: {
|
8826 | start: {
|
8827 | line: 1,
|
8828 | column: 0
|
8829 | },
|
8830 | end: {
|
8831 | line: 1,
|
8832 | column: 20
|
8833 | }
|
8834 | }
|
8835 | },
|
8836 | loc: {
|
8837 | start: {
|
8838 | line: 1,
|
8839 | column: 0
|
8840 | },
|
8841 | end: {
|
8842 | line: 1,
|
8843 | column: 20
|
8844 | }
|
8845 | }
|
8846 | }
|
8847 | ],
|
8848 | loc: {
|
8849 | start: {
|
8850 | line: 1,
|
8851 | column: 0
|
8852 | },
|
8853 | end: {
|
8854 | line: 1,
|
8855 | column: 20
|
8856 | }
|
8857 | }
|
8858 | });
|
8859 |
|
8860 | test("universe[42].galaxies", {
|
8861 | type: "Program",
|
8862 | body: [
|
8863 | {
|
8864 | type: "ExpressionStatement",
|
8865 | expression: {
|
8866 | type: "MemberExpression",
|
8867 | object: {
|
8868 | type: "MemberExpression",
|
8869 | object: {
|
8870 | type: "Identifier",
|
8871 | name: "universe",
|
8872 | loc: {
|
8873 | start: {
|
8874 | line: 1,
|
8875 | column: 0
|
8876 | },
|
8877 | end: {
|
8878 | line: 1,
|
8879 | column: 8
|
8880 | }
|
8881 | }
|
8882 | },
|
8883 | property: {
|
8884 | type: "Literal",
|
8885 | value: 42,
|
8886 | loc: {
|
8887 | start: {
|
8888 | line: 1,
|
8889 | column: 9
|
8890 | },
|
8891 | end: {
|
8892 | line: 1,
|
8893 | column: 11
|
8894 | }
|
8895 | }
|
8896 | },
|
8897 | computed: true,
|
8898 | loc: {
|
8899 | start: {
|
8900 | line: 1,
|
8901 | column: 0
|
8902 | },
|
8903 | end: {
|
8904 | line: 1,
|
8905 | column: 12
|
8906 | }
|
8907 | }
|
8908 | },
|
8909 | property: {
|
8910 | type: "Identifier",
|
8911 | name: "galaxies",
|
8912 | loc: {
|
8913 | start: {
|
8914 | line: 1,
|
8915 | column: 13
|
8916 | },
|
8917 | end: {
|
8918 | line: 1,
|
8919 | column: 21
|
8920 | }
|
8921 | }
|
8922 | },
|
8923 | computed: false,
|
8924 | loc: {
|
8925 | start: {
|
8926 | line: 1,
|
8927 | column: 0
|
8928 | },
|
8929 | end: {
|
8930 | line: 1,
|
8931 | column: 21
|
8932 | }
|
8933 | }
|
8934 | },
|
8935 | loc: {
|
8936 | start: {
|
8937 | line: 1,
|
8938 | column: 0
|
8939 | },
|
8940 | end: {
|
8941 | line: 1,
|
8942 | column: 21
|
8943 | }
|
8944 | }
|
8945 | }
|
8946 | ],
|
8947 | loc: {
|
8948 | start: {
|
8949 | line: 1,
|
8950 | column: 0
|
8951 | },
|
8952 | end: {
|
8953 | line: 1,
|
8954 | column: 21
|
8955 | }
|
8956 | }
|
8957 | });
|
8958 |
|
8959 | test("universe(42).galaxies", {
|
8960 | type: "Program",
|
8961 | body: [
|
8962 | {
|
8963 | type: "ExpressionStatement",
|
8964 | expression: {
|
8965 | type: "MemberExpression",
|
8966 | object: {
|
8967 | type: "CallExpression",
|
8968 | callee: {
|
8969 | type: "Identifier",
|
8970 | name: "universe",
|
8971 | loc: {
|
8972 | start: {
|
8973 | line: 1,
|
8974 | column: 0
|
8975 | },
|
8976 | end: {
|
8977 | line: 1,
|
8978 | column: 8
|
8979 | }
|
8980 | }
|
8981 | },
|
8982 | arguments: [
|
8983 | {
|
8984 | type: "Literal",
|
8985 | value: 42,
|
8986 | loc: {
|
8987 | start: {
|
8988 | line: 1,
|
8989 | column: 9
|
8990 | },
|
8991 | end: {
|
8992 | line: 1,
|
8993 | column: 11
|
8994 | }
|
8995 | }
|
8996 | }
|
8997 | ],
|
8998 | loc: {
|
8999 | start: {
|
9000 | line: 1,
|
9001 | column: 0
|
9002 | },
|
9003 | end: {
|
9004 | line: 1,
|
9005 | column: 12
|
9006 | }
|
9007 | }
|
9008 | },
|
9009 | property: {
|
9010 | type: "Identifier",
|
9011 | name: "galaxies",
|
9012 | loc: {
|
9013 | start: {
|
9014 | line: 1,
|
9015 | column: 13
|
9016 | },
|
9017 | end: {
|
9018 | line: 1,
|
9019 | column: 21
|
9020 | }
|
9021 | }
|
9022 | },
|
9023 | computed: false,
|
9024 | loc: {
|
9025 | start: {
|
9026 | line: 1,
|
9027 | column: 0
|
9028 | },
|
9029 | end: {
|
9030 | line: 1,
|
9031 | column: 21
|
9032 | }
|
9033 | }
|
9034 | },
|
9035 | loc: {
|
9036 | start: {
|
9037 | line: 1,
|
9038 | column: 0
|
9039 | },
|
9040 | end: {
|
9041 | line: 1,
|
9042 | column: 21
|
9043 | }
|
9044 | }
|
9045 | }
|
9046 | ],
|
9047 | loc: {
|
9048 | start: {
|
9049 | line: 1,
|
9050 | column: 0
|
9051 | },
|
9052 | end: {
|
9053 | line: 1,
|
9054 | column: 21
|
9055 | }
|
9056 | }
|
9057 | });
|
9058 |
|
9059 | test("universe(42).galaxies(14, 3, 77).milkyway", {
|
9060 | type: "Program",
|
9061 | body: [
|
9062 | {
|
9063 | type: "ExpressionStatement",
|
9064 | expression: {
|
9065 | type: "MemberExpression",
|
9066 | object: {
|
9067 | type: "CallExpression",
|
9068 | callee: {
|
9069 | type: "MemberExpression",
|
9070 | object: {
|
9071 | type: "CallExpression",
|
9072 | callee: {
|
9073 | type: "Identifier",
|
9074 | name: "universe",
|
9075 | loc: {
|
9076 | start: {
|
9077 | line: 1,
|
9078 | column: 0
|
9079 | },
|
9080 | end: {
|
9081 | line: 1,
|
9082 | column: 8
|
9083 | }
|
9084 | }
|
9085 | },
|
9086 | arguments: [
|
9087 | {
|
9088 | type: "Literal",
|
9089 | value: 42,
|
9090 | loc: {
|
9091 | start: {
|
9092 | line: 1,
|
9093 | column: 9
|
9094 | },
|
9095 | end: {
|
9096 | line: 1,
|
9097 | column: 11
|
9098 | }
|
9099 | }
|
9100 | }
|
9101 | ],
|
9102 | loc: {
|
9103 | start: {
|
9104 | line: 1,
|
9105 | column: 0
|
9106 | },
|
9107 | end: {
|
9108 | line: 1,
|
9109 | column: 12
|
9110 | }
|
9111 | }
|
9112 | },
|
9113 | property: {
|
9114 | type: "Identifier",
|
9115 | name: "galaxies",
|
9116 | loc: {
|
9117 | start: {
|
9118 | line: 1,
|
9119 | column: 13
|
9120 | },
|
9121 | end: {
|
9122 | line: 1,
|
9123 | column: 21
|
9124 | }
|
9125 | }
|
9126 | },
|
9127 | computed: false,
|
9128 | loc: {
|
9129 | start: {
|
9130 | line: 1,
|
9131 | column: 0
|
9132 | },
|
9133 | end: {
|
9134 | line: 1,
|
9135 | column: 21
|
9136 | }
|
9137 | }
|
9138 | },
|
9139 | arguments: [
|
9140 | {
|
9141 | type: "Literal",
|
9142 | value: 14,
|
9143 | loc: {
|
9144 | start: {
|
9145 | line: 1,
|
9146 | column: 22
|
9147 | },
|
9148 | end: {
|
9149 | line: 1,
|
9150 | column: 24
|
9151 | }
|
9152 | }
|
9153 | },
|
9154 | {
|
9155 | type: "Literal",
|
9156 | value: 3,
|
9157 | loc: {
|
9158 | start: {
|
9159 | line: 1,
|
9160 | column: 26
|
9161 | },
|
9162 | end: {
|
9163 | line: 1,
|
9164 | column: 27
|
9165 | }
|
9166 | }
|
9167 | },
|
9168 | {
|
9169 | type: "Literal",
|
9170 | value: 77,
|
9171 | loc: {
|
9172 | start: {
|
9173 | line: 1,
|
9174 | column: 29
|
9175 | },
|
9176 | end: {
|
9177 | line: 1,
|
9178 | column: 31
|
9179 | }
|
9180 | }
|
9181 | }
|
9182 | ],
|
9183 | loc: {
|
9184 | start: {
|
9185 | line: 1,
|
9186 | column: 0
|
9187 | },
|
9188 | end: {
|
9189 | line: 1,
|
9190 | column: 32
|
9191 | }
|
9192 | }
|
9193 | },
|
9194 | property: {
|
9195 | type: "Identifier",
|
9196 | name: "milkyway",
|
9197 | loc: {
|
9198 | start: {
|
9199 | line: 1,
|
9200 | column: 33
|
9201 | },
|
9202 | end: {
|
9203 | line: 1,
|
9204 | column: 41
|
9205 | }
|
9206 | }
|
9207 | },
|
9208 | computed: false,
|
9209 | loc: {
|
9210 | start: {
|
9211 | line: 1,
|
9212 | column: 0
|
9213 | },
|
9214 | end: {
|
9215 | line: 1,
|
9216 | column: 41
|
9217 | }
|
9218 | }
|
9219 | },
|
9220 | loc: {
|
9221 | start: {
|
9222 | line: 1,
|
9223 | column: 0
|
9224 | },
|
9225 | end: {
|
9226 | line: 1,
|
9227 | column: 41
|
9228 | }
|
9229 | }
|
9230 | }
|
9231 | ],
|
9232 | loc: {
|
9233 | start: {
|
9234 | line: 1,
|
9235 | column: 0
|
9236 | },
|
9237 | end: {
|
9238 | line: 1,
|
9239 | column: 41
|
9240 | }
|
9241 | }
|
9242 | });
|
9243 |
|
9244 | test("earth.asia.Indonesia.prepareForElection(2014)", {
|
9245 | type: "Program",
|
9246 | body: [
|
9247 | {
|
9248 | type: "ExpressionStatement",
|
9249 | expression: {
|
9250 | type: "CallExpression",
|
9251 | callee: {
|
9252 | type: "MemberExpression",
|
9253 | object: {
|
9254 | type: "MemberExpression",
|
9255 | object: {
|
9256 | type: "MemberExpression",
|
9257 | object: {
|
9258 | type: "Identifier",
|
9259 | name: "earth",
|
9260 | loc: {
|
9261 | start: {
|
9262 | line: 1,
|
9263 | column: 0
|
9264 | },
|
9265 | end: {
|
9266 | line: 1,
|
9267 | column: 5
|
9268 | }
|
9269 | }
|
9270 | },
|
9271 | property: {
|
9272 | type: "Identifier",
|
9273 | name: "asia",
|
9274 | loc: {
|
9275 | start: {
|
9276 | line: 1,
|
9277 | column: 6
|
9278 | },
|
9279 | end: {
|
9280 | line: 1,
|
9281 | column: 10
|
9282 | }
|
9283 | }
|
9284 | },
|
9285 | computed: false,
|
9286 | loc: {
|
9287 | start: {
|
9288 | line: 1,
|
9289 | column: 0
|
9290 | },
|
9291 | end: {
|
9292 | line: 1,
|
9293 | column: 10
|
9294 | }
|
9295 | }
|
9296 | },
|
9297 | property: {
|
9298 | type: "Identifier",
|
9299 | name: "Indonesia",
|
9300 | loc: {
|
9301 | start: {
|
9302 | line: 1,
|
9303 | column: 11
|
9304 | },
|
9305 | end: {
|
9306 | line: 1,
|
9307 | column: 20
|
9308 | }
|
9309 | }
|
9310 | },
|
9311 | computed: false,
|
9312 | loc: {
|
9313 | start: {
|
9314 | line: 1,
|
9315 | column: 0
|
9316 | },
|
9317 | end: {
|
9318 | line: 1,
|
9319 | column: 20
|
9320 | }
|
9321 | }
|
9322 | },
|
9323 | property: {
|
9324 | type: "Identifier",
|
9325 | name: "prepareForElection",
|
9326 | loc: {
|
9327 | start: {
|
9328 | line: 1,
|
9329 | column: 21
|
9330 | },
|
9331 | end: {
|
9332 | line: 1,
|
9333 | column: 39
|
9334 | }
|
9335 | }
|
9336 | },
|
9337 | computed: false,
|
9338 | loc: {
|
9339 | start: {
|
9340 | line: 1,
|
9341 | column: 0
|
9342 | },
|
9343 | end: {
|
9344 | line: 1,
|
9345 | column: 39
|
9346 | }
|
9347 | }
|
9348 | },
|
9349 | arguments: [
|
9350 | {
|
9351 | type: "Literal",
|
9352 | value: 2014,
|
9353 | loc: {
|
9354 | start: {
|
9355 | line: 1,
|
9356 | column: 40
|
9357 | },
|
9358 | end: {
|
9359 | line: 1,
|
9360 | column: 44
|
9361 | }
|
9362 | }
|
9363 | }
|
9364 | ],
|
9365 | loc: {
|
9366 | start: {
|
9367 | line: 1,
|
9368 | column: 0
|
9369 | },
|
9370 | end: {
|
9371 | line: 1,
|
9372 | column: 45
|
9373 | }
|
9374 | }
|
9375 | },
|
9376 | loc: {
|
9377 | start: {
|
9378 | line: 1,
|
9379 | column: 0
|
9380 | },
|
9381 | end: {
|
9382 | line: 1,
|
9383 | column: 45
|
9384 | }
|
9385 | }
|
9386 | }
|
9387 | ],
|
9388 | loc: {
|
9389 | start: {
|
9390 | line: 1,
|
9391 | column: 0
|
9392 | },
|
9393 | end: {
|
9394 | line: 1,
|
9395 | column: 45
|
9396 | }
|
9397 | }
|
9398 | });
|
9399 |
|
9400 | test("universe.if", {
|
9401 | type: "Program",
|
9402 | body: [
|
9403 | {
|
9404 | type: "ExpressionStatement",
|
9405 | expression: {
|
9406 | type: "MemberExpression",
|
9407 | object: {
|
9408 | type: "Identifier",
|
9409 | name: "universe",
|
9410 | loc: {
|
9411 | start: {
|
9412 | line: 1,
|
9413 | column: 0
|
9414 | },
|
9415 | end: {
|
9416 | line: 1,
|
9417 | column: 8
|
9418 | }
|
9419 | }
|
9420 | },
|
9421 | property: {
|
9422 | type: "Identifier",
|
9423 | name: "if",
|
9424 | loc: {
|
9425 | start: {
|
9426 | line: 1,
|
9427 | column: 9
|
9428 | },
|
9429 | end: {
|
9430 | line: 1,
|
9431 | column: 11
|
9432 | }
|
9433 | }
|
9434 | },
|
9435 | computed: false,
|
9436 | loc: {
|
9437 | start: {
|
9438 | line: 1,
|
9439 | column: 0
|
9440 | },
|
9441 | end: {
|
9442 | line: 1,
|
9443 | column: 11
|
9444 | }
|
9445 | }
|
9446 | },
|
9447 | loc: {
|
9448 | start: {
|
9449 | line: 1,
|
9450 | column: 0
|
9451 | },
|
9452 | end: {
|
9453 | line: 1,
|
9454 | column: 11
|
9455 | }
|
9456 | }
|
9457 | }
|
9458 | ],
|
9459 | loc: {
|
9460 | start: {
|
9461 | line: 1,
|
9462 | column: 0
|
9463 | },
|
9464 | end: {
|
9465 | line: 1,
|
9466 | column: 11
|
9467 | }
|
9468 | }
|
9469 | });
|
9470 |
|
9471 | test("universe.true", {
|
9472 | type: "Program",
|
9473 | body: [
|
9474 | {
|
9475 | type: "ExpressionStatement",
|
9476 | expression: {
|
9477 | type: "MemberExpression",
|
9478 | object: {
|
9479 | type: "Identifier",
|
9480 | name: "universe",
|
9481 | loc: {
|
9482 | start: {
|
9483 | line: 1,
|
9484 | column: 0
|
9485 | },
|
9486 | end: {
|
9487 | line: 1,
|
9488 | column: 8
|
9489 | }
|
9490 | }
|
9491 | },
|
9492 | property: {
|
9493 | type: "Identifier",
|
9494 | name: "true",
|
9495 | loc: {
|
9496 | start: {
|
9497 | line: 1,
|
9498 | column: 9
|
9499 | },
|
9500 | end: {
|
9501 | line: 1,
|
9502 | column: 13
|
9503 | }
|
9504 | }
|
9505 | },
|
9506 | computed: false,
|
9507 | loc: {
|
9508 | start: {
|
9509 | line: 1,
|
9510 | column: 0
|
9511 | },
|
9512 | end: {
|
9513 | line: 1,
|
9514 | column: 13
|
9515 | }
|
9516 | }
|
9517 | },
|
9518 | loc: {
|
9519 | start: {
|
9520 | line: 1,
|
9521 | column: 0
|
9522 | },
|
9523 | end: {
|
9524 | line: 1,
|
9525 | column: 13
|
9526 | }
|
9527 | }
|
9528 | }
|
9529 | ],
|
9530 | loc: {
|
9531 | start: {
|
9532 | line: 1,
|
9533 | column: 0
|
9534 | },
|
9535 | end: {
|
9536 | line: 1,
|
9537 | column: 13
|
9538 | }
|
9539 | }
|
9540 | });
|
9541 |
|
9542 | test("universe.false", {
|
9543 | type: "Program",
|
9544 | body: [
|
9545 | {
|
9546 | type: "ExpressionStatement",
|
9547 | expression: {
|
9548 | type: "MemberExpression",
|
9549 | object: {
|
9550 | type: "Identifier",
|
9551 | name: "universe",
|
9552 | loc: {
|
9553 | start: {
|
9554 | line: 1,
|
9555 | column: 0
|
9556 | },
|
9557 | end: {
|
9558 | line: 1,
|
9559 | column: 8
|
9560 | }
|
9561 | }
|
9562 | },
|
9563 | property: {
|
9564 | type: "Identifier",
|
9565 | name: "false",
|
9566 | loc: {
|
9567 | start: {
|
9568 | line: 1,
|
9569 | column: 9
|
9570 | },
|
9571 | end: {
|
9572 | line: 1,
|
9573 | column: 14
|
9574 | }
|
9575 | }
|
9576 | },
|
9577 | computed: false,
|
9578 | loc: {
|
9579 | start: {
|
9580 | line: 1,
|
9581 | column: 0
|
9582 | },
|
9583 | end: {
|
9584 | line: 1,
|
9585 | column: 14
|
9586 | }
|
9587 | }
|
9588 | },
|
9589 | loc: {
|
9590 | start: {
|
9591 | line: 1,
|
9592 | column: 0
|
9593 | },
|
9594 | end: {
|
9595 | line: 1,
|
9596 | column: 14
|
9597 | }
|
9598 | }
|
9599 | }
|
9600 | ],
|
9601 | loc: {
|
9602 | start: {
|
9603 | line: 1,
|
9604 | column: 0
|
9605 | },
|
9606 | end: {
|
9607 | line: 1,
|
9608 | column: 14
|
9609 | }
|
9610 | }
|
9611 | });
|
9612 |
|
9613 | test("universe.null", {
|
9614 | type: "Program",
|
9615 | body: [
|
9616 | {
|
9617 | type: "ExpressionStatement",
|
9618 | expression: {
|
9619 | type: "MemberExpression",
|
9620 | object: {
|
9621 | type: "Identifier",
|
9622 | name: "universe",
|
9623 | loc: {
|
9624 | start: {
|
9625 | line: 1,
|
9626 | column: 0
|
9627 | },
|
9628 | end: {
|
9629 | line: 1,
|
9630 | column: 8
|
9631 | }
|
9632 | }
|
9633 | },
|
9634 | property: {
|
9635 | type: "Identifier",
|
9636 | name: "null",
|
9637 | loc: {
|
9638 | start: {
|
9639 | line: 1,
|
9640 | column: 9
|
9641 | },
|
9642 | end: {
|
9643 | line: 1,
|
9644 | column: 13
|
9645 | }
|
9646 | }
|
9647 | },
|
9648 | computed: false,
|
9649 | loc: {
|
9650 | start: {
|
9651 | line: 1,
|
9652 | column: 0
|
9653 | },
|
9654 | end: {
|
9655 | line: 1,
|
9656 | column: 13
|
9657 | }
|
9658 | }
|
9659 | },
|
9660 | loc: {
|
9661 | start: {
|
9662 | line: 1,
|
9663 | column: 0
|
9664 | },
|
9665 | end: {
|
9666 | line: 1,
|
9667 | column: 13
|
9668 | }
|
9669 | }
|
9670 | }
|
9671 | ],
|
9672 | loc: {
|
9673 | start: {
|
9674 | line: 1,
|
9675 | column: 0
|
9676 | },
|
9677 | end: {
|
9678 | line: 1,
|
9679 | column: 13
|
9680 | }
|
9681 | }
|
9682 | });
|
9683 |
|
9684 | test("x++", {
|
9685 | type: "Program",
|
9686 | body: [
|
9687 | {
|
9688 | type: "ExpressionStatement",
|
9689 | expression: {
|
9690 | type: "UpdateExpression",
|
9691 | operator: "++",
|
9692 | prefix: false,
|
9693 | argument: {
|
9694 | type: "Identifier",
|
9695 | name: "x",
|
9696 | loc: {
|
9697 | start: {
|
9698 | line: 1,
|
9699 | column: 0
|
9700 | },
|
9701 | end: {
|
9702 | line: 1,
|
9703 | column: 1
|
9704 | }
|
9705 | }
|
9706 | },
|
9707 | loc: {
|
9708 | start: {
|
9709 | line: 1,
|
9710 | column: 0
|
9711 | },
|
9712 | end: {
|
9713 | line: 1,
|
9714 | column: 3
|
9715 | }
|
9716 | }
|
9717 | },
|
9718 | loc: {
|
9719 | start: {
|
9720 | line: 1,
|
9721 | column: 0
|
9722 | },
|
9723 | end: {
|
9724 | line: 1,
|
9725 | column: 3
|
9726 | }
|
9727 | }
|
9728 | }
|
9729 | ],
|
9730 | loc: {
|
9731 | start: {
|
9732 | line: 1,
|
9733 | column: 0
|
9734 | },
|
9735 | end: {
|
9736 | line: 1,
|
9737 | column: 3
|
9738 | }
|
9739 | }
|
9740 | });
|
9741 |
|
9742 | test("x--", {
|
9743 | type: "Program",
|
9744 | body: [
|
9745 | {
|
9746 | type: "ExpressionStatement",
|
9747 | expression: {
|
9748 | type: "UpdateExpression",
|
9749 | operator: "--",
|
9750 | prefix: false,
|
9751 | argument: {
|
9752 | type: "Identifier",
|
9753 | name: "x",
|
9754 | loc: {
|
9755 | start: {
|
9756 | line: 1,
|
9757 | column: 0
|
9758 | },
|
9759 | end: {
|
9760 | line: 1,
|
9761 | column: 1
|
9762 | }
|
9763 | }
|
9764 | },
|
9765 | loc: {
|
9766 | start: {
|
9767 | line: 1,
|
9768 | column: 0
|
9769 | },
|
9770 | end: {
|
9771 | line: 1,
|
9772 | column: 3
|
9773 | }
|
9774 | }
|
9775 | },
|
9776 | loc: {
|
9777 | start: {
|
9778 | line: 1,
|
9779 | column: 0
|
9780 | },
|
9781 | end: {
|
9782 | line: 1,
|
9783 | column: 3
|
9784 | }
|
9785 | }
|
9786 | }
|
9787 | ],
|
9788 | loc: {
|
9789 | start: {
|
9790 | line: 1,
|
9791 | column: 0
|
9792 | },
|
9793 | end: {
|
9794 | line: 1,
|
9795 | column: 3
|
9796 | }
|
9797 | }
|
9798 | });
|
9799 |
|
9800 | test("eval++", {
|
9801 | type: "Program",
|
9802 | body: [
|
9803 | {
|
9804 | type: "ExpressionStatement",
|
9805 | expression: {
|
9806 | type: "UpdateExpression",
|
9807 | operator: "++",
|
9808 | prefix: false,
|
9809 | argument: {
|
9810 | type: "Identifier",
|
9811 | name: "eval",
|
9812 | loc: {
|
9813 | start: {
|
9814 | line: 1,
|
9815 | column: 0
|
9816 | },
|
9817 | end: {
|
9818 | line: 1,
|
9819 | column: 4
|
9820 | }
|
9821 | }
|
9822 | },
|
9823 | loc: {
|
9824 | start: {
|
9825 | line: 1,
|
9826 | column: 0
|
9827 | },
|
9828 | end: {
|
9829 | line: 1,
|
9830 | column: 6
|
9831 | }
|
9832 | }
|
9833 | },
|
9834 | loc: {
|
9835 | start: {
|
9836 | line: 1,
|
9837 | column: 0
|
9838 | },
|
9839 | end: {
|
9840 | line: 1,
|
9841 | column: 6
|
9842 | }
|
9843 | }
|
9844 | }
|
9845 | ],
|
9846 | loc: {
|
9847 | start: {
|
9848 | line: 1,
|
9849 | column: 0
|
9850 | },
|
9851 | end: {
|
9852 | line: 1,
|
9853 | column: 6
|
9854 | }
|
9855 | }
|
9856 | });
|
9857 |
|
9858 | test("eval--", {
|
9859 | type: "Program",
|
9860 | body: [
|
9861 | {
|
9862 | type: "ExpressionStatement",
|
9863 | expression: {
|
9864 | type: "UpdateExpression",
|
9865 | operator: "--",
|
9866 | prefix: false,
|
9867 | argument: {
|
9868 | type: "Identifier",
|
9869 | name: "eval",
|
9870 | loc: {
|
9871 | start: {
|
9872 | line: 1,
|
9873 | column: 0
|
9874 | },
|
9875 | end: {
|
9876 | line: 1,
|
9877 | column: 4
|
9878 | }
|
9879 | }
|
9880 | },
|
9881 | loc: {
|
9882 | start: {
|
9883 | line: 1,
|
9884 | column: 0
|
9885 | },
|
9886 | end: {
|
9887 | line: 1,
|
9888 | column: 6
|
9889 | }
|
9890 | }
|
9891 | },
|
9892 | loc: {
|
9893 | start: {
|
9894 | line: 1,
|
9895 | column: 0
|
9896 | },
|
9897 | end: {
|
9898 | line: 1,
|
9899 | column: 6
|
9900 | }
|
9901 | }
|
9902 | }
|
9903 | ],
|
9904 | loc: {
|
9905 | start: {
|
9906 | line: 1,
|
9907 | column: 0
|
9908 | },
|
9909 | end: {
|
9910 | line: 1,
|
9911 | column: 6
|
9912 | }
|
9913 | }
|
9914 | });
|
9915 |
|
9916 | test("arguments++", {
|
9917 | type: "Program",
|
9918 | body: [
|
9919 | {
|
9920 | type: "ExpressionStatement",
|
9921 | expression: {
|
9922 | type: "UpdateExpression",
|
9923 | operator: "++",
|
9924 | prefix: false,
|
9925 | argument: {
|
9926 | type: "Identifier",
|
9927 | name: "arguments",
|
9928 | loc: {
|
9929 | start: {
|
9930 | line: 1,
|
9931 | column: 0
|
9932 | },
|
9933 | end: {
|
9934 | line: 1,
|
9935 | column: 9
|
9936 | }
|
9937 | }
|
9938 | },
|
9939 | loc: {
|
9940 | start: {
|
9941 | line: 1,
|
9942 | column: 0
|
9943 | },
|
9944 | end: {
|
9945 | line: 1,
|
9946 | column: 11
|
9947 | }
|
9948 | }
|
9949 | },
|
9950 | loc: {
|
9951 | start: {
|
9952 | line: 1,
|
9953 | column: 0
|
9954 | },
|
9955 | end: {
|
9956 | line: 1,
|
9957 | column: 11
|
9958 | }
|
9959 | }
|
9960 | }
|
9961 | ],
|
9962 | loc: {
|
9963 | start: {
|
9964 | line: 1,
|
9965 | column: 0
|
9966 | },
|
9967 | end: {
|
9968 | line: 1,
|
9969 | column: 11
|
9970 | }
|
9971 | }
|
9972 | });
|
9973 |
|
9974 | test("arguments--", {
|
9975 | type: "Program",
|
9976 | body: [
|
9977 | {
|
9978 | type: "ExpressionStatement",
|
9979 | expression: {
|
9980 | type: "UpdateExpression",
|
9981 | operator: "--",
|
9982 | prefix: false,
|
9983 | argument: {
|
9984 | type: "Identifier",
|
9985 | name: "arguments",
|
9986 | loc: {
|
9987 | start: {
|
9988 | line: 1,
|
9989 | column: 0
|
9990 | },
|
9991 | end: {
|
9992 | line: 1,
|
9993 | column: 9
|
9994 | }
|
9995 | }
|
9996 | },
|
9997 | loc: {
|
9998 | start: {
|
9999 | line: 1,
|
10000 | column: 0
|
10001 | },
|
10002 | end: {
|
10003 | line: 1,
|
10004 | column: 11
|
10005 | }
|
10006 | }
|
10007 | },
|
10008 | loc: {
|
10009 | start: {
|
10010 | line: 1,
|
10011 | column: 0
|
10012 | },
|
10013 | end: {
|
10014 | line: 1,
|
10015 | column: 11
|
10016 | }
|
10017 | }
|
10018 | }
|
10019 | ],
|
10020 | loc: {
|
10021 | start: {
|
10022 | line: 1,
|
10023 | column: 0
|
10024 | },
|
10025 | end: {
|
10026 | line: 1,
|
10027 | column: 11
|
10028 | }
|
10029 | }
|
10030 | });
|
10031 |
|
10032 | test("++x", {
|
10033 | type: "Program",
|
10034 | body: [
|
10035 | {
|
10036 | type: "ExpressionStatement",
|
10037 | expression: {
|
10038 | type: "UpdateExpression",
|
10039 | operator: "++",
|
10040 | prefix: true,
|
10041 | argument: {
|
10042 | type: "Identifier",
|
10043 | name: "x",
|
10044 | loc: {
|
10045 | start: {
|
10046 | line: 1,
|
10047 | column: 2
|
10048 | },
|
10049 | end: {
|
10050 | line: 1,
|
10051 | column: 3
|
10052 | }
|
10053 | }
|
10054 | },
|
10055 | loc: {
|
10056 | start: {
|
10057 | line: 1,
|
10058 | column: 0
|
10059 | },
|
10060 | end: {
|
10061 | line: 1,
|
10062 | column: 3
|
10063 | }
|
10064 | }
|
10065 | },
|
10066 | loc: {
|
10067 | start: {
|
10068 | line: 1,
|
10069 | column: 0
|
10070 | },
|
10071 | end: {
|
10072 | line: 1,
|
10073 | column: 3
|
10074 | }
|
10075 | }
|
10076 | }
|
10077 | ],
|
10078 | loc: {
|
10079 | start: {
|
10080 | line: 1,
|
10081 | column: 0
|
10082 | },
|
10083 | end: {
|
10084 | line: 1,
|
10085 | column: 3
|
10086 | }
|
10087 | }
|
10088 | });
|
10089 |
|
10090 | test("--x", {
|
10091 | type: "Program",
|
10092 | body: [
|
10093 | {
|
10094 | type: "ExpressionStatement",
|
10095 | expression: {
|
10096 | type: "UpdateExpression",
|
10097 | operator: "--",
|
10098 | prefix: true,
|
10099 | argument: {
|
10100 | type: "Identifier",
|
10101 | name: "x",
|
10102 | loc: {
|
10103 | start: {
|
10104 | line: 1,
|
10105 | column: 2
|
10106 | },
|
10107 | end: {
|
10108 | line: 1,
|
10109 | column: 3
|
10110 | }
|
10111 | }
|
10112 | },
|
10113 | loc: {
|
10114 | start: {
|
10115 | line: 1,
|
10116 | column: 0
|
10117 | },
|
10118 | end: {
|
10119 | line: 1,
|
10120 | column: 3
|
10121 | }
|
10122 | }
|
10123 | },
|
10124 | loc: {
|
10125 | start: {
|
10126 | line: 1,
|
10127 | column: 0
|
10128 | },
|
10129 | end: {
|
10130 | line: 1,
|
10131 | column: 3
|
10132 | }
|
10133 | }
|
10134 | }
|
10135 | ],
|
10136 | loc: {
|
10137 | start: {
|
10138 | line: 1,
|
10139 | column: 0
|
10140 | },
|
10141 | end: {
|
10142 | line: 1,
|
10143 | column: 3
|
10144 | }
|
10145 | }
|
10146 | });
|
10147 |
|
10148 | test("++eval", {
|
10149 | type: "Program",
|
10150 | body: [
|
10151 | {
|
10152 | type: "ExpressionStatement",
|
10153 | expression: {
|
10154 | type: "UpdateExpression",
|
10155 | operator: "++",
|
10156 | prefix: true,
|
10157 | argument: {
|
10158 | type: "Identifier",
|
10159 | name: "eval",
|
10160 | loc: {
|
10161 | start: {
|
10162 | line: 1,
|
10163 | column: 2
|
10164 | },
|
10165 | end: {
|
10166 | line: 1,
|
10167 | column: 6
|
10168 | }
|
10169 | }
|
10170 | },
|
10171 | loc: {
|
10172 | start: {
|
10173 | line: 1,
|
10174 | column: 0
|
10175 | },
|
10176 | end: {
|
10177 | line: 1,
|
10178 | column: 6
|
10179 | }
|
10180 | }
|
10181 | },
|
10182 | loc: {
|
10183 | start: {
|
10184 | line: 1,
|
10185 | column: 0
|
10186 | },
|
10187 | end: {
|
10188 | line: 1,
|
10189 | column: 6
|
10190 | }
|
10191 | }
|
10192 | }
|
10193 | ],
|
10194 | loc: {
|
10195 | start: {
|
10196 | line: 1,
|
10197 | column: 0
|
10198 | },
|
10199 | end: {
|
10200 | line: 1,
|
10201 | column: 6
|
10202 | }
|
10203 | }
|
10204 | });
|
10205 |
|
10206 | test("--eval", {
|
10207 | type: "Program",
|
10208 | body: [
|
10209 | {
|
10210 | type: "ExpressionStatement",
|
10211 | expression: {
|
10212 | type: "UpdateExpression",
|
10213 | operator: "--",
|
10214 | prefix: true,
|
10215 | argument: {
|
10216 | type: "Identifier",
|
10217 | name: "eval",
|
10218 | loc: {
|
10219 | start: {
|
10220 | line: 1,
|
10221 | column: 2
|
10222 | },
|
10223 | end: {
|
10224 | line: 1,
|
10225 | column: 6
|
10226 | }
|
10227 | }
|
10228 | },
|
10229 | loc: {
|
10230 | start: {
|
10231 | line: 1,
|
10232 | column: 0
|
10233 | },
|
10234 | end: {
|
10235 | line: 1,
|
10236 | column: 6
|
10237 | }
|
10238 | }
|
10239 | },
|
10240 | loc: {
|
10241 | start: {
|
10242 | line: 1,
|
10243 | column: 0
|
10244 | },
|
10245 | end: {
|
10246 | line: 1,
|
10247 | column: 6
|
10248 | }
|
10249 | }
|
10250 | }
|
10251 | ],
|
10252 | loc: {
|
10253 | start: {
|
10254 | line: 1,
|
10255 | column: 0
|
10256 | },
|
10257 | end: {
|
10258 | line: 1,
|
10259 | column: 6
|
10260 | }
|
10261 | }
|
10262 | });
|
10263 |
|
10264 | test("++arguments", {
|
10265 | type: "Program",
|
10266 | body: [
|
10267 | {
|
10268 | type: "ExpressionStatement",
|
10269 | expression: {
|
10270 | type: "UpdateExpression",
|
10271 | operator: "++",
|
10272 | prefix: true,
|
10273 | argument: {
|
10274 | type: "Identifier",
|
10275 | name: "arguments",
|
10276 | loc: {
|
10277 | start: {
|
10278 | line: 1,
|
10279 | column: 2
|
10280 | },
|
10281 | end: {
|
10282 | line: 1,
|
10283 | column: 11
|
10284 | }
|
10285 | }
|
10286 | },
|
10287 | loc: {
|
10288 | start: {
|
10289 | line: 1,
|
10290 | column: 0
|
10291 | },
|
10292 | end: {
|
10293 | line: 1,
|
10294 | column: 11
|
10295 | }
|
10296 | }
|
10297 | },
|
10298 | loc: {
|
10299 | start: {
|
10300 | line: 1,
|
10301 | column: 0
|
10302 | },
|
10303 | end: {
|
10304 | line: 1,
|
10305 | column: 11
|
10306 | }
|
10307 | }
|
10308 | }
|
10309 | ],
|
10310 | loc: {
|
10311 | start: {
|
10312 | line: 1,
|
10313 | column: 0
|
10314 | },
|
10315 | end: {
|
10316 | line: 1,
|
10317 | column: 11
|
10318 | }
|
10319 | }
|
10320 | });
|
10321 |
|
10322 | test("--arguments", {
|
10323 | type: "Program",
|
10324 | body: [
|
10325 | {
|
10326 | type: "ExpressionStatement",
|
10327 | expression: {
|
10328 | type: "UpdateExpression",
|
10329 | operator: "--",
|
10330 | prefix: true,
|
10331 | argument: {
|
10332 | type: "Identifier",
|
10333 | name: "arguments",
|
10334 | loc: {
|
10335 | start: {
|
10336 | line: 1,
|
10337 | column: 2
|
10338 | },
|
10339 | end: {
|
10340 | line: 1,
|
10341 | column: 11
|
10342 | }
|
10343 | }
|
10344 | },
|
10345 | loc: {
|
10346 | start: {
|
10347 | line: 1,
|
10348 | column: 0
|
10349 | },
|
10350 | end: {
|
10351 | line: 1,
|
10352 | column: 11
|
10353 | }
|
10354 | }
|
10355 | },
|
10356 | loc: {
|
10357 | start: {
|
10358 | line: 1,
|
10359 | column: 0
|
10360 | },
|
10361 | end: {
|
10362 | line: 1,
|
10363 | column: 11
|
10364 | }
|
10365 | }
|
10366 | }
|
10367 | ],
|
10368 | loc: {
|
10369 | start: {
|
10370 | line: 1,
|
10371 | column: 0
|
10372 | },
|
10373 | end: {
|
10374 | line: 1,
|
10375 | column: 11
|
10376 | }
|
10377 | }
|
10378 | });
|
10379 |
|
10380 | test("+x", {
|
10381 | type: "Program",
|
10382 | body: [
|
10383 | {
|
10384 | type: "ExpressionStatement",
|
10385 | expression: {
|
10386 | type: "UnaryExpression",
|
10387 | operator: "+",
|
10388 | prefix: true,
|
10389 | argument: {
|
10390 | type: "Identifier",
|
10391 | name: "x",
|
10392 | loc: {
|
10393 | start: {
|
10394 | line: 1,
|
10395 | column: 1
|
10396 | },
|
10397 | end: {
|
10398 | line: 1,
|
10399 | column: 2
|
10400 | }
|
10401 | }
|
10402 | },
|
10403 | loc: {
|
10404 | start: {
|
10405 | line: 1,
|
10406 | column: 0
|
10407 | },
|
10408 | end: {
|
10409 | line: 1,
|
10410 | column: 2
|
10411 | }
|
10412 | }
|
10413 | },
|
10414 | loc: {
|
10415 | start: {
|
10416 | line: 1,
|
10417 | column: 0
|
10418 | },
|
10419 | end: {
|
10420 | line: 1,
|
10421 | column: 2
|
10422 | }
|
10423 | }
|
10424 | }
|
10425 | ],
|
10426 | loc: {
|
10427 | start: {
|
10428 | line: 1,
|
10429 | column: 0
|
10430 | },
|
10431 | end: {
|
10432 | line: 1,
|
10433 | column: 2
|
10434 | }
|
10435 | }
|
10436 | });
|
10437 |
|
10438 | test("-x", {
|
10439 | type: "Program",
|
10440 | body: [
|
10441 | {
|
10442 | type: "ExpressionStatement",
|
10443 | expression: {
|
10444 | type: "UnaryExpression",
|
10445 | operator: "-",
|
10446 | prefix: true,
|
10447 | argument: {
|
10448 | type: "Identifier",
|
10449 | name: "x",
|
10450 | loc: {
|
10451 | start: {
|
10452 | line: 1,
|
10453 | column: 1
|
10454 | },
|
10455 | end: {
|
10456 | line: 1,
|
10457 | column: 2
|
10458 | }
|
10459 | }
|
10460 | },
|
10461 | loc: {
|
10462 | start: {
|
10463 | line: 1,
|
10464 | column: 0
|
10465 | },
|
10466 | end: {
|
10467 | line: 1,
|
10468 | column: 2
|
10469 | }
|
10470 | }
|
10471 | },
|
10472 | loc: {
|
10473 | start: {
|
10474 | line: 1,
|
10475 | column: 0
|
10476 | },
|
10477 | end: {
|
10478 | line: 1,
|
10479 | column: 2
|
10480 | }
|
10481 | }
|
10482 | }
|
10483 | ],
|
10484 | loc: {
|
10485 | start: {
|
10486 | line: 1,
|
10487 | column: 0
|
10488 | },
|
10489 | end: {
|
10490 | line: 1,
|
10491 | column: 2
|
10492 | }
|
10493 | }
|
10494 | });
|
10495 |
|
10496 | test("~x", {
|
10497 | type: "Program",
|
10498 | body: [
|
10499 | {
|
10500 | type: "ExpressionStatement",
|
10501 | expression: {
|
10502 | type: "UnaryExpression",
|
10503 | operator: "~",
|
10504 | prefix: true,
|
10505 | argument: {
|
10506 | type: "Identifier",
|
10507 | name: "x",
|
10508 | loc: {
|
10509 | start: {
|
10510 | line: 1,
|
10511 | column: 1
|
10512 | },
|
10513 | end: {
|
10514 | line: 1,
|
10515 | column: 2
|
10516 | }
|
10517 | }
|
10518 | },
|
10519 | loc: {
|
10520 | start: {
|
10521 | line: 1,
|
10522 | column: 0
|
10523 | },
|
10524 | end: {
|
10525 | line: 1,
|
10526 | column: 2
|
10527 | }
|
10528 | }
|
10529 | },
|
10530 | loc: {
|
10531 | start: {
|
10532 | line: 1,
|
10533 | column: 0
|
10534 | },
|
10535 | end: {
|
10536 | line: 1,
|
10537 | column: 2
|
10538 | }
|
10539 | }
|
10540 | }
|
10541 | ],
|
10542 | loc: {
|
10543 | start: {
|
10544 | line: 1,
|
10545 | column: 0
|
10546 | },
|
10547 | end: {
|
10548 | line: 1,
|
10549 | column: 2
|
10550 | }
|
10551 | }
|
10552 | });
|
10553 |
|
10554 | test("!x", {
|
10555 | type: "Program",
|
10556 | body: [
|
10557 | {
|
10558 | type: "ExpressionStatement",
|
10559 | expression: {
|
10560 | type: "UnaryExpression",
|
10561 | operator: "!",
|
10562 | prefix: true,
|
10563 | argument: {
|
10564 | type: "Identifier",
|
10565 | name: "x",
|
10566 | loc: {
|
10567 | start: {
|
10568 | line: 1,
|
10569 | column: 1
|
10570 | },
|
10571 | end: {
|
10572 | line: 1,
|
10573 | column: 2
|
10574 | }
|
10575 | }
|
10576 | },
|
10577 | loc: {
|
10578 | start: {
|
10579 | line: 1,
|
10580 | column: 0
|
10581 | },
|
10582 | end: {
|
10583 | line: 1,
|
10584 | column: 2
|
10585 | }
|
10586 | }
|
10587 | },
|
10588 | loc: {
|
10589 | start: {
|
10590 | line: 1,
|
10591 | column: 0
|
10592 | },
|
10593 | end: {
|
10594 | line: 1,
|
10595 | column: 2
|
10596 | }
|
10597 | }
|
10598 | }
|
10599 | ],
|
10600 | loc: {
|
10601 | start: {
|
10602 | line: 1,
|
10603 | column: 0
|
10604 | },
|
10605 | end: {
|
10606 | line: 1,
|
10607 | column: 2
|
10608 | }
|
10609 | }
|
10610 | });
|
10611 |
|
10612 | test("void x", {
|
10613 | type: "Program",
|
10614 | body: [
|
10615 | {
|
10616 | type: "ExpressionStatement",
|
10617 | expression: {
|
10618 | type: "UnaryExpression",
|
10619 | operator: "void",
|
10620 | prefix: true,
|
10621 | argument: {
|
10622 | type: "Identifier",
|
10623 | name: "x",
|
10624 | loc: {
|
10625 | start: {
|
10626 | line: 1,
|
10627 | column: 5
|
10628 | },
|
10629 | end: {
|
10630 | line: 1,
|
10631 | column: 6
|
10632 | }
|
10633 | }
|
10634 | },
|
10635 | loc: {
|
10636 | start: {
|
10637 | line: 1,
|
10638 | column: 0
|
10639 | },
|
10640 | end: {
|
10641 | line: 1,
|
10642 | column: 6
|
10643 | }
|
10644 | }
|
10645 | },
|
10646 | loc: {
|
10647 | start: {
|
10648 | line: 1,
|
10649 | column: 0
|
10650 | },
|
10651 | end: {
|
10652 | line: 1,
|
10653 | column: 6
|
10654 | }
|
10655 | }
|
10656 | }
|
10657 | ],
|
10658 | loc: {
|
10659 | start: {
|
10660 | line: 1,
|
10661 | column: 0
|
10662 | },
|
10663 | end: {
|
10664 | line: 1,
|
10665 | column: 6
|
10666 | }
|
10667 | }
|
10668 | });
|
10669 |
|
10670 | test("delete x", {
|
10671 | type: "Program",
|
10672 | body: [
|
10673 | {
|
10674 | type: "ExpressionStatement",
|
10675 | expression: {
|
10676 | type: "UnaryExpression",
|
10677 | operator: "delete",
|
10678 | prefix: true,
|
10679 | argument: {
|
10680 | type: "Identifier",
|
10681 | name: "x",
|
10682 | loc: {
|
10683 | start: {
|
10684 | line: 1,
|
10685 | column: 7
|
10686 | },
|
10687 | end: {
|
10688 | line: 1,
|
10689 | column: 8
|
10690 | }
|
10691 | }
|
10692 | },
|
10693 | loc: {
|
10694 | start: {
|
10695 | line: 1,
|
10696 | column: 0
|
10697 | },
|
10698 | end: {
|
10699 | line: 1,
|
10700 | column: 8
|
10701 | }
|
10702 | }
|
10703 | },
|
10704 | loc: {
|
10705 | start: {
|
10706 | line: 1,
|
10707 | column: 0
|
10708 | },
|
10709 | end: {
|
10710 | line: 1,
|
10711 | column: 8
|
10712 | }
|
10713 | }
|
10714 | }
|
10715 | ],
|
10716 | loc: {
|
10717 | start: {
|
10718 | line: 1,
|
10719 | column: 0
|
10720 | },
|
10721 | end: {
|
10722 | line: 1,
|
10723 | column: 8
|
10724 | }
|
10725 | }
|
10726 | });
|
10727 |
|
10728 | test("typeof x", {
|
10729 | type: "Program",
|
10730 | body: [
|
10731 | {
|
10732 | type: "ExpressionStatement",
|
10733 | expression: {
|
10734 | type: "UnaryExpression",
|
10735 | operator: "typeof",
|
10736 | prefix: true,
|
10737 | argument: {
|
10738 | type: "Identifier",
|
10739 | name: "x",
|
10740 | loc: {
|
10741 | start: {
|
10742 | line: 1,
|
10743 | column: 7
|
10744 | },
|
10745 | end: {
|
10746 | line: 1,
|
10747 | column: 8
|
10748 | }
|
10749 | }
|
10750 | },
|
10751 | loc: {
|
10752 | start: {
|
10753 | line: 1,
|
10754 | column: 0
|
10755 | },
|
10756 | end: {
|
10757 | line: 1,
|
10758 | column: 8
|
10759 | }
|
10760 | }
|
10761 | },
|
10762 | loc: {
|
10763 | start: {
|
10764 | line: 1,
|
10765 | column: 0
|
10766 | },
|
10767 | end: {
|
10768 | line: 1,
|
10769 | column: 8
|
10770 | }
|
10771 | }
|
10772 | }
|
10773 | ],
|
10774 | loc: {
|
10775 | start: {
|
10776 | line: 1,
|
10777 | column: 0
|
10778 | },
|
10779 | end: {
|
10780 | line: 1,
|
10781 | column: 8
|
10782 | }
|
10783 | }
|
10784 | });
|
10785 |
|
10786 | test("x * y", {
|
10787 | type: "Program",
|
10788 | body: [
|
10789 | {
|
10790 | type: "ExpressionStatement",
|
10791 | expression: {
|
10792 | type: "BinaryExpression",
|
10793 | left: {
|
10794 | type: "Identifier",
|
10795 | name: "x",
|
10796 | loc: {
|
10797 | start: {
|
10798 | line: 1,
|
10799 | column: 0
|
10800 | },
|
10801 | end: {
|
10802 | line: 1,
|
10803 | column: 1
|
10804 | }
|
10805 | }
|
10806 | },
|
10807 | operator: "*",
|
10808 | right: {
|
10809 | type: "Identifier",
|
10810 | name: "y",
|
10811 | loc: {
|
10812 | start: {
|
10813 | line: 1,
|
10814 | column: 4
|
10815 | },
|
10816 | end: {
|
10817 | line: 1,
|
10818 | column: 5
|
10819 | }
|
10820 | }
|
10821 | },
|
10822 | loc: {
|
10823 | start: {
|
10824 | line: 1,
|
10825 | column: 0
|
10826 | },
|
10827 | end: {
|
10828 | line: 1,
|
10829 | column: 5
|
10830 | }
|
10831 | }
|
10832 | },
|
10833 | loc: {
|
10834 | start: {
|
10835 | line: 1,
|
10836 | column: 0
|
10837 | },
|
10838 | end: {
|
10839 | line: 1,
|
10840 | column: 5
|
10841 | }
|
10842 | }
|
10843 | }
|
10844 | ],
|
10845 | loc: {
|
10846 | start: {
|
10847 | line: 1,
|
10848 | column: 0
|
10849 | },
|
10850 | end: {
|
10851 | line: 1,
|
10852 | column: 5
|
10853 | }
|
10854 | }
|
10855 | });
|
10856 |
|
10857 | test("x / y", {
|
10858 | type: "Program",
|
10859 | body: [
|
10860 | {
|
10861 | type: "ExpressionStatement",
|
10862 | expression: {
|
10863 | type: "BinaryExpression",
|
10864 | left: {
|
10865 | type: "Identifier",
|
10866 | name: "x",
|
10867 | loc: {
|
10868 | start: {
|
10869 | line: 1,
|
10870 | column: 0
|
10871 | },
|
10872 | end: {
|
10873 | line: 1,
|
10874 | column: 1
|
10875 | }
|
10876 | }
|
10877 | },
|
10878 | operator: "/",
|
10879 | right: {
|
10880 | type: "Identifier",
|
10881 | name: "y",
|
10882 | loc: {
|
10883 | start: {
|
10884 | line: 1,
|
10885 | column: 4
|
10886 | },
|
10887 | end: {
|
10888 | line: 1,
|
10889 | column: 5
|
10890 | }
|
10891 | }
|
10892 | },
|
10893 | loc: {
|
10894 | start: {
|
10895 | line: 1,
|
10896 | column: 0
|
10897 | },
|
10898 | end: {
|
10899 | line: 1,
|
10900 | column: 5
|
10901 | }
|
10902 | }
|
10903 | },
|
10904 | loc: {
|
10905 | start: {
|
10906 | line: 1,
|
10907 | column: 0
|
10908 | },
|
10909 | end: {
|
10910 | line: 1,
|
10911 | column: 5
|
10912 | }
|
10913 | }
|
10914 | }
|
10915 | ],
|
10916 | loc: {
|
10917 | start: {
|
10918 | line: 1,
|
10919 | column: 0
|
10920 | },
|
10921 | end: {
|
10922 | line: 1,
|
10923 | column: 5
|
10924 | }
|
10925 | }
|
10926 | });
|
10927 |
|
10928 | test("x % y", {
|
10929 | type: "Program",
|
10930 | body: [
|
10931 | {
|
10932 | type: "ExpressionStatement",
|
10933 | expression: {
|
10934 | type: "BinaryExpression",
|
10935 | left: {
|
10936 | type: "Identifier",
|
10937 | name: "x",
|
10938 | loc: {
|
10939 | start: {
|
10940 | line: 1,
|
10941 | column: 0
|
10942 | },
|
10943 | end: {
|
10944 | line: 1,
|
10945 | column: 1
|
10946 | }
|
10947 | }
|
10948 | },
|
10949 | operator: "%",
|
10950 | right: {
|
10951 | type: "Identifier",
|
10952 | name: "y",
|
10953 | loc: {
|
10954 | start: {
|
10955 | line: 1,
|
10956 | column: 4
|
10957 | },
|
10958 | end: {
|
10959 | line: 1,
|
10960 | column: 5
|
10961 | }
|
10962 | }
|
10963 | },
|
10964 | loc: {
|
10965 | start: {
|
10966 | line: 1,
|
10967 | column: 0
|
10968 | },
|
10969 | end: {
|
10970 | line: 1,
|
10971 | column: 5
|
10972 | }
|
10973 | }
|
10974 | },
|
10975 | loc: {
|
10976 | start: {
|
10977 | line: 1,
|
10978 | column: 0
|
10979 | },
|
10980 | end: {
|
10981 | line: 1,
|
10982 | column: 5
|
10983 | }
|
10984 | }
|
10985 | }
|
10986 | ],
|
10987 | loc: {
|
10988 | start: {
|
10989 | line: 1,
|
10990 | column: 0
|
10991 | },
|
10992 | end: {
|
10993 | line: 1,
|
10994 | column: 5
|
10995 | }
|
10996 | }
|
10997 | });
|
10998 |
|
10999 | test("x + y", {
|
11000 | type: "Program",
|
11001 | body: [
|
11002 | {
|
11003 | type: "ExpressionStatement",
|
11004 | expression: {
|
11005 | type: "BinaryExpression",
|
11006 | left: {
|
11007 | type: "Identifier",
|
11008 | name: "x",
|
11009 | loc: {
|
11010 | start: {
|
11011 | line: 1,
|
11012 | column: 0
|
11013 | },
|
11014 | end: {
|
11015 | line: 1,
|
11016 | column: 1
|
11017 | }
|
11018 | }
|
11019 | },
|
11020 | operator: "+",
|
11021 | right: {
|
11022 | type: "Identifier",
|
11023 | name: "y",
|
11024 | loc: {
|
11025 | start: {
|
11026 | line: 1,
|
11027 | column: 4
|
11028 | },
|
11029 | end: {
|
11030 | line: 1,
|
11031 | column: 5
|
11032 | }
|
11033 | }
|
11034 | },
|
11035 | loc: {
|
11036 | start: {
|
11037 | line: 1,
|
11038 | column: 0
|
11039 | },
|
11040 | end: {
|
11041 | line: 1,
|
11042 | column: 5
|
11043 | }
|
11044 | }
|
11045 | },
|
11046 | loc: {
|
11047 | start: {
|
11048 | line: 1,
|
11049 | column: 0
|
11050 | },
|
11051 | end: {
|
11052 | line: 1,
|
11053 | column: 5
|
11054 | }
|
11055 | }
|
11056 | }
|
11057 | ],
|
11058 | loc: {
|
11059 | start: {
|
11060 | line: 1,
|
11061 | column: 0
|
11062 | },
|
11063 | end: {
|
11064 | line: 1,
|
11065 | column: 5
|
11066 | }
|
11067 | }
|
11068 | });
|
11069 |
|
11070 | test("x - y", {
|
11071 | type: "Program",
|
11072 | body: [
|
11073 | {
|
11074 | type: "ExpressionStatement",
|
11075 | expression: {
|
11076 | type: "BinaryExpression",
|
11077 | left: {
|
11078 | type: "Identifier",
|
11079 | name: "x",
|
11080 | loc: {
|
11081 | start: {
|
11082 | line: 1,
|
11083 | column: 0
|
11084 | },
|
11085 | end: {
|
11086 | line: 1,
|
11087 | column: 1
|
11088 | }
|
11089 | }
|
11090 | },
|
11091 | operator: "-",
|
11092 | right: {
|
11093 | type: "Identifier",
|
11094 | name: "y",
|
11095 | loc: {
|
11096 | start: {
|
11097 | line: 1,
|
11098 | column: 4
|
11099 | },
|
11100 | end: {
|
11101 | line: 1,
|
11102 | column: 5
|
11103 | }
|
11104 | }
|
11105 | },
|
11106 | loc: {
|
11107 | start: {
|
11108 | line: 1,
|
11109 | column: 0
|
11110 | },
|
11111 | end: {
|
11112 | line: 1,
|
11113 | column: 5
|
11114 | }
|
11115 | }
|
11116 | },
|
11117 | loc: {
|
11118 | start: {
|
11119 | line: 1,
|
11120 | column: 0
|
11121 | },
|
11122 | end: {
|
11123 | line: 1,
|
11124 | column: 5
|
11125 | }
|
11126 | }
|
11127 | }
|
11128 | ],
|
11129 | loc: {
|
11130 | start: {
|
11131 | line: 1,
|
11132 | column: 0
|
11133 | },
|
11134 | end: {
|
11135 | line: 1,
|
11136 | column: 5
|
11137 | }
|
11138 | }
|
11139 | });
|
11140 |
|
11141 | test("x << y", {
|
11142 | type: "Program",
|
11143 | body: [
|
11144 | {
|
11145 | type: "ExpressionStatement",
|
11146 | expression: {
|
11147 | type: "BinaryExpression",
|
11148 | left: {
|
11149 | type: "Identifier",
|
11150 | name: "x",
|
11151 | loc: {
|
11152 | start: {
|
11153 | line: 1,
|
11154 | column: 0
|
11155 | },
|
11156 | end: {
|
11157 | line: 1,
|
11158 | column: 1
|
11159 | }
|
11160 | }
|
11161 | },
|
11162 | operator: "<<",
|
11163 | right: {
|
11164 | type: "Identifier",
|
11165 | name: "y",
|
11166 | loc: {
|
11167 | start: {
|
11168 | line: 1,
|
11169 | column: 5
|
11170 | },
|
11171 | end: {
|
11172 | line: 1,
|
11173 | column: 6
|
11174 | }
|
11175 | }
|
11176 | },
|
11177 | loc: {
|
11178 | start: {
|
11179 | line: 1,
|
11180 | column: 0
|
11181 | },
|
11182 | end: {
|
11183 | line: 1,
|
11184 | column: 6
|
11185 | }
|
11186 | }
|
11187 | },
|
11188 | loc: {
|
11189 | start: {
|
11190 | line: 1,
|
11191 | column: 0
|
11192 | },
|
11193 | end: {
|
11194 | line: 1,
|
11195 | column: 6
|
11196 | }
|
11197 | }
|
11198 | }
|
11199 | ],
|
11200 | loc: {
|
11201 | start: {
|
11202 | line: 1,
|
11203 | column: 0
|
11204 | },
|
11205 | end: {
|
11206 | line: 1,
|
11207 | column: 6
|
11208 | }
|
11209 | }
|
11210 | });
|
11211 |
|
11212 | test("x >> y", {
|
11213 | type: "Program",
|
11214 | body: [
|
11215 | {
|
11216 | type: "ExpressionStatement",
|
11217 | expression: {
|
11218 | type: "BinaryExpression",
|
11219 | left: {
|
11220 | type: "Identifier",
|
11221 | name: "x",
|
11222 | loc: {
|
11223 | start: {
|
11224 | line: 1,
|
11225 | column: 0
|
11226 | },
|
11227 | end: {
|
11228 | line: 1,
|
11229 | column: 1
|
11230 | }
|
11231 | }
|
11232 | },
|
11233 | operator: ">>",
|
11234 | right: {
|
11235 | type: "Identifier",
|
11236 | name: "y",
|
11237 | loc: {
|
11238 | start: {
|
11239 | line: 1,
|
11240 | column: 5
|
11241 | },
|
11242 | end: {
|
11243 | line: 1,
|
11244 | column: 6
|
11245 | }
|
11246 | }
|
11247 | },
|
11248 | loc: {
|
11249 | start: {
|
11250 | line: 1,
|
11251 | column: 0
|
11252 | },
|
11253 | end: {
|
11254 | line: 1,
|
11255 | column: 6
|
11256 | }
|
11257 | }
|
11258 | },
|
11259 | loc: {
|
11260 | start: {
|
11261 | line: 1,
|
11262 | column: 0
|
11263 | },
|
11264 | end: {
|
11265 | line: 1,
|
11266 | column: 6
|
11267 | }
|
11268 | }
|
11269 | }
|
11270 | ],
|
11271 | loc: {
|
11272 | start: {
|
11273 | line: 1,
|
11274 | column: 0
|
11275 | },
|
11276 | end: {
|
11277 | line: 1,
|
11278 | column: 6
|
11279 | }
|
11280 | }
|
11281 | });
|
11282 |
|
11283 | test("x >>> y", {
|
11284 | type: "Program",
|
11285 | body: [
|
11286 | {
|
11287 | type: "ExpressionStatement",
|
11288 | expression: {
|
11289 | type: "BinaryExpression",
|
11290 | left: {
|
11291 | type: "Identifier",
|
11292 | name: "x",
|
11293 | loc: {
|
11294 | start: {
|
11295 | line: 1,
|
11296 | column: 0
|
11297 | },
|
11298 | end: {
|
11299 | line: 1,
|
11300 | column: 1
|
11301 | }
|
11302 | }
|
11303 | },
|
11304 | operator: ">>>",
|
11305 | right: {
|
11306 | type: "Identifier",
|
11307 | name: "y",
|
11308 | loc: {
|
11309 | start: {
|
11310 | line: 1,
|
11311 | column: 6
|
11312 | },
|
11313 | end: {
|
11314 | line: 1,
|
11315 | column: 7
|
11316 | }
|
11317 | }
|
11318 | },
|
11319 | loc: {
|
11320 | start: {
|
11321 | line: 1,
|
11322 | column: 0
|
11323 | },
|
11324 | end: {
|
11325 | line: 1,
|
11326 | column: 7
|
11327 | }
|
11328 | }
|
11329 | },
|
11330 | loc: {
|
11331 | start: {
|
11332 | line: 1,
|
11333 | column: 0
|
11334 | },
|
11335 | end: {
|
11336 | line: 1,
|
11337 | column: 7
|
11338 | }
|
11339 | }
|
11340 | }
|
11341 | ],
|
11342 | loc: {
|
11343 | start: {
|
11344 | line: 1,
|
11345 | column: 0
|
11346 | },
|
11347 | end: {
|
11348 | line: 1,
|
11349 | column: 7
|
11350 | }
|
11351 | }
|
11352 | });
|
11353 |
|
11354 | test("x < y", {
|
11355 | type: "Program",
|
11356 | body: [
|
11357 | {
|
11358 | type: "ExpressionStatement",
|
11359 | expression: {
|
11360 | type: "BinaryExpression",
|
11361 | left: {
|
11362 | type: "Identifier",
|
11363 | name: "x",
|
11364 | loc: {
|
11365 | start: {
|
11366 | line: 1,
|
11367 | column: 0
|
11368 | },
|
11369 | end: {
|
11370 | line: 1,
|
11371 | column: 1
|
11372 | }
|
11373 | }
|
11374 | },
|
11375 | operator: "<",
|
11376 | right: {
|
11377 | type: "Identifier",
|
11378 | name: "y",
|
11379 | loc: {
|
11380 | start: {
|
11381 | line: 1,
|
11382 | column: 4
|
11383 | },
|
11384 | end: {
|
11385 | line: 1,
|
11386 | column: 5
|
11387 | }
|
11388 | }
|
11389 | },
|
11390 | loc: {
|
11391 | start: {
|
11392 | line: 1,
|
11393 | column: 0
|
11394 | },
|
11395 | end: {
|
11396 | line: 1,
|
11397 | column: 5
|
11398 | }
|
11399 | }
|
11400 | },
|
11401 | loc: {
|
11402 | start: {
|
11403 | line: 1,
|
11404 | column: 0
|
11405 | },
|
11406 | end: {
|
11407 | line: 1,
|
11408 | column: 5
|
11409 | }
|
11410 | }
|
11411 | }
|
11412 | ],
|
11413 | loc: {
|
11414 | start: {
|
11415 | line: 1,
|
11416 | column: 0
|
11417 | },
|
11418 | end: {
|
11419 | line: 1,
|
11420 | column: 5
|
11421 | }
|
11422 | }
|
11423 | });
|
11424 |
|
11425 | test("x > y", {
|
11426 | type: "Program",
|
11427 | body: [
|
11428 | {
|
11429 | type: "ExpressionStatement",
|
11430 | expression: {
|
11431 | type: "BinaryExpression",
|
11432 | left: {
|
11433 | type: "Identifier",
|
11434 | name: "x",
|
11435 | loc: {
|
11436 | start: {
|
11437 | line: 1,
|
11438 | column: 0
|
11439 | },
|
11440 | end: {
|
11441 | line: 1,
|
11442 | column: 1
|
11443 | }
|
11444 | }
|
11445 | },
|
11446 | operator: ">",
|
11447 | right: {
|
11448 | type: "Identifier",
|
11449 | name: "y",
|
11450 | loc: {
|
11451 | start: {
|
11452 | line: 1,
|
11453 | column: 4
|
11454 | },
|
11455 | end: {
|
11456 | line: 1,
|
11457 | column: 5
|
11458 | }
|
11459 | }
|
11460 | },
|
11461 | loc: {
|
11462 | start: {
|
11463 | line: 1,
|
11464 | column: 0
|
11465 | },
|
11466 | end: {
|
11467 | line: 1,
|
11468 | column: 5
|
11469 | }
|
11470 | }
|
11471 | },
|
11472 | loc: {
|
11473 | start: {
|
11474 | line: 1,
|
11475 | column: 0
|
11476 | },
|
11477 | end: {
|
11478 | line: 1,
|
11479 | column: 5
|
11480 | }
|
11481 | }
|
11482 | }
|
11483 | ],
|
11484 | loc: {
|
11485 | start: {
|
11486 | line: 1,
|
11487 | column: 0
|
11488 | },
|
11489 | end: {
|
11490 | line: 1,
|
11491 | column: 5
|
11492 | }
|
11493 | }
|
11494 | });
|
11495 |
|
11496 | test("x <= y", {
|
11497 | type: "Program",
|
11498 | body: [
|
11499 | {
|
11500 | type: "ExpressionStatement",
|
11501 | expression: {
|
11502 | type: "BinaryExpression",
|
11503 | left: {
|
11504 | type: "Identifier",
|
11505 | name: "x",
|
11506 | loc: {
|
11507 | start: {
|
11508 | line: 1,
|
11509 | column: 0
|
11510 | },
|
11511 | end: {
|
11512 | line: 1,
|
11513 | column: 1
|
11514 | }
|
11515 | }
|
11516 | },
|
11517 | operator: "<=",
|
11518 | right: {
|
11519 | type: "Identifier",
|
11520 | name: "y",
|
11521 | loc: {
|
11522 | start: {
|
11523 | line: 1,
|
11524 | column: 5
|
11525 | },
|
11526 | end: {
|
11527 | line: 1,
|
11528 | column: 6
|
11529 | }
|
11530 | }
|
11531 | },
|
11532 | loc: {
|
11533 | start: {
|
11534 | line: 1,
|
11535 | column: 0
|
11536 | },
|
11537 | end: {
|
11538 | line: 1,
|
11539 | column: 6
|
11540 | }
|
11541 | }
|
11542 | },
|
11543 | loc: {
|
11544 | start: {
|
11545 | line: 1,
|
11546 | column: 0
|
11547 | },
|
11548 | end: {
|
11549 | line: 1,
|
11550 | column: 6
|
11551 | }
|
11552 | }
|
11553 | }
|
11554 | ],
|
11555 | loc: {
|
11556 | start: {
|
11557 | line: 1,
|
11558 | column: 0
|
11559 | },
|
11560 | end: {
|
11561 | line: 1,
|
11562 | column: 6
|
11563 | }
|
11564 | }
|
11565 | });
|
11566 |
|
11567 | test("x >= y", {
|
11568 | type: "Program",
|
11569 | body: [
|
11570 | {
|
11571 | type: "ExpressionStatement",
|
11572 | expression: {
|
11573 | type: "BinaryExpression",
|
11574 | left: {
|
11575 | type: "Identifier",
|
11576 | name: "x",
|
11577 | loc: {
|
11578 | start: {
|
11579 | line: 1,
|
11580 | column: 0
|
11581 | },
|
11582 | end: {
|
11583 | line: 1,
|
11584 | column: 1
|
11585 | }
|
11586 | }
|
11587 | },
|
11588 | operator: ">=",
|
11589 | right: {
|
11590 | type: "Identifier",
|
11591 | name: "y",
|
11592 | loc: {
|
11593 | start: {
|
11594 | line: 1,
|
11595 | column: 5
|
11596 | },
|
11597 | end: {
|
11598 | line: 1,
|
11599 | column: 6
|
11600 | }
|
11601 | }
|
11602 | },
|
11603 | loc: {
|
11604 | start: {
|
11605 | line: 1,
|
11606 | column: 0
|
11607 | },
|
11608 | end: {
|
11609 | line: 1,
|
11610 | column: 6
|
11611 | }
|
11612 | }
|
11613 | },
|
11614 | loc: {
|
11615 | start: {
|
11616 | line: 1,
|
11617 | column: 0
|
11618 | },
|
11619 | end: {
|
11620 | line: 1,
|
11621 | column: 6
|
11622 | }
|
11623 | }
|
11624 | }
|
11625 | ],
|
11626 | loc: {
|
11627 | start: {
|
11628 | line: 1,
|
11629 | column: 0
|
11630 | },
|
11631 | end: {
|
11632 | line: 1,
|
11633 | column: 6
|
11634 | }
|
11635 | }
|
11636 | });
|
11637 |
|
11638 | test("x in y", {
|
11639 | type: "Program",
|
11640 | body: [
|
11641 | {
|
11642 | type: "ExpressionStatement",
|
11643 | expression: {
|
11644 | type: "BinaryExpression",
|
11645 | left: {
|
11646 | type: "Identifier",
|
11647 | name: "x",
|
11648 | loc: {
|
11649 | start: {
|
11650 | line: 1,
|
11651 | column: 0
|
11652 | },
|
11653 | end: {
|
11654 | line: 1,
|
11655 | column: 1
|
11656 | }
|
11657 | }
|
11658 | },
|
11659 | operator: "in",
|
11660 | right: {
|
11661 | type: "Identifier",
|
11662 | name: "y",
|
11663 | loc: {
|
11664 | start: {
|
11665 | line: 1,
|
11666 | column: 5
|
11667 | },
|
11668 | end: {
|
11669 | line: 1,
|
11670 | column: 6
|
11671 | }
|
11672 | }
|
11673 | },
|
11674 | loc: {
|
11675 | start: {
|
11676 | line: 1,
|
11677 | column: 0
|
11678 | },
|
11679 | end: {
|
11680 | line: 1,
|
11681 | column: 6
|
11682 | }
|
11683 | }
|
11684 | },
|
11685 | loc: {
|
11686 | start: {
|
11687 | line: 1,
|
11688 | column: 0
|
11689 | },
|
11690 | end: {
|
11691 | line: 1,
|
11692 | column: 6
|
11693 | }
|
11694 | }
|
11695 | }
|
11696 | ],
|
11697 | loc: {
|
11698 | start: {
|
11699 | line: 1,
|
11700 | column: 0
|
11701 | },
|
11702 | end: {
|
11703 | line: 1,
|
11704 | column: 6
|
11705 | }
|
11706 | }
|
11707 | });
|
11708 |
|
11709 | test("x instanceof y", {
|
11710 | type: "Program",
|
11711 | body: [
|
11712 | {
|
11713 | type: "ExpressionStatement",
|
11714 | expression: {
|
11715 | type: "BinaryExpression",
|
11716 | left: {
|
11717 | type: "Identifier",
|
11718 | name: "x",
|
11719 | loc: {
|
11720 | start: {
|
11721 | line: 1,
|
11722 | column: 0
|
11723 | },
|
11724 | end: {
|
11725 | line: 1,
|
11726 | column: 1
|
11727 | }
|
11728 | }
|
11729 | },
|
11730 | operator: "instanceof",
|
11731 | right: {
|
11732 | type: "Identifier",
|
11733 | name: "y",
|
11734 | loc: {
|
11735 | start: {
|
11736 | line: 1,
|
11737 | column: 13
|
11738 | },
|
11739 | end: {
|
11740 | line: 1,
|
11741 | column: 14
|
11742 | }
|
11743 | }
|
11744 | },
|
11745 | loc: {
|
11746 | start: {
|
11747 | line: 1,
|
11748 | column: 0
|
11749 | },
|
11750 | end: {
|
11751 | line: 1,
|
11752 | column: 14
|
11753 | }
|
11754 | }
|
11755 | },
|
11756 | loc: {
|
11757 | start: {
|
11758 | line: 1,
|
11759 | column: 0
|
11760 | },
|
11761 | end: {
|
11762 | line: 1,
|
11763 | column: 14
|
11764 | }
|
11765 | }
|
11766 | }
|
11767 | ],
|
11768 | loc: {
|
11769 | start: {
|
11770 | line: 1,
|
11771 | column: 0
|
11772 | },
|
11773 | end: {
|
11774 | line: 1,
|
11775 | column: 14
|
11776 | }
|
11777 | }
|
11778 | });
|
11779 |
|
11780 | test("x < y < z", {
|
11781 | type: "Program",
|
11782 | body: [
|
11783 | {
|
11784 | type: "ExpressionStatement",
|
11785 | expression: {
|
11786 | type: "BinaryExpression",
|
11787 | left: {
|
11788 | type: "BinaryExpression",
|
11789 | left: {
|
11790 | type: "Identifier",
|
11791 | name: "x",
|
11792 | loc: {
|
11793 | start: {
|
11794 | line: 1,
|
11795 | column: 0
|
11796 | },
|
11797 | end: {
|
11798 | line: 1,
|
11799 | column: 1
|
11800 | }
|
11801 | }
|
11802 | },
|
11803 | operator: "<",
|
11804 | right: {
|
11805 | type: "Identifier",
|
11806 | name: "y",
|
11807 | loc: {
|
11808 | start: {
|
11809 | line: 1,
|
11810 | column: 4
|
11811 | },
|
11812 | end: {
|
11813 | line: 1,
|
11814 | column: 5
|
11815 | }
|
11816 | }
|
11817 | },
|
11818 | loc: {
|
11819 | start: {
|
11820 | line: 1,
|
11821 | column: 0
|
11822 | },
|
11823 | end: {
|
11824 | line: 1,
|
11825 | column: 5
|
11826 | }
|
11827 | }
|
11828 | },
|
11829 | operator: "<",
|
11830 | right: {
|
11831 | type: "Identifier",
|
11832 | name: "z",
|
11833 | loc: {
|
11834 | start: {
|
11835 | line: 1,
|
11836 | column: 8
|
11837 | },
|
11838 | end: {
|
11839 | line: 1,
|
11840 | column: 9
|
11841 | }
|
11842 | }
|
11843 | },
|
11844 | loc: {
|
11845 | start: {
|
11846 | line: 1,
|
11847 | column: 0
|
11848 | },
|
11849 | end: {
|
11850 | line: 1,
|
11851 | column: 9
|
11852 | }
|
11853 | }
|
11854 | },
|
11855 | loc: {
|
11856 | start: {
|
11857 | line: 1,
|
11858 | column: 0
|
11859 | },
|
11860 | end: {
|
11861 | line: 1,
|
11862 | column: 9
|
11863 | }
|
11864 | }
|
11865 | }
|
11866 | ],
|
11867 | loc: {
|
11868 | start: {
|
11869 | line: 1,
|
11870 | column: 0
|
11871 | },
|
11872 | end: {
|
11873 | line: 1,
|
11874 | column: 9
|
11875 | }
|
11876 | }
|
11877 | });
|
11878 |
|
11879 | test("x == y", {
|
11880 | type: "Program",
|
11881 | body: [
|
11882 | {
|
11883 | type: "ExpressionStatement",
|
11884 | expression: {
|
11885 | type: "BinaryExpression",
|
11886 | left: {
|
11887 | type: "Identifier",
|
11888 | name: "x",
|
11889 | loc: {
|
11890 | start: {
|
11891 | line: 1,
|
11892 | column: 0
|
11893 | },
|
11894 | end: {
|
11895 | line: 1,
|
11896 | column: 1
|
11897 | }
|
11898 | }
|
11899 | },
|
11900 | operator: "==",
|
11901 | right: {
|
11902 | type: "Identifier",
|
11903 | name: "y",
|
11904 | loc: {
|
11905 | start: {
|
11906 | line: 1,
|
11907 | column: 5
|
11908 | },
|
11909 | end: {
|
11910 | line: 1,
|
11911 | column: 6
|
11912 | }
|
11913 | }
|
11914 | },
|
11915 | loc: {
|
11916 | start: {
|
11917 | line: 1,
|
11918 | column: 0
|
11919 | },
|
11920 | end: {
|
11921 | line: 1,
|
11922 | column: 6
|
11923 | }
|
11924 | }
|
11925 | },
|
11926 | loc: {
|
11927 | start: {
|
11928 | line: 1,
|
11929 | column: 0
|
11930 | },
|
11931 | end: {
|
11932 | line: 1,
|
11933 | column: 6
|
11934 | }
|
11935 | }
|
11936 | }
|
11937 | ],
|
11938 | loc: {
|
11939 | start: {
|
11940 | line: 1,
|
11941 | column: 0
|
11942 | },
|
11943 | end: {
|
11944 | line: 1,
|
11945 | column: 6
|
11946 | }
|
11947 | }
|
11948 | });
|
11949 |
|
11950 | test("x != y", {
|
11951 | type: "Program",
|
11952 | body: [
|
11953 | {
|
11954 | type: "ExpressionStatement",
|
11955 | expression: {
|
11956 | type: "BinaryExpression",
|
11957 | left: {
|
11958 | type: "Identifier",
|
11959 | name: "x",
|
11960 | loc: {
|
11961 | start: {
|
11962 | line: 1,
|
11963 | column: 0
|
11964 | },
|
11965 | end: {
|
11966 | line: 1,
|
11967 | column: 1
|
11968 | }
|
11969 | }
|
11970 | },
|
11971 | operator: "!=",
|
11972 | right: {
|
11973 | type: "Identifier",
|
11974 | name: "y",
|
11975 | loc: {
|
11976 | start: {
|
11977 | line: 1,
|
11978 | column: 5
|
11979 | },
|
11980 | end: {
|
11981 | line: 1,
|
11982 | column: 6
|
11983 | }
|
11984 | }
|
11985 | },
|
11986 | loc: {
|
11987 | start: {
|
11988 | line: 1,
|
11989 | column: 0
|
11990 | },
|
11991 | end: {
|
11992 | line: 1,
|
11993 | column: 6
|
11994 | }
|
11995 | }
|
11996 | },
|
11997 | loc: {
|
11998 | start: {
|
11999 | line: 1,
|
12000 | column: 0
|
12001 | },
|
12002 | end: {
|
12003 | line: 1,
|
12004 | column: 6
|
12005 | }
|
12006 | }
|
12007 | }
|
12008 | ],
|
12009 | loc: {
|
12010 | start: {
|
12011 | line: 1,
|
12012 | column: 0
|
12013 | },
|
12014 | end: {
|
12015 | line: 1,
|
12016 | column: 6
|
12017 | }
|
12018 | }
|
12019 | });
|
12020 |
|
12021 | test("x === y", {
|
12022 | type: "Program",
|
12023 | body: [
|
12024 | {
|
12025 | type: "ExpressionStatement",
|
12026 | expression: {
|
12027 | type: "BinaryExpression",
|
12028 | left: {
|
12029 | type: "Identifier",
|
12030 | name: "x",
|
12031 | loc: {
|
12032 | start: {
|
12033 | line: 1,
|
12034 | column: 0
|
12035 | },
|
12036 | end: {
|
12037 | line: 1,
|
12038 | column: 1
|
12039 | }
|
12040 | }
|
12041 | },
|
12042 | operator: "===",
|
12043 | right: {
|
12044 | type: "Identifier",
|
12045 | name: "y",
|
12046 | loc: {
|
12047 | start: {
|
12048 | line: 1,
|
12049 | column: 6
|
12050 | },
|
12051 | end: {
|
12052 | line: 1,
|
12053 | column: 7
|
12054 | }
|
12055 | }
|
12056 | },
|
12057 | loc: {
|
12058 | start: {
|
12059 | line: 1,
|
12060 | column: 0
|
12061 | },
|
12062 | end: {
|
12063 | line: 1,
|
12064 | column: 7
|
12065 | }
|
12066 | }
|
12067 | },
|
12068 | loc: {
|
12069 | start: {
|
12070 | line: 1,
|
12071 | column: 0
|
12072 | },
|
12073 | end: {
|
12074 | line: 1,
|
12075 | column: 7
|
12076 | }
|
12077 | }
|
12078 | }
|
12079 | ],
|
12080 | loc: {
|
12081 | start: {
|
12082 | line: 1,
|
12083 | column: 0
|
12084 | },
|
12085 | end: {
|
12086 | line: 1,
|
12087 | column: 7
|
12088 | }
|
12089 | }
|
12090 | });
|
12091 |
|
12092 | test("x !== y", {
|
12093 | type: "Program",
|
12094 | body: [
|
12095 | {
|
12096 | type: "ExpressionStatement",
|
12097 | expression: {
|
12098 | type: "BinaryExpression",
|
12099 | left: {
|
12100 | type: "Identifier",
|
12101 | name: "x",
|
12102 | loc: {
|
12103 | start: {
|
12104 | line: 1,
|
12105 | column: 0
|
12106 | },
|
12107 | end: {
|
12108 | line: 1,
|
12109 | column: 1
|
12110 | }
|
12111 | }
|
12112 | },
|
12113 | operator: "!==",
|
12114 | right: {
|
12115 | type: "Identifier",
|
12116 | name: "y",
|
12117 | loc: {
|
12118 | start: {
|
12119 | line: 1,
|
12120 | column: 6
|
12121 | },
|
12122 | end: {
|
12123 | line: 1,
|
12124 | column: 7
|
12125 | }
|
12126 | }
|
12127 | },
|
12128 | loc: {
|
12129 | start: {
|
12130 | line: 1,
|
12131 | column: 0
|
12132 | },
|
12133 | end: {
|
12134 | line: 1,
|
12135 | column: 7
|
12136 | }
|
12137 | }
|
12138 | },
|
12139 | loc: {
|
12140 | start: {
|
12141 | line: 1,
|
12142 | column: 0
|
12143 | },
|
12144 | end: {
|
12145 | line: 1,
|
12146 | column: 7
|
12147 | }
|
12148 | }
|
12149 | }
|
12150 | ],
|
12151 | loc: {
|
12152 | start: {
|
12153 | line: 1,
|
12154 | column: 0
|
12155 | },
|
12156 | end: {
|
12157 | line: 1,
|
12158 | column: 7
|
12159 | }
|
12160 | }
|
12161 | });
|
12162 |
|
12163 | test("x & y", {
|
12164 | type: "Program",
|
12165 | body: [
|
12166 | {
|
12167 | type: "ExpressionStatement",
|
12168 | expression: {
|
12169 | type: "BinaryExpression",
|
12170 | left: {
|
12171 | type: "Identifier",
|
12172 | name: "x",
|
12173 | loc: {
|
12174 | start: {
|
12175 | line: 1,
|
12176 | column: 0
|
12177 | },
|
12178 | end: {
|
12179 | line: 1,
|
12180 | column: 1
|
12181 | }
|
12182 | }
|
12183 | },
|
12184 | operator: "&",
|
12185 | right: {
|
12186 | type: "Identifier",
|
12187 | name: "y",
|
12188 | loc: {
|
12189 | start: {
|
12190 | line: 1,
|
12191 | column: 4
|
12192 | },
|
12193 | end: {
|
12194 | line: 1,
|
12195 | column: 5
|
12196 | }
|
12197 | }
|
12198 | },
|
12199 | loc: {
|
12200 | start: {
|
12201 | line: 1,
|
12202 | column: 0
|
12203 | },
|
12204 | end: {
|
12205 | line: 1,
|
12206 | column: 5
|
12207 | }
|
12208 | }
|
12209 | },
|
12210 | loc: {
|
12211 | start: {
|
12212 | line: 1,
|
12213 | column: 0
|
12214 | },
|
12215 | end: {
|
12216 | line: 1,
|
12217 | column: 5
|
12218 | }
|
12219 | }
|
12220 | }
|
12221 | ],
|
12222 | loc: {
|
12223 | start: {
|
12224 | line: 1,
|
12225 | column: 0
|
12226 | },
|
12227 | end: {
|
12228 | line: 1,
|
12229 | column: 5
|
12230 | }
|
12231 | }
|
12232 | });
|
12233 |
|
12234 | test("x ^ y", {
|
12235 | type: "Program",
|
12236 | body: [
|
12237 | {
|
12238 | type: "ExpressionStatement",
|
12239 | expression: {
|
12240 | type: "BinaryExpression",
|
12241 | left: {
|
12242 | type: "Identifier",
|
12243 | name: "x",
|
12244 | loc: {
|
12245 | start: {
|
12246 | line: 1,
|
12247 | column: 0
|
12248 | },
|
12249 | end: {
|
12250 | line: 1,
|
12251 | column: 1
|
12252 | }
|
12253 | }
|
12254 | },
|
12255 | operator: "^",
|
12256 | right: {
|
12257 | type: "Identifier",
|
12258 | name: "y",
|
12259 | loc: {
|
12260 | start: {
|
12261 | line: 1,
|
12262 | column: 4
|
12263 | },
|
12264 | end: {
|
12265 | line: 1,
|
12266 | column: 5
|
12267 | }
|
12268 | }
|
12269 | },
|
12270 | loc: {
|
12271 | start: {
|
12272 | line: 1,
|
12273 | column: 0
|
12274 | },
|
12275 | end: {
|
12276 | line: 1,
|
12277 | column: 5
|
12278 | }
|
12279 | }
|
12280 | },
|
12281 | loc: {
|
12282 | start: {
|
12283 | line: 1,
|
12284 | column: 0
|
12285 | },
|
12286 | end: {
|
12287 | line: 1,
|
12288 | column: 5
|
12289 | }
|
12290 | }
|
12291 | }
|
12292 | ],
|
12293 | loc: {
|
12294 | start: {
|
12295 | line: 1,
|
12296 | column: 0
|
12297 | },
|
12298 | end: {
|
12299 | line: 1,
|
12300 | column: 5
|
12301 | }
|
12302 | }
|
12303 | });
|
12304 |
|
12305 | test("x | y", {
|
12306 | type: "Program",
|
12307 | body: [
|
12308 | {
|
12309 | type: "ExpressionStatement",
|
12310 | expression: {
|
12311 | type: "BinaryExpression",
|
12312 | left: {
|
12313 | type: "Identifier",
|
12314 | name: "x",
|
12315 | loc: {
|
12316 | start: {
|
12317 | line: 1,
|
12318 | column: 0
|
12319 | },
|
12320 | end: {
|
12321 | line: 1,
|
12322 | column: 1
|
12323 | }
|
12324 | }
|
12325 | },
|
12326 | operator: "|",
|
12327 | right: {
|
12328 | type: "Identifier",
|
12329 | name: "y",
|
12330 | loc: {
|
12331 | start: {
|
12332 | line: 1,
|
12333 | column: 4
|
12334 | },
|
12335 | end: {
|
12336 | line: 1,
|
12337 | column: 5
|
12338 | }
|
12339 | }
|
12340 | },
|
12341 | loc: {
|
12342 | start: {
|
12343 | line: 1,
|
12344 | column: 0
|
12345 | },
|
12346 | end: {
|
12347 | line: 1,
|
12348 | column: 5
|
12349 | }
|
12350 | }
|
12351 | },
|
12352 | loc: {
|
12353 | start: {
|
12354 | line: 1,
|
12355 | column: 0
|
12356 | },
|
12357 | end: {
|
12358 | line: 1,
|
12359 | column: 5
|
12360 | }
|
12361 | }
|
12362 | }
|
12363 | ],
|
12364 | loc: {
|
12365 | start: {
|
12366 | line: 1,
|
12367 | column: 0
|
12368 | },
|
12369 | end: {
|
12370 | line: 1,
|
12371 | column: 5
|
12372 | }
|
12373 | }
|
12374 | });
|
12375 |
|
12376 | test("x + y + z", {
|
12377 | type: "Program",
|
12378 | body: [
|
12379 | {
|
12380 | type: "ExpressionStatement",
|
12381 | expression: {
|
12382 | type: "BinaryExpression",
|
12383 | left: {
|
12384 | type: "BinaryExpression",
|
12385 | left: {
|
12386 | type: "Identifier",
|
12387 | name: "x",
|
12388 | loc: {
|
12389 | start: {
|
12390 | line: 1,
|
12391 | column: 0
|
12392 | },
|
12393 | end: {
|
12394 | line: 1,
|
12395 | column: 1
|
12396 | }
|
12397 | }
|
12398 | },
|
12399 | operator: "+",
|
12400 | right: {
|
12401 | type: "Identifier",
|
12402 | name: "y",
|
12403 | loc: {
|
12404 | start: {
|
12405 | line: 1,
|
12406 | column: 4
|
12407 | },
|
12408 | end: {
|
12409 | line: 1,
|
12410 | column: 5
|
12411 | }
|
12412 | }
|
12413 | },
|
12414 | loc: {
|
12415 | start: {
|
12416 | line: 1,
|
12417 | column: 0
|
12418 | },
|
12419 | end: {
|
12420 | line: 1,
|
12421 | column: 5
|
12422 | }
|
12423 | }
|
12424 | },
|
12425 | operator: "+",
|
12426 | right: {
|
12427 | type: "Identifier",
|
12428 | name: "z",
|
12429 | loc: {
|
12430 | start: {
|
12431 | line: 1,
|
12432 | column: 8
|
12433 | },
|
12434 | end: {
|
12435 | line: 1,
|
12436 | column: 9
|
12437 | }
|
12438 | }
|
12439 | },
|
12440 | loc: {
|
12441 | start: {
|
12442 | line: 1,
|
12443 | column: 0
|
12444 | },
|
12445 | end: {
|
12446 | line: 1,
|
12447 | column: 9
|
12448 | }
|
12449 | }
|
12450 | },
|
12451 | loc: {
|
12452 | start: {
|
12453 | line: 1,
|
12454 | column: 0
|
12455 | },
|
12456 | end: {
|
12457 | line: 1,
|
12458 | column: 9
|
12459 | }
|
12460 | }
|
12461 | }
|
12462 | ],
|
12463 | loc: {
|
12464 | start: {
|
12465 | line: 1,
|
12466 | column: 0
|
12467 | },
|
12468 | end: {
|
12469 | line: 1,
|
12470 | column: 9
|
12471 | }
|
12472 | }
|
12473 | });
|
12474 |
|
12475 | test("x - y + z", {
|
12476 | type: "Program",
|
12477 | body: [
|
12478 | {
|
12479 | type: "ExpressionStatement",
|
12480 | expression: {
|
12481 | type: "BinaryExpression",
|
12482 | left: {
|
12483 | type: "BinaryExpression",
|
12484 | left: {
|
12485 | type: "Identifier",
|
12486 | name: "x",
|
12487 | loc: {
|
12488 | start: {
|
12489 | line: 1,
|
12490 | column: 0
|
12491 | },
|
12492 | end: {
|
12493 | line: 1,
|
12494 | column: 1
|
12495 | }
|
12496 | }
|
12497 | },
|
12498 | operator: "-",
|
12499 | right: {
|
12500 | type: "Identifier",
|
12501 | name: "y",
|
12502 | loc: {
|
12503 | start: {
|
12504 | line: 1,
|
12505 | column: 4
|
12506 | },
|
12507 | end: {
|
12508 | line: 1,
|
12509 | column: 5
|
12510 | }
|
12511 | }
|
12512 | },
|
12513 | loc: {
|
12514 | start: {
|
12515 | line: 1,
|
12516 | column: 0
|
12517 | },
|
12518 | end: {
|
12519 | line: 1,
|
12520 | column: 5
|
12521 | }
|
12522 | }
|
12523 | },
|
12524 | operator: "+",
|
12525 | right: {
|
12526 | type: "Identifier",
|
12527 | name: "z",
|
12528 | loc: {
|
12529 | start: {
|
12530 | line: 1,
|
12531 | column: 8
|
12532 | },
|
12533 | end: {
|
12534 | line: 1,
|
12535 | column: 9
|
12536 | }
|
12537 | }
|
12538 | },
|
12539 | loc: {
|
12540 | start: {
|
12541 | line: 1,
|
12542 | column: 0
|
12543 | },
|
12544 | end: {
|
12545 | line: 1,
|
12546 | column: 9
|
12547 | }
|
12548 | }
|
12549 | },
|
12550 | loc: {
|
12551 | start: {
|
12552 | line: 1,
|
12553 | column: 0
|
12554 | },
|
12555 | end: {
|
12556 | line: 1,
|
12557 | column: 9
|
12558 | }
|
12559 | }
|
12560 | }
|
12561 | ],
|
12562 | loc: {
|
12563 | start: {
|
12564 | line: 1,
|
12565 | column: 0
|
12566 | },
|
12567 | end: {
|
12568 | line: 1,
|
12569 | column: 9
|
12570 | }
|
12571 | }
|
12572 | });
|
12573 |
|
12574 | test("x + y - z", {
|
12575 | type: "Program",
|
12576 | body: [
|
12577 | {
|
12578 | type: "ExpressionStatement",
|
12579 | expression: {
|
12580 | type: "BinaryExpression",
|
12581 | left: {
|
12582 | type: "BinaryExpression",
|
12583 | left: {
|
12584 | type: "Identifier",
|
12585 | name: "x",
|
12586 | loc: {
|
12587 | start: {
|
12588 | line: 1,
|
12589 | column: 0
|
12590 | },
|
12591 | end: {
|
12592 | line: 1,
|
12593 | column: 1
|
12594 | }
|
12595 | }
|
12596 | },
|
12597 | operator: "+",
|
12598 | right: {
|
12599 | type: "Identifier",
|
12600 | name: "y",
|
12601 | loc: {
|
12602 | start: {
|
12603 | line: 1,
|
12604 | column: 4
|
12605 | },
|
12606 | end: {
|
12607 | line: 1,
|
12608 | column: 5
|
12609 | }
|
12610 | }
|
12611 | },
|
12612 | loc: {
|
12613 | start: {
|
12614 | line: 1,
|
12615 | column: 0
|
12616 | },
|
12617 | end: {
|
12618 | line: 1,
|
12619 | column: 5
|
12620 | }
|
12621 | }
|
12622 | },
|
12623 | operator: "-",
|
12624 | right: {
|
12625 | type: "Identifier",
|
12626 | name: "z",
|
12627 | loc: {
|
12628 | start: {
|
12629 | line: 1,
|
12630 | column: 8
|
12631 | },
|
12632 | end: {
|
12633 | line: 1,
|
12634 | column: 9
|
12635 | }
|
12636 | }
|
12637 | },
|
12638 | loc: {
|
12639 | start: {
|
12640 | line: 1,
|
12641 | column: 0
|
12642 | },
|
12643 | end: {
|
12644 | line: 1,
|
12645 | column: 9
|
12646 | }
|
12647 | }
|
12648 | },
|
12649 | loc: {
|
12650 | start: {
|
12651 | line: 1,
|
12652 | column: 0
|
12653 | },
|
12654 | end: {
|
12655 | line: 1,
|
12656 | column: 9
|
12657 | }
|
12658 | }
|
12659 | }
|
12660 | ],
|
12661 | loc: {
|
12662 | start: {
|
12663 | line: 1,
|
12664 | column: 0
|
12665 | },
|
12666 | end: {
|
12667 | line: 1,
|
12668 | column: 9
|
12669 | }
|
12670 | }
|
12671 | });
|
12672 |
|
12673 | test("x - y - z", {
|
12674 | type: "Program",
|
12675 | body: [
|
12676 | {
|
12677 | type: "ExpressionStatement",
|
12678 | expression: {
|
12679 | type: "BinaryExpression",
|
12680 | left: {
|
12681 | type: "BinaryExpression",
|
12682 | left: {
|
12683 | type: "Identifier",
|
12684 | name: "x",
|
12685 | loc: {
|
12686 | start: {
|
12687 | line: 1,
|
12688 | column: 0
|
12689 | },
|
12690 | end: {
|
12691 | line: 1,
|
12692 | column: 1
|
12693 | }
|
12694 | }
|
12695 | },
|
12696 | operator: "-",
|
12697 | right: {
|
12698 | type: "Identifier",
|
12699 | name: "y",
|
12700 | loc: {
|
12701 | start: {
|
12702 | line: 1,
|
12703 | column: 4
|
12704 | },
|
12705 | end: {
|
12706 | line: 1,
|
12707 | column: 5
|
12708 | }
|
12709 | }
|
12710 | },
|
12711 | loc: {
|
12712 | start: {
|
12713 | line: 1,
|
12714 | column: 0
|
12715 | },
|
12716 | end: {
|
12717 | line: 1,
|
12718 | column: 5
|
12719 | }
|
12720 | }
|
12721 | },
|
12722 | operator: "-",
|
12723 | right: {
|
12724 | type: "Identifier",
|
12725 | name: "z",
|
12726 | loc: {
|
12727 | start: {
|
12728 | line: 1,
|
12729 | column: 8
|
12730 | },
|
12731 | end: {
|
12732 | line: 1,
|
12733 | column: 9
|
12734 | }
|
12735 | }
|
12736 | },
|
12737 | loc: {
|
12738 | start: {
|
12739 | line: 1,
|
12740 | column: 0
|
12741 | },
|
12742 | end: {
|
12743 | line: 1,
|
12744 | column: 9
|
12745 | }
|
12746 | }
|
12747 | },
|
12748 | loc: {
|
12749 | start: {
|
12750 | line: 1,
|
12751 | column: 0
|
12752 | },
|
12753 | end: {
|
12754 | line: 1,
|
12755 | column: 9
|
12756 | }
|
12757 | }
|
12758 | }
|
12759 | ],
|
12760 | loc: {
|
12761 | start: {
|
12762 | line: 1,
|
12763 | column: 0
|
12764 | },
|
12765 | end: {
|
12766 | line: 1,
|
12767 | column: 9
|
12768 | }
|
12769 | }
|
12770 | });
|
12771 |
|
12772 | test("x + y * z", {
|
12773 | type: "Program",
|
12774 | body: [
|
12775 | {
|
12776 | type: "ExpressionStatement",
|
12777 | expression: {
|
12778 | type: "BinaryExpression",
|
12779 | left: {
|
12780 | type: "Identifier",
|
12781 | name: "x",
|
12782 | loc: {
|
12783 | start: {
|
12784 | line: 1,
|
12785 | column: 0
|
12786 | },
|
12787 | end: {
|
12788 | line: 1,
|
12789 | column: 1
|
12790 | }
|
12791 | }
|
12792 | },
|
12793 | operator: "+",
|
12794 | right: {
|
12795 | type: "BinaryExpression",
|
12796 | left: {
|
12797 | type: "Identifier",
|
12798 | name: "y",
|
12799 | loc: {
|
12800 | start: {
|
12801 | line: 1,
|
12802 | column: 4
|
12803 | },
|
12804 | end: {
|
12805 | line: 1,
|
12806 | column: 5
|
12807 | }
|
12808 | }
|
12809 | },
|
12810 | operator: "*",
|
12811 | right: {
|
12812 | type: "Identifier",
|
12813 | name: "z",
|
12814 | loc: {
|
12815 | start: {
|
12816 | line: 1,
|
12817 | column: 8
|
12818 | },
|
12819 | end: {
|
12820 | line: 1,
|
12821 | column: 9
|
12822 | }
|
12823 | }
|
12824 | },
|
12825 | loc: {
|
12826 | start: {
|
12827 | line: 1,
|
12828 | column: 4
|
12829 | },
|
12830 | end: {
|
12831 | line: 1,
|
12832 | column: 9
|
12833 | }
|
12834 | }
|
12835 | },
|
12836 | loc: {
|
12837 | start: {
|
12838 | line: 1,
|
12839 | column: 0
|
12840 | },
|
12841 | end: {
|
12842 | line: 1,
|
12843 | column: 9
|
12844 | }
|
12845 | }
|
12846 | },
|
12847 | loc: {
|
12848 | start: {
|
12849 | line: 1,
|
12850 | column: 0
|
12851 | },
|
12852 | end: {
|
12853 | line: 1,
|
12854 | column: 9
|
12855 | }
|
12856 | }
|
12857 | }
|
12858 | ],
|
12859 | loc: {
|
12860 | start: {
|
12861 | line: 1,
|
12862 | column: 0
|
12863 | },
|
12864 | end: {
|
12865 | line: 1,
|
12866 | column: 9
|
12867 | }
|
12868 | }
|
12869 | });
|
12870 |
|
12871 | test("x + y / z", {
|
12872 | type: "Program",
|
12873 | body: [
|
12874 | {
|
12875 | type: "ExpressionStatement",
|
12876 | expression: {
|
12877 | type: "BinaryExpression",
|
12878 | left: {
|
12879 | type: "Identifier",
|
12880 | name: "x",
|
12881 | loc: {
|
12882 | start: {
|
12883 | line: 1,
|
12884 | column: 0
|
12885 | },
|
12886 | end: {
|
12887 | line: 1,
|
12888 | column: 1
|
12889 | }
|
12890 | }
|
12891 | },
|
12892 | operator: "+",
|
12893 | right: {
|
12894 | type: "BinaryExpression",
|
12895 | left: {
|
12896 | type: "Identifier",
|
12897 | name: "y",
|
12898 | loc: {
|
12899 | start: {
|
12900 | line: 1,
|
12901 | column: 4
|
12902 | },
|
12903 | end: {
|
12904 | line: 1,
|
12905 | column: 5
|
12906 | }
|
12907 | }
|
12908 | },
|
12909 | operator: "/",
|
12910 | right: {
|
12911 | type: "Identifier",
|
12912 | name: "z",
|
12913 | loc: {
|
12914 | start: {
|
12915 | line: 1,
|
12916 | column: 8
|
12917 | },
|
12918 | end: {
|
12919 | line: 1,
|
12920 | column: 9
|
12921 | }
|
12922 | }
|
12923 | },
|
12924 | loc: {
|
12925 | start: {
|
12926 | line: 1,
|
12927 | column: 4
|
12928 | },
|
12929 | end: {
|
12930 | line: 1,
|
12931 | column: 9
|
12932 | }
|
12933 | }
|
12934 | },
|
12935 | loc: {
|
12936 | start: {
|
12937 | line: 1,
|
12938 | column: 0
|
12939 | },
|
12940 | end: {
|
12941 | line: 1,
|
12942 | column: 9
|
12943 | }
|
12944 | }
|
12945 | },
|
12946 | loc: {
|
12947 | start: {
|
12948 | line: 1,
|
12949 | column: 0
|
12950 | },
|
12951 | end: {
|
12952 | line: 1,
|
12953 | column: 9
|
12954 | }
|
12955 | }
|
12956 | }
|
12957 | ],
|
12958 | loc: {
|
12959 | start: {
|
12960 | line: 1,
|
12961 | column: 0
|
12962 | },
|
12963 | end: {
|
12964 | line: 1,
|
12965 | column: 9
|
12966 | }
|
12967 | }
|
12968 | });
|
12969 |
|
12970 | test("x - y % z", {
|
12971 | type: "Program",
|
12972 | body: [
|
12973 | {
|
12974 | type: "ExpressionStatement",
|
12975 | expression: {
|
12976 | type: "BinaryExpression",
|
12977 | left: {
|
12978 | type: "Identifier",
|
12979 | name: "x",
|
12980 | loc: {
|
12981 | start: {
|
12982 | line: 1,
|
12983 | column: 0
|
12984 | },
|
12985 | end: {
|
12986 | line: 1,
|
12987 | column: 1
|
12988 | }
|
12989 | }
|
12990 | },
|
12991 | operator: "-",
|
12992 | right: {
|
12993 | type: "BinaryExpression",
|
12994 | left: {
|
12995 | type: "Identifier",
|
12996 | name: "y",
|
12997 | loc: {
|
12998 | start: {
|
12999 | line: 1,
|
13000 | column: 4
|
13001 | },
|
13002 | end: {
|
13003 | line: 1,
|
13004 | column: 5
|
13005 | }
|
13006 | }
|
13007 | },
|
13008 | operator: "%",
|
13009 | right: {
|
13010 | type: "Identifier",
|
13011 | name: "z",
|
13012 | loc: {
|
13013 | start: {
|
13014 | line: 1,
|
13015 | column: 8
|
13016 | },
|
13017 | end: {
|
13018 | line: 1,
|
13019 | column: 9
|
13020 | }
|
13021 | }
|
13022 | },
|
13023 | loc: {
|
13024 | start: {
|
13025 | line: 1,
|
13026 | column: 4
|
13027 | },
|
13028 | end: {
|
13029 | line: 1,
|
13030 | column: 9
|
13031 | }
|
13032 | }
|
13033 | },
|
13034 | loc: {
|
13035 | start: {
|
13036 | line: 1,
|
13037 | column: 0
|
13038 | },
|
13039 | end: {
|
13040 | line: 1,
|
13041 | column: 9
|
13042 | }
|
13043 | }
|
13044 | },
|
13045 | loc: {
|
13046 | start: {
|
13047 | line: 1,
|
13048 | column: 0
|
13049 | },
|
13050 | end: {
|
13051 | line: 1,
|
13052 | column: 9
|
13053 | }
|
13054 | }
|
13055 | }
|
13056 | ],
|
13057 | loc: {
|
13058 | start: {
|
13059 | line: 1,
|
13060 | column: 0
|
13061 | },
|
13062 | end: {
|
13063 | line: 1,
|
13064 | column: 9
|
13065 | }
|
13066 | }
|
13067 | });
|
13068 |
|
13069 | test("x * y * z", {
|
13070 | type: "Program",
|
13071 | body: [
|
13072 | {
|
13073 | type: "ExpressionStatement",
|
13074 | expression: {
|
13075 | type: "BinaryExpression",
|
13076 | left: {
|
13077 | type: "BinaryExpression",
|
13078 | left: {
|
13079 | type: "Identifier",
|
13080 | name: "x",
|
13081 | loc: {
|
13082 | start: {
|
13083 | line: 1,
|
13084 | column: 0
|
13085 | },
|
13086 | end: {
|
13087 | line: 1,
|
13088 | column: 1
|
13089 | }
|
13090 | }
|
13091 | },
|
13092 | operator: "*",
|
13093 | right: {
|
13094 | type: "Identifier",
|
13095 | name: "y",
|
13096 | loc: {
|
13097 | start: {
|
13098 | line: 1,
|
13099 | column: 4
|
13100 | },
|
13101 | end: {
|
13102 | line: 1,
|
13103 | column: 5
|
13104 | }
|
13105 | }
|
13106 | },
|
13107 | loc: {
|
13108 | start: {
|
13109 | line: 1,
|
13110 | column: 0
|
13111 | },
|
13112 | end: {
|
13113 | line: 1,
|
13114 | column: 5
|
13115 | }
|
13116 | }
|
13117 | },
|
13118 | operator: "*",
|
13119 | right: {
|
13120 | type: "Identifier",
|
13121 | name: "z",
|
13122 | loc: {
|
13123 | start: {
|
13124 | line: 1,
|
13125 | column: 8
|
13126 | },
|
13127 | end: {
|
13128 | line: 1,
|
13129 | column: 9
|
13130 | }
|
13131 | }
|
13132 | },
|
13133 | loc: {
|
13134 | start: {
|
13135 | line: 1,
|
13136 | column: 0
|
13137 | },
|
13138 | end: {
|
13139 | line: 1,
|
13140 | column: 9
|
13141 | }
|
13142 | }
|
13143 | },
|
13144 | loc: {
|
13145 | start: {
|
13146 | line: 1,
|
13147 | column: 0
|
13148 | },
|
13149 | end: {
|
13150 | line: 1,
|
13151 | column: 9
|
13152 | }
|
13153 | }
|
13154 | }
|
13155 | ],
|
13156 | loc: {
|
13157 | start: {
|
13158 | line: 1,
|
13159 | column: 0
|
13160 | },
|
13161 | end: {
|
13162 | line: 1,
|
13163 | column: 9
|
13164 | }
|
13165 | }
|
13166 | });
|
13167 |
|
13168 | test("x * y / z", {
|
13169 | type: "Program",
|
13170 | body: [
|
13171 | {
|
13172 | type: "ExpressionStatement",
|
13173 | expression: {
|
13174 | type: "BinaryExpression",
|
13175 | left: {
|
13176 | type: "BinaryExpression",
|
13177 | left: {
|
13178 | type: "Identifier",
|
13179 | name: "x",
|
13180 | loc: {
|
13181 | start: {
|
13182 | line: 1,
|
13183 | column: 0
|
13184 | },
|
13185 | end: {
|
13186 | line: 1,
|
13187 | column: 1
|
13188 | }
|
13189 | }
|
13190 | },
|
13191 | operator: "*",
|
13192 | right: {
|
13193 | type: "Identifier",
|
13194 | name: "y",
|
13195 | loc: {
|
13196 | start: {
|
13197 | line: 1,
|
13198 | column: 4
|
13199 | },
|
13200 | end: {
|
13201 | line: 1,
|
13202 | column: 5
|
13203 | }
|
13204 | }
|
13205 | },
|
13206 | loc: {
|
13207 | start: {
|
13208 | line: 1,
|
13209 | column: 0
|
13210 | },
|
13211 | end: {
|
13212 | line: 1,
|
13213 | column: 5
|
13214 | }
|
13215 | }
|
13216 | },
|
13217 | operator: "/",
|
13218 | right: {
|
13219 | type: "Identifier",
|
13220 | name: "z",
|
13221 | loc: {
|
13222 | start: {
|
13223 | line: 1,
|
13224 | column: 8
|
13225 | },
|
13226 | end: {
|
13227 | line: 1,
|
13228 | column: 9
|
13229 | }
|
13230 | }
|
13231 | },
|
13232 | loc: {
|
13233 | start: {
|
13234 | line: 1,
|
13235 | column: 0
|
13236 | },
|
13237 | end: {
|
13238 | line: 1,
|
13239 | column: 9
|
13240 | }
|
13241 | }
|
13242 | },
|
13243 | loc: {
|
13244 | start: {
|
13245 | line: 1,
|
13246 | column: 0
|
13247 | },
|
13248 | end: {
|
13249 | line: 1,
|
13250 | column: 9
|
13251 | }
|
13252 | }
|
13253 | }
|
13254 | ],
|
13255 | loc: {
|
13256 | start: {
|
13257 | line: 1,
|
13258 | column: 0
|
13259 | },
|
13260 | end: {
|
13261 | line: 1,
|
13262 | column: 9
|
13263 | }
|
13264 | }
|
13265 | });
|
13266 |
|
13267 | test("x * y % z", {
|
13268 | type: "Program",
|
13269 | body: [
|
13270 | {
|
13271 | type: "ExpressionStatement",
|
13272 | expression: {
|
13273 | type: "BinaryExpression",
|
13274 | left: {
|
13275 | type: "BinaryExpression",
|
13276 | left: {
|
13277 | type: "Identifier",
|
13278 | name: "x",
|
13279 | loc: {
|
13280 | start: {
|
13281 | line: 1,
|
13282 | column: 0
|
13283 | },
|
13284 | end: {
|
13285 | line: 1,
|
13286 | column: 1
|
13287 | }
|
13288 | }
|
13289 | },
|
13290 | operator: "*",
|
13291 | right: {
|
13292 | type: "Identifier",
|
13293 | name: "y",
|
13294 | loc: {
|
13295 | start: {
|
13296 | line: 1,
|
13297 | column: 4
|
13298 | },
|
13299 | end: {
|
13300 | line: 1,
|
13301 | column: 5
|
13302 | }
|
13303 | }
|
13304 | },
|
13305 | loc: {
|
13306 | start: {
|
13307 | line: 1,
|
13308 | column: 0
|
13309 | },
|
13310 | end: {
|
13311 | line: 1,
|
13312 | column: 5
|
13313 | }
|
13314 | }
|
13315 | },
|
13316 | operator: "%",
|
13317 | right: {
|
13318 | type: "Identifier",
|
13319 | name: "z",
|
13320 | loc: {
|
13321 | start: {
|
13322 | line: 1,
|
13323 | column: 8
|
13324 | },
|
13325 | end: {
|
13326 | line: 1,
|
13327 | column: 9
|
13328 | }
|
13329 | }
|
13330 | },
|
13331 | loc: {
|
13332 | start: {
|
13333 | line: 1,
|
13334 | column: 0
|
13335 | },
|
13336 | end: {
|
13337 | line: 1,
|
13338 | column: 9
|
13339 | }
|
13340 | }
|
13341 | },
|
13342 | loc: {
|
13343 | start: {
|
13344 | line: 1,
|
13345 | column: 0
|
13346 | },
|
13347 | end: {
|
13348 | line: 1,
|
13349 | column: 9
|
13350 | }
|
13351 | }
|
13352 | }
|
13353 | ],
|
13354 | loc: {
|
13355 | start: {
|
13356 | line: 1,
|
13357 | column: 0
|
13358 | },
|
13359 | end: {
|
13360 | line: 1,
|
13361 | column: 9
|
13362 | }
|
13363 | }
|
13364 | });
|
13365 |
|
13366 | test("x % y * z", {
|
13367 | type: "Program",
|
13368 | body: [
|
13369 | {
|
13370 | type: "ExpressionStatement",
|
13371 | expression: {
|
13372 | type: "BinaryExpression",
|
13373 | left: {
|
13374 | type: "BinaryExpression",
|
13375 | left: {
|
13376 | type: "Identifier",
|
13377 | name: "x",
|
13378 | loc: {
|
13379 | start: {
|
13380 | line: 1,
|
13381 | column: 0
|
13382 | },
|
13383 | end: {
|
13384 | line: 1,
|
13385 | column: 1
|
13386 | }
|
13387 | }
|
13388 | },
|
13389 | operator: "%",
|
13390 | right: {
|
13391 | type: "Identifier",
|
13392 | name: "y",
|
13393 | loc: {
|
13394 | start: {
|
13395 | line: 1,
|
13396 | column: 4
|
13397 | },
|
13398 | end: {
|
13399 | line: 1,
|
13400 | column: 5
|
13401 | }
|
13402 | }
|
13403 | },
|
13404 | loc: {
|
13405 | start: {
|
13406 | line: 1,
|
13407 | column: 0
|
13408 | },
|
13409 | end: {
|
13410 | line: 1,
|
13411 | column: 5
|
13412 | }
|
13413 | }
|
13414 | },
|
13415 | operator: "*",
|
13416 | right: {
|
13417 | type: "Identifier",
|
13418 | name: "z",
|
13419 | loc: {
|
13420 | start: {
|
13421 | line: 1,
|
13422 | column: 8
|
13423 | },
|
13424 | end: {
|
13425 | line: 1,
|
13426 | column: 9
|
13427 | }
|
13428 | }
|
13429 | },
|
13430 | loc: {
|
13431 | start: {
|
13432 | line: 1,
|
13433 | column: 0
|
13434 | },
|
13435 | end: {
|
13436 | line: 1,
|
13437 | column: 9
|
13438 | }
|
13439 | }
|
13440 | },
|
13441 | loc: {
|
13442 | start: {
|
13443 | line: 1,
|
13444 | column: 0
|
13445 | },
|
13446 | end: {
|
13447 | line: 1,
|
13448 | column: 9
|
13449 | }
|
13450 | }
|
13451 | }
|
13452 | ],
|
13453 | loc: {
|
13454 | start: {
|
13455 | line: 1,
|
13456 | column: 0
|
13457 | },
|
13458 | end: {
|
13459 | line: 1,
|
13460 | column: 9
|
13461 | }
|
13462 | }
|
13463 | });
|
13464 |
|
13465 | test("x << y << z", {
|
13466 | type: "Program",
|
13467 | body: [
|
13468 | {
|
13469 | type: "ExpressionStatement",
|
13470 | expression: {
|
13471 | type: "BinaryExpression",
|
13472 | left: {
|
13473 | type: "BinaryExpression",
|
13474 | left: {
|
13475 | type: "Identifier",
|
13476 | name: "x",
|
13477 | loc: {
|
13478 | start: {
|
13479 | line: 1,
|
13480 | column: 0
|
13481 | },
|
13482 | end: {
|
13483 | line: 1,
|
13484 | column: 1
|
13485 | }
|
13486 | }
|
13487 | },
|
13488 | operator: "<<",
|
13489 | right: {
|
13490 | type: "Identifier",
|
13491 | name: "y",
|
13492 | loc: {
|
13493 | start: {
|
13494 | line: 1,
|
13495 | column: 5
|
13496 | },
|
13497 | end: {
|
13498 | line: 1,
|
13499 | column: 6
|
13500 | }
|
13501 | }
|
13502 | },
|
13503 | loc: {
|
13504 | start: {
|
13505 | line: 1,
|
13506 | column: 0
|
13507 | },
|
13508 | end: {
|
13509 | line: 1,
|
13510 | column: 6
|
13511 | }
|
13512 | }
|
13513 | },
|
13514 | operator: "<<",
|
13515 | right: {
|
13516 | type: "Identifier",
|
13517 | name: "z",
|
13518 | loc: {
|
13519 | start: {
|
13520 | line: 1,
|
13521 | column: 10
|
13522 | },
|
13523 | end: {
|
13524 | line: 1,
|
13525 | column: 11
|
13526 | }
|
13527 | }
|
13528 | },
|
13529 | loc: {
|
13530 | start: {
|
13531 | line: 1,
|
13532 | column: 0
|
13533 | },
|
13534 | end: {
|
13535 | line: 1,
|
13536 | column: 11
|
13537 | }
|
13538 | }
|
13539 | },
|
13540 | loc: {
|
13541 | start: {
|
13542 | line: 1,
|
13543 | column: 0
|
13544 | },
|
13545 | end: {
|
13546 | line: 1,
|
13547 | column: 11
|
13548 | }
|
13549 | }
|
13550 | }
|
13551 | ],
|
13552 | loc: {
|
13553 | start: {
|
13554 | line: 1,
|
13555 | column: 0
|
13556 | },
|
13557 | end: {
|
13558 | line: 1,
|
13559 | column: 11
|
13560 | }
|
13561 | }
|
13562 | });
|
13563 |
|
13564 | test("x | y | z", {
|
13565 | type: "Program",
|
13566 | body: [
|
13567 | {
|
13568 | type: "ExpressionStatement",
|
13569 | expression: {
|
13570 | type: "BinaryExpression",
|
13571 | left: {
|
13572 | type: "BinaryExpression",
|
13573 | left: {
|
13574 | type: "Identifier",
|
13575 | name: "x",
|
13576 | loc: {
|
13577 | start: {
|
13578 | line: 1,
|
13579 | column: 0
|
13580 | },
|
13581 | end: {
|
13582 | line: 1,
|
13583 | column: 1
|
13584 | }
|
13585 | }
|
13586 | },
|
13587 | operator: "|",
|
13588 | right: {
|
13589 | type: "Identifier",
|
13590 | name: "y",
|
13591 | loc: {
|
13592 | start: {
|
13593 | line: 1,
|
13594 | column: 4
|
13595 | },
|
13596 | end: {
|
13597 | line: 1,
|
13598 | column: 5
|
13599 | }
|
13600 | }
|
13601 | },
|
13602 | loc: {
|
13603 | start: {
|
13604 | line: 1,
|
13605 | column: 0
|
13606 | },
|
13607 | end: {
|
13608 | line: 1,
|
13609 | column: 5
|
13610 | }
|
13611 | }
|
13612 | },
|
13613 | operator: "|",
|
13614 | right: {
|
13615 | type: "Identifier",
|
13616 | name: "z",
|
13617 | loc: {
|
13618 | start: {
|
13619 | line: 1,
|
13620 | column: 8
|
13621 | },
|
13622 | end: {
|
13623 | line: 1,
|
13624 | column: 9
|
13625 | }
|
13626 | }
|
13627 | },
|
13628 | loc: {
|
13629 | start: {
|
13630 | line: 1,
|
13631 | column: 0
|
13632 | },
|
13633 | end: {
|
13634 | line: 1,
|
13635 | column: 9
|
13636 | }
|
13637 | }
|
13638 | },
|
13639 | loc: {
|
13640 | start: {
|
13641 | line: 1,
|
13642 | column: 0
|
13643 | },
|
13644 | end: {
|
13645 | line: 1,
|
13646 | column: 9
|
13647 | }
|
13648 | }
|
13649 | }
|
13650 | ],
|
13651 | loc: {
|
13652 | start: {
|
13653 | line: 1,
|
13654 | column: 0
|
13655 | },
|
13656 | end: {
|
13657 | line: 1,
|
13658 | column: 9
|
13659 | }
|
13660 | }
|
13661 | });
|
13662 |
|
13663 | test("x & y & z", {
|
13664 | type: "Program",
|
13665 | body: [
|
13666 | {
|
13667 | type: "ExpressionStatement",
|
13668 | expression: {
|
13669 | type: "BinaryExpression",
|
13670 | left: {
|
13671 | type: "BinaryExpression",
|
13672 | left: {
|
13673 | type: "Identifier",
|
13674 | name: "x",
|
13675 | loc: {
|
13676 | start: {
|
13677 | line: 1,
|
13678 | column: 0
|
13679 | },
|
13680 | end: {
|
13681 | line: 1,
|
13682 | column: 1
|
13683 | }
|
13684 | }
|
13685 | },
|
13686 | operator: "&",
|
13687 | right: {
|
13688 | type: "Identifier",
|
13689 | name: "y",
|
13690 | loc: {
|
13691 | start: {
|
13692 | line: 1,
|
13693 | column: 4
|
13694 | },
|
13695 | end: {
|
13696 | line: 1,
|
13697 | column: 5
|
13698 | }
|
13699 | }
|
13700 | },
|
13701 | loc: {
|
13702 | start: {
|
13703 | line: 1,
|
13704 | column: 0
|
13705 | },
|
13706 | end: {
|
13707 | line: 1,
|
13708 | column: 5
|
13709 | }
|
13710 | }
|
13711 | },
|
13712 | operator: "&",
|
13713 | right: {
|
13714 | type: "Identifier",
|
13715 | name: "z",
|
13716 | loc: {
|
13717 | start: {
|
13718 | line: 1,
|
13719 | column: 8
|
13720 | },
|
13721 | end: {
|
13722 | line: 1,
|
13723 | column: 9
|
13724 | }
|
13725 | }
|
13726 | },
|
13727 | loc: {
|
13728 | start: {
|
13729 | line: 1,
|
13730 | column: 0
|
13731 | },
|
13732 | end: {
|
13733 | line: 1,
|
13734 | column: 9
|
13735 | }
|
13736 | }
|
13737 | },
|
13738 | loc: {
|
13739 | start: {
|
13740 | line: 1,
|
13741 | column: 0
|
13742 | },
|
13743 | end: {
|
13744 | line: 1,
|
13745 | column: 9
|
13746 | }
|
13747 | }
|
13748 | }
|
13749 | ],
|
13750 | loc: {
|
13751 | start: {
|
13752 | line: 1,
|
13753 | column: 0
|
13754 | },
|
13755 | end: {
|
13756 | line: 1,
|
13757 | column: 9
|
13758 | }
|
13759 | }
|
13760 | });
|
13761 |
|
13762 | test("x ^ y ^ z", {
|
13763 | type: "Program",
|
13764 | body: [
|
13765 | {
|
13766 | type: "ExpressionStatement",
|
13767 | expression: {
|
13768 | type: "BinaryExpression",
|
13769 | left: {
|
13770 | type: "BinaryExpression",
|
13771 | left: {
|
13772 | type: "Identifier",
|
13773 | name: "x",
|
13774 | loc: {
|
13775 | start: {
|
13776 | line: 1,
|
13777 | column: 0
|
13778 | },
|
13779 | end: {
|
13780 | line: 1,
|
13781 | column: 1
|
13782 | }
|
13783 | }
|
13784 | },
|
13785 | operator: "^",
|
13786 | right: {
|
13787 | type: "Identifier",
|
13788 | name: "y",
|
13789 | loc: {
|
13790 | start: {
|
13791 | line: 1,
|
13792 | column: 4
|
13793 | },
|
13794 | end: {
|
13795 | line: 1,
|
13796 | column: 5
|
13797 | }
|
13798 | }
|
13799 | },
|
13800 | loc: {
|
13801 | start: {
|
13802 | line: 1,
|
13803 | column: 0
|
13804 | },
|
13805 | end: {
|
13806 | line: 1,
|
13807 | column: 5
|
13808 | }
|
13809 | }
|
13810 | },
|
13811 | operator: "^",
|
13812 | right: {
|
13813 | type: "Identifier",
|
13814 | name: "z",
|
13815 | loc: {
|
13816 | start: {
|
13817 | line: 1,
|
13818 | column: 8
|
13819 | },
|
13820 | end: {
|
13821 | line: 1,
|
13822 | column: 9
|
13823 | }
|
13824 | }
|
13825 | },
|
13826 | loc: {
|
13827 | start: {
|
13828 | line: 1,
|
13829 | column: 0
|
13830 | },
|
13831 | end: {
|
13832 | line: 1,
|
13833 | column: 9
|
13834 | }
|
13835 | }
|
13836 | },
|
13837 | loc: {
|
13838 | start: {
|
13839 | line: 1,
|
13840 | column: 0
|
13841 | },
|
13842 | end: {
|
13843 | line: 1,
|
13844 | column: 9
|
13845 | }
|
13846 | }
|
13847 | }
|
13848 | ],
|
13849 | loc: {
|
13850 | start: {
|
13851 | line: 1,
|
13852 | column: 0
|
13853 | },
|
13854 | end: {
|
13855 | line: 1,
|
13856 | column: 9
|
13857 | }
|
13858 | }
|
13859 | });
|
13860 |
|
13861 | test("x & y | z", {
|
13862 | type: "Program",
|
13863 | body: [
|
13864 | {
|
13865 | type: "ExpressionStatement",
|
13866 | expression: {
|
13867 | type: "BinaryExpression",
|
13868 | left: {
|
13869 | type: "BinaryExpression",
|
13870 | left: {
|
13871 | type: "Identifier",
|
13872 | name: "x",
|
13873 | loc: {
|
13874 | start: {
|
13875 | line: 1,
|
13876 | column: 0
|
13877 | },
|
13878 | end: {
|
13879 | line: 1,
|
13880 | column: 1
|
13881 | }
|
13882 | }
|
13883 | },
|
13884 | operator: "&",
|
13885 | right: {
|
13886 | type: "Identifier",
|
13887 | name: "y",
|
13888 | loc: {
|
13889 | start: {
|
13890 | line: 1,
|
13891 | column: 4
|
13892 | },
|
13893 | end: {
|
13894 | line: 1,
|
13895 | column: 5
|
13896 | }
|
13897 | }
|
13898 | },
|
13899 | loc: {
|
13900 | start: {
|
13901 | line: 1,
|
13902 | column: 0
|
13903 | },
|
13904 | end: {
|
13905 | line: 1,
|
13906 | column: 5
|
13907 | }
|
13908 | }
|
13909 | },
|
13910 | operator: "|",
|
13911 | right: {
|
13912 | type: "Identifier",
|
13913 | name: "z",
|
13914 | loc: {
|
13915 | start: {
|
13916 | line: 1,
|
13917 | column: 8
|
13918 | },
|
13919 | end: {
|
13920 | line: 1,
|
13921 | column: 9
|
13922 | }
|
13923 | }
|
13924 | },
|
13925 | loc: {
|
13926 | start: {
|
13927 | line: 1,
|
13928 | column: 0
|
13929 | },
|
13930 | end: {
|
13931 | line: 1,
|
13932 | column: 9
|
13933 | }
|
13934 | }
|
13935 | },
|
13936 | loc: {
|
13937 | start: {
|
13938 | line: 1,
|
13939 | column: 0
|
13940 | },
|
13941 | end: {
|
13942 | line: 1,
|
13943 | column: 9
|
13944 | }
|
13945 | }
|
13946 | }
|
13947 | ],
|
13948 | loc: {
|
13949 | start: {
|
13950 | line: 1,
|
13951 | column: 0
|
13952 | },
|
13953 | end: {
|
13954 | line: 1,
|
13955 | column: 9
|
13956 | }
|
13957 | }
|
13958 | });
|
13959 |
|
13960 | test("x | y ^ z", {
|
13961 | type: "Program",
|
13962 | body: [
|
13963 | {
|
13964 | type: "ExpressionStatement",
|
13965 | expression: {
|
13966 | type: "BinaryExpression",
|
13967 | left: {
|
13968 | type: "Identifier",
|
13969 | name: "x",
|
13970 | loc: {
|
13971 | start: {
|
13972 | line: 1,
|
13973 | column: 0
|
13974 | },
|
13975 | end: {
|
13976 | line: 1,
|
13977 | column: 1
|
13978 | }
|
13979 | }
|
13980 | },
|
13981 | operator: "|",
|
13982 | right: {
|
13983 | type: "BinaryExpression",
|
13984 | left: {
|
13985 | type: "Identifier",
|
13986 | name: "y",
|
13987 | loc: {
|
13988 | start: {
|
13989 | line: 1,
|
13990 | column: 4
|
13991 | },
|
13992 | end: {
|
13993 | line: 1,
|
13994 | column: 5
|
13995 | }
|
13996 | }
|
13997 | },
|
13998 | operator: "^",
|
13999 | right: {
|
14000 | type: "Identifier",
|
14001 | name: "z",
|
14002 | loc: {
|
14003 | start: {
|
14004 | line: 1,
|
14005 | column: 8
|
14006 | },
|
14007 | end: {
|
14008 | line: 1,
|
14009 | column: 9
|
14010 | }
|
14011 | }
|
14012 | },
|
14013 | loc: {
|
14014 | start: {
|
14015 | line: 1,
|
14016 | column: 4
|
14017 | },
|
14018 | end: {
|
14019 | line: 1,
|
14020 | column: 9
|
14021 | }
|
14022 | }
|
14023 | },
|
14024 | loc: {
|
14025 | start: {
|
14026 | line: 1,
|
14027 | column: 0
|
14028 | },
|
14029 | end: {
|
14030 | line: 1,
|
14031 | column: 9
|
14032 | }
|
14033 | }
|
14034 | },
|
14035 | loc: {
|
14036 | start: {
|
14037 | line: 1,
|
14038 | column: 0
|
14039 | },
|
14040 | end: {
|
14041 | line: 1,
|
14042 | column: 9
|
14043 | }
|
14044 | }
|
14045 | }
|
14046 | ],
|
14047 | loc: {
|
14048 | start: {
|
14049 | line: 1,
|
14050 | column: 0
|
14051 | },
|
14052 | end: {
|
14053 | line: 1,
|
14054 | column: 9
|
14055 | }
|
14056 | }
|
14057 | });
|
14058 |
|
14059 | test("x | y & z", {
|
14060 | type: "Program",
|
14061 | body: [
|
14062 | {
|
14063 | type: "ExpressionStatement",
|
14064 | expression: {
|
14065 | type: "BinaryExpression",
|
14066 | left: {
|
14067 | type: "Identifier",
|
14068 | name: "x",
|
14069 | loc: {
|
14070 | start: {
|
14071 | line: 1,
|
14072 | column: 0
|
14073 | },
|
14074 | end: {
|
14075 | line: 1,
|
14076 | column: 1
|
14077 | }
|
14078 | }
|
14079 | },
|
14080 | operator: "|",
|
14081 | right: {
|
14082 | type: "BinaryExpression",
|
14083 | left: {
|
14084 | type: "Identifier",
|
14085 | name: "y",
|
14086 | loc: {
|
14087 | start: {
|
14088 | line: 1,
|
14089 | column: 4
|
14090 | },
|
14091 | end: {
|
14092 | line: 1,
|
14093 | column: 5
|
14094 | }
|
14095 | }
|
14096 | },
|
14097 | operator: "&",
|
14098 | right: {
|
14099 | type: "Identifier",
|
14100 | name: "z",
|
14101 | loc: {
|
14102 | start: {
|
14103 | line: 1,
|
14104 | column: 8
|
14105 | },
|
14106 | end: {
|
14107 | line: 1,
|
14108 | column: 9
|
14109 | }
|
14110 | }
|
14111 | },
|
14112 | loc: {
|
14113 | start: {
|
14114 | line: 1,
|
14115 | column: 4
|
14116 | },
|
14117 | end: {
|
14118 | line: 1,
|
14119 | column: 9
|
14120 | }
|
14121 | }
|
14122 | },
|
14123 | loc: {
|
14124 | start: {
|
14125 | line: 1,
|
14126 | column: 0
|
14127 | },
|
14128 | end: {
|
14129 | line: 1,
|
14130 | column: 9
|
14131 | }
|
14132 | }
|
14133 | },
|
14134 | loc: {
|
14135 | start: {
|
14136 | line: 1,
|
14137 | column: 0
|
14138 | },
|
14139 | end: {
|
14140 | line: 1,
|
14141 | column: 9
|
14142 | }
|
14143 | }
|
14144 | }
|
14145 | ],
|
14146 | loc: {
|
14147 | start: {
|
14148 | line: 1,
|
14149 | column: 0
|
14150 | },
|
14151 | end: {
|
14152 | line: 1,
|
14153 | column: 9
|
14154 | }
|
14155 | }
|
14156 | });
|
14157 |
|
14158 | test("x || y", {
|
14159 | type: "Program",
|
14160 | body: [
|
14161 | {
|
14162 | type: "ExpressionStatement",
|
14163 | expression: {
|
14164 | type: "LogicalExpression",
|
14165 | left: {
|
14166 | type: "Identifier",
|
14167 | name: "x",
|
14168 | loc: {
|
14169 | start: {
|
14170 | line: 1,
|
14171 | column: 0
|
14172 | },
|
14173 | end: {
|
14174 | line: 1,
|
14175 | column: 1
|
14176 | }
|
14177 | }
|
14178 | },
|
14179 | operator: "||",
|
14180 | right: {
|
14181 | type: "Identifier",
|
14182 | name: "y",
|
14183 | loc: {
|
14184 | start: {
|
14185 | line: 1,
|
14186 | column: 5
|
14187 | },
|
14188 | end: {
|
14189 | line: 1,
|
14190 | column: 6
|
14191 | }
|
14192 | }
|
14193 | },
|
14194 | loc: {
|
14195 | start: {
|
14196 | line: 1,
|
14197 | column: 0
|
14198 | },
|
14199 | end: {
|
14200 | line: 1,
|
14201 | column: 6
|
14202 | }
|
14203 | }
|
14204 | },
|
14205 | loc: {
|
14206 | start: {
|
14207 | line: 1,
|
14208 | column: 0
|
14209 | },
|
14210 | end: {
|
14211 | line: 1,
|
14212 | column: 6
|
14213 | }
|
14214 | }
|
14215 | }
|
14216 | ],
|
14217 | loc: {
|
14218 | start: {
|
14219 | line: 1,
|
14220 | column: 0
|
14221 | },
|
14222 | end: {
|
14223 | line: 1,
|
14224 | column: 6
|
14225 | }
|
14226 | }
|
14227 | });
|
14228 |
|
14229 | test("x && y", {
|
14230 | type: "Program",
|
14231 | body: [
|
14232 | {
|
14233 | type: "ExpressionStatement",
|
14234 | expression: {
|
14235 | type: "LogicalExpression",
|
14236 | left: {
|
14237 | type: "Identifier",
|
14238 | name: "x",
|
14239 | loc: {
|
14240 | start: {
|
14241 | line: 1,
|
14242 | column: 0
|
14243 | },
|
14244 | end: {
|
14245 | line: 1,
|
14246 | column: 1
|
14247 | }
|
14248 | }
|
14249 | },
|
14250 | operator: "&&",
|
14251 | right: {
|
14252 | type: "Identifier",
|
14253 | name: "y",
|
14254 | loc: {
|
14255 | start: {
|
14256 | line: 1,
|
14257 | column: 5
|
14258 | },
|
14259 | end: {
|
14260 | line: 1,
|
14261 | column: 6
|
14262 | }
|
14263 | }
|
14264 | },
|
14265 | loc: {
|
14266 | start: {
|
14267 | line: 1,
|
14268 | column: 0
|
14269 | },
|
14270 | end: {
|
14271 | line: 1,
|
14272 | column: 6
|
14273 | }
|
14274 | }
|
14275 | },
|
14276 | loc: {
|
14277 | start: {
|
14278 | line: 1,
|
14279 | column: 0
|
14280 | },
|
14281 | end: {
|
14282 | line: 1,
|
14283 | column: 6
|
14284 | }
|
14285 | }
|
14286 | }
|
14287 | ],
|
14288 | loc: {
|
14289 | start: {
|
14290 | line: 1,
|
14291 | column: 0
|
14292 | },
|
14293 | end: {
|
14294 | line: 1,
|
14295 | column: 6
|
14296 | }
|
14297 | }
|
14298 | });
|
14299 |
|
14300 | test("x || y || z", {
|
14301 | type: "Program",
|
14302 | body: [
|
14303 | {
|
14304 | type: "ExpressionStatement",
|
14305 | expression: {
|
14306 | type: "LogicalExpression",
|
14307 | left: {
|
14308 | type: "LogicalExpression",
|
14309 | left: {
|
14310 | type: "Identifier",
|
14311 | name: "x",
|
14312 | loc: {
|
14313 | start: {
|
14314 | line: 1,
|
14315 | column: 0
|
14316 | },
|
14317 | end: {
|
14318 | line: 1,
|
14319 | column: 1
|
14320 | }
|
14321 | }
|
14322 | },
|
14323 | operator: "||",
|
14324 | right: {
|
14325 | type: "Identifier",
|
14326 | name: "y",
|
14327 | loc: {
|
14328 | start: {
|
14329 | line: 1,
|
14330 | column: 5
|
14331 | },
|
14332 | end: {
|
14333 | line: 1,
|
14334 | column: 6
|
14335 | }
|
14336 | }
|
14337 | },
|
14338 | loc: {
|
14339 | start: {
|
14340 | line: 1,
|
14341 | column: 0
|
14342 | },
|
14343 | end: {
|
14344 | line: 1,
|
14345 | column: 6
|
14346 | }
|
14347 | }
|
14348 | },
|
14349 | operator: "||",
|
14350 | right: {
|
14351 | type: "Identifier",
|
14352 | name: "z",
|
14353 | loc: {
|
14354 | start: {
|
14355 | line: 1,
|
14356 | column: 10
|
14357 | },
|
14358 | end: {
|
14359 | line: 1,
|
14360 | column: 11
|
14361 | }
|
14362 | }
|
14363 | },
|
14364 | loc: {
|
14365 | start: {
|
14366 | line: 1,
|
14367 | column: 0
|
14368 | },
|
14369 | end: {
|
14370 | line: 1,
|
14371 | column: 11
|
14372 | }
|
14373 | }
|
14374 | },
|
14375 | loc: {
|
14376 | start: {
|
14377 | line: 1,
|
14378 | column: 0
|
14379 | },
|
14380 | end: {
|
14381 | line: 1,
|
14382 | column: 11
|
14383 | }
|
14384 | }
|
14385 | }
|
14386 | ],
|
14387 | loc: {
|
14388 | start: {
|
14389 | line: 1,
|
14390 | column: 0
|
14391 | },
|
14392 | end: {
|
14393 | line: 1,
|
14394 | column: 11
|
14395 | }
|
14396 | }
|
14397 | });
|
14398 |
|
14399 | test("x && y && z", {
|
14400 | type: "Program",
|
14401 | body: [
|
14402 | {
|
14403 | type: "ExpressionStatement",
|
14404 | expression: {
|
14405 | type: "LogicalExpression",
|
14406 | left: {
|
14407 | type: "LogicalExpression",
|
14408 | left: {
|
14409 | type: "Identifier",
|
14410 | name: "x",
|
14411 | loc: {
|
14412 | start: {
|
14413 | line: 1,
|
14414 | column: 0
|
14415 | },
|
14416 | end: {
|
14417 | line: 1,
|
14418 | column: 1
|
14419 | }
|
14420 | }
|
14421 | },
|
14422 | operator: "&&",
|
14423 | right: {
|
14424 | type: "Identifier",
|
14425 | name: "y",
|
14426 | loc: {
|
14427 | start: {
|
14428 | line: 1,
|
14429 | column: 5
|
14430 | },
|
14431 | end: {
|
14432 | line: 1,
|
14433 | column: 6
|
14434 | }
|
14435 | }
|
14436 | },
|
14437 | loc: {
|
14438 | start: {
|
14439 | line: 1,
|
14440 | column: 0
|
14441 | },
|
14442 | end: {
|
14443 | line: 1,
|
14444 | column: 6
|
14445 | }
|
14446 | }
|
14447 | },
|
14448 | operator: "&&",
|
14449 | right: {
|
14450 | type: "Identifier",
|
14451 | name: "z",
|
14452 | loc: {
|
14453 | start: {
|
14454 | line: 1,
|
14455 | column: 10
|
14456 | },
|
14457 | end: {
|
14458 | line: 1,
|
14459 | column: 11
|
14460 | }
|
14461 | }
|
14462 | },
|
14463 | loc: {
|
14464 | start: {
|
14465 | line: 1,
|
14466 | column: 0
|
14467 | },
|
14468 | end: {
|
14469 | line: 1,
|
14470 | column: 11
|
14471 | }
|
14472 | }
|
14473 | },
|
14474 | loc: {
|
14475 | start: {
|
14476 | line: 1,
|
14477 | column: 0
|
14478 | },
|
14479 | end: {
|
14480 | line: 1,
|
14481 | column: 11
|
14482 | }
|
14483 | }
|
14484 | }
|
14485 | ],
|
14486 | loc: {
|
14487 | start: {
|
14488 | line: 1,
|
14489 | column: 0
|
14490 | },
|
14491 | end: {
|
14492 | line: 1,
|
14493 | column: 11
|
14494 | }
|
14495 | }
|
14496 | });
|
14497 |
|
14498 | test("x || y && z", {
|
14499 | type: "Program",
|
14500 | body: [
|
14501 | {
|
14502 | type: "ExpressionStatement",
|
14503 | expression: {
|
14504 | type: "LogicalExpression",
|
14505 | left: {
|
14506 | type: "Identifier",
|
14507 | name: "x",
|
14508 | loc: {
|
14509 | start: {
|
14510 | line: 1,
|
14511 | column: 0
|
14512 | },
|
14513 | end: {
|
14514 | line: 1,
|
14515 | column: 1
|
14516 | }
|
14517 | }
|
14518 | },
|
14519 | operator: "||",
|
14520 | right: {
|
14521 | type: "LogicalExpression",
|
14522 | left: {
|
14523 | type: "Identifier",
|
14524 | name: "y",
|
14525 | loc: {
|
14526 | start: {
|
14527 | line: 1,
|
14528 | column: 5
|
14529 | },
|
14530 | end: {
|
14531 | line: 1,
|
14532 | column: 6
|
14533 | }
|
14534 | }
|
14535 | },
|
14536 | operator: "&&",
|
14537 | right: {
|
14538 | type: "Identifier",
|
14539 | name: "z",
|
14540 | loc: {
|
14541 | start: {
|
14542 | line: 1,
|
14543 | column: 10
|
14544 | },
|
14545 | end: {
|
14546 | line: 1,
|
14547 | column: 11
|
14548 | }
|
14549 | }
|
14550 | },
|
14551 | loc: {
|
14552 | start: {
|
14553 | line: 1,
|
14554 | column: 5
|
14555 | },
|
14556 | end: {
|
14557 | line: 1,
|
14558 | column: 11
|
14559 | }
|
14560 | }
|
14561 | },
|
14562 | loc: {
|
14563 | start: {
|
14564 | line: 1,
|
14565 | column: 0
|
14566 | },
|
14567 | end: {
|
14568 | line: 1,
|
14569 | column: 11
|
14570 | }
|
14571 | }
|
14572 | },
|
14573 | loc: {
|
14574 | start: {
|
14575 | line: 1,
|
14576 | column: 0
|
14577 | },
|
14578 | end: {
|
14579 | line: 1,
|
14580 | column: 11
|
14581 | }
|
14582 | }
|
14583 | }
|
14584 | ],
|
14585 | loc: {
|
14586 | start: {
|
14587 | line: 1,
|
14588 | column: 0
|
14589 | },
|
14590 | end: {
|
14591 | line: 1,
|
14592 | column: 11
|
14593 | }
|
14594 | }
|
14595 | });
|
14596 |
|
14597 | test("x || y ^ z", {
|
14598 | type: "Program",
|
14599 | body: [
|
14600 | {
|
14601 | type: "ExpressionStatement",
|
14602 | expression: {
|
14603 | type: "LogicalExpression",
|
14604 | left: {
|
14605 | type: "Identifier",
|
14606 | name: "x",
|
14607 | loc: {
|
14608 | start: {
|
14609 | line: 1,
|
14610 | column: 0
|
14611 | },
|
14612 | end: {
|
14613 | line: 1,
|
14614 | column: 1
|
14615 | }
|
14616 | }
|
14617 | },
|
14618 | operator: "||",
|
14619 | right: {
|
14620 | type: "BinaryExpression",
|
14621 | left: {
|
14622 | type: "Identifier",
|
14623 | name: "y",
|
14624 | loc: {
|
14625 | start: {
|
14626 | line: 1,
|
14627 | column: 5
|
14628 | },
|
14629 | end: {
|
14630 | line: 1,
|
14631 | column: 6
|
14632 | }
|
14633 | }
|
14634 | },
|
14635 | operator: "^",
|
14636 | right: {
|
14637 | type: "Identifier",
|
14638 | name: "z",
|
14639 | loc: {
|
14640 | start: {
|
14641 | line: 1,
|
14642 | column: 9
|
14643 | },
|
14644 | end: {
|
14645 | line: 1,
|
14646 | column: 10
|
14647 | }
|
14648 | }
|
14649 | },
|
14650 | loc: {
|
14651 | start: {
|
14652 | line: 1,
|
14653 | column: 5
|
14654 | },
|
14655 | end: {
|
14656 | line: 1,
|
14657 | column: 10
|
14658 | }
|
14659 | }
|
14660 | },
|
14661 | loc: {
|
14662 | start: {
|
14663 | line: 1,
|
14664 | column: 0
|
14665 | },
|
14666 | end: {
|
14667 | line: 1,
|
14668 | column: 10
|
14669 | }
|
14670 | }
|
14671 | },
|
14672 | loc: {
|
14673 | start: {
|
14674 | line: 1,
|
14675 | column: 0
|
14676 | },
|
14677 | end: {
|
14678 | line: 1,
|
14679 | column: 10
|
14680 | }
|
14681 | }
|
14682 | }
|
14683 | ],
|
14684 | loc: {
|
14685 | start: {
|
14686 | line: 1,
|
14687 | column: 0
|
14688 | },
|
14689 | end: {
|
14690 | line: 1,
|
14691 | column: 10
|
14692 | }
|
14693 | }
|
14694 | });
|
14695 |
|
14696 | test("y ? 1 : 2", {
|
14697 | type: "Program",
|
14698 | body: [
|
14699 | {
|
14700 | type: "ExpressionStatement",
|
14701 | expression: {
|
14702 | type: "ConditionalExpression",
|
14703 | test: {
|
14704 | type: "Identifier",
|
14705 | name: "y",
|
14706 | loc: {
|
14707 | start: {
|
14708 | line: 1,
|
14709 | column: 0
|
14710 | },
|
14711 | end: {
|
14712 | line: 1,
|
14713 | column: 1
|
14714 | }
|
14715 | }
|
14716 | },
|
14717 | consequent: {
|
14718 | type: "Literal",
|
14719 | value: 1,
|
14720 | loc: {
|
14721 | start: {
|
14722 | line: 1,
|
14723 | column: 4
|
14724 | },
|
14725 | end: {
|
14726 | line: 1,
|
14727 | column: 5
|
14728 | }
|
14729 | }
|
14730 | },
|
14731 | alternate: {
|
14732 | type: "Literal",
|
14733 | value: 2,
|
14734 | loc: {
|
14735 | start: {
|
14736 | line: 1,
|
14737 | column: 8
|
14738 | },
|
14739 | end: {
|
14740 | line: 1,
|
14741 | column: 9
|
14742 | }
|
14743 | }
|
14744 | },
|
14745 | loc: {
|
14746 | start: {
|
14747 | line: 1,
|
14748 | column: 0
|
14749 | },
|
14750 | end: {
|
14751 | line: 1,
|
14752 | column: 9
|
14753 | }
|
14754 | }
|
14755 | },
|
14756 | loc: {
|
14757 | start: {
|
14758 | line: 1,
|
14759 | column: 0
|
14760 | },
|
14761 | end: {
|
14762 | line: 1,
|
14763 | column: 9
|
14764 | }
|
14765 | }
|
14766 | }
|
14767 | ],
|
14768 | loc: {
|
14769 | start: {
|
14770 | line: 1,
|
14771 | column: 0
|
14772 | },
|
14773 | end: {
|
14774 | line: 1,
|
14775 | column: 9
|
14776 | }
|
14777 | }
|
14778 | });
|
14779 |
|
14780 | test("x && y ? 1 : 2", {
|
14781 | type: "Program",
|
14782 | body: [
|
14783 | {
|
14784 | type: "ExpressionStatement",
|
14785 | expression: {
|
14786 | type: "ConditionalExpression",
|
14787 | test: {
|
14788 | type: "LogicalExpression",
|
14789 | left: {
|
14790 | type: "Identifier",
|
14791 | name: "x",
|
14792 | loc: {
|
14793 | start: {
|
14794 | line: 1,
|
14795 | column: 0
|
14796 | },
|
14797 | end: {
|
14798 | line: 1,
|
14799 | column: 1
|
14800 | }
|
14801 | }
|
14802 | },
|
14803 | operator: "&&",
|
14804 | right: {
|
14805 | type: "Identifier",
|
14806 | name: "y",
|
14807 | loc: {
|
14808 | start: {
|
14809 | line: 1,
|
14810 | column: 5
|
14811 | },
|
14812 | end: {
|
14813 | line: 1,
|
14814 | column: 6
|
14815 | }
|
14816 | }
|
14817 | },
|
14818 | loc: {
|
14819 | start: {
|
14820 | line: 1,
|
14821 | column: 0
|
14822 | },
|
14823 | end: {
|
14824 | line: 1,
|
14825 | column: 6
|
14826 | }
|
14827 | }
|
14828 | },
|
14829 | consequent: {
|
14830 | type: "Literal",
|
14831 | value: 1,
|
14832 | loc: {
|
14833 | start: {
|
14834 | line: 1,
|
14835 | column: 9
|
14836 | },
|
14837 | end: {
|
14838 | line: 1,
|
14839 | column: 10
|
14840 | }
|
14841 | }
|
14842 | },
|
14843 | alternate: {
|
14844 | type: "Literal",
|
14845 | value: 2,
|
14846 | loc: {
|
14847 | start: {
|
14848 | line: 1,
|
14849 | column: 13
|
14850 | },
|
14851 | end: {
|
14852 | line: 1,
|
14853 | column: 14
|
14854 | }
|
14855 | }
|
14856 | },
|
14857 | loc: {
|
14858 | start: {
|
14859 | line: 1,
|
14860 | column: 0
|
14861 | },
|
14862 | end: {
|
14863 | line: 1,
|
14864 | column: 14
|
14865 | }
|
14866 | }
|
14867 | },
|
14868 | loc: {
|
14869 | start: {
|
14870 | line: 1,
|
14871 | column: 0
|
14872 | },
|
14873 | end: {
|
14874 | line: 1,
|
14875 | column: 14
|
14876 | }
|
14877 | }
|
14878 | }
|
14879 | ],
|
14880 | loc: {
|
14881 | start: {
|
14882 | line: 1,
|
14883 | column: 0
|
14884 | },
|
14885 | end: {
|
14886 | line: 1,
|
14887 | column: 14
|
14888 | }
|
14889 | }
|
14890 | });
|
14891 |
|
14892 | test("x = 42", {
|
14893 | type: "Program",
|
14894 | body: [
|
14895 | {
|
14896 | type: "ExpressionStatement",
|
14897 | expression: {
|
14898 | type: "AssignmentExpression",
|
14899 | operator: "=",
|
14900 | left: {
|
14901 | type: "Identifier",
|
14902 | name: "x",
|
14903 | loc: {
|
14904 | start: {
|
14905 | line: 1,
|
14906 | column: 0
|
14907 | },
|
14908 | end: {
|
14909 | line: 1,
|
14910 | column: 1
|
14911 | }
|
14912 | }
|
14913 | },
|
14914 | right: {
|
14915 | type: "Literal",
|
14916 | value: 42,
|
14917 | loc: {
|
14918 | start: {
|
14919 | line: 1,
|
14920 | column: 4
|
14921 | },
|
14922 | end: {
|
14923 | line: 1,
|
14924 | column: 6
|
14925 | }
|
14926 | }
|
14927 | },
|
14928 | loc: {
|
14929 | start: {
|
14930 | line: 1,
|
14931 | column: 0
|
14932 | },
|
14933 | end: {
|
14934 | line: 1,
|
14935 | column: 6
|
14936 | }
|
14937 | }
|
14938 | },
|
14939 | loc: {
|
14940 | start: {
|
14941 | line: 1,
|
14942 | column: 0
|
14943 | },
|
14944 | end: {
|
14945 | line: 1,
|
14946 | column: 6
|
14947 | }
|
14948 | }
|
14949 | }
|
14950 | ],
|
14951 | loc: {
|
14952 | start: {
|
14953 | line: 1,
|
14954 | column: 0
|
14955 | },
|
14956 | end: {
|
14957 | line: 1,
|
14958 | column: 6
|
14959 | }
|
14960 | }
|
14961 | });
|
14962 |
|
14963 | test("eval = 42", {
|
14964 | type: "Program",
|
14965 | body: [
|
14966 | {
|
14967 | type: "ExpressionStatement",
|
14968 | expression: {
|
14969 | type: "AssignmentExpression",
|
14970 | operator: "=",
|
14971 | left: {
|
14972 | type: "Identifier",
|
14973 | name: "eval",
|
14974 | loc: {
|
14975 | start: {
|
14976 | line: 1,
|
14977 | column: 0
|
14978 | },
|
14979 | end: {
|
14980 | line: 1,
|
14981 | column: 4
|
14982 | }
|
14983 | }
|
14984 | },
|
14985 | right: {
|
14986 | type: "Literal",
|
14987 | value: 42,
|
14988 | loc: {
|
14989 | start: {
|
14990 | line: 1,
|
14991 | column: 7
|
14992 | },
|
14993 | end: {
|
14994 | line: 1,
|
14995 | column: 9
|
14996 | }
|
14997 | }
|
14998 | },
|
14999 | loc: {
|
15000 | start: {
|
15001 | line: 1,
|
15002 | column: 0
|
15003 | },
|
15004 | end: {
|
15005 | line: 1,
|
15006 | column: 9
|
15007 | }
|
15008 | }
|
15009 | },
|
15010 | loc: {
|
15011 | start: {
|
15012 | line: 1,
|
15013 | column: 0
|
15014 | },
|
15015 | end: {
|
15016 | line: 1,
|
15017 | column: 9
|
15018 | }
|
15019 | }
|
15020 | }
|
15021 | ],
|
15022 | loc: {
|
15023 | start: {
|
15024 | line: 1,
|
15025 | column: 0
|
15026 | },
|
15027 | end: {
|
15028 | line: 1,
|
15029 | column: 9
|
15030 | }
|
15031 | }
|
15032 | });
|
15033 |
|
15034 | test("arguments = 42", {
|
15035 | type: "Program",
|
15036 | body: [
|
15037 | {
|
15038 | type: "ExpressionStatement",
|
15039 | expression: {
|
15040 | type: "AssignmentExpression",
|
15041 | operator: "=",
|
15042 | left: {
|
15043 | type: "Identifier",
|
15044 | name: "arguments",
|
15045 | loc: {
|
15046 | start: {
|
15047 | line: 1,
|
15048 | column: 0
|
15049 | },
|
15050 | end: {
|
15051 | line: 1,
|
15052 | column: 9
|
15053 | }
|
15054 | }
|
15055 | },
|
15056 | right: {
|
15057 | type: "Literal",
|
15058 | value: 42,
|
15059 | loc: {
|
15060 | start: {
|
15061 | line: 1,
|
15062 | column: 12
|
15063 | },
|
15064 | end: {
|
15065 | line: 1,
|
15066 | column: 14
|
15067 | }
|
15068 | }
|
15069 | },
|
15070 | loc: {
|
15071 | start: {
|
15072 | line: 1,
|
15073 | column: 0
|
15074 | },
|
15075 | end: {
|
15076 | line: 1,
|
15077 | column: 14
|
15078 | }
|
15079 | }
|
15080 | },
|
15081 | loc: {
|
15082 | start: {
|
15083 | line: 1,
|
15084 | column: 0
|
15085 | },
|
15086 | end: {
|
15087 | line: 1,
|
15088 | column: 14
|
15089 | }
|
15090 | }
|
15091 | }
|
15092 | ],
|
15093 | loc: {
|
15094 | start: {
|
15095 | line: 1,
|
15096 | column: 0
|
15097 | },
|
15098 | end: {
|
15099 | line: 1,
|
15100 | column: 14
|
15101 | }
|
15102 | }
|
15103 | });
|
15104 |
|
15105 | test("x *= 42", {
|
15106 | type: "Program",
|
15107 | body: [
|
15108 | {
|
15109 | type: "ExpressionStatement",
|
15110 | expression: {
|
15111 | type: "AssignmentExpression",
|
15112 | operator: "*=",
|
15113 | left: {
|
15114 | type: "Identifier",
|
15115 | name: "x",
|
15116 | loc: {
|
15117 | start: {
|
15118 | line: 1,
|
15119 | column: 0
|
15120 | },
|
15121 | end: {
|
15122 | line: 1,
|
15123 | column: 1
|
15124 | }
|
15125 | }
|
15126 | },
|
15127 | right: {
|
15128 | type: "Literal",
|
15129 | value: 42,
|
15130 | loc: {
|
15131 | start: {
|
15132 | line: 1,
|
15133 | column: 5
|
15134 | },
|
15135 | end: {
|
15136 | line: 1,
|
15137 | column: 7
|
15138 | }
|
15139 | }
|
15140 | },
|
15141 | loc: {
|
15142 | start: {
|
15143 | line: 1,
|
15144 | column: 0
|
15145 | },
|
15146 | end: {
|
15147 | line: 1,
|
15148 | column: 7
|
15149 | }
|
15150 | }
|
15151 | },
|
15152 | loc: {
|
15153 | start: {
|
15154 | line: 1,
|
15155 | column: 0
|
15156 | },
|
15157 | end: {
|
15158 | line: 1,
|
15159 | column: 7
|
15160 | }
|
15161 | }
|
15162 | }
|
15163 | ],
|
15164 | loc: {
|
15165 | start: {
|
15166 | line: 1,
|
15167 | column: 0
|
15168 | },
|
15169 | end: {
|
15170 | line: 1,
|
15171 | column: 7
|
15172 | }
|
15173 | }
|
15174 | });
|
15175 |
|
15176 | test("x /= 42", {
|
15177 | type: "Program",
|
15178 | body: [
|
15179 | {
|
15180 | type: "ExpressionStatement",
|
15181 | expression: {
|
15182 | type: "AssignmentExpression",
|
15183 | operator: "/=",
|
15184 | left: {
|
15185 | type: "Identifier",
|
15186 | name: "x",
|
15187 | loc: {
|
15188 | start: {
|
15189 | line: 1,
|
15190 | column: 0
|
15191 | },
|
15192 | end: {
|
15193 | line: 1,
|
15194 | column: 1
|
15195 | }
|
15196 | }
|
15197 | },
|
15198 | right: {
|
15199 | type: "Literal",
|
15200 | value: 42,
|
15201 | loc: {
|
15202 | start: {
|
15203 | line: 1,
|
15204 | column: 5
|
15205 | },
|
15206 | end: {
|
15207 | line: 1,
|
15208 | column: 7
|
15209 | }
|
15210 | }
|
15211 | },
|
15212 | loc: {
|
15213 | start: {
|
15214 | line: 1,
|
15215 | column: 0
|
15216 | },
|
15217 | end: {
|
15218 | line: 1,
|
15219 | column: 7
|
15220 | }
|
15221 | }
|
15222 | },
|
15223 | loc: {
|
15224 | start: {
|
15225 | line: 1,
|
15226 | column: 0
|
15227 | },
|
15228 | end: {
|
15229 | line: 1,
|
15230 | column: 7
|
15231 | }
|
15232 | }
|
15233 | }
|
15234 | ],
|
15235 | loc: {
|
15236 | start: {
|
15237 | line: 1,
|
15238 | column: 0
|
15239 | },
|
15240 | end: {
|
15241 | line: 1,
|
15242 | column: 7
|
15243 | }
|
15244 | }
|
15245 | });
|
15246 |
|
15247 | test("x %= 42", {
|
15248 | type: "Program",
|
15249 | body: [
|
15250 | {
|
15251 | type: "ExpressionStatement",
|
15252 | expression: {
|
15253 | type: "AssignmentExpression",
|
15254 | operator: "%=",
|
15255 | left: {
|
15256 | type: "Identifier",
|
15257 | name: "x",
|
15258 | loc: {
|
15259 | start: {
|
15260 | line: 1,
|
15261 | column: 0
|
15262 | },
|
15263 | end: {
|
15264 | line: 1,
|
15265 | column: 1
|
15266 | }
|
15267 | }
|
15268 | },
|
15269 | right: {
|
15270 | type: "Literal",
|
15271 | value: 42,
|
15272 | loc: {
|
15273 | start: {
|
15274 | line: 1,
|
15275 | column: 5
|
15276 | },
|
15277 | end: {
|
15278 | line: 1,
|
15279 | column: 7
|
15280 | }
|
15281 | }
|
15282 | },
|
15283 | loc: {
|
15284 | start: {
|
15285 | line: 1,
|
15286 | column: 0
|
15287 | },
|
15288 | end: {
|
15289 | line: 1,
|
15290 | column: 7
|
15291 | }
|
15292 | }
|
15293 | },
|
15294 | loc: {
|
15295 | start: {
|
15296 | line: 1,
|
15297 | column: 0
|
15298 | },
|
15299 | end: {
|
15300 | line: 1,
|
15301 | column: 7
|
15302 | }
|
15303 | }
|
15304 | }
|
15305 | ],
|
15306 | loc: {
|
15307 | start: {
|
15308 | line: 1,
|
15309 | column: 0
|
15310 | },
|
15311 | end: {
|
15312 | line: 1,
|
15313 | column: 7
|
15314 | }
|
15315 | }
|
15316 | });
|
15317 |
|
15318 | test("x += 42", {
|
15319 | type: "Program",
|
15320 | body: [
|
15321 | {
|
15322 | type: "ExpressionStatement",
|
15323 | expression: {
|
15324 | type: "AssignmentExpression",
|
15325 | operator: "+=",
|
15326 | left: {
|
15327 | type: "Identifier",
|
15328 | name: "x",
|
15329 | loc: {
|
15330 | start: {
|
15331 | line: 1,
|
15332 | column: 0
|
15333 | },
|
15334 | end: {
|
15335 | line: 1,
|
15336 | column: 1
|
15337 | }
|
15338 | }
|
15339 | },
|
15340 | right: {
|
15341 | type: "Literal",
|
15342 | value: 42,
|
15343 | loc: {
|
15344 | start: {
|
15345 | line: 1,
|
15346 | column: 5
|
15347 | },
|
15348 | end: {
|
15349 | line: 1,
|
15350 | column: 7
|
15351 | }
|
15352 | }
|
15353 | },
|
15354 | loc: {
|
15355 | start: {
|
15356 | line: 1,
|
15357 | column: 0
|
15358 | },
|
15359 | end: {
|
15360 | line: 1,
|
15361 | column: 7
|
15362 | }
|
15363 | }
|
15364 | },
|
15365 | loc: {
|
15366 | start: {
|
15367 | line: 1,
|
15368 | column: 0
|
15369 | },
|
15370 | end: {
|
15371 | line: 1,
|
15372 | column: 7
|
15373 | }
|
15374 | }
|
15375 | }
|
15376 | ],
|
15377 | loc: {
|
15378 | start: {
|
15379 | line: 1,
|
15380 | column: 0
|
15381 | },
|
15382 | end: {
|
15383 | line: 1,
|
15384 | column: 7
|
15385 | }
|
15386 | }
|
15387 | });
|
15388 |
|
15389 | test("x -= 42", {
|
15390 | type: "Program",
|
15391 | body: [
|
15392 | {
|
15393 | type: "ExpressionStatement",
|
15394 | expression: {
|
15395 | type: "AssignmentExpression",
|
15396 | operator: "-=",
|
15397 | left: {
|
15398 | type: "Identifier",
|
15399 | name: "x",
|
15400 | loc: {
|
15401 | start: {
|
15402 | line: 1,
|
15403 | column: 0
|
15404 | },
|
15405 | end: {
|
15406 | line: 1,
|
15407 | column: 1
|
15408 | }
|
15409 | }
|
15410 | },
|
15411 | right: {
|
15412 | type: "Literal",
|
15413 | value: 42,
|
15414 | loc: {
|
15415 | start: {
|
15416 | line: 1,
|
15417 | column: 5
|
15418 | },
|
15419 | end: {
|
15420 | line: 1,
|
15421 | column: 7
|
15422 | }
|
15423 | }
|
15424 | },
|
15425 | loc: {
|
15426 | start: {
|
15427 | line: 1,
|
15428 | column: 0
|
15429 | },
|
15430 | end: {
|
15431 | line: 1,
|
15432 | column: 7
|
15433 | }
|
15434 | }
|
15435 | },
|
15436 | loc: {
|
15437 | start: {
|
15438 | line: 1,
|
15439 | column: 0
|
15440 | },
|
15441 | end: {
|
15442 | line: 1,
|
15443 | column: 7
|
15444 | }
|
15445 | }
|
15446 | }
|
15447 | ],
|
15448 | loc: {
|
15449 | start: {
|
15450 | line: 1,
|
15451 | column: 0
|
15452 | },
|
15453 | end: {
|
15454 | line: 1,
|
15455 | column: 7
|
15456 | }
|
15457 | }
|
15458 | });
|
15459 |
|
15460 | test("x <<= 42", {
|
15461 | type: "Program",
|
15462 | body: [
|
15463 | {
|
15464 | type: "ExpressionStatement",
|
15465 | expression: {
|
15466 | type: "AssignmentExpression",
|
15467 | operator: "<<=",
|
15468 | left: {
|
15469 | type: "Identifier",
|
15470 | name: "x",
|
15471 | loc: {
|
15472 | start: {
|
15473 | line: 1,
|
15474 | column: 0
|
15475 | },
|
15476 | end: {
|
15477 | line: 1,
|
15478 | column: 1
|
15479 | }
|
15480 | }
|
15481 | },
|
15482 | right: {
|
15483 | type: "Literal",
|
15484 | value: 42,
|
15485 | loc: {
|
15486 | start: {
|
15487 | line: 1,
|
15488 | column: 6
|
15489 | },
|
15490 | end: {
|
15491 | line: 1,
|
15492 | column: 8
|
15493 | }
|
15494 | }
|
15495 | },
|
15496 | loc: {
|
15497 | start: {
|
15498 | line: 1,
|
15499 | column: 0
|
15500 | },
|
15501 | end: {
|
15502 | line: 1,
|
15503 | column: 8
|
15504 | }
|
15505 | }
|
15506 | },
|
15507 | loc: {
|
15508 | start: {
|
15509 | line: 1,
|
15510 | column: 0
|
15511 | },
|
15512 | end: {
|
15513 | line: 1,
|
15514 | column: 8
|
15515 | }
|
15516 | }
|
15517 | }
|
15518 | ],
|
15519 | loc: {
|
15520 | start: {
|
15521 | line: 1,
|
15522 | column: 0
|
15523 | },
|
15524 | end: {
|
15525 | line: 1,
|
15526 | column: 8
|
15527 | }
|
15528 | }
|
15529 | });
|
15530 |
|
15531 | test("x >>= 42", {
|
15532 | type: "Program",
|
15533 | body: [
|
15534 | {
|
15535 | type: "ExpressionStatement",
|
15536 | expression: {
|
15537 | type: "AssignmentExpression",
|
15538 | operator: ">>=",
|
15539 | left: {
|
15540 | type: "Identifier",
|
15541 | name: "x",
|
15542 | loc: {
|
15543 | start: {
|
15544 | line: 1,
|
15545 | column: 0
|
15546 | },
|
15547 | end: {
|
15548 | line: 1,
|
15549 | column: 1
|
15550 | }
|
15551 | }
|
15552 | },
|
15553 | right: {
|
15554 | type: "Literal",
|
15555 | value: 42,
|
15556 | loc: {
|
15557 | start: {
|
15558 | line: 1,
|
15559 | column: 6
|
15560 | },
|
15561 | end: {
|
15562 | line: 1,
|
15563 | column: 8
|
15564 | }
|
15565 | }
|
15566 | },
|
15567 | loc: {
|
15568 | start: {
|
15569 | line: 1,
|
15570 | column: 0
|
15571 | },
|
15572 | end: {
|
15573 | line: 1,
|
15574 | column: 8
|
15575 | }
|
15576 | }
|
15577 | },
|
15578 | loc: {
|
15579 | start: {
|
15580 | line: 1,
|
15581 | column: 0
|
15582 | },
|
15583 | end: {
|
15584 | line: 1,
|
15585 | column: 8
|
15586 | }
|
15587 | }
|
15588 | }
|
15589 | ],
|
15590 | loc: {
|
15591 | start: {
|
15592 | line: 1,
|
15593 | column: 0
|
15594 | },
|
15595 | end: {
|
15596 | line: 1,
|
15597 | column: 8
|
15598 | }
|
15599 | }
|
15600 | });
|
15601 |
|
15602 | test("x >>>= 42", {
|
15603 | type: "Program",
|
15604 | body: [
|
15605 | {
|
15606 | type: "ExpressionStatement",
|
15607 | expression: {
|
15608 | type: "AssignmentExpression",
|
15609 | operator: ">>>=",
|
15610 | left: {
|
15611 | type: "Identifier",
|
15612 | name: "x",
|
15613 | loc: {
|
15614 | start: {
|
15615 | line: 1,
|
15616 | column: 0
|
15617 | },
|
15618 | end: {
|
15619 | line: 1,
|
15620 | column: 1
|
15621 | }
|
15622 | }
|
15623 | },
|
15624 | right: {
|
15625 | type: "Literal",
|
15626 | value: 42,
|
15627 | loc: {
|
15628 | start: {
|
15629 | line: 1,
|
15630 | column: 7
|
15631 | },
|
15632 | end: {
|
15633 | line: 1,
|
15634 | column: 9
|
15635 | }
|
15636 | }
|
15637 | },
|
15638 | loc: {
|
15639 | start: {
|
15640 | line: 1,
|
15641 | column: 0
|
15642 | },
|
15643 | end: {
|
15644 | line: 1,
|
15645 | column: 9
|
15646 | }
|
15647 | }
|
15648 | },
|
15649 | loc: {
|
15650 | start: {
|
15651 | line: 1,
|
15652 | column: 0
|
15653 | },
|
15654 | end: {
|
15655 | line: 1,
|
15656 | column: 9
|
15657 | }
|
15658 | }
|
15659 | }
|
15660 | ],
|
15661 | loc: {
|
15662 | start: {
|
15663 | line: 1,
|
15664 | column: 0
|
15665 | },
|
15666 | end: {
|
15667 | line: 1,
|
15668 | column: 9
|
15669 | }
|
15670 | }
|
15671 | });
|
15672 |
|
15673 | test("x &= 42", {
|
15674 | type: "Program",
|
15675 | body: [
|
15676 | {
|
15677 | type: "ExpressionStatement",
|
15678 | expression: {
|
15679 | type: "AssignmentExpression",
|
15680 | operator: "&=",
|
15681 | left: {
|
15682 | type: "Identifier",
|
15683 | name: "x",
|
15684 | loc: {
|
15685 | start: {
|
15686 | line: 1,
|
15687 | column: 0
|
15688 | },
|
15689 | end: {
|
15690 | line: 1,
|
15691 | column: 1
|
15692 | }
|
15693 | }
|
15694 | },
|
15695 | right: {
|
15696 | type: "Literal",
|
15697 | value: 42,
|
15698 | loc: {
|
15699 | start: {
|
15700 | line: 1,
|
15701 | column: 5
|
15702 | },
|
15703 | end: {
|
15704 | line: 1,
|
15705 | column: 7
|
15706 | }
|
15707 | }
|
15708 | },
|
15709 | loc: {
|
15710 | start: {
|
15711 | line: 1,
|
15712 | column: 0
|
15713 | },
|
15714 | end: {
|
15715 | line: 1,
|
15716 | column: 7
|
15717 | }
|
15718 | }
|
15719 | },
|
15720 | loc: {
|
15721 | start: {
|
15722 | line: 1,
|
15723 | column: 0
|
15724 | },
|
15725 | end: {
|
15726 | line: 1,
|
15727 | column: 7
|
15728 | }
|
15729 | }
|
15730 | }
|
15731 | ],
|
15732 | loc: {
|
15733 | start: {
|
15734 | line: 1,
|
15735 | column: 0
|
15736 | },
|
15737 | end: {
|
15738 | line: 1,
|
15739 | column: 7
|
15740 | }
|
15741 | }
|
15742 | });
|
15743 |
|
15744 | test("x ^= 42", {
|
15745 | type: "Program",
|
15746 | body: [
|
15747 | {
|
15748 | type: "ExpressionStatement",
|
15749 | expression: {
|
15750 | type: "AssignmentExpression",
|
15751 | operator: "^=",
|
15752 | left: {
|
15753 | type: "Identifier",
|
15754 | name: "x",
|
15755 | loc: {
|
15756 | start: {
|
15757 | line: 1,
|
15758 | column: 0
|
15759 | },
|
15760 | end: {
|
15761 | line: 1,
|
15762 | column: 1
|
15763 | }
|
15764 | }
|
15765 | },
|
15766 | right: {
|
15767 | type: "Literal",
|
15768 | value: 42,
|
15769 | loc: {
|
15770 | start: {
|
15771 | line: 1,
|
15772 | column: 5
|
15773 | },
|
15774 | end: {
|
15775 | line: 1,
|
15776 | column: 7
|
15777 | }
|
15778 | }
|
15779 | },
|
15780 | loc: {
|
15781 | start: {
|
15782 | line: 1,
|
15783 | column: 0
|
15784 | },
|
15785 | end: {
|
15786 | line: 1,
|
15787 | column: 7
|
15788 | }
|
15789 | }
|
15790 | },
|
15791 | loc: {
|
15792 | start: {
|
15793 | line: 1,
|
15794 | column: 0
|
15795 | },
|
15796 | end: {
|
15797 | line: 1,
|
15798 | column: 7
|
15799 | }
|
15800 | }
|
15801 | }
|
15802 | ],
|
15803 | loc: {
|
15804 | start: {
|
15805 | line: 1,
|
15806 | column: 0
|
15807 | },
|
15808 | end: {
|
15809 | line: 1,
|
15810 | column: 7
|
15811 | }
|
15812 | }
|
15813 | });
|
15814 |
|
15815 | test("x |= 42", {
|
15816 | type: "Program",
|
15817 | body: [
|
15818 | {
|
15819 | type: "ExpressionStatement",
|
15820 | expression: {
|
15821 | type: "AssignmentExpression",
|
15822 | operator: "|=",
|
15823 | left: {
|
15824 | type: "Identifier",
|
15825 | name: "x",
|
15826 | loc: {
|
15827 | start: {
|
15828 | line: 1,
|
15829 | column: 0
|
15830 | },
|
15831 | end: {
|
15832 | line: 1,
|
15833 | column: 1
|
15834 | }
|
15835 | }
|
15836 | },
|
15837 | right: {
|
15838 | type: "Literal",
|
15839 | value: 42,
|
15840 | loc: {
|
15841 | start: {
|
15842 | line: 1,
|
15843 | column: 5
|
15844 | },
|
15845 | end: {
|
15846 | line: 1,
|
15847 | column: 7
|
15848 | }
|
15849 | }
|
15850 | },
|
15851 | loc: {
|
15852 | start: {
|
15853 | line: 1,
|
15854 | column: 0
|
15855 | },
|
15856 | end: {
|
15857 | line: 1,
|
15858 | column: 7
|
15859 | }
|
15860 | }
|
15861 | },
|
15862 | loc: {
|
15863 | start: {
|
15864 | line: 1,
|
15865 | column: 0
|
15866 | },
|
15867 | end: {
|
15868 | line: 1,
|
15869 | column: 7
|
15870 | }
|
15871 | }
|
15872 | }
|
15873 | ],
|
15874 | loc: {
|
15875 | start: {
|
15876 | line: 1,
|
15877 | column: 0
|
15878 | },
|
15879 | end: {
|
15880 | line: 1,
|
15881 | column: 7
|
15882 | }
|
15883 | }
|
15884 | });
|
15885 |
|
15886 | test("{ foo }", {
|
15887 | type: "Program",
|
15888 | body: [
|
15889 | {
|
15890 | type: "BlockStatement",
|
15891 | body: [
|
15892 | {
|
15893 | type: "ExpressionStatement",
|
15894 | expression: {
|
15895 | type: "Identifier",
|
15896 | name: "foo",
|
15897 | loc: {
|
15898 | start: {
|
15899 | line: 1,
|
15900 | column: 2
|
15901 | },
|
15902 | end: {
|
15903 | line: 1,
|
15904 | column: 5
|
15905 | }
|
15906 | }
|
15907 | },
|
15908 | loc: {
|
15909 | start: {
|
15910 | line: 1,
|
15911 | column: 2
|
15912 | },
|
15913 | end: {
|
15914 | line: 1,
|
15915 | column: 5
|
15916 | }
|
15917 | }
|
15918 | }
|
15919 | ],
|
15920 | loc: {
|
15921 | start: {
|
15922 | line: 1,
|
15923 | column: 0
|
15924 | },
|
15925 | end: {
|
15926 | line: 1,
|
15927 | column: 7
|
15928 | }
|
15929 | }
|
15930 | }
|
15931 | ],
|
15932 | loc: {
|
15933 | start: {
|
15934 | line: 1,
|
15935 | column: 0
|
15936 | },
|
15937 | end: {
|
15938 | line: 1,
|
15939 | column: 7
|
15940 | }
|
15941 | }
|
15942 | });
|
15943 |
|
15944 | test("{ doThis(); doThat(); }", {
|
15945 | type: "Program",
|
15946 | body: [
|
15947 | {
|
15948 | type: "BlockStatement",
|
15949 | body: [
|
15950 | {
|
15951 | type: "ExpressionStatement",
|
15952 | expression: {
|
15953 | type: "CallExpression",
|
15954 | callee: {
|
15955 | type: "Identifier",
|
15956 | name: "doThis",
|
15957 | loc: {
|
15958 | start: {
|
15959 | line: 1,
|
15960 | column: 2
|
15961 | },
|
15962 | end: {
|
15963 | line: 1,
|
15964 | column: 8
|
15965 | }
|
15966 | }
|
15967 | },
|
15968 | arguments: [],
|
15969 | loc: {
|
15970 | start: {
|
15971 | line: 1,
|
15972 | column: 2
|
15973 | },
|
15974 | end: {
|
15975 | line: 1,
|
15976 | column: 10
|
15977 | }
|
15978 | }
|
15979 | },
|
15980 | loc: {
|
15981 | start: {
|
15982 | line: 1,
|
15983 | column: 2
|
15984 | },
|
15985 | end: {
|
15986 | line: 1,
|
15987 | column: 11
|
15988 | }
|
15989 | }
|
15990 | },
|
15991 | {
|
15992 | type: "ExpressionStatement",
|
15993 | expression: {
|
15994 | type: "CallExpression",
|
15995 | callee: {
|
15996 | type: "Identifier",
|
15997 | name: "doThat",
|
15998 | loc: {
|
15999 | start: {
|
16000 | line: 1,
|
16001 | column: 12
|
16002 | },
|
16003 | end: {
|
16004 | line: 1,
|
16005 | column: 18
|
16006 | }
|
16007 | }
|
16008 | },
|
16009 | arguments: [],
|
16010 | loc: {
|
16011 | start: {
|
16012 | line: 1,
|
16013 | column: 12
|
16014 | },
|
16015 | end: {
|
16016 | line: 1,
|
16017 | column: 20
|
16018 | }
|
16019 | }
|
16020 | },
|
16021 | loc: {
|
16022 | start: {
|
16023 | line: 1,
|
16024 | column: 12
|
16025 | },
|
16026 | end: {
|
16027 | line: 1,
|
16028 | column: 21
|
16029 | }
|
16030 | }
|
16031 | }
|
16032 | ],
|
16033 | loc: {
|
16034 | start: {
|
16035 | line: 1,
|
16036 | column: 0
|
16037 | },
|
16038 | end: {
|
16039 | line: 1,
|
16040 | column: 23
|
16041 | }
|
16042 | }
|
16043 | }
|
16044 | ],
|
16045 | loc: {
|
16046 | start: {
|
16047 | line: 1,
|
16048 | column: 0
|
16049 | },
|
16050 | end: {
|
16051 | line: 1,
|
16052 | column: 23
|
16053 | }
|
16054 | }
|
16055 | });
|
16056 |
|
16057 | test("{}", {
|
16058 | type: "Program",
|
16059 | body: [
|
16060 | {
|
16061 | type: "BlockStatement",
|
16062 | body: [],
|
16063 | loc: {
|
16064 | start: {
|
16065 | line: 1,
|
16066 | column: 0
|
16067 | },
|
16068 | end: {
|
16069 | line: 1,
|
16070 | column: 2
|
16071 | }
|
16072 | }
|
16073 | }
|
16074 | ],
|
16075 | loc: {
|
16076 | start: {
|
16077 | line: 1,
|
16078 | column: 0
|
16079 | },
|
16080 | end: {
|
16081 | line: 1,
|
16082 | column: 2
|
16083 | }
|
16084 | }
|
16085 | });
|
16086 |
|
16087 | test("var x", {
|
16088 | type: "Program",
|
16089 | body: [
|
16090 | {
|
16091 | type: "VariableDeclaration",
|
16092 | declarations: [
|
16093 | {
|
16094 | type: "VariableDeclarator",
|
16095 | id: {
|
16096 | type: "Identifier",
|
16097 | name: "x",
|
16098 | loc: {
|
16099 | start: {
|
16100 | line: 1,
|
16101 | column: 4
|
16102 | },
|
16103 | end: {
|
16104 | line: 1,
|
16105 | column: 5
|
16106 | }
|
16107 | }
|
16108 | },
|
16109 | init: null,
|
16110 | loc: {
|
16111 | start: {
|
16112 | line: 1,
|
16113 | column: 4
|
16114 | },
|
16115 | end: {
|
16116 | line: 1,
|
16117 | column: 5
|
16118 | }
|
16119 | }
|
16120 | }
|
16121 | ],
|
16122 | kind: "var",
|
16123 | loc: {
|
16124 | start: {
|
16125 | line: 1,
|
16126 | column: 0
|
16127 | },
|
16128 | end: {
|
16129 | line: 1,
|
16130 | column: 5
|
16131 | }
|
16132 | }
|
16133 | }
|
16134 | ],
|
16135 | loc: {
|
16136 | start: {
|
16137 | line: 1,
|
16138 | column: 0
|
16139 | },
|
16140 | end: {
|
16141 | line: 1,
|
16142 | column: 5
|
16143 | }
|
16144 | }
|
16145 | });
|
16146 |
|
16147 | test("var x, y;", {
|
16148 | type: "Program",
|
16149 | body: [
|
16150 | {
|
16151 | type: "VariableDeclaration",
|
16152 | declarations: [
|
16153 | {
|
16154 | type: "VariableDeclarator",
|
16155 | id: {
|
16156 | type: "Identifier",
|
16157 | name: "x",
|
16158 | loc: {
|
16159 | start: {
|
16160 | line: 1,
|
16161 | column: 4
|
16162 | },
|
16163 | end: {
|
16164 | line: 1,
|
16165 | column: 5
|
16166 | }
|
16167 | }
|
16168 | },
|
16169 | init: null,
|
16170 | loc: {
|
16171 | start: {
|
16172 | line: 1,
|
16173 | column: 4
|
16174 | },
|
16175 | end: {
|
16176 | line: 1,
|
16177 | column: 5
|
16178 | }
|
16179 | }
|
16180 | },
|
16181 | {
|
16182 | type: "VariableDeclarator",
|
16183 | id: {
|
16184 | type: "Identifier",
|
16185 | name: "y",
|
16186 | loc: {
|
16187 | start: {
|
16188 | line: 1,
|
16189 | column: 7
|
16190 | },
|
16191 | end: {
|
16192 | line: 1,
|
16193 | column: 8
|
16194 | }
|
16195 | }
|
16196 | },
|
16197 | init: null,
|
16198 | loc: {
|
16199 | start: {
|
16200 | line: 1,
|
16201 | column: 7
|
16202 | },
|
16203 | end: {
|
16204 | line: 1,
|
16205 | column: 8
|
16206 | }
|
16207 | }
|
16208 | }
|
16209 | ],
|
16210 | kind: "var",
|
16211 | loc: {
|
16212 | start: {
|
16213 | line: 1,
|
16214 | column: 0
|
16215 | },
|
16216 | end: {
|
16217 | line: 1,
|
16218 | column: 9
|
16219 | }
|
16220 | }
|
16221 | }
|
16222 | ],
|
16223 | loc: {
|
16224 | start: {
|
16225 | line: 1,
|
16226 | column: 0
|
16227 | },
|
16228 | end: {
|
16229 | line: 1,
|
16230 | column: 9
|
16231 | }
|
16232 | }
|
16233 | });
|
16234 |
|
16235 | test("var x = 42", {
|
16236 | type: "Program",
|
16237 | body: [
|
16238 | {
|
16239 | type: "VariableDeclaration",
|
16240 | declarations: [
|
16241 | {
|
16242 | type: "VariableDeclarator",
|
16243 | id: {
|
16244 | type: "Identifier",
|
16245 | name: "x",
|
16246 | loc: {
|
16247 | start: {
|
16248 | line: 1,
|
16249 | column: 4
|
16250 | },
|
16251 | end: {
|
16252 | line: 1,
|
16253 | column: 5
|
16254 | }
|
16255 | }
|
16256 | },
|
16257 | init: {
|
16258 | type: "Literal",
|
16259 | value: 42,
|
16260 | loc: {
|
16261 | start: {
|
16262 | line: 1,
|
16263 | column: 8
|
16264 | },
|
16265 | end: {
|
16266 | line: 1,
|
16267 | column: 10
|
16268 | }
|
16269 | }
|
16270 | },
|
16271 | loc: {
|
16272 | start: {
|
16273 | line: 1,
|
16274 | column: 4
|
16275 | },
|
16276 | end: {
|
16277 | line: 1,
|
16278 | column: 10
|
16279 | }
|
16280 | }
|
16281 | }
|
16282 | ],
|
16283 | kind: "var",
|
16284 | loc: {
|
16285 | start: {
|
16286 | line: 1,
|
16287 | column: 0
|
16288 | },
|
16289 | end: {
|
16290 | line: 1,
|
16291 | column: 10
|
16292 | }
|
16293 | }
|
16294 | }
|
16295 | ],
|
16296 | loc: {
|
16297 | start: {
|
16298 | line: 1,
|
16299 | column: 0
|
16300 | },
|
16301 | end: {
|
16302 | line: 1,
|
16303 | column: 10
|
16304 | }
|
16305 | }
|
16306 | });
|
16307 |
|
16308 | test("var eval = 42, arguments = 42", {
|
16309 | type: "Program",
|
16310 | body: [
|
16311 | {
|
16312 | type: "VariableDeclaration",
|
16313 | declarations: [
|
16314 | {
|
16315 | type: "VariableDeclarator",
|
16316 | id: {
|
16317 | type: "Identifier",
|
16318 | name: "eval",
|
16319 | loc: {
|
16320 | start: {
|
16321 | line: 1,
|
16322 | column: 4
|
16323 | },
|
16324 | end: {
|
16325 | line: 1,
|
16326 | column: 8
|
16327 | }
|
16328 | }
|
16329 | },
|
16330 | init: {
|
16331 | type: "Literal",
|
16332 | value: 42,
|
16333 | loc: {
|
16334 | start: {
|
16335 | line: 1,
|
16336 | column: 11
|
16337 | },
|
16338 | end: {
|
16339 | line: 1,
|
16340 | column: 13
|
16341 | }
|
16342 | }
|
16343 | },
|
16344 | loc: {
|
16345 | start: {
|
16346 | line: 1,
|
16347 | column: 4
|
16348 | },
|
16349 | end: {
|
16350 | line: 1,
|
16351 | column: 13
|
16352 | }
|
16353 | }
|
16354 | },
|
16355 | {
|
16356 | type: "VariableDeclarator",
|
16357 | id: {
|
16358 | type: "Identifier",
|
16359 | name: "arguments",
|
16360 | loc: {
|
16361 | start: {
|
16362 | line: 1,
|
16363 | column: 15
|
16364 | },
|
16365 | end: {
|
16366 | line: 1,
|
16367 | column: 24
|
16368 | }
|
16369 | }
|
16370 | },
|
16371 | init: {
|
16372 | type: "Literal",
|
16373 | value: 42,
|
16374 | loc: {
|
16375 | start: {
|
16376 | line: 1,
|
16377 | column: 27
|
16378 | },
|
16379 | end: {
|
16380 | line: 1,
|
16381 | column: 29
|
16382 | }
|
16383 | }
|
16384 | },
|
16385 | loc: {
|
16386 | start: {
|
16387 | line: 1,
|
16388 | column: 15
|
16389 | },
|
16390 | end: {
|
16391 | line: 1,
|
16392 | column: 29
|
16393 | }
|
16394 | }
|
16395 | }
|
16396 | ],
|
16397 | kind: "var",
|
16398 | loc: {
|
16399 | start: {
|
16400 | line: 1,
|
16401 | column: 0
|
16402 | },
|
16403 | end: {
|
16404 | line: 1,
|
16405 | column: 29
|
16406 | }
|
16407 | }
|
16408 | }
|
16409 | ],
|
16410 | loc: {
|
16411 | start: {
|
16412 | line: 1,
|
16413 | column: 0
|
16414 | },
|
16415 | end: {
|
16416 | line: 1,
|
16417 | column: 29
|
16418 | }
|
16419 | }
|
16420 | });
|
16421 |
|
16422 | test("var x = 14, y = 3, z = 1977", {
|
16423 | type: "Program",
|
16424 | body: [
|
16425 | {
|
16426 | type: "VariableDeclaration",
|
16427 | declarations: [
|
16428 | {
|
16429 | type: "VariableDeclarator",
|
16430 | id: {
|
16431 | type: "Identifier",
|
16432 | name: "x",
|
16433 | loc: {
|
16434 | start: {
|
16435 | line: 1,
|
16436 | column: 4
|
16437 | },
|
16438 | end: {
|
16439 | line: 1,
|
16440 | column: 5
|
16441 | }
|
16442 | }
|
16443 | },
|
16444 | init: {
|
16445 | type: "Literal",
|
16446 | value: 14,
|
16447 | loc: {
|
16448 | start: {
|
16449 | line: 1,
|
16450 | column: 8
|
16451 | },
|
16452 | end: {
|
16453 | line: 1,
|
16454 | column: 10
|
16455 | }
|
16456 | }
|
16457 | },
|
16458 | loc: {
|
16459 | start: {
|
16460 | line: 1,
|
16461 | column: 4
|
16462 | },
|
16463 | end: {
|
16464 | line: 1,
|
16465 | column: 10
|
16466 | }
|
16467 | }
|
16468 | },
|
16469 | {
|
16470 | type: "VariableDeclarator",
|
16471 | id: {
|
16472 | type: "Identifier",
|
16473 | name: "y",
|
16474 | loc: {
|
16475 | start: {
|
16476 | line: 1,
|
16477 | column: 12
|
16478 | },
|
16479 | end: {
|
16480 | line: 1,
|
16481 | column: 13
|
16482 | }
|
16483 | }
|
16484 | },
|
16485 | init: {
|
16486 | type: "Literal",
|
16487 | value: 3,
|
16488 | loc: {
|
16489 | start: {
|
16490 | line: 1,
|
16491 | column: 16
|
16492 | },
|
16493 | end: {
|
16494 | line: 1,
|
16495 | column: 17
|
16496 | }
|
16497 | }
|
16498 | },
|
16499 | loc: {
|
16500 | start: {
|
16501 | line: 1,
|
16502 | column: 12
|
16503 | },
|
16504 | end: {
|
16505 | line: 1,
|
16506 | column: 17
|
16507 | }
|
16508 | }
|
16509 | },
|
16510 | {
|
16511 | type: "VariableDeclarator",
|
16512 | id: {
|
16513 | type: "Identifier",
|
16514 | name: "z",
|
16515 | loc: {
|
16516 | start: {
|
16517 | line: 1,
|
16518 | column: 19
|
16519 | },
|
16520 | end: {
|
16521 | line: 1,
|
16522 | column: 20
|
16523 | }
|
16524 | }
|
16525 | },
|
16526 | init: {
|
16527 | type: "Literal",
|
16528 | value: 1977,
|
16529 | loc: {
|
16530 | start: {
|
16531 | line: 1,
|
16532 | column: 23
|
16533 | },
|
16534 | end: {
|
16535 | line: 1,
|
16536 | column: 27
|
16537 | }
|
16538 | }
|
16539 | },
|
16540 | loc: {
|
16541 | start: {
|
16542 | line: 1,
|
16543 | column: 19
|
16544 | },
|
16545 | end: {
|
16546 | line: 1,
|
16547 | column: 27
|
16548 | }
|
16549 | }
|
16550 | }
|
16551 | ],
|
16552 | kind: "var",
|
16553 | loc: {
|
16554 | start: {
|
16555 | line: 1,
|
16556 | column: 0
|
16557 | },
|
16558 | end: {
|
16559 | line: 1,
|
16560 | column: 27
|
16561 | }
|
16562 | }
|
16563 | }
|
16564 | ],
|
16565 | loc: {
|
16566 | start: {
|
16567 | line: 1,
|
16568 | column: 0
|
16569 | },
|
16570 | end: {
|
16571 | line: 1,
|
16572 | column: 27
|
16573 | }
|
16574 | }
|
16575 | });
|
16576 |
|
16577 | test("var implements, interface, package", {
|
16578 | type: "Program",
|
16579 | body: [
|
16580 | {
|
16581 | type: "VariableDeclaration",
|
16582 | declarations: [
|
16583 | {
|
16584 | type: "VariableDeclarator",
|
16585 | id: {
|
16586 | type: "Identifier",
|
16587 | name: "implements",
|
16588 | loc: {
|
16589 | start: {
|
16590 | line: 1,
|
16591 | column: 4
|
16592 | },
|
16593 | end: {
|
16594 | line: 1,
|
16595 | column: 14
|
16596 | }
|
16597 | }
|
16598 | },
|
16599 | init: null,
|
16600 | loc: {
|
16601 | start: {
|
16602 | line: 1,
|
16603 | column: 4
|
16604 | },
|
16605 | end: {
|
16606 | line: 1,
|
16607 | column: 14
|
16608 | }
|
16609 | }
|
16610 | },
|
16611 | {
|
16612 | type: "VariableDeclarator",
|
16613 | id: {
|
16614 | type: "Identifier",
|
16615 | name: "interface",
|
16616 | loc: {
|
16617 | start: {
|
16618 | line: 1,
|
16619 | column: 16
|
16620 | },
|
16621 | end: {
|
16622 | line: 1,
|
16623 | column: 25
|
16624 | }
|
16625 | }
|
16626 | },
|
16627 | init: null,
|
16628 | loc: {
|
16629 | start: {
|
16630 | line: 1,
|
16631 | column: 16
|
16632 | },
|
16633 | end: {
|
16634 | line: 1,
|
16635 | column: 25
|
16636 | }
|
16637 | }
|
16638 | },
|
16639 | {
|
16640 | type: "VariableDeclarator",
|
16641 | id: {
|
16642 | type: "Identifier",
|
16643 | name: "package",
|
16644 | loc: {
|
16645 | start: {
|
16646 | line: 1,
|
16647 | column: 27
|
16648 | },
|
16649 | end: {
|
16650 | line: 1,
|
16651 | column: 34
|
16652 | }
|
16653 | }
|
16654 | },
|
16655 | init: null,
|
16656 | loc: {
|
16657 | start: {
|
16658 | line: 1,
|
16659 | column: 27
|
16660 | },
|
16661 | end: {
|
16662 | line: 1,
|
16663 | column: 34
|
16664 | }
|
16665 | }
|
16666 | }
|
16667 | ],
|
16668 | kind: "var",
|
16669 | loc: {
|
16670 | start: {
|
16671 | line: 1,
|
16672 | column: 0
|
16673 | },
|
16674 | end: {
|
16675 | line: 1,
|
16676 | column: 34
|
16677 | }
|
16678 | }
|
16679 | }
|
16680 | ],
|
16681 | loc: {
|
16682 | start: {
|
16683 | line: 1,
|
16684 | column: 0
|
16685 | },
|
16686 | end: {
|
16687 | line: 1,
|
16688 | column: 34
|
16689 | }
|
16690 | }
|
16691 | });
|
16692 |
|
16693 | test("var private, protected, public, static", {
|
16694 | type: "Program",
|
16695 | body: [
|
16696 | {
|
16697 | type: "VariableDeclaration",
|
16698 | declarations: [
|
16699 | {
|
16700 | type: "VariableDeclarator",
|
16701 | id: {
|
16702 | type: "Identifier",
|
16703 | name: "private",
|
16704 | loc: {
|
16705 | start: {
|
16706 | line: 1,
|
16707 | column: 4
|
16708 | },
|
16709 | end: {
|
16710 | line: 1,
|
16711 | column: 11
|
16712 | }
|
16713 | }
|
16714 | },
|
16715 | init: null,
|
16716 | loc: {
|
16717 | start: {
|
16718 | line: 1,
|
16719 | column: 4
|
16720 | },
|
16721 | end: {
|
16722 | line: 1,
|
16723 | column: 11
|
16724 | }
|
16725 | }
|
16726 | },
|
16727 | {
|
16728 | type: "VariableDeclarator",
|
16729 | id: {
|
16730 | type: "Identifier",
|
16731 | name: "protected",
|
16732 | loc: {
|
16733 | start: {
|
16734 | line: 1,
|
16735 | column: 13
|
16736 | },
|
16737 | end: {
|
16738 | line: 1,
|
16739 | column: 22
|
16740 | }
|
16741 | }
|
16742 | },
|
16743 | init: null,
|
16744 | loc: {
|
16745 | start: {
|
16746 | line: 1,
|
16747 | column: 13
|
16748 | },
|
16749 | end: {
|
16750 | line: 1,
|
16751 | column: 22
|
16752 | }
|
16753 | }
|
16754 | },
|
16755 | {
|
16756 | type: "VariableDeclarator",
|
16757 | id: {
|
16758 | type: "Identifier",
|
16759 | name: "public",
|
16760 | loc: {
|
16761 | start: {
|
16762 | line: 1,
|
16763 | column: 24
|
16764 | },
|
16765 | end: {
|
16766 | line: 1,
|
16767 | column: 30
|
16768 | }
|
16769 | }
|
16770 | },
|
16771 | init: null,
|
16772 | loc: {
|
16773 | start: {
|
16774 | line: 1,
|
16775 | column: 24
|
16776 | },
|
16777 | end: {
|
16778 | line: 1,
|
16779 | column: 30
|
16780 | }
|
16781 | }
|
16782 | },
|
16783 | {
|
16784 | type: "VariableDeclarator",
|
16785 | id: {
|
16786 | type: "Identifier",
|
16787 | name: "static",
|
16788 | loc: {
|
16789 | start: {
|
16790 | line: 1,
|
16791 | column: 32
|
16792 | },
|
16793 | end: {
|
16794 | line: 1,
|
16795 | column: 38
|
16796 | }
|
16797 | }
|
16798 | },
|
16799 | init: null,
|
16800 | loc: {
|
16801 | start: {
|
16802 | line: 1,
|
16803 | column: 32
|
16804 | },
|
16805 | end: {
|
16806 | line: 1,
|
16807 | column: 38
|
16808 | }
|
16809 | }
|
16810 | }
|
16811 | ],
|
16812 | kind: "var",
|
16813 | loc: {
|
16814 | start: {
|
16815 | line: 1,
|
16816 | column: 0
|
16817 | },
|
16818 | end: {
|
16819 | line: 1,
|
16820 | column: 38
|
16821 | }
|
16822 | }
|
16823 | }
|
16824 | ],
|
16825 | loc: {
|
16826 | start: {
|
16827 | line: 1,
|
16828 | column: 0
|
16829 | },
|
16830 | end: {
|
16831 | line: 1,
|
16832 | column: 38
|
16833 | }
|
16834 | }
|
16835 | });
|
16836 |
|
16837 | test(";", {
|
16838 | type: "Program",
|
16839 | body: [
|
16840 | {
|
16841 | type: "EmptyStatement",
|
16842 | loc: {
|
16843 | start: {
|
16844 | line: 1,
|
16845 | column: 0
|
16846 | },
|
16847 | end: {
|
16848 | line: 1,
|
16849 | column: 1
|
16850 | }
|
16851 | }
|
16852 | }
|
16853 | ],
|
16854 | loc: {
|
16855 | start: {
|
16856 | line: 1,
|
16857 | column: 0
|
16858 | },
|
16859 | end: {
|
16860 | line: 1,
|
16861 | column: 1
|
16862 | }
|
16863 | }
|
16864 | });
|
16865 |
|
16866 | test("x", {
|
16867 | type: "Program",
|
16868 | body: [
|
16869 | {
|
16870 | type: "ExpressionStatement",
|
16871 | expression: {
|
16872 | type: "Identifier",
|
16873 | name: "x",
|
16874 | loc: {
|
16875 | start: {
|
16876 | line: 1,
|
16877 | column: 0
|
16878 | },
|
16879 | end: {
|
16880 | line: 1,
|
16881 | column: 1
|
16882 | }
|
16883 | }
|
16884 | },
|
16885 | loc: {
|
16886 | start: {
|
16887 | line: 1,
|
16888 | column: 0
|
16889 | },
|
16890 | end: {
|
16891 | line: 1,
|
16892 | column: 1
|
16893 | }
|
16894 | }
|
16895 | }
|
16896 | ],
|
16897 | loc: {
|
16898 | start: {
|
16899 | line: 1,
|
16900 | column: 0
|
16901 | },
|
16902 | end: {
|
16903 | line: 1,
|
16904 | column: 1
|
16905 | }
|
16906 | }
|
16907 | });
|
16908 |
|
16909 | test("x, y", {
|
16910 | type: "Program",
|
16911 | body: [
|
16912 | {
|
16913 | type: "ExpressionStatement",
|
16914 | expression: {
|
16915 | type: "SequenceExpression",
|
16916 | expressions: [
|
16917 | {
|
16918 | type: "Identifier",
|
16919 | name: "x",
|
16920 | loc: {
|
16921 | start: {
|
16922 | line: 1,
|
16923 | column: 0
|
16924 | },
|
16925 | end: {
|
16926 | line: 1,
|
16927 | column: 1
|
16928 | }
|
16929 | }
|
16930 | },
|
16931 | {
|
16932 | type: "Identifier",
|
16933 | name: "y",
|
16934 | loc: {
|
16935 | start: {
|
16936 | line: 1,
|
16937 | column: 3
|
16938 | },
|
16939 | end: {
|
16940 | line: 1,
|
16941 | column: 4
|
16942 | }
|
16943 | }
|
16944 | }
|
16945 | ],
|
16946 | loc: {
|
16947 | start: {
|
16948 | line: 1,
|
16949 | column: 0
|
16950 | },
|
16951 | end: {
|
16952 | line: 1,
|
16953 | column: 4
|
16954 | }
|
16955 | }
|
16956 | },
|
16957 | loc: {
|
16958 | start: {
|
16959 | line: 1,
|
16960 | column: 0
|
16961 | },
|
16962 | end: {
|
16963 | line: 1,
|
16964 | column: 4
|
16965 | }
|
16966 | }
|
16967 | }
|
16968 | ],
|
16969 | loc: {
|
16970 | start: {
|
16971 | line: 1,
|
16972 | column: 0
|
16973 | },
|
16974 | end: {
|
16975 | line: 1,
|
16976 | column: 4
|
16977 | }
|
16978 | }
|
16979 | });
|
16980 |
|
16981 | test("\\u0061", {
|
16982 | type: "Program",
|
16983 | body: [
|
16984 | {
|
16985 | type: "ExpressionStatement",
|
16986 | expression: {
|
16987 | type: "Identifier",
|
16988 | name: "a",
|
16989 | loc: {
|
16990 | start: {
|
16991 | line: 1,
|
16992 | column: 0
|
16993 | },
|
16994 | end: {
|
16995 | line: 1,
|
16996 | column: 6
|
16997 | }
|
16998 | }
|
16999 | },
|
17000 | loc: {
|
17001 | start: {
|
17002 | line: 1,
|
17003 | column: 0
|
17004 | },
|
17005 | end: {
|
17006 | line: 1,
|
17007 | column: 6
|
17008 | }
|
17009 | }
|
17010 | }
|
17011 | ],
|
17012 | loc: {
|
17013 | start: {
|
17014 | line: 1,
|
17015 | column: 0
|
17016 | },
|
17017 | end: {
|
17018 | line: 1,
|
17019 | column: 6
|
17020 | }
|
17021 | }
|
17022 | });
|
17023 |
|
17024 | test("a\\u0061", {
|
17025 | type: "Program",
|
17026 | body: [
|
17027 | {
|
17028 | type: "ExpressionStatement",
|
17029 | expression: {
|
17030 | type: "Identifier",
|
17031 | name: "aa",
|
17032 | loc: {
|
17033 | start: {
|
17034 | line: 1,
|
17035 | column: 0
|
17036 | },
|
17037 | end: {
|
17038 | line: 1,
|
17039 | column: 7
|
17040 | }
|
17041 | }
|
17042 | },
|
17043 | loc: {
|
17044 | start: {
|
17045 | line: 1,
|
17046 | column: 0
|
17047 | },
|
17048 | end: {
|
17049 | line: 1,
|
17050 | column: 7
|
17051 | }
|
17052 | }
|
17053 | }
|
17054 | ],
|
17055 | loc: {
|
17056 | start: {
|
17057 | line: 1,
|
17058 | column: 0
|
17059 | },
|
17060 | end: {
|
17061 | line: 1,
|
17062 | column: 7
|
17063 | }
|
17064 | }
|
17065 | });
|
17066 |
|
17067 | test("if (morning) goodMorning()", {
|
17068 | type: "Program",
|
17069 | body: [
|
17070 | {
|
17071 | type: "IfStatement",
|
17072 | test: {
|
17073 | type: "Identifier",
|
17074 | name: "morning",
|
17075 | loc: {
|
17076 | start: {
|
17077 | line: 1,
|
17078 | column: 4
|
17079 | },
|
17080 | end: {
|
17081 | line: 1,
|
17082 | column: 11
|
17083 | }
|
17084 | }
|
17085 | },
|
17086 | consequent: {
|
17087 | type: "ExpressionStatement",
|
17088 | expression: {
|
17089 | type: "CallExpression",
|
17090 | callee: {
|
17091 | type: "Identifier",
|
17092 | name: "goodMorning",
|
17093 | loc: {
|
17094 | start: {
|
17095 | line: 1,
|
17096 | column: 13
|
17097 | },
|
17098 | end: {
|
17099 | line: 1,
|
17100 | column: 24
|
17101 | }
|
17102 | }
|
17103 | },
|
17104 | arguments: [],
|
17105 | loc: {
|
17106 | start: {
|
17107 | line: 1,
|
17108 | column: 13
|
17109 | },
|
17110 | end: {
|
17111 | line: 1,
|
17112 | column: 26
|
17113 | }
|
17114 | }
|
17115 | },
|
17116 | loc: {
|
17117 | start: {
|
17118 | line: 1,
|
17119 | column: 13
|
17120 | },
|
17121 | end: {
|
17122 | line: 1,
|
17123 | column: 26
|
17124 | }
|
17125 | }
|
17126 | },
|
17127 | alternate: null,
|
17128 | loc: {
|
17129 | start: {
|
17130 | line: 1,
|
17131 | column: 0
|
17132 | },
|
17133 | end: {
|
17134 | line: 1,
|
17135 | column: 26
|
17136 | }
|
17137 | }
|
17138 | }
|
17139 | ],
|
17140 | loc: {
|
17141 | start: {
|
17142 | line: 1,
|
17143 | column: 0
|
17144 | },
|
17145 | end: {
|
17146 | line: 1,
|
17147 | column: 26
|
17148 | }
|
17149 | }
|
17150 | });
|
17151 |
|
17152 | test("if (morning) (function(){})", {
|
17153 | type: "Program",
|
17154 | body: [
|
17155 | {
|
17156 | type: "IfStatement",
|
17157 | test: {
|
17158 | type: "Identifier",
|
17159 | name: "morning",
|
17160 | loc: {
|
17161 | start: {
|
17162 | line: 1,
|
17163 | column: 4
|
17164 | },
|
17165 | end: {
|
17166 | line: 1,
|
17167 | column: 11
|
17168 | }
|
17169 | }
|
17170 | },
|
17171 | consequent: {
|
17172 | type: "ExpressionStatement",
|
17173 | expression: {
|
17174 | type: "FunctionExpression",
|
17175 | id: null,
|
17176 | params: [],
|
17177 | body: {
|
17178 | type: "BlockStatement",
|
17179 | body: [],
|
17180 | loc: {
|
17181 | start: {
|
17182 | line: 1,
|
17183 | column: 24
|
17184 | },
|
17185 | end: {
|
17186 | line: 1,
|
17187 | column: 26
|
17188 | }
|
17189 | }
|
17190 | },
|
17191 | loc: {
|
17192 | start: {
|
17193 | line: 1,
|
17194 | column: 13
|
17195 | },
|
17196 | end: {
|
17197 | line: 1,
|
17198 | column: 27
|
17199 | }
|
17200 | }
|
17201 | },
|
17202 | loc: {
|
17203 | start: {
|
17204 | line: 1,
|
17205 | column: 13
|
17206 | },
|
17207 | end: {
|
17208 | line: 1,
|
17209 | column: 27
|
17210 | }
|
17211 | }
|
17212 | },
|
17213 | alternate: null,
|
17214 | loc: {
|
17215 | start: {
|
17216 | line: 1,
|
17217 | column: 0
|
17218 | },
|
17219 | end: {
|
17220 | line: 1,
|
17221 | column: 27
|
17222 | }
|
17223 | }
|
17224 | }
|
17225 | ],
|
17226 | loc: {
|
17227 | start: {
|
17228 | line: 1,
|
17229 | column: 0
|
17230 | },
|
17231 | end: {
|
17232 | line: 1,
|
17233 | column: 27
|
17234 | }
|
17235 | }
|
17236 | });
|
17237 |
|
17238 | test("if (morning) var x = 0;", {
|
17239 | type: "Program",
|
17240 | body: [
|
17241 | {
|
17242 | type: "IfStatement",
|
17243 | test: {
|
17244 | type: "Identifier",
|
17245 | name: "morning",
|
17246 | loc: {
|
17247 | start: {
|
17248 | line: 1,
|
17249 | column: 4
|
17250 | },
|
17251 | end: {
|
17252 | line: 1,
|
17253 | column: 11
|
17254 | }
|
17255 | }
|
17256 | },
|
17257 | consequent: {
|
17258 | type: "VariableDeclaration",
|
17259 | declarations: [
|
17260 | {
|
17261 | type: "VariableDeclarator",
|
17262 | id: {
|
17263 | type: "Identifier",
|
17264 | name: "x",
|
17265 | loc: {
|
17266 | start: {
|
17267 | line: 1,
|
17268 | column: 17
|
17269 | },
|
17270 | end: {
|
17271 | line: 1,
|
17272 | column: 18
|
17273 | }
|
17274 | }
|
17275 | },
|
17276 | init: {
|
17277 | type: "Literal",
|
17278 | value: 0,
|
17279 | loc: {
|
17280 | start: {
|
17281 | line: 1,
|
17282 | column: 21
|
17283 | },
|
17284 | end: {
|
17285 | line: 1,
|
17286 | column: 22
|
17287 | }
|
17288 | }
|
17289 | },
|
17290 | loc: {
|
17291 | start: {
|
17292 | line: 1,
|
17293 | column: 17
|
17294 | },
|
17295 | end: {
|
17296 | line: 1,
|
17297 | column: 22
|
17298 | }
|
17299 | }
|
17300 | }
|
17301 | ],
|
17302 | kind: "var",
|
17303 | loc: {
|
17304 | start: {
|
17305 | line: 1,
|
17306 | column: 13
|
17307 | },
|
17308 | end: {
|
17309 | line: 1,
|
17310 | column: 23
|
17311 | }
|
17312 | }
|
17313 | },
|
17314 | alternate: null,
|
17315 | loc: {
|
17316 | start: {
|
17317 | line: 1,
|
17318 | column: 0
|
17319 | },
|
17320 | end: {
|
17321 | line: 1,
|
17322 | column: 23
|
17323 | }
|
17324 | }
|
17325 | }
|
17326 | ],
|
17327 | loc: {
|
17328 | start: {
|
17329 | line: 1,
|
17330 | column: 0
|
17331 | },
|
17332 | end: {
|
17333 | line: 1,
|
17334 | column: 23
|
17335 | }
|
17336 | }
|
17337 | });
|
17338 |
|
17339 | test("if (morning) function a(){}", {
|
17340 | type: "Program",
|
17341 | body: [
|
17342 | {
|
17343 | type: "IfStatement",
|
17344 | test: {
|
17345 | type: "Identifier",
|
17346 | name: "morning",
|
17347 | loc: {
|
17348 | start: {
|
17349 | line: 1,
|
17350 | column: 4
|
17351 | },
|
17352 | end: {
|
17353 | line: 1,
|
17354 | column: 11
|
17355 | }
|
17356 | }
|
17357 | },
|
17358 | consequent: {
|
17359 | type: "FunctionDeclaration",
|
17360 | id: {
|
17361 | type: "Identifier",
|
17362 | name: "a",
|
17363 | loc: {
|
17364 | start: {
|
17365 | line: 1,
|
17366 | column: 22
|
17367 | },
|
17368 | end: {
|
17369 | line: 1,
|
17370 | column: 23
|
17371 | }
|
17372 | }
|
17373 | },
|
17374 | params: [],
|
17375 | body: {
|
17376 | type: "BlockStatement",
|
17377 | body: [],
|
17378 | loc: {
|
17379 | start: {
|
17380 | line: 1,
|
17381 | column: 25
|
17382 | },
|
17383 | end: {
|
17384 | line: 1,
|
17385 | column: 27
|
17386 | }
|
17387 | }
|
17388 | },
|
17389 | loc: {
|
17390 | start: {
|
17391 | line: 1,
|
17392 | column: 13
|
17393 | },
|
17394 | end: {
|
17395 | line: 1,
|
17396 | column: 27
|
17397 | }
|
17398 | }
|
17399 | },
|
17400 | alternate: null,
|
17401 | loc: {
|
17402 | start: {
|
17403 | line: 1,
|
17404 | column: 0
|
17405 | },
|
17406 | end: {
|
17407 | line: 1,
|
17408 | column: 27
|
17409 | }
|
17410 | }
|
17411 | }
|
17412 | ],
|
17413 | loc: {
|
17414 | start: {
|
17415 | line: 1,
|
17416 | column: 0
|
17417 | },
|
17418 | end: {
|
17419 | line: 1,
|
17420 | column: 27
|
17421 | }
|
17422 | }
|
17423 | });
|
17424 |
|
17425 | test("if (morning) goodMorning(); else goodDay()", {
|
17426 | type: "Program",
|
17427 | body: [
|
17428 | {
|
17429 | type: "IfStatement",
|
17430 | test: {
|
17431 | type: "Identifier",
|
17432 | name: "morning",
|
17433 | loc: {
|
17434 | start: {
|
17435 | line: 1,
|
17436 | column: 4
|
17437 | },
|
17438 | end: {
|
17439 | line: 1,
|
17440 | column: 11
|
17441 | }
|
17442 | }
|
17443 | },
|
17444 | consequent: {
|
17445 | type: "ExpressionStatement",
|
17446 | expression: {
|
17447 | type: "CallExpression",
|
17448 | callee: {
|
17449 | type: "Identifier",
|
17450 | name: "goodMorning",
|
17451 | loc: {
|
17452 | start: {
|
17453 | line: 1,
|
17454 | column: 13
|
17455 | },
|
17456 | end: {
|
17457 | line: 1,
|
17458 | column: 24
|
17459 | }
|
17460 | }
|
17461 | },
|
17462 | arguments: [],
|
17463 | loc: {
|
17464 | start: {
|
17465 | line: 1,
|
17466 | column: 13
|
17467 | },
|
17468 | end: {
|
17469 | line: 1,
|
17470 | column: 26
|
17471 | }
|
17472 | }
|
17473 | },
|
17474 | loc: {
|
17475 | start: {
|
17476 | line: 1,
|
17477 | column: 13
|
17478 | },
|
17479 | end: {
|
17480 | line: 1,
|
17481 | column: 27
|
17482 | }
|
17483 | }
|
17484 | },
|
17485 | alternate: {
|
17486 | type: "ExpressionStatement",
|
17487 | expression: {
|
17488 | type: "CallExpression",
|
17489 | callee: {
|
17490 | type: "Identifier",
|
17491 | name: "goodDay",
|
17492 | loc: {
|
17493 | start: {
|
17494 | line: 1,
|
17495 | column: 33
|
17496 | },
|
17497 | end: {
|
17498 | line: 1,
|
17499 | column: 40
|
17500 | }
|
17501 | }
|
17502 | },
|
17503 | arguments: [],
|
17504 | loc: {
|
17505 | start: {
|
17506 | line: 1,
|
17507 | column: 33
|
17508 | },
|
17509 | end: {
|
17510 | line: 1,
|
17511 | column: 42
|
17512 | }
|
17513 | }
|
17514 | },
|
17515 | loc: {
|
17516 | start: {
|
17517 | line: 1,
|
17518 | column: 33
|
17519 | },
|
17520 | end: {
|
17521 | line: 1,
|
17522 | column: 42
|
17523 | }
|
17524 | }
|
17525 | },
|
17526 | loc: {
|
17527 | start: {
|
17528 | line: 1,
|
17529 | column: 0
|
17530 | },
|
17531 | end: {
|
17532 | line: 1,
|
17533 | column: 42
|
17534 | }
|
17535 | }
|
17536 | }
|
17537 | ],
|
17538 | loc: {
|
17539 | start: {
|
17540 | line: 1,
|
17541 | column: 0
|
17542 | },
|
17543 | end: {
|
17544 | line: 1,
|
17545 | column: 42
|
17546 | }
|
17547 | }
|
17548 | });
|
17549 |
|
17550 | test("do keep(); while (true)", {
|
17551 | type: "Program",
|
17552 | body: [
|
17553 | {
|
17554 | type: "DoWhileStatement",
|
17555 | body: {
|
17556 | type: "ExpressionStatement",
|
17557 | expression: {
|
17558 | type: "CallExpression",
|
17559 | callee: {
|
17560 | type: "Identifier",
|
17561 | name: "keep",
|
17562 | loc: {
|
17563 | start: {
|
17564 | line: 1,
|
17565 | column: 3
|
17566 | },
|
17567 | end: {
|
17568 | line: 1,
|
17569 | column: 7
|
17570 | }
|
17571 | }
|
17572 | },
|
17573 | arguments: [],
|
17574 | loc: {
|
17575 | start: {
|
17576 | line: 1,
|
17577 | column: 3
|
17578 | },
|
17579 | end: {
|
17580 | line: 1,
|
17581 | column: 9
|
17582 | }
|
17583 | }
|
17584 | },
|
17585 | loc: {
|
17586 | start: {
|
17587 | line: 1,
|
17588 | column: 3
|
17589 | },
|
17590 | end: {
|
17591 | line: 1,
|
17592 | column: 10
|
17593 | }
|
17594 | }
|
17595 | },
|
17596 | test: {
|
17597 | type: "Literal",
|
17598 | value: true,
|
17599 | loc: {
|
17600 | start: {
|
17601 | line: 1,
|
17602 | column: 18
|
17603 | },
|
17604 | end: {
|
17605 | line: 1,
|
17606 | column: 22
|
17607 | }
|
17608 | }
|
17609 | },
|
17610 | loc: {
|
17611 | start: {
|
17612 | line: 1,
|
17613 | column: 0
|
17614 | },
|
17615 | end: {
|
17616 | line: 1,
|
17617 | column: 23
|
17618 | }
|
17619 | }
|
17620 | }
|
17621 | ],
|
17622 | loc: {
|
17623 | start: {
|
17624 | line: 1,
|
17625 | column: 0
|
17626 | },
|
17627 | end: {
|
17628 | line: 1,
|
17629 | column: 23
|
17630 | }
|
17631 | }
|
17632 | });
|
17633 |
|
17634 | test("do keep(); while (true);", {
|
17635 | type: "Program",
|
17636 | body: [
|
17637 | {
|
17638 | type: "DoWhileStatement",
|
17639 | body: {
|
17640 | type: "ExpressionStatement",
|
17641 | expression: {
|
17642 | type: "CallExpression",
|
17643 | callee: {
|
17644 | type: "Identifier",
|
17645 | name: "keep",
|
17646 | loc: {
|
17647 | start: {
|
17648 | line: 1,
|
17649 | column: 3
|
17650 | },
|
17651 | end: {
|
17652 | line: 1,
|
17653 | column: 7
|
17654 | }
|
17655 | }
|
17656 | },
|
17657 | arguments: [],
|
17658 | loc: {
|
17659 | start: {
|
17660 | line: 1,
|
17661 | column: 3
|
17662 | },
|
17663 | end: {
|
17664 | line: 1,
|
17665 | column: 9
|
17666 | }
|
17667 | }
|
17668 | },
|
17669 | loc: {
|
17670 | start: {
|
17671 | line: 1,
|
17672 | column: 3
|
17673 | },
|
17674 | end: {
|
17675 | line: 1,
|
17676 | column: 10
|
17677 | }
|
17678 | }
|
17679 | },
|
17680 | test: {
|
17681 | type: "Literal",
|
17682 | value: true,
|
17683 | loc: {
|
17684 | start: {
|
17685 | line: 1,
|
17686 | column: 18
|
17687 | },
|
17688 | end: {
|
17689 | line: 1,
|
17690 | column: 22
|
17691 | }
|
17692 | }
|
17693 | },
|
17694 | loc: {
|
17695 | start: {
|
17696 | line: 1,
|
17697 | column: 0
|
17698 | },
|
17699 | end: {
|
17700 | line: 1,
|
17701 | column: 24
|
17702 | }
|
17703 | }
|
17704 | }
|
17705 | ],
|
17706 | loc: {
|
17707 | start: {
|
17708 | line: 1,
|
17709 | column: 0
|
17710 | },
|
17711 | end: {
|
17712 | line: 1,
|
17713 | column: 24
|
17714 | }
|
17715 | }
|
17716 | });
|
17717 |
|
17718 | test("do { x++; y--; } while (x < 10)", {
|
17719 | type: "Program",
|
17720 | body: [
|
17721 | {
|
17722 | type: "DoWhileStatement",
|
17723 | body: {
|
17724 | type: "BlockStatement",
|
17725 | body: [
|
17726 | {
|
17727 | type: "ExpressionStatement",
|
17728 | expression: {
|
17729 | type: "UpdateExpression",
|
17730 | operator: "++",
|
17731 | prefix: false,
|
17732 | argument: {
|
17733 | type: "Identifier",
|
17734 | name: "x",
|
17735 | loc: {
|
17736 | start: {
|
17737 | line: 1,
|
17738 | column: 5
|
17739 | },
|
17740 | end: {
|
17741 | line: 1,
|
17742 | column: 6
|
17743 | }
|
17744 | }
|
17745 | },
|
17746 | loc: {
|
17747 | start: {
|
17748 | line: 1,
|
17749 | column: 5
|
17750 | },
|
17751 | end: {
|
17752 | line: 1,
|
17753 | column: 8
|
17754 | }
|
17755 | }
|
17756 | },
|
17757 | loc: {
|
17758 | start: {
|
17759 | line: 1,
|
17760 | column: 5
|
17761 | },
|
17762 | end: {
|
17763 | line: 1,
|
17764 | column: 9
|
17765 | }
|
17766 | }
|
17767 | },
|
17768 | {
|
17769 | type: "ExpressionStatement",
|
17770 | expression: {
|
17771 | type: "UpdateExpression",
|
17772 | operator: "--",
|
17773 | prefix: false,
|
17774 | argument: {
|
17775 | type: "Identifier",
|
17776 | name: "y",
|
17777 | loc: {
|
17778 | start: {
|
17779 | line: 1,
|
17780 | column: 10
|
17781 | },
|
17782 | end: {
|
17783 | line: 1,
|
17784 | column: 11
|
17785 | }
|
17786 | }
|
17787 | },
|
17788 | loc: {
|
17789 | start: {
|
17790 | line: 1,
|
17791 | column: 10
|
17792 | },
|
17793 | end: {
|
17794 | line: 1,
|
17795 | column: 13
|
17796 | }
|
17797 | }
|
17798 | },
|
17799 | loc: {
|
17800 | start: {
|
17801 | line: 1,
|
17802 | column: 10
|
17803 | },
|
17804 | end: {
|
17805 | line: 1,
|
17806 | column: 14
|
17807 | }
|
17808 | }
|
17809 | }
|
17810 | ],
|
17811 | loc: {
|
17812 | start: {
|
17813 | line: 1,
|
17814 | column: 3
|
17815 | },
|
17816 | end: {
|
17817 | line: 1,
|
17818 | column: 16
|
17819 | }
|
17820 | }
|
17821 | },
|
17822 | test: {
|
17823 | type: "BinaryExpression",
|
17824 | left: {
|
17825 | type: "Identifier",
|
17826 | name: "x",
|
17827 | loc: {
|
17828 | start: {
|
17829 | line: 1,
|
17830 | column: 24
|
17831 | },
|
17832 | end: {
|
17833 | line: 1,
|
17834 | column: 25
|
17835 | }
|
17836 | }
|
17837 | },
|
17838 | operator: "<",
|
17839 | right: {
|
17840 | type: "Literal",
|
17841 | value: 10,
|
17842 | loc: {
|
17843 | start: {
|
17844 | line: 1,
|
17845 | column: 28
|
17846 | },
|
17847 | end: {
|
17848 | line: 1,
|
17849 | column: 30
|
17850 | }
|
17851 | }
|
17852 | },
|
17853 | loc: {
|
17854 | start: {
|
17855 | line: 1,
|
17856 | column: 24
|
17857 | },
|
17858 | end: {
|
17859 | line: 1,
|
17860 | column: 30
|
17861 | }
|
17862 | }
|
17863 | },
|
17864 | loc: {
|
17865 | start: {
|
17866 | line: 1,
|
17867 | column: 0
|
17868 | },
|
17869 | end: {
|
17870 | line: 1,
|
17871 | column: 31
|
17872 | }
|
17873 | }
|
17874 | }
|
17875 | ],
|
17876 | loc: {
|
17877 | start: {
|
17878 | line: 1,
|
17879 | column: 0
|
17880 | },
|
17881 | end: {
|
17882 | line: 1,
|
17883 | column: 31
|
17884 | }
|
17885 | }
|
17886 | });
|
17887 |
|
17888 | test("{ do { } while (false);false }", {
|
17889 | type: "Program",
|
17890 | body: [
|
17891 | {
|
17892 | type: "BlockStatement",
|
17893 | body: [
|
17894 | {
|
17895 | type: "DoWhileStatement",
|
17896 | body: {
|
17897 | type: "BlockStatement",
|
17898 | body: [],
|
17899 | loc: {
|
17900 | start: {
|
17901 | line: 1,
|
17902 | column: 5
|
17903 | },
|
17904 | end: {
|
17905 | line: 1,
|
17906 | column: 8
|
17907 | }
|
17908 | }
|
17909 | },
|
17910 | test: {
|
17911 | type: "Literal",
|
17912 | value: false,
|
17913 | loc: {
|
17914 | start: {
|
17915 | line: 1,
|
17916 | column: 16
|
17917 | },
|
17918 | end: {
|
17919 | line: 1,
|
17920 | column: 21
|
17921 | }
|
17922 | }
|
17923 | },
|
17924 | loc: {
|
17925 | start: {
|
17926 | line: 1,
|
17927 | column: 2
|
17928 | },
|
17929 | end: {
|
17930 | line: 1,
|
17931 | column: 23
|
17932 | }
|
17933 | }
|
17934 | },
|
17935 | {
|
17936 | type: "ExpressionStatement",
|
17937 | expression: {
|
17938 | type: "Literal",
|
17939 | value: false,
|
17940 | loc: {
|
17941 | start: {
|
17942 | line: 1,
|
17943 | column: 23
|
17944 | },
|
17945 | end: {
|
17946 | line: 1,
|
17947 | column: 28
|
17948 | }
|
17949 | }
|
17950 | },
|
17951 | loc: {
|
17952 | start: {
|
17953 | line: 1,
|
17954 | column: 23
|
17955 | },
|
17956 | end: {
|
17957 | line: 1,
|
17958 | column: 28
|
17959 | }
|
17960 | }
|
17961 | }
|
17962 | ],
|
17963 | loc: {
|
17964 | start: {
|
17965 | line: 1,
|
17966 | column: 0
|
17967 | },
|
17968 | end: {
|
17969 | line: 1,
|
17970 | column: 30
|
17971 | }
|
17972 | }
|
17973 | }
|
17974 | ],
|
17975 | loc: {
|
17976 | start: {
|
17977 | line: 1,
|
17978 | column: 0
|
17979 | },
|
17980 | end: {
|
17981 | line: 1,
|
17982 | column: 30
|
17983 | }
|
17984 | }
|
17985 | });
|
17986 |
|
17987 | test("while (true) doSomething()", {
|
17988 | type: "Program",
|
17989 | body: [
|
17990 | {
|
17991 | type: "WhileStatement",
|
17992 | test: {
|
17993 | type: "Literal",
|
17994 | value: true,
|
17995 | loc: {
|
17996 | start: {
|
17997 | line: 1,
|
17998 | column: 7
|
17999 | },
|
18000 | end: {
|
18001 | line: 1,
|
18002 | column: 11
|
18003 | }
|
18004 | }
|
18005 | },
|
18006 | body: {
|
18007 | type: "ExpressionStatement",
|
18008 | expression: {
|
18009 | type: "CallExpression",
|
18010 | callee: {
|
18011 | type: "Identifier",
|
18012 | name: "doSomething",
|
18013 | loc: {
|
18014 | start: {
|
18015 | line: 1,
|
18016 | column: 13
|
18017 | },
|
18018 | end: {
|
18019 | line: 1,
|
18020 | column: 24
|
18021 | }
|
18022 | }
|
18023 | },
|
18024 | arguments: [],
|
18025 | loc: {
|
18026 | start: {
|
18027 | line: 1,
|
18028 | column: 13
|
18029 | },
|
18030 | end: {
|
18031 | line: 1,
|
18032 | column: 26
|
18033 | }
|
18034 | }
|
18035 | },
|
18036 | loc: {
|
18037 | start: {
|
18038 | line: 1,
|
18039 | column: 13
|
18040 | },
|
18041 | end: {
|
18042 | line: 1,
|
18043 | column: 26
|
18044 | }
|
18045 | }
|
18046 | },
|
18047 | loc: {
|
18048 | start: {
|
18049 | line: 1,
|
18050 | column: 0
|
18051 | },
|
18052 | end: {
|
18053 | line: 1,
|
18054 | column: 26
|
18055 | }
|
18056 | }
|
18057 | }
|
18058 | ],
|
18059 | loc: {
|
18060 | start: {
|
18061 | line: 1,
|
18062 | column: 0
|
18063 | },
|
18064 | end: {
|
18065 | line: 1,
|
18066 | column: 26
|
18067 | }
|
18068 | }
|
18069 | });
|
18070 |
|
18071 | test("while (x < 10) { x++; y--; }", {
|
18072 | type: "Program",
|
18073 | body: [
|
18074 | {
|
18075 | type: "WhileStatement",
|
18076 | test: {
|
18077 | type: "BinaryExpression",
|
18078 | left: {
|
18079 | type: "Identifier",
|
18080 | name: "x",
|
18081 | loc: {
|
18082 | start: {
|
18083 | line: 1,
|
18084 | column: 7
|
18085 | },
|
18086 | end: {
|
18087 | line: 1,
|
18088 | column: 8
|
18089 | }
|
18090 | }
|
18091 | },
|
18092 | operator: "<",
|
18093 | right: {
|
18094 | type: "Literal",
|
18095 | value: 10,
|
18096 | loc: {
|
18097 | start: {
|
18098 | line: 1,
|
18099 | column: 11
|
18100 | },
|
18101 | end: {
|
18102 | line: 1,
|
18103 | column: 13
|
18104 | }
|
18105 | }
|
18106 | },
|
18107 | loc: {
|
18108 | start: {
|
18109 | line: 1,
|
18110 | column: 7
|
18111 | },
|
18112 | end: {
|
18113 | line: 1,
|
18114 | column: 13
|
18115 | }
|
18116 | }
|
18117 | },
|
18118 | body: {
|
18119 | type: "BlockStatement",
|
18120 | body: [
|
18121 | {
|
18122 | type: "ExpressionStatement",
|
18123 | expression: {
|
18124 | type: "UpdateExpression",
|
18125 | operator: "++",
|
18126 | prefix: false,
|
18127 | argument: {
|
18128 | type: "Identifier",
|
18129 | name: "x",
|
18130 | loc: {
|
18131 | start: {
|
18132 | line: 1,
|
18133 | column: 17
|
18134 | },
|
18135 | end: {
|
18136 | line: 1,
|
18137 | column: 18
|
18138 | }
|
18139 | }
|
18140 | },
|
18141 | loc: {
|
18142 | start: {
|
18143 | line: 1,
|
18144 | column: 17
|
18145 | },
|
18146 | end: {
|
18147 | line: 1,
|
18148 | column: 20
|
18149 | }
|
18150 | }
|
18151 | },
|
18152 | loc: {
|
18153 | start: {
|
18154 | line: 1,
|
18155 | column: 17
|
18156 | },
|
18157 | end: {
|
18158 | line: 1,
|
18159 | column: 21
|
18160 | }
|
18161 | }
|
18162 | },
|
18163 | {
|
18164 | type: "ExpressionStatement",
|
18165 | expression: {
|
18166 | type: "UpdateExpression",
|
18167 | operator: "--",
|
18168 | prefix: false,
|
18169 | argument: {
|
18170 | type: "Identifier",
|
18171 | name: "y",
|
18172 | loc: {
|
18173 | start: {
|
18174 | line: 1,
|
18175 | column: 22
|
18176 | },
|
18177 | end: {
|
18178 | line: 1,
|
18179 | column: 23
|
18180 | }
|
18181 | }
|
18182 | },
|
18183 | loc: {
|
18184 | start: {
|
18185 | line: 1,
|
18186 | column: 22
|
18187 | },
|
18188 | end: {
|
18189 | line: 1,
|
18190 | column: 25
|
18191 | }
|
18192 | }
|
18193 | },
|
18194 | loc: {
|
18195 | start: {
|
18196 | line: 1,
|
18197 | column: 22
|
18198 | },
|
18199 | end: {
|
18200 | line: 1,
|
18201 | column: 26
|
18202 | }
|
18203 | }
|
18204 | }
|
18205 | ],
|
18206 | loc: {
|
18207 | start: {
|
18208 | line: 1,
|
18209 | column: 15
|
18210 | },
|
18211 | end: {
|
18212 | line: 1,
|
18213 | column: 28
|
18214 | }
|
18215 | }
|
18216 | },
|
18217 | loc: {
|
18218 | start: {
|
18219 | line: 1,
|
18220 | column: 0
|
18221 | },
|
18222 | end: {
|
18223 | line: 1,
|
18224 | column: 28
|
18225 | }
|
18226 | }
|
18227 | }
|
18228 | ],
|
18229 | loc: {
|
18230 | start: {
|
18231 | line: 1,
|
18232 | column: 0
|
18233 | },
|
18234 | end: {
|
18235 | line: 1,
|
18236 | column: 28
|
18237 | }
|
18238 | }
|
18239 | });
|
18240 |
|
18241 | test("for(;;);", {
|
18242 | type: "Program",
|
18243 | body: [
|
18244 | {
|
18245 | type: "ForStatement",
|
18246 | init: null,
|
18247 | test: null,
|
18248 | update: null,
|
18249 | body: {
|
18250 | type: "EmptyStatement",
|
18251 | loc: {
|
18252 | start: {
|
18253 | line: 1,
|
18254 | column: 7
|
18255 | },
|
18256 | end: {
|
18257 | line: 1,
|
18258 | column: 8
|
18259 | }
|
18260 | }
|
18261 | },
|
18262 | loc: {
|
18263 | start: {
|
18264 | line: 1,
|
18265 | column: 0
|
18266 | },
|
18267 | end: {
|
18268 | line: 1,
|
18269 | column: 8
|
18270 | }
|
18271 | }
|
18272 | }
|
18273 | ],
|
18274 | loc: {
|
18275 | start: {
|
18276 | line: 1,
|
18277 | column: 0
|
18278 | },
|
18279 | end: {
|
18280 | line: 1,
|
18281 | column: 8
|
18282 | }
|
18283 | }
|
18284 | });
|
18285 |
|
18286 | test("for(;;){}", {
|
18287 | type: "Program",
|
18288 | body: [
|
18289 | {
|
18290 | type: "ForStatement",
|
18291 | init: null,
|
18292 | test: null,
|
18293 | update: null,
|
18294 | body: {
|
18295 | type: "BlockStatement",
|
18296 | body: [],
|
18297 | loc: {
|
18298 | start: {
|
18299 | line: 1,
|
18300 | column: 7
|
18301 | },
|
18302 | end: {
|
18303 | line: 1,
|
18304 | column: 9
|
18305 | }
|
18306 | }
|
18307 | },
|
18308 | loc: {
|
18309 | start: {
|
18310 | line: 1,
|
18311 | column: 0
|
18312 | },
|
18313 | end: {
|
18314 | line: 1,
|
18315 | column: 9
|
18316 | }
|
18317 | }
|
18318 | }
|
18319 | ],
|
18320 | loc: {
|
18321 | start: {
|
18322 | line: 1,
|
18323 | column: 0
|
18324 | },
|
18325 | end: {
|
18326 | line: 1,
|
18327 | column: 9
|
18328 | }
|
18329 | }
|
18330 | });
|
18331 |
|
18332 | test("for(x = 0;;);", {
|
18333 | type: "Program",
|
18334 | body: [
|
18335 | {
|
18336 | type: "ForStatement",
|
18337 | init: {
|
18338 | type: "AssignmentExpression",
|
18339 | operator: "=",
|
18340 | left: {
|
18341 | type: "Identifier",
|
18342 | name: "x",
|
18343 | loc: {
|
18344 | start: {
|
18345 | line: 1,
|
18346 | column: 4
|
18347 | },
|
18348 | end: {
|
18349 | line: 1,
|
18350 | column: 5
|
18351 | }
|
18352 | }
|
18353 | },
|
18354 | right: {
|
18355 | type: "Literal",
|
18356 | value: 0,
|
18357 | loc: {
|
18358 | start: {
|
18359 | line: 1,
|
18360 | column: 8
|
18361 | },
|
18362 | end: {
|
18363 | line: 1,
|
18364 | column: 9
|
18365 | }
|
18366 | }
|
18367 | },
|
18368 | loc: {
|
18369 | start: {
|
18370 | line: 1,
|
18371 | column: 4
|
18372 | },
|
18373 | end: {
|
18374 | line: 1,
|
18375 | column: 9
|
18376 | }
|
18377 | }
|
18378 | },
|
18379 | test: null,
|
18380 | update: null,
|
18381 | body: {
|
18382 | type: "EmptyStatement",
|
18383 | loc: {
|
18384 | start: {
|
18385 | line: 1,
|
18386 | column: 12
|
18387 | },
|
18388 | end: {
|
18389 | line: 1,
|
18390 | column: 13
|
18391 | }
|
18392 | }
|
18393 | },
|
18394 | loc: {
|
18395 | start: {
|
18396 | line: 1,
|
18397 | column: 0
|
18398 | },
|
18399 | end: {
|
18400 | line: 1,
|
18401 | column: 13
|
18402 | }
|
18403 | }
|
18404 | }
|
18405 | ],
|
18406 | loc: {
|
18407 | start: {
|
18408 | line: 1,
|
18409 | column: 0
|
18410 | },
|
18411 | end: {
|
18412 | line: 1,
|
18413 | column: 13
|
18414 | }
|
18415 | }
|
18416 | });
|
18417 |
|
18418 | test("for(var x = 0;;);", {
|
18419 | type: "Program",
|
18420 | body: [
|
18421 | {
|
18422 | type: "ForStatement",
|
18423 | init: {
|
18424 | type: "VariableDeclaration",
|
18425 | declarations: [
|
18426 | {
|
18427 | type: "VariableDeclarator",
|
18428 | id: {
|
18429 | type: "Identifier",
|
18430 | name: "x",
|
18431 | loc: {
|
18432 | start: {
|
18433 | line: 1,
|
18434 | column: 8
|
18435 | },
|
18436 | end: {
|
18437 | line: 1,
|
18438 | column: 9
|
18439 | }
|
18440 | }
|
18441 | },
|
18442 | init: {
|
18443 | type: "Literal",
|
18444 | value: 0,
|
18445 | loc: {
|
18446 | start: {
|
18447 | line: 1,
|
18448 | column: 12
|
18449 | },
|
18450 | end: {
|
18451 | line: 1,
|
18452 | column: 13
|
18453 | }
|
18454 | }
|
18455 | },
|
18456 | loc: {
|
18457 | start: {
|
18458 | line: 1,
|
18459 | column: 8
|
18460 | },
|
18461 | end: {
|
18462 | line: 1,
|
18463 | column: 13
|
18464 | }
|
18465 | }
|
18466 | }
|
18467 | ],
|
18468 | kind: "var",
|
18469 | loc: {
|
18470 | start: {
|
18471 | line: 1,
|
18472 | column: 4
|
18473 | },
|
18474 | end: {
|
18475 | line: 1,
|
18476 | column: 13
|
18477 | }
|
18478 | }
|
18479 | },
|
18480 | test: null,
|
18481 | update: null,
|
18482 | body: {
|
18483 | type: "EmptyStatement",
|
18484 | loc: {
|
18485 | start: {
|
18486 | line: 1,
|
18487 | column: 16
|
18488 | },
|
18489 | end: {
|
18490 | line: 1,
|
18491 | column: 17
|
18492 | }
|
18493 | }
|
18494 | },
|
18495 | loc: {
|
18496 | start: {
|
18497 | line: 1,
|
18498 | column: 0
|
18499 | },
|
18500 | end: {
|
18501 | line: 1,
|
18502 | column: 17
|
18503 | }
|
18504 | }
|
18505 | }
|
18506 | ],
|
18507 | loc: {
|
18508 | start: {
|
18509 | line: 1,
|
18510 | column: 0
|
18511 | },
|
18512 | end: {
|
18513 | line: 1,
|
18514 | column: 17
|
18515 | }
|
18516 | }
|
18517 | });
|
18518 |
|
18519 | test("for(var x = 0, y = 1;;);", {
|
18520 | type: "Program",
|
18521 | body: [
|
18522 | {
|
18523 | type: "ForStatement",
|
18524 | init: {
|
18525 | type: "VariableDeclaration",
|
18526 | declarations: [
|
18527 | {
|
18528 | type: "VariableDeclarator",
|
18529 | id: {
|
18530 | type: "Identifier",
|
18531 | name: "x",
|
18532 | loc: {
|
18533 | start: {
|
18534 | line: 1,
|
18535 | column: 8
|
18536 | },
|
18537 | end: {
|
18538 | line: 1,
|
18539 | column: 9
|
18540 | }
|
18541 | }
|
18542 | },
|
18543 | init: {
|
18544 | type: "Literal",
|
18545 | value: 0,
|
18546 | loc: {
|
18547 | start: {
|
18548 | line: 1,
|
18549 | column: 12
|
18550 | },
|
18551 | end: {
|
18552 | line: 1,
|
18553 | column: 13
|
18554 | }
|
18555 | }
|
18556 | },
|
18557 | loc: {
|
18558 | start: {
|
18559 | line: 1,
|
18560 | column: 8
|
18561 | },
|
18562 | end: {
|
18563 | line: 1,
|
18564 | column: 13
|
18565 | }
|
18566 | }
|
18567 | },
|
18568 | {
|
18569 | type: "VariableDeclarator",
|
18570 | id: {
|
18571 | type: "Identifier",
|
18572 | name: "y",
|
18573 | loc: {
|
18574 | start: {
|
18575 | line: 1,
|
18576 | column: 15
|
18577 | },
|
18578 | end: {
|
18579 | line: 1,
|
18580 | column: 16
|
18581 | }
|
18582 | }
|
18583 | },
|
18584 | init: {
|
18585 | type: "Literal",
|
18586 | value: 1,
|
18587 | loc: {
|
18588 | start: {
|
18589 | line: 1,
|
18590 | column: 19
|
18591 | },
|
18592 | end: {
|
18593 | line: 1,
|
18594 | column: 20
|
18595 | }
|
18596 | }
|
18597 | },
|
18598 | loc: {
|
18599 | start: {
|
18600 | line: 1,
|
18601 | column: 15
|
18602 | },
|
18603 | end: {
|
18604 | line: 1,
|
18605 | column: 20
|
18606 | }
|
18607 | }
|
18608 | }
|
18609 | ],
|
18610 | kind: "var",
|
18611 | loc: {
|
18612 | start: {
|
18613 | line: 1,
|
18614 | column: 4
|
18615 | },
|
18616 | end: {
|
18617 | line: 1,
|
18618 | column: 20
|
18619 | }
|
18620 | }
|
18621 | },
|
18622 | test: null,
|
18623 | update: null,
|
18624 | body: {
|
18625 | type: "EmptyStatement",
|
18626 | loc: {
|
18627 | start: {
|
18628 | line: 1,
|
18629 | column: 23
|
18630 | },
|
18631 | end: {
|
18632 | line: 1,
|
18633 | column: 24
|
18634 | }
|
18635 | }
|
18636 | },
|
18637 | loc: {
|
18638 | start: {
|
18639 | line: 1,
|
18640 | column: 0
|
18641 | },
|
18642 | end: {
|
18643 | line: 1,
|
18644 | column: 24
|
18645 | }
|
18646 | }
|
18647 | }
|
18648 | ],
|
18649 | loc: {
|
18650 | start: {
|
18651 | line: 1,
|
18652 | column: 0
|
18653 | },
|
18654 | end: {
|
18655 | line: 1,
|
18656 | column: 24
|
18657 | }
|
18658 | }
|
18659 | });
|
18660 |
|
18661 | test("for(x = 0; x < 42;);", {
|
18662 | type: "Program",
|
18663 | body: [
|
18664 | {
|
18665 | type: "ForStatement",
|
18666 | init: {
|
18667 | type: "AssignmentExpression",
|
18668 | operator: "=",
|
18669 | left: {
|
18670 | type: "Identifier",
|
18671 | name: "x",
|
18672 | loc: {
|
18673 | start: {
|
18674 | line: 1,
|
18675 | column: 4
|
18676 | },
|
18677 | end: {
|
18678 | line: 1,
|
18679 | column: 5
|
18680 | }
|
18681 | }
|
18682 | },
|
18683 | right: {
|
18684 | type: "Literal",
|
18685 | value: 0,
|
18686 | loc: {
|
18687 | start: {
|
18688 | line: 1,
|
18689 | column: 8
|
18690 | },
|
18691 | end: {
|
18692 | line: 1,
|
18693 | column: 9
|
18694 | }
|
18695 | }
|
18696 | },
|
18697 | loc: {
|
18698 | start: {
|
18699 | line: 1,
|
18700 | column: 4
|
18701 | },
|
18702 | end: {
|
18703 | line: 1,
|
18704 | column: 9
|
18705 | }
|
18706 | }
|
18707 | },
|
18708 | test: {
|
18709 | type: "BinaryExpression",
|
18710 | left: {
|
18711 | type: "Identifier",
|
18712 | name: "x",
|
18713 | loc: {
|
18714 | start: {
|
18715 | line: 1,
|
18716 | column: 11
|
18717 | },
|
18718 | end: {
|
18719 | line: 1,
|
18720 | column: 12
|
18721 | }
|
18722 | }
|
18723 | },
|
18724 | operator: "<",
|
18725 | right: {
|
18726 | type: "Literal",
|
18727 | value: 42,
|
18728 | loc: {
|
18729 | start: {
|
18730 | line: 1,
|
18731 | column: 15
|
18732 | },
|
18733 | end: {
|
18734 | line: 1,
|
18735 | column: 17
|
18736 | }
|
18737 | }
|
18738 | },
|
18739 | loc: {
|
18740 | start: {
|
18741 | line: 1,
|
18742 | column: 11
|
18743 | },
|
18744 | end: {
|
18745 | line: 1,
|
18746 | column: 17
|
18747 | }
|
18748 | }
|
18749 | },
|
18750 | update: null,
|
18751 | body: {
|
18752 | type: "EmptyStatement",
|
18753 | loc: {
|
18754 | start: {
|
18755 | line: 1,
|
18756 | column: 19
|
18757 | },
|
18758 | end: {
|
18759 | line: 1,
|
18760 | column: 20
|
18761 | }
|
18762 | }
|
18763 | },
|
18764 | loc: {
|
18765 | start: {
|
18766 | line: 1,
|
18767 | column: 0
|
18768 | },
|
18769 | end: {
|
18770 | line: 1,
|
18771 | column: 20
|
18772 | }
|
18773 | }
|
18774 | }
|
18775 | ],
|
18776 | loc: {
|
18777 | start: {
|
18778 | line: 1,
|
18779 | column: 0
|
18780 | },
|
18781 | end: {
|
18782 | line: 1,
|
18783 | column: 20
|
18784 | }
|
18785 | }
|
18786 | });
|
18787 |
|
18788 | test("for(x = 0; x < 42; x++);", {
|
18789 | type: "Program",
|
18790 | body: [
|
18791 | {
|
18792 | type: "ForStatement",
|
18793 | init: {
|
18794 | type: "AssignmentExpression",
|
18795 | operator: "=",
|
18796 | left: {
|
18797 | type: "Identifier",
|
18798 | name: "x",
|
18799 | loc: {
|
18800 | start: {
|
18801 | line: 1,
|
18802 | column: 4
|
18803 | },
|
18804 | end: {
|
18805 | line: 1,
|
18806 | column: 5
|
18807 | }
|
18808 | }
|
18809 | },
|
18810 | right: {
|
18811 | type: "Literal",
|
18812 | value: 0,
|
18813 | loc: {
|
18814 | start: {
|
18815 | line: 1,
|
18816 | column: 8
|
18817 | },
|
18818 | end: {
|
18819 | line: 1,
|
18820 | column: 9
|
18821 | }
|
18822 | }
|
18823 | },
|
18824 | loc: {
|
18825 | start: {
|
18826 | line: 1,
|
18827 | column: 4
|
18828 | },
|
18829 | end: {
|
18830 | line: 1,
|
18831 | column: 9
|
18832 | }
|
18833 | }
|
18834 | },
|
18835 | test: {
|
18836 | type: "BinaryExpression",
|
18837 | left: {
|
18838 | type: "Identifier",
|
18839 | name: "x",
|
18840 | loc: {
|
18841 | start: {
|
18842 | line: 1,
|
18843 | column: 11
|
18844 | },
|
18845 | end: {
|
18846 | line: 1,
|
18847 | column: 12
|
18848 | }
|
18849 | }
|
18850 | },
|
18851 | operator: "<",
|
18852 | right: {
|
18853 | type: "Literal",
|
18854 | value: 42,
|
18855 | loc: {
|
18856 | start: {
|
18857 | line: 1,
|
18858 | column: 15
|
18859 | },
|
18860 | end: {
|
18861 | line: 1,
|
18862 | column: 17
|
18863 | }
|
18864 | }
|
18865 | },
|
18866 | loc: {
|
18867 | start: {
|
18868 | line: 1,
|
18869 | column: 11
|
18870 | },
|
18871 | end: {
|
18872 | line: 1,
|
18873 | column: 17
|
18874 | }
|
18875 | }
|
18876 | },
|
18877 | update: {
|
18878 | type: "UpdateExpression",
|
18879 | operator: "++",
|
18880 | prefix: false,
|
18881 | argument: {
|
18882 | type: "Identifier",
|
18883 | name: "x",
|
18884 | loc: {
|
18885 | start: {
|
18886 | line: 1,
|
18887 | column: 19
|
18888 | },
|
18889 | end: {
|
18890 | line: 1,
|
18891 | column: 20
|
18892 | }
|
18893 | }
|
18894 | },
|
18895 | loc: {
|
18896 | start: {
|
18897 | line: 1,
|
18898 | column: 19
|
18899 | },
|
18900 | end: {
|
18901 | line: 1,
|
18902 | column: 22
|
18903 | }
|
18904 | }
|
18905 | },
|
18906 | body: {
|
18907 | type: "EmptyStatement",
|
18908 | loc: {
|
18909 | start: {
|
18910 | line: 1,
|
18911 | column: 23
|
18912 | },
|
18913 | end: {
|
18914 | line: 1,
|
18915 | column: 24
|
18916 | }
|
18917 | }
|
18918 | },
|
18919 | loc: {
|
18920 | start: {
|
18921 | line: 1,
|
18922 | column: 0
|
18923 | },
|
18924 | end: {
|
18925 | line: 1,
|
18926 | column: 24
|
18927 | }
|
18928 | }
|
18929 | }
|
18930 | ],
|
18931 | loc: {
|
18932 | start: {
|
18933 | line: 1,
|
18934 | column: 0
|
18935 | },
|
18936 | end: {
|
18937 | line: 1,
|
18938 | column: 24
|
18939 | }
|
18940 | }
|
18941 | });
|
18942 |
|
18943 | test("for(x = 0; x < 42; x++) process(x);", {
|
18944 | type: "Program",
|
18945 | body: [
|
18946 | {
|
18947 | type: "ForStatement",
|
18948 | init: {
|
18949 | type: "AssignmentExpression",
|
18950 | operator: "=",
|
18951 | left: {
|
18952 | type: "Identifier",
|
18953 | name: "x",
|
18954 | loc: {
|
18955 | start: {
|
18956 | line: 1,
|
18957 | column: 4
|
18958 | },
|
18959 | end: {
|
18960 | line: 1,
|
18961 | column: 5
|
18962 | }
|
18963 | }
|
18964 | },
|
18965 | right: {
|
18966 | type: "Literal",
|
18967 | value: 0,
|
18968 | loc: {
|
18969 | start: {
|
18970 | line: 1,
|
18971 | column: 8
|
18972 | },
|
18973 | end: {
|
18974 | line: 1,
|
18975 | column: 9
|
18976 | }
|
18977 | }
|
18978 | },
|
18979 | loc: {
|
18980 | start: {
|
18981 | line: 1,
|
18982 | column: 4
|
18983 | },
|
18984 | end: {
|
18985 | line: 1,
|
18986 | column: 9
|
18987 | }
|
18988 | }
|
18989 | },
|
18990 | test: {
|
18991 | type: "BinaryExpression",
|
18992 | left: {
|
18993 | type: "Identifier",
|
18994 | name: "x",
|
18995 | loc: {
|
18996 | start: {
|
18997 | line: 1,
|
18998 | column: 11
|
18999 | },
|
19000 | end: {
|
19001 | line: 1,
|
19002 | column: 12
|
19003 | }
|
19004 | }
|
19005 | },
|
19006 | operator: "<",
|
19007 | right: {
|
19008 | type: "Literal",
|
19009 | value: 42,
|
19010 | loc: {
|
19011 | start: {
|
19012 | line: 1,
|
19013 | column: 15
|
19014 | },
|
19015 | end: {
|
19016 | line: 1,
|
19017 | column: 17
|
19018 | }
|
19019 | }
|
19020 | },
|
19021 | loc: {
|
19022 | start: {
|
19023 | line: 1,
|
19024 | column: 11
|
19025 | },
|
19026 | end: {
|
19027 | line: 1,
|
19028 | column: 17
|
19029 | }
|
19030 | }
|
19031 | },
|
19032 | update: {
|
19033 | type: "UpdateExpression",
|
19034 | operator: "++",
|
19035 | prefix: false,
|
19036 | argument: {
|
19037 | type: "Identifier",
|
19038 | name: "x",
|
19039 | loc: {
|
19040 | start: {
|
19041 | line: 1,
|
19042 | column: 19
|
19043 | },
|
19044 | end: {
|
19045 | line: 1,
|
19046 | column: 20
|
19047 | }
|
19048 | }
|
19049 | },
|
19050 | loc: {
|
19051 | start: {
|
19052 | line: 1,
|
19053 | column: 19
|
19054 | },
|
19055 | end: {
|
19056 | line: 1,
|
19057 | column: 22
|
19058 | }
|
19059 | }
|
19060 | },
|
19061 | body: {
|
19062 | type: "ExpressionStatement",
|
19063 | expression: {
|
19064 | type: "CallExpression",
|
19065 | callee: {
|
19066 | type: "Identifier",
|
19067 | name: "process",
|
19068 | loc: {
|
19069 | start: {
|
19070 | line: 1,
|
19071 | column: 24
|
19072 | },
|
19073 | end: {
|
19074 | line: 1,
|
19075 | column: 31
|
19076 | }
|
19077 | }
|
19078 | },
|
19079 | arguments: [
|
19080 | {
|
19081 | type: "Identifier",
|
19082 | name: "x",
|
19083 | loc: {
|
19084 | start: {
|
19085 | line: 1,
|
19086 | column: 32
|
19087 | },
|
19088 | end: {
|
19089 | line: 1,
|
19090 | column: 33
|
19091 | }
|
19092 | }
|
19093 | }
|
19094 | ],
|
19095 | loc: {
|
19096 | start: {
|
19097 | line: 1,
|
19098 | column: 24
|
19099 | },
|
19100 | end: {
|
19101 | line: 1,
|
19102 | column: 34
|
19103 | }
|
19104 | }
|
19105 | },
|
19106 | loc: {
|
19107 | start: {
|
19108 | line: 1,
|
19109 | column: 24
|
19110 | },
|
19111 | end: {
|
19112 | line: 1,
|
19113 | column: 35
|
19114 | }
|
19115 | }
|
19116 | },
|
19117 | loc: {
|
19118 | start: {
|
19119 | line: 1,
|
19120 | column: 0
|
19121 | },
|
19122 | end: {
|
19123 | line: 1,
|
19124 | column: 35
|
19125 | }
|
19126 | }
|
19127 | }
|
19128 | ],
|
19129 | loc: {
|
19130 | start: {
|
19131 | line: 1,
|
19132 | column: 0
|
19133 | },
|
19134 | end: {
|
19135 | line: 1,
|
19136 | column: 35
|
19137 | }
|
19138 | }
|
19139 | });
|
19140 |
|
19141 | test("for(x in list) process(x);", {
|
19142 | type: "Program",
|
19143 | body: [
|
19144 | {
|
19145 | type: "ForInStatement",
|
19146 | left: {
|
19147 | type: "Identifier",
|
19148 | name: "x",
|
19149 | loc: {
|
19150 | start: {
|
19151 | line: 1,
|
19152 | column: 4
|
19153 | },
|
19154 | end: {
|
19155 | line: 1,
|
19156 | column: 5
|
19157 | }
|
19158 | }
|
19159 | },
|
19160 | right: {
|
19161 | type: "Identifier",
|
19162 | name: "list",
|
19163 | loc: {
|
19164 | start: {
|
19165 | line: 1,
|
19166 | column: 9
|
19167 | },
|
19168 | end: {
|
19169 | line: 1,
|
19170 | column: 13
|
19171 | }
|
19172 | }
|
19173 | },
|
19174 | body: {
|
19175 | type: "ExpressionStatement",
|
19176 | expression: {
|
19177 | type: "CallExpression",
|
19178 | callee: {
|
19179 | type: "Identifier",
|
19180 | name: "process",
|
19181 | loc: {
|
19182 | start: {
|
19183 | line: 1,
|
19184 | column: 15
|
19185 | },
|
19186 | end: {
|
19187 | line: 1,
|
19188 | column: 22
|
19189 | }
|
19190 | }
|
19191 | },
|
19192 | arguments: [
|
19193 | {
|
19194 | type: "Identifier",
|
19195 | name: "x",
|
19196 | loc: {
|
19197 | start: {
|
19198 | line: 1,
|
19199 | column: 23
|
19200 | },
|
19201 | end: {
|
19202 | line: 1,
|
19203 | column: 24
|
19204 | }
|
19205 | }
|
19206 | }
|
19207 | ],
|
19208 | loc: {
|
19209 | start: {
|
19210 | line: 1,
|
19211 | column: 15
|
19212 | },
|
19213 | end: {
|
19214 | line: 1,
|
19215 | column: 25
|
19216 | }
|
19217 | }
|
19218 | },
|
19219 | loc: {
|
19220 | start: {
|
19221 | line: 1,
|
19222 | column: 15
|
19223 | },
|
19224 | end: {
|
19225 | line: 1,
|
19226 | column: 26
|
19227 | }
|
19228 | }
|
19229 | },
|
19230 | loc: {
|
19231 | start: {
|
19232 | line: 1,
|
19233 | column: 0
|
19234 | },
|
19235 | end: {
|
19236 | line: 1,
|
19237 | column: 26
|
19238 | }
|
19239 | }
|
19240 | }
|
19241 | ],
|
19242 | loc: {
|
19243 | start: {
|
19244 | line: 1,
|
19245 | column: 0
|
19246 | },
|
19247 | end: {
|
19248 | line: 1,
|
19249 | column: 26
|
19250 | }
|
19251 | }
|
19252 | });
|
19253 |
|
19254 | test("for (var x in list) process(x);", {
|
19255 | type: "Program",
|
19256 | body: [
|
19257 | {
|
19258 | type: "ForInStatement",
|
19259 | left: {
|
19260 | type: "VariableDeclaration",
|
19261 | declarations: [
|
19262 | {
|
19263 | type: "VariableDeclarator",
|
19264 | id: {
|
19265 | type: "Identifier",
|
19266 | name: "x",
|
19267 | loc: {
|
19268 | start: {
|
19269 | line: 1,
|
19270 | column: 9
|
19271 | },
|
19272 | end: {
|
19273 | line: 1,
|
19274 | column: 10
|
19275 | }
|
19276 | }
|
19277 | },
|
19278 | init: null,
|
19279 | loc: {
|
19280 | start: {
|
19281 | line: 1,
|
19282 | column: 9
|
19283 | },
|
19284 | end: {
|
19285 | line: 1,
|
19286 | column: 10
|
19287 | }
|
19288 | }
|
19289 | }
|
19290 | ],
|
19291 | kind: "var",
|
19292 | loc: {
|
19293 | start: {
|
19294 | line: 1,
|
19295 | column: 5
|
19296 | },
|
19297 | end: {
|
19298 | line: 1,
|
19299 | column: 10
|
19300 | }
|
19301 | }
|
19302 | },
|
19303 | right: {
|
19304 | type: "Identifier",
|
19305 | name: "list",
|
19306 | loc: {
|
19307 | start: {
|
19308 | line: 1,
|
19309 | column: 14
|
19310 | },
|
19311 | end: {
|
19312 | line: 1,
|
19313 | column: 18
|
19314 | }
|
19315 | }
|
19316 | },
|
19317 | body: {
|
19318 | type: "ExpressionStatement",
|
19319 | expression: {
|
19320 | type: "CallExpression",
|
19321 | callee: {
|
19322 | type: "Identifier",
|
19323 | name: "process",
|
19324 | loc: {
|
19325 | start: {
|
19326 | line: 1,
|
19327 | column: 20
|
19328 | },
|
19329 | end: {
|
19330 | line: 1,
|
19331 | column: 27
|
19332 | }
|
19333 | }
|
19334 | },
|
19335 | arguments: [
|
19336 | {
|
19337 | type: "Identifier",
|
19338 | name: "x",
|
19339 | loc: {
|
19340 | start: {
|
19341 | line: 1,
|
19342 | column: 28
|
19343 | },
|
19344 | end: {
|
19345 | line: 1,
|
19346 | column: 29
|
19347 | }
|
19348 | }
|
19349 | }
|
19350 | ],
|
19351 | loc: {
|
19352 | start: {
|
19353 | line: 1,
|
19354 | column: 20
|
19355 | },
|
19356 | end: {
|
19357 | line: 1,
|
19358 | column: 30
|
19359 | }
|
19360 | }
|
19361 | },
|
19362 | loc: {
|
19363 | start: {
|
19364 | line: 1,
|
19365 | column: 20
|
19366 | },
|
19367 | end: {
|
19368 | line: 1,
|
19369 | column: 31
|
19370 | }
|
19371 | }
|
19372 | },
|
19373 | loc: {
|
19374 | start: {
|
19375 | line: 1,
|
19376 | column: 0
|
19377 | },
|
19378 | end: {
|
19379 | line: 1,
|
19380 | column: 31
|
19381 | }
|
19382 | }
|
19383 | }
|
19384 | ],
|
19385 | loc: {
|
19386 | start: {
|
19387 | line: 1,
|
19388 | column: 0
|
19389 | },
|
19390 | end: {
|
19391 | line: 1,
|
19392 | column: 31
|
19393 | }
|
19394 | }
|
19395 | });
|
19396 |
|
19397 | test("for (var x = 42 in list) process(x);", {
|
19398 | type: "Program",
|
19399 | body: [
|
19400 | {
|
19401 | type: "ForInStatement",
|
19402 | left: {
|
19403 | type: "VariableDeclaration",
|
19404 | declarations: [
|
19405 | {
|
19406 | type: "VariableDeclarator",
|
19407 | id: {
|
19408 | type: "Identifier",
|
19409 | name: "x",
|
19410 | loc: {
|
19411 | start: {
|
19412 | line: 1,
|
19413 | column: 9
|
19414 | },
|
19415 | end: {
|
19416 | line: 1,
|
19417 | column: 10
|
19418 | }
|
19419 | }
|
19420 | },
|
19421 | init: {
|
19422 | type: "Literal",
|
19423 | value: 42,
|
19424 | loc: {
|
19425 | start: {
|
19426 | line: 1,
|
19427 | column: 13
|
19428 | },
|
19429 | end: {
|
19430 | line: 1,
|
19431 | column: 15
|
19432 | }
|
19433 | }
|
19434 | },
|
19435 | loc: {
|
19436 | start: {
|
19437 | line: 1,
|
19438 | column: 9
|
19439 | },
|
19440 | end: {
|
19441 | line: 1,
|
19442 | column: 15
|
19443 | }
|
19444 | }
|
19445 | }
|
19446 | ],
|
19447 | kind: "var",
|
19448 | loc: {
|
19449 | start: {
|
19450 | line: 1,
|
19451 | column: 5
|
19452 | },
|
19453 | end: {
|
19454 | line: 1,
|
19455 | column: 15
|
19456 | }
|
19457 | }
|
19458 | },
|
19459 | right: {
|
19460 | type: "Identifier",
|
19461 | name: "list",
|
19462 | loc: {
|
19463 | start: {
|
19464 | line: 1,
|
19465 | column: 19
|
19466 | },
|
19467 | end: {
|
19468 | line: 1,
|
19469 | column: 23
|
19470 | }
|
19471 | }
|
19472 | },
|
19473 | body: {
|
19474 | type: "ExpressionStatement",
|
19475 | expression: {
|
19476 | type: "CallExpression",
|
19477 | callee: {
|
19478 | type: "Identifier",
|
19479 | name: "process",
|
19480 | loc: {
|
19481 | start: {
|
19482 | line: 1,
|
19483 | column: 25
|
19484 | },
|
19485 | end: {
|
19486 | line: 1,
|
19487 | column: 32
|
19488 | }
|
19489 | }
|
19490 | },
|
19491 | arguments: [
|
19492 | {
|
19493 | type: "Identifier",
|
19494 | name: "x",
|
19495 | loc: {
|
19496 | start: {
|
19497 | line: 1,
|
19498 | column: 33
|
19499 | },
|
19500 | end: {
|
19501 | line: 1,
|
19502 | column: 34
|
19503 | }
|
19504 | }
|
19505 | }
|
19506 | ],
|
19507 | loc: {
|
19508 | start: {
|
19509 | line: 1,
|
19510 | column: 25
|
19511 | },
|
19512 | end: {
|
19513 | line: 1,
|
19514 | column: 35
|
19515 | }
|
19516 | }
|
19517 | },
|
19518 | loc: {
|
19519 | start: {
|
19520 | line: 1,
|
19521 | column: 25
|
19522 | },
|
19523 | end: {
|
19524 | line: 1,
|
19525 | column: 36
|
19526 | }
|
19527 | }
|
19528 | },
|
19529 | loc: {
|
19530 | start: {
|
19531 | line: 1,
|
19532 | column: 0
|
19533 | },
|
19534 | end: {
|
19535 | line: 1,
|
19536 | column: 36
|
19537 | }
|
19538 | }
|
19539 | }
|
19540 | ],
|
19541 | loc: {
|
19542 | start: {
|
19543 | line: 1,
|
19544 | column: 0
|
19545 | },
|
19546 | end: {
|
19547 | line: 1,
|
19548 | column: 36
|
19549 | }
|
19550 | }
|
19551 | });
|
19552 |
|
19553 | test("for (var i = function() { return 10 in [] } in list) process(x);", {
|
19554 | type: "Program",
|
19555 | body: [
|
19556 | {
|
19557 | type: "ForInStatement",
|
19558 | left: {
|
19559 | type: "VariableDeclaration",
|
19560 | declarations: [
|
19561 | {
|
19562 | type: "VariableDeclarator",
|
19563 | id: {
|
19564 | type: "Identifier",
|
19565 | name: "i",
|
19566 | loc: {
|
19567 | start: {
|
19568 | line: 1,
|
19569 | column: 9
|
19570 | },
|
19571 | end: {
|
19572 | line: 1,
|
19573 | column: 10
|
19574 | }
|
19575 | }
|
19576 | },
|
19577 | init: {
|
19578 | type: "FunctionExpression",
|
19579 | id: null,
|
19580 | params: [],
|
19581 | body: {
|
19582 | type: "BlockStatement",
|
19583 | body: [
|
19584 | {
|
19585 | type: "ReturnStatement",
|
19586 | argument: {
|
19587 | type: "BinaryExpression",
|
19588 | left: {
|
19589 | type: "Literal",
|
19590 | value: 10,
|
19591 | loc: {
|
19592 | start: {
|
19593 | line: 1,
|
19594 | column: 33
|
19595 | },
|
19596 | end: {
|
19597 | line: 1,
|
19598 | column: 35
|
19599 | }
|
19600 | }
|
19601 | },
|
19602 | operator: "in",
|
19603 | right: {
|
19604 | type: "ArrayExpression",
|
19605 | elements: [],
|
19606 | loc: {
|
19607 | start: {
|
19608 | line: 1,
|
19609 | column: 39
|
19610 | },
|
19611 | end: {
|
19612 | line: 1,
|
19613 | column: 41
|
19614 | }
|
19615 | }
|
19616 | },
|
19617 | loc: {
|
19618 | start: {
|
19619 | line: 1,
|
19620 | column: 33
|
19621 | },
|
19622 | end: {
|
19623 | line: 1,
|
19624 | column: 41
|
19625 | }
|
19626 | }
|
19627 | },
|
19628 | loc: {
|
19629 | start: {
|
19630 | line: 1,
|
19631 | column: 26
|
19632 | },
|
19633 | end: {
|
19634 | line: 1,
|
19635 | column: 41
|
19636 | }
|
19637 | }
|
19638 | }
|
19639 | ],
|
19640 | loc: {
|
19641 | start: {
|
19642 | line: 1,
|
19643 | column: 24
|
19644 | },
|
19645 | end: {
|
19646 | line: 1,
|
19647 | column: 43
|
19648 | }
|
19649 | }
|
19650 | },
|
19651 | loc: {
|
19652 | start: {
|
19653 | line: 1,
|
19654 | column: 13
|
19655 | },
|
19656 | end: {
|
19657 | line: 1,
|
19658 | column: 43
|
19659 | }
|
19660 | }
|
19661 | },
|
19662 | loc: {
|
19663 | start: {
|
19664 | line: 1,
|
19665 | column: 9
|
19666 | },
|
19667 | end: {
|
19668 | line: 1,
|
19669 | column: 43
|
19670 | }
|
19671 | }
|
19672 | }
|
19673 | ],
|
19674 | kind: "var",
|
19675 | loc: {
|
19676 | start: {
|
19677 | line: 1,
|
19678 | column: 5
|
19679 | },
|
19680 | end: {
|
19681 | line: 1,
|
19682 | column: 43
|
19683 | }
|
19684 | }
|
19685 | },
|
19686 | right: {
|
19687 | type: "Identifier",
|
19688 | name: "list",
|
19689 | loc: {
|
19690 | start: {
|
19691 | line: 1,
|
19692 | column: 47
|
19693 | },
|
19694 | end: {
|
19695 | line: 1,
|
19696 | column: 51
|
19697 | }
|
19698 | }
|
19699 | },
|
19700 | body: {
|
19701 | type: "ExpressionStatement",
|
19702 | expression: {
|
19703 | type: "CallExpression",
|
19704 | callee: {
|
19705 | type: "Identifier",
|
19706 | name: "process",
|
19707 | loc: {
|
19708 | start: {
|
19709 | line: 1,
|
19710 | column: 53
|
19711 | },
|
19712 | end: {
|
19713 | line: 1,
|
19714 | column: 60
|
19715 | }
|
19716 | }
|
19717 | },
|
19718 | arguments: [
|
19719 | {
|
19720 | type: "Identifier",
|
19721 | name: "x",
|
19722 | loc: {
|
19723 | start: {
|
19724 | line: 1,
|
19725 | column: 61
|
19726 | },
|
19727 | end: {
|
19728 | line: 1,
|
19729 | column: 62
|
19730 | }
|
19731 | }
|
19732 | }
|
19733 | ],
|
19734 | loc: {
|
19735 | start: {
|
19736 | line: 1,
|
19737 | column: 53
|
19738 | },
|
19739 | end: {
|
19740 | line: 1,
|
19741 | column: 63
|
19742 | }
|
19743 | }
|
19744 | },
|
19745 | loc: {
|
19746 | start: {
|
19747 | line: 1,
|
19748 | column: 53
|
19749 | },
|
19750 | end: {
|
19751 | line: 1,
|
19752 | column: 64
|
19753 | }
|
19754 | }
|
19755 | },
|
19756 | loc: {
|
19757 | start: {
|
19758 | line: 1,
|
19759 | column: 0
|
19760 | },
|
19761 | end: {
|
19762 | line: 1,
|
19763 | column: 64
|
19764 | }
|
19765 | }
|
19766 | }
|
19767 | ],
|
19768 | loc: {
|
19769 | start: {
|
19770 | line: 1,
|
19771 | column: 0
|
19772 | },
|
19773 | end: {
|
19774 | line: 1,
|
19775 | column: 64
|
19776 | }
|
19777 | }
|
19778 | });
|
19779 |
|
19780 | test("while (true) { continue; }", {
|
19781 | type: "Program",
|
19782 | body: [
|
19783 | {
|
19784 | type: "WhileStatement",
|
19785 | test: {
|
19786 | type: "Literal",
|
19787 | value: true,
|
19788 | loc: {
|
19789 | start: {
|
19790 | line: 1,
|
19791 | column: 7
|
19792 | },
|
19793 | end: {
|
19794 | line: 1,
|
19795 | column: 11
|
19796 | }
|
19797 | }
|
19798 | },
|
19799 | body: {
|
19800 | type: "BlockStatement",
|
19801 | body: [
|
19802 | {
|
19803 | type: "ContinueStatement",
|
19804 | label: null,
|
19805 | loc: {
|
19806 | start: {
|
19807 | line: 1,
|
19808 | column: 15
|
19809 | },
|
19810 | end: {
|
19811 | line: 1,
|
19812 | column: 24
|
19813 | }
|
19814 | }
|
19815 | }
|
19816 | ],
|
19817 | loc: {
|
19818 | start: {
|
19819 | line: 1,
|
19820 | column: 13
|
19821 | },
|
19822 | end: {
|
19823 | line: 1,
|
19824 | column: 26
|
19825 | }
|
19826 | }
|
19827 | },
|
19828 | loc: {
|
19829 | start: {
|
19830 | line: 1,
|
19831 | column: 0
|
19832 | },
|
19833 | end: {
|
19834 | line: 1,
|
19835 | column: 26
|
19836 | }
|
19837 | }
|
19838 | }
|
19839 | ],
|
19840 | loc: {
|
19841 | start: {
|
19842 | line: 1,
|
19843 | column: 0
|
19844 | },
|
19845 | end: {
|
19846 | line: 1,
|
19847 | column: 26
|
19848 | }
|
19849 | }
|
19850 | });
|
19851 |
|
19852 | test("while (true) { continue }", {
|
19853 | type: "Program",
|
19854 | body: [
|
19855 | {
|
19856 | type: "WhileStatement",
|
19857 | test: {
|
19858 | type: "Literal",
|
19859 | value: true,
|
19860 | loc: {
|
19861 | start: {
|
19862 | line: 1,
|
19863 | column: 7
|
19864 | },
|
19865 | end: {
|
19866 | line: 1,
|
19867 | column: 11
|
19868 | }
|
19869 | }
|
19870 | },
|
19871 | body: {
|
19872 | type: "BlockStatement",
|
19873 | body: [
|
19874 | {
|
19875 | type: "ContinueStatement",
|
19876 | label: null,
|
19877 | loc: {
|
19878 | start: {
|
19879 | line: 1,
|
19880 | column: 15
|
19881 | },
|
19882 | end: {
|
19883 | line: 1,
|
19884 | column: 23
|
19885 | }
|
19886 | }
|
19887 | }
|
19888 | ],
|
19889 | loc: {
|
19890 | start: {
|
19891 | line: 1,
|
19892 | column: 13
|
19893 | },
|
19894 | end: {
|
19895 | line: 1,
|
19896 | column: 25
|
19897 | }
|
19898 | }
|
19899 | },
|
19900 | loc: {
|
19901 | start: {
|
19902 | line: 1,
|
19903 | column: 0
|
19904 | },
|
19905 | end: {
|
19906 | line: 1,
|
19907 | column: 25
|
19908 | }
|
19909 | }
|
19910 | }
|
19911 | ],
|
19912 | loc: {
|
19913 | start: {
|
19914 | line: 1,
|
19915 | column: 0
|
19916 | },
|
19917 | end: {
|
19918 | line: 1,
|
19919 | column: 25
|
19920 | }
|
19921 | }
|
19922 | });
|
19923 |
|
19924 | test("done: while (true) { continue done }", {
|
19925 | type: "Program",
|
19926 | body: [
|
19927 | {
|
19928 | type: "LabeledStatement",
|
19929 | body: {
|
19930 | type: "WhileStatement",
|
19931 | test: {
|
19932 | type: "Literal",
|
19933 | value: true,
|
19934 | loc: {
|
19935 | start: {
|
19936 | line: 1,
|
19937 | column: 13
|
19938 | },
|
19939 | end: {
|
19940 | line: 1,
|
19941 | column: 17
|
19942 | }
|
19943 | }
|
19944 | },
|
19945 | body: {
|
19946 | type: "BlockStatement",
|
19947 | body: [
|
19948 | {
|
19949 | type: "ContinueStatement",
|
19950 | label: {
|
19951 | type: "Identifier",
|
19952 | name: "done",
|
19953 | loc: {
|
19954 | start: {
|
19955 | line: 1,
|
19956 | column: 30
|
19957 | },
|
19958 | end: {
|
19959 | line: 1,
|
19960 | column: 34
|
19961 | }
|
19962 | }
|
19963 | },
|
19964 | loc: {
|
19965 | start: {
|
19966 | line: 1,
|
19967 | column: 21
|
19968 | },
|
19969 | end: {
|
19970 | line: 1,
|
19971 | column: 34
|
19972 | }
|
19973 | }
|
19974 | }
|
19975 | ],
|
19976 | loc: {
|
19977 | start: {
|
19978 | line: 1,
|
19979 | column: 19
|
19980 | },
|
19981 | end: {
|
19982 | line: 1,
|
19983 | column: 36
|
19984 | }
|
19985 | }
|
19986 | },
|
19987 | loc: {
|
19988 | start: {
|
19989 | line: 1,
|
19990 | column: 6
|
19991 | },
|
19992 | end: {
|
19993 | line: 1,
|
19994 | column: 36
|
19995 | }
|
19996 | }
|
19997 | },
|
19998 | label: {
|
19999 | type: "Identifier",
|
20000 | name: "done",
|
20001 | loc: {
|
20002 | start: {
|
20003 | line: 1,
|
20004 | column: 0
|
20005 | },
|
20006 | end: {
|
20007 | line: 1,
|
20008 | column: 4
|
20009 | }
|
20010 | }
|
20011 | },
|
20012 | loc: {
|
20013 | start: {
|
20014 | line: 1,
|
20015 | column: 0
|
20016 | },
|
20017 | end: {
|
20018 | line: 1,
|
20019 | column: 36
|
20020 | }
|
20021 | }
|
20022 | }
|
20023 | ],
|
20024 | loc: {
|
20025 | start: {
|
20026 | line: 1,
|
20027 | column: 0
|
20028 | },
|
20029 | end: {
|
20030 | line: 1,
|
20031 | column: 36
|
20032 | }
|
20033 | }
|
20034 | });
|
20035 |
|
20036 | test("done: while (true) { continue done; }", {
|
20037 | type: "Program",
|
20038 | body: [
|
20039 | {
|
20040 | type: "LabeledStatement",
|
20041 | body: {
|
20042 | type: "WhileStatement",
|
20043 | test: {
|
20044 | type: "Literal",
|
20045 | value: true,
|
20046 | loc: {
|
20047 | start: {
|
20048 | line: 1,
|
20049 | column: 13
|
20050 | },
|
20051 | end: {
|
20052 | line: 1,
|
20053 | column: 17
|
20054 | }
|
20055 | }
|
20056 | },
|
20057 | body: {
|
20058 | type: "BlockStatement",
|
20059 | body: [
|
20060 | {
|
20061 | type: "ContinueStatement",
|
20062 | label: {
|
20063 | type: "Identifier",
|
20064 | name: "done",
|
20065 | loc: {
|
20066 | start: {
|
20067 | line: 1,
|
20068 | column: 30
|
20069 | },
|
20070 | end: {
|
20071 | line: 1,
|
20072 | column: 34
|
20073 | }
|
20074 | }
|
20075 | },
|
20076 | loc: {
|
20077 | start: {
|
20078 | line: 1,
|
20079 | column: 21
|
20080 | },
|
20081 | end: {
|
20082 | line: 1,
|
20083 | column: 35
|
20084 | }
|
20085 | }
|
20086 | }
|
20087 | ],
|
20088 | loc: {
|
20089 | start: {
|
20090 | line: 1,
|
20091 | column: 19
|
20092 | },
|
20093 | end: {
|
20094 | line: 1,
|
20095 | column: 37
|
20096 | }
|
20097 | }
|
20098 | },
|
20099 | loc: {
|
20100 | start: {
|
20101 | line: 1,
|
20102 | column: 6
|
20103 | },
|
20104 | end: {
|
20105 | line: 1,
|
20106 | column: 37
|
20107 | }
|
20108 | }
|
20109 | },
|
20110 | label: {
|
20111 | type: "Identifier",
|
20112 | name: "done",
|
20113 | loc: {
|
20114 | start: {
|
20115 | line: 1,
|
20116 | column: 0
|
20117 | },
|
20118 | end: {
|
20119 | line: 1,
|
20120 | column: 4
|
20121 | }
|
20122 | }
|
20123 | },
|
20124 | loc: {
|
20125 | start: {
|
20126 | line: 1,
|
20127 | column: 0
|
20128 | },
|
20129 | end: {
|
20130 | line: 1,
|
20131 | column: 37
|
20132 | }
|
20133 | }
|
20134 | }
|
20135 | ],
|
20136 | loc: {
|
20137 | start: {
|
20138 | line: 1,
|
20139 | column: 0
|
20140 | },
|
20141 | end: {
|
20142 | line: 1,
|
20143 | column: 37
|
20144 | }
|
20145 | }
|
20146 | });
|
20147 |
|
20148 | test("while (true) { break }", {
|
20149 | type: "Program",
|
20150 | body: [
|
20151 | {
|
20152 | type: "WhileStatement",
|
20153 | test: {
|
20154 | type: "Literal",
|
20155 | value: true,
|
20156 | loc: {
|
20157 | start: {
|
20158 | line: 1,
|
20159 | column: 7
|
20160 | },
|
20161 | end: {
|
20162 | line: 1,
|
20163 | column: 11
|
20164 | }
|
20165 | }
|
20166 | },
|
20167 | body: {
|
20168 | type: "BlockStatement",
|
20169 | body: [
|
20170 | {
|
20171 | type: "BreakStatement",
|
20172 | label: null,
|
20173 | loc: {
|
20174 | start: {
|
20175 | line: 1,
|
20176 | column: 15
|
20177 | },
|
20178 | end: {
|
20179 | line: 1,
|
20180 | column: 20
|
20181 | }
|
20182 | }
|
20183 | }
|
20184 | ],
|
20185 | loc: {
|
20186 | start: {
|
20187 | line: 1,
|
20188 | column: 13
|
20189 | },
|
20190 | end: {
|
20191 | line: 1,
|
20192 | column: 22
|
20193 | }
|
20194 | }
|
20195 | },
|
20196 | loc: {
|
20197 | start: {
|
20198 | line: 1,
|
20199 | column: 0
|
20200 | },
|
20201 | end: {
|
20202 | line: 1,
|
20203 | column: 22
|
20204 | }
|
20205 | }
|
20206 | }
|
20207 | ],
|
20208 | loc: {
|
20209 | start: {
|
20210 | line: 1,
|
20211 | column: 0
|
20212 | },
|
20213 | end: {
|
20214 | line: 1,
|
20215 | column: 22
|
20216 | }
|
20217 | }
|
20218 | });
|
20219 |
|
20220 | test("done: while (true) { break done }", {
|
20221 | type: "Program",
|
20222 | body: [
|
20223 | {
|
20224 | type: "LabeledStatement",
|
20225 | body: {
|
20226 | type: "WhileStatement",
|
20227 | test: {
|
20228 | type: "Literal",
|
20229 | value: true,
|
20230 | loc: {
|
20231 | start: {
|
20232 | line: 1,
|
20233 | column: 13
|
20234 | },
|
20235 | end: {
|
20236 | line: 1,
|
20237 | column: 17
|
20238 | }
|
20239 | }
|
20240 | },
|
20241 | body: {
|
20242 | type: "BlockStatement",
|
20243 | body: [
|
20244 | {
|
20245 | type: "BreakStatement",
|
20246 | label: {
|
20247 | type: "Identifier",
|
20248 | name: "done",
|
20249 | loc: {
|
20250 | start: {
|
20251 | line: 1,
|
20252 | column: 27
|
20253 | },
|
20254 | end: {
|
20255 | line: 1,
|
20256 | column: 31
|
20257 | }
|
20258 | }
|
20259 | },
|
20260 | loc: {
|
20261 | start: {
|
20262 | line: 1,
|
20263 | column: 21
|
20264 | },
|
20265 | end: {
|
20266 | line: 1,
|
20267 | column: 31
|
20268 | }
|
20269 | }
|
20270 | }
|
20271 | ],
|
20272 | loc: {
|
20273 | start: {
|
20274 | line: 1,
|
20275 | column: 19
|
20276 | },
|
20277 | end: {
|
20278 | line: 1,
|
20279 | column: 33
|
20280 | }
|
20281 | }
|
20282 | },
|
20283 | loc: {
|
20284 | start: {
|
20285 | line: 1,
|
20286 | column: 6
|
20287 | },
|
20288 | end: {
|
20289 | line: 1,
|
20290 | column: 33
|
20291 | }
|
20292 | }
|
20293 | },
|
20294 | label: {
|
20295 | type: "Identifier",
|
20296 | name: "done",
|
20297 | loc: {
|
20298 | start: {
|
20299 | line: 1,
|
20300 | column: 0
|
20301 | },
|
20302 | end: {
|
20303 | line: 1,
|
20304 | column: 4
|
20305 | }
|
20306 | }
|
20307 | },
|
20308 | loc: {
|
20309 | start: {
|
20310 | line: 1,
|
20311 | column: 0
|
20312 | },
|
20313 | end: {
|
20314 | line: 1,
|
20315 | column: 33
|
20316 | }
|
20317 | }
|
20318 | }
|
20319 | ],
|
20320 | loc: {
|
20321 | start: {
|
20322 | line: 1,
|
20323 | column: 0
|
20324 | },
|
20325 | end: {
|
20326 | line: 1,
|
20327 | column: 33
|
20328 | }
|
20329 | }
|
20330 | });
|
20331 |
|
20332 | test("done: while (true) { break done; }", {
|
20333 | type: "Program",
|
20334 | body: [
|
20335 | {
|
20336 | type: "LabeledStatement",
|
20337 | body: {
|
20338 | type: "WhileStatement",
|
20339 | test: {
|
20340 | type: "Literal",
|
20341 | value: true,
|
20342 | loc: {
|
20343 | start: {
|
20344 | line: 1,
|
20345 | column: 13
|
20346 | },
|
20347 | end: {
|
20348 | line: 1,
|
20349 | column: 17
|
20350 | }
|
20351 | }
|
20352 | },
|
20353 | body: {
|
20354 | type: "BlockStatement",
|
20355 | body: [
|
20356 | {
|
20357 | type: "BreakStatement",
|
20358 | label: {
|
20359 | type: "Identifier",
|
20360 | name: "done",
|
20361 | loc: {
|
20362 | start: {
|
20363 | line: 1,
|
20364 | column: 27
|
20365 | },
|
20366 | end: {
|
20367 | line: 1,
|
20368 | column: 31
|
20369 | }
|
20370 | }
|
20371 | },
|
20372 | loc: {
|
20373 | start: {
|
20374 | line: 1,
|
20375 | column: 21
|
20376 | },
|
20377 | end: {
|
20378 | line: 1,
|
20379 | column: 32
|
20380 | }
|
20381 | }
|
20382 | }
|
20383 | ],
|
20384 | loc: {
|
20385 | start: {
|
20386 | line: 1,
|
20387 | column: 19
|
20388 | },
|
20389 | end: {
|
20390 | line: 1,
|
20391 | column: 34
|
20392 | }
|
20393 | }
|
20394 | },
|
20395 | loc: {
|
20396 | start: {
|
20397 | line: 1,
|
20398 | column: 6
|
20399 | },
|
20400 | end: {
|
20401 | line: 1,
|
20402 | column: 34
|
20403 | }
|
20404 | }
|
20405 | },
|
20406 | label: {
|
20407 | type: "Identifier",
|
20408 | name: "done",
|
20409 | loc: {
|
20410 | start: {
|
20411 | line: 1,
|
20412 | column: 0
|
20413 | },
|
20414 | end: {
|
20415 | line: 1,
|
20416 | column: 4
|
20417 | }
|
20418 | }
|
20419 | },
|
20420 | loc: {
|
20421 | start: {
|
20422 | line: 1,
|
20423 | column: 0
|
20424 | },
|
20425 | end: {
|
20426 | line: 1,
|
20427 | column: 34
|
20428 | }
|
20429 | }
|
20430 | }
|
20431 | ],
|
20432 | loc: {
|
20433 | start: {
|
20434 | line: 1,
|
20435 | column: 0
|
20436 | },
|
20437 | end: {
|
20438 | line: 1,
|
20439 | column: 34
|
20440 | }
|
20441 | }
|
20442 | });
|
20443 |
|
20444 | test("(function(){ return })", {
|
20445 | type: "Program",
|
20446 | body: [
|
20447 | {
|
20448 | type: "ExpressionStatement",
|
20449 | expression: {
|
20450 | type: "FunctionExpression",
|
20451 | id: null,
|
20452 | params: [],
|
20453 | body: {
|
20454 | type: "BlockStatement",
|
20455 | body: [
|
20456 | {
|
20457 | type: "ReturnStatement",
|
20458 | argument: null,
|
20459 | loc: {
|
20460 | start: {
|
20461 | line: 1,
|
20462 | column: 13
|
20463 | },
|
20464 | end: {
|
20465 | line: 1,
|
20466 | column: 19
|
20467 | }
|
20468 | }
|
20469 | }
|
20470 | ],
|
20471 | loc: {
|
20472 | start: {
|
20473 | line: 1,
|
20474 | column: 11
|
20475 | },
|
20476 | end: {
|
20477 | line: 1,
|
20478 | column: 21
|
20479 | }
|
20480 | }
|
20481 | },
|
20482 | loc: {
|
20483 | start: {
|
20484 | line: 1,
|
20485 | column: 0
|
20486 | },
|
20487 | end: {
|
20488 | line: 1,
|
20489 | column: 22
|
20490 | }
|
20491 | }
|
20492 | },
|
20493 | loc: {
|
20494 | start: {
|
20495 | line: 1,
|
20496 | column: 0
|
20497 | },
|
20498 | end: {
|
20499 | line: 1,
|
20500 | column: 22
|
20501 | }
|
20502 | }
|
20503 | }
|
20504 | ],
|
20505 | loc: {
|
20506 | start: {
|
20507 | line: 1,
|
20508 | column: 0
|
20509 | },
|
20510 | end: {
|
20511 | line: 1,
|
20512 | column: 22
|
20513 | }
|
20514 | }
|
20515 | });
|
20516 |
|
20517 | test("(function(){ return; })", {
|
20518 | type: "Program",
|
20519 | body: [
|
20520 | {
|
20521 | type: "ExpressionStatement",
|
20522 | expression: {
|
20523 | type: "FunctionExpression",
|
20524 | id: null,
|
20525 | params: [],
|
20526 | body: {
|
20527 | type: "BlockStatement",
|
20528 | body: [
|
20529 | {
|
20530 | type: "ReturnStatement",
|
20531 | argument: null,
|
20532 | loc: {
|
20533 | start: {
|
20534 | line: 1,
|
20535 | column: 13
|
20536 | },
|
20537 | end: {
|
20538 | line: 1,
|
20539 | column: 20
|
20540 | }
|
20541 | }
|
20542 | }
|
20543 | ],
|
20544 | loc: {
|
20545 | start: {
|
20546 | line: 1,
|
20547 | column: 11
|
20548 | },
|
20549 | end: {
|
20550 | line: 1,
|
20551 | column: 22
|
20552 | }
|
20553 | }
|
20554 | },
|
20555 | loc: {
|
20556 | start: {
|
20557 | line: 1,
|
20558 | column: 0
|
20559 | },
|
20560 | end: {
|
20561 | line: 1,
|
20562 | column: 23
|
20563 | }
|
20564 | }
|
20565 | },
|
20566 | loc: {
|
20567 | start: {
|
20568 | line: 1,
|
20569 | column: 0
|
20570 | },
|
20571 | end: {
|
20572 | line: 1,
|
20573 | column: 23
|
20574 | }
|
20575 | }
|
20576 | }
|
20577 | ],
|
20578 | loc: {
|
20579 | start: {
|
20580 | line: 1,
|
20581 | column: 0
|
20582 | },
|
20583 | end: {
|
20584 | line: 1,
|
20585 | column: 23
|
20586 | }
|
20587 | }
|
20588 | });
|
20589 |
|
20590 | test("(function(){ return x; })", {
|
20591 | type: "Program",
|
20592 | body: [
|
20593 | {
|
20594 | type: "ExpressionStatement",
|
20595 | expression: {
|
20596 | type: "FunctionExpression",
|
20597 | id: null,
|
20598 | params: [],
|
20599 | body: {
|
20600 | type: "BlockStatement",
|
20601 | body: [
|
20602 | {
|
20603 | type: "ReturnStatement",
|
20604 | argument: {
|
20605 | type: "Identifier",
|
20606 | name: "x",
|
20607 | loc: {
|
20608 | start: {
|
20609 | line: 1,
|
20610 | column: 20
|
20611 | },
|
20612 | end: {
|
20613 | line: 1,
|
20614 | column: 21
|
20615 | }
|
20616 | }
|
20617 | },
|
20618 | loc: {
|
20619 | start: {
|
20620 | line: 1,
|
20621 | column: 13
|
20622 | },
|
20623 | end: {
|
20624 | line: 1,
|
20625 | column: 22
|
20626 | }
|
20627 | }
|
20628 | }
|
20629 | ],
|
20630 | loc: {
|
20631 | start: {
|
20632 | line: 1,
|
20633 | column: 11
|
20634 | },
|
20635 | end: {
|
20636 | line: 1,
|
20637 | column: 24
|
20638 | }
|
20639 | }
|
20640 | },
|
20641 | loc: {
|
20642 | start: {
|
20643 | line: 1,
|
20644 | column: 0
|
20645 | },
|
20646 | end: {
|
20647 | line: 1,
|
20648 | column: 25
|
20649 | }
|
20650 | }
|
20651 | },
|
20652 | loc: {
|
20653 | start: {
|
20654 | line: 1,
|
20655 | column: 0
|
20656 | },
|
20657 | end: {
|
20658 | line: 1,
|
20659 | column: 25
|
20660 | }
|
20661 | }
|
20662 | }
|
20663 | ],
|
20664 | loc: {
|
20665 | start: {
|
20666 | line: 1,
|
20667 | column: 0
|
20668 | },
|
20669 | end: {
|
20670 | line: 1,
|
20671 | column: 25
|
20672 | }
|
20673 | }
|
20674 | });
|
20675 |
|
20676 | test("(function(){ return x * y })", {
|
20677 | type: "Program",
|
20678 | body: [
|
20679 | {
|
20680 | type: "ExpressionStatement",
|
20681 | expression: {
|
20682 | type: "FunctionExpression",
|
20683 | id: null,
|
20684 | params: [],
|
20685 | body: {
|
20686 | type: "BlockStatement",
|
20687 | body: [
|
20688 | {
|
20689 | type: "ReturnStatement",
|
20690 | argument: {
|
20691 | type: "BinaryExpression",
|
20692 | left: {
|
20693 | type: "Identifier",
|
20694 | name: "x",
|
20695 | loc: {
|
20696 | start: {
|
20697 | line: 1,
|
20698 | column: 20
|
20699 | },
|
20700 | end: {
|
20701 | line: 1,
|
20702 | column: 21
|
20703 | }
|
20704 | }
|
20705 | },
|
20706 | operator: "*",
|
20707 | right: {
|
20708 | type: "Identifier",
|
20709 | name: "y",
|
20710 | loc: {
|
20711 | start: {
|
20712 | line: 1,
|
20713 | column: 24
|
20714 | },
|
20715 | end: {
|
20716 | line: 1,
|
20717 | column: 25
|
20718 | }
|
20719 | }
|
20720 | },
|
20721 | loc: {
|
20722 | start: {
|
20723 | line: 1,
|
20724 | column: 20
|
20725 | },
|
20726 | end: {
|
20727 | line: 1,
|
20728 | column: 25
|
20729 | }
|
20730 | }
|
20731 | },
|
20732 | loc: {
|
20733 | start: {
|
20734 | line: 1,
|
20735 | column: 13
|
20736 | },
|
20737 | end: {
|
20738 | line: 1,
|
20739 | column: 25
|
20740 | }
|
20741 | }
|
20742 | }
|
20743 | ],
|
20744 | loc: {
|
20745 | start: {
|
20746 | line: 1,
|
20747 | column: 11
|
20748 | },
|
20749 | end: {
|
20750 | line: 1,
|
20751 | column: 27
|
20752 | }
|
20753 | }
|
20754 | },
|
20755 | loc: {
|
20756 | start: {
|
20757 | line: 1,
|
20758 | column: 0
|
20759 | },
|
20760 | end: {
|
20761 | line: 1,
|
20762 | column: 28
|
20763 | }
|
20764 | }
|
20765 | },
|
20766 | loc: {
|
20767 | start: {
|
20768 | line: 1,
|
20769 | column: 0
|
20770 | },
|
20771 | end: {
|
20772 | line: 1,
|
20773 | column: 28
|
20774 | }
|
20775 | }
|
20776 | }
|
20777 | ],
|
20778 | loc: {
|
20779 | start: {
|
20780 | line: 1,
|
20781 | column: 0
|
20782 | },
|
20783 | end: {
|
20784 | line: 1,
|
20785 | column: 28
|
20786 | }
|
20787 | }
|
20788 | });
|
20789 |
|
20790 | test("with (x) foo = bar", {
|
20791 | type: "Program",
|
20792 | body: [
|
20793 | {
|
20794 | type: "WithStatement",
|
20795 | object: {
|
20796 | type: "Identifier",
|
20797 | name: "x",
|
20798 | loc: {
|
20799 | start: {
|
20800 | line: 1,
|
20801 | column: 6
|
20802 | },
|
20803 | end: {
|
20804 | line: 1,
|
20805 | column: 7
|
20806 | }
|
20807 | }
|
20808 | },
|
20809 | body: {
|
20810 | type: "ExpressionStatement",
|
20811 | expression: {
|
20812 | type: "AssignmentExpression",
|
20813 | operator: "=",
|
20814 | left: {
|
20815 | type: "Identifier",
|
20816 | name: "foo",
|
20817 | loc: {
|
20818 | start: {
|
20819 | line: 1,
|
20820 | column: 9
|
20821 | },
|
20822 | end: {
|
20823 | line: 1,
|
20824 | column: 12
|
20825 | }
|
20826 | }
|
20827 | },
|
20828 | right: {
|
20829 | type: "Identifier",
|
20830 | name: "bar",
|
20831 | loc: {
|
20832 | start: {
|
20833 | line: 1,
|
20834 | column: 15
|
20835 | },
|
20836 | end: {
|
20837 | line: 1,
|
20838 | column: 18
|
20839 | }
|
20840 | }
|
20841 | },
|
20842 | loc: {
|
20843 | start: {
|
20844 | line: 1,
|
20845 | column: 9
|
20846 | },
|
20847 | end: {
|
20848 | line: 1,
|
20849 | column: 18
|
20850 | }
|
20851 | }
|
20852 | },
|
20853 | loc: {
|
20854 | start: {
|
20855 | line: 1,
|
20856 | column: 9
|
20857 | },
|
20858 | end: {
|
20859 | line: 1,
|
20860 | column: 18
|
20861 | }
|
20862 | }
|
20863 | },
|
20864 | loc: {
|
20865 | start: {
|
20866 | line: 1,
|
20867 | column: 0
|
20868 | },
|
20869 | end: {
|
20870 | line: 1,
|
20871 | column: 18
|
20872 | }
|
20873 | }
|
20874 | }
|
20875 | ],
|
20876 | loc: {
|
20877 | start: {
|
20878 | line: 1,
|
20879 | column: 0
|
20880 | },
|
20881 | end: {
|
20882 | line: 1,
|
20883 | column: 18
|
20884 | }
|
20885 | }
|
20886 | });
|
20887 |
|
20888 | test("with (x) foo = bar;", {
|
20889 | type: "Program",
|
20890 | body: [
|
20891 | {
|
20892 | type: "WithStatement",
|
20893 | object: {
|
20894 | type: "Identifier",
|
20895 | name: "x",
|
20896 | loc: {
|
20897 | start: {
|
20898 | line: 1,
|
20899 | column: 6
|
20900 | },
|
20901 | end: {
|
20902 | line: 1,
|
20903 | column: 7
|
20904 | }
|
20905 | }
|
20906 | },
|
20907 | body: {
|
20908 | type: "ExpressionStatement",
|
20909 | expression: {
|
20910 | type: "AssignmentExpression",
|
20911 | operator: "=",
|
20912 | left: {
|
20913 | type: "Identifier",
|
20914 | name: "foo",
|
20915 | loc: {
|
20916 | start: {
|
20917 | line: 1,
|
20918 | column: 9
|
20919 | },
|
20920 | end: {
|
20921 | line: 1,
|
20922 | column: 12
|
20923 | }
|
20924 | }
|
20925 | },
|
20926 | right: {
|
20927 | type: "Identifier",
|
20928 | name: "bar",
|
20929 | loc: {
|
20930 | start: {
|
20931 | line: 1,
|
20932 | column: 15
|
20933 | },
|
20934 | end: {
|
20935 | line: 1,
|
20936 | column: 18
|
20937 | }
|
20938 | }
|
20939 | },
|
20940 | loc: {
|
20941 | start: {
|
20942 | line: 1,
|
20943 | column: 9
|
20944 | },
|
20945 | end: {
|
20946 | line: 1,
|
20947 | column: 18
|
20948 | }
|
20949 | }
|
20950 | },
|
20951 | loc: {
|
20952 | start: {
|
20953 | line: 1,
|
20954 | column: 9
|
20955 | },
|
20956 | end: {
|
20957 | line: 1,
|
20958 | column: 19
|
20959 | }
|
20960 | }
|
20961 | },
|
20962 | loc: {
|
20963 | start: {
|
20964 | line: 1,
|
20965 | column: 0
|
20966 | },
|
20967 | end: {
|
20968 | line: 1,
|
20969 | column: 19
|
20970 | }
|
20971 | }
|
20972 | }
|
20973 | ],
|
20974 | loc: {
|
20975 | start: {
|
20976 | line: 1,
|
20977 | column: 0
|
20978 | },
|
20979 | end: {
|
20980 | line: 1,
|
20981 | column: 19
|
20982 | }
|
20983 | }
|
20984 | });
|
20985 |
|
20986 | test("with (x) { foo = bar }", {
|
20987 | type: "Program",
|
20988 | body: [
|
20989 | {
|
20990 | type: "WithStatement",
|
20991 | object: {
|
20992 | type: "Identifier",
|
20993 | name: "x",
|
20994 | loc: {
|
20995 | start: {
|
20996 | line: 1,
|
20997 | column: 6
|
20998 | },
|
20999 | end: {
|
21000 | line: 1,
|
21001 | column: 7
|
21002 | }
|
21003 | }
|
21004 | },
|
21005 | body: {
|
21006 | type: "BlockStatement",
|
21007 | body: [
|
21008 | {
|
21009 | type: "ExpressionStatement",
|
21010 | expression: {
|
21011 | type: "AssignmentExpression",
|
21012 | operator: "=",
|
21013 | left: {
|
21014 | type: "Identifier",
|
21015 | name: "foo",
|
21016 | loc: {
|
21017 | start: {
|
21018 | line: 1,
|
21019 | column: 11
|
21020 | },
|
21021 | end: {
|
21022 | line: 1,
|
21023 | column: 14
|
21024 | }
|
21025 | }
|
21026 | },
|
21027 | right: {
|
21028 | type: "Identifier",
|
21029 | name: "bar",
|
21030 | loc: {
|
21031 | start: {
|
21032 | line: 1,
|
21033 | column: 17
|
21034 | },
|
21035 | end: {
|
21036 | line: 1,
|
21037 | column: 20
|
21038 | }
|
21039 | }
|
21040 | },
|
21041 | loc: {
|
21042 | start: {
|
21043 | line: 1,
|
21044 | column: 11
|
21045 | },
|
21046 | end: {
|
21047 | line: 1,
|
21048 | column: 20
|
21049 | }
|
21050 | }
|
21051 | },
|
21052 | loc: {
|
21053 | start: {
|
21054 | line: 1,
|
21055 | column: 11
|
21056 | },
|
21057 | end: {
|
21058 | line: 1,
|
21059 | column: 20
|
21060 | }
|
21061 | }
|
21062 | }
|
21063 | ],
|
21064 | loc: {
|
21065 | start: {
|
21066 | line: 1,
|
21067 | column: 9
|
21068 | },
|
21069 | end: {
|
21070 | line: 1,
|
21071 | column: 22
|
21072 | }
|
21073 | }
|
21074 | },
|
21075 | loc: {
|
21076 | start: {
|
21077 | line: 1,
|
21078 | column: 0
|
21079 | },
|
21080 | end: {
|
21081 | line: 1,
|
21082 | column: 22
|
21083 | }
|
21084 | }
|
21085 | }
|
21086 | ],
|
21087 | loc: {
|
21088 | start: {
|
21089 | line: 1,
|
21090 | column: 0
|
21091 | },
|
21092 | end: {
|
21093 | line: 1,
|
21094 | column: 22
|
21095 | }
|
21096 | }
|
21097 | });
|
21098 |
|
21099 | test("switch (x) {}", {
|
21100 | type: "Program",
|
21101 | body: [
|
21102 | {
|
21103 | type: "SwitchStatement",
|
21104 | discriminant: {
|
21105 | type: "Identifier",
|
21106 | name: "x",
|
21107 | loc: {
|
21108 | start: {
|
21109 | line: 1,
|
21110 | column: 8
|
21111 | },
|
21112 | end: {
|
21113 | line: 1,
|
21114 | column: 9
|
21115 | }
|
21116 | }
|
21117 | },
|
21118 | cases: [],
|
21119 | loc: {
|
21120 | start: {
|
21121 | line: 1,
|
21122 | column: 0
|
21123 | },
|
21124 | end: {
|
21125 | line: 1,
|
21126 | column: 13
|
21127 | }
|
21128 | }
|
21129 | }
|
21130 | ],
|
21131 | loc: {
|
21132 | start: {
|
21133 | line: 1,
|
21134 | column: 0
|
21135 | },
|
21136 | end: {
|
21137 | line: 1,
|
21138 | column: 13
|
21139 | }
|
21140 | }
|
21141 | });
|
21142 |
|
21143 | test("switch (answer) { case 42: hi(); break; }", {
|
21144 | type: "Program",
|
21145 | body: [
|
21146 | {
|
21147 | type: "SwitchStatement",
|
21148 | discriminant: {
|
21149 | type: "Identifier",
|
21150 | name: "answer",
|
21151 | loc: {
|
21152 | start: {
|
21153 | line: 1,
|
21154 | column: 8
|
21155 | },
|
21156 | end: {
|
21157 | line: 1,
|
21158 | column: 14
|
21159 | }
|
21160 | }
|
21161 | },
|
21162 | cases: [
|
21163 | {
|
21164 | type: "SwitchCase",
|
21165 | consequent: [
|
21166 | {
|
21167 | type: "ExpressionStatement",
|
21168 | expression: {
|
21169 | type: "CallExpression",
|
21170 | callee: {
|
21171 | type: "Identifier",
|
21172 | name: "hi",
|
21173 | loc: {
|
21174 | start: {
|
21175 | line: 1,
|
21176 | column: 27
|
21177 | },
|
21178 | end: {
|
21179 | line: 1,
|
21180 | column: 29
|
21181 | }
|
21182 | }
|
21183 | },
|
21184 | arguments: [],
|
21185 | loc: {
|
21186 | start: {
|
21187 | line: 1,
|
21188 | column: 27
|
21189 | },
|
21190 | end: {
|
21191 | line: 1,
|
21192 | column: 31
|
21193 | }
|
21194 | }
|
21195 | },
|
21196 | loc: {
|
21197 | start: {
|
21198 | line: 1,
|
21199 | column: 27
|
21200 | },
|
21201 | end: {
|
21202 | line: 1,
|
21203 | column: 32
|
21204 | }
|
21205 | }
|
21206 | },
|
21207 | {
|
21208 | type: "BreakStatement",
|
21209 | label: null,
|
21210 | loc: {
|
21211 | start: {
|
21212 | line: 1,
|
21213 | column: 33
|
21214 | },
|
21215 | end: {
|
21216 | line: 1,
|
21217 | column: 39
|
21218 | }
|
21219 | }
|
21220 | }
|
21221 | ],
|
21222 | test: {
|
21223 | type: "Literal",
|
21224 | value: 42,
|
21225 | loc: {
|
21226 | start: {
|
21227 | line: 1,
|
21228 | column: 23
|
21229 | },
|
21230 | end: {
|
21231 | line: 1,
|
21232 | column: 25
|
21233 | }
|
21234 | }
|
21235 | },
|
21236 | loc: {
|
21237 | start: {
|
21238 | line: 1,
|
21239 | column: 18
|
21240 | },
|
21241 | end: {
|
21242 | line: 1,
|
21243 | column: 39
|
21244 | }
|
21245 | }
|
21246 | }
|
21247 | ],
|
21248 | loc: {
|
21249 | start: {
|
21250 | line: 1,
|
21251 | column: 0
|
21252 | },
|
21253 | end: {
|
21254 | line: 1,
|
21255 | column: 41
|
21256 | }
|
21257 | }
|
21258 | }
|
21259 | ],
|
21260 | loc: {
|
21261 | start: {
|
21262 | line: 1,
|
21263 | column: 0
|
21264 | },
|
21265 | end: {
|
21266 | line: 1,
|
21267 | column: 41
|
21268 | }
|
21269 | }
|
21270 | });
|
21271 |
|
21272 | test("switch (answer) { case 42: hi(); break; default: break }", {
|
21273 | type: "Program",
|
21274 | body: [
|
21275 | {
|
21276 | type: "SwitchStatement",
|
21277 | discriminant: {
|
21278 | type: "Identifier",
|
21279 | name: "answer",
|
21280 | loc: {
|
21281 | start: {
|
21282 | line: 1,
|
21283 | column: 8
|
21284 | },
|
21285 | end: {
|
21286 | line: 1,
|
21287 | column: 14
|
21288 | }
|
21289 | }
|
21290 | },
|
21291 | cases: [
|
21292 | {
|
21293 | type: "SwitchCase",
|
21294 | consequent: [
|
21295 | {
|
21296 | type: "ExpressionStatement",
|
21297 | expression: {
|
21298 | type: "CallExpression",
|
21299 | callee: {
|
21300 | type: "Identifier",
|
21301 | name: "hi",
|
21302 | loc: {
|
21303 | start: {
|
21304 | line: 1,
|
21305 | column: 27
|
21306 | },
|
21307 | end: {
|
21308 | line: 1,
|
21309 | column: 29
|
21310 | }
|
21311 | }
|
21312 | },
|
21313 | arguments: [],
|
21314 | loc: {
|
21315 | start: {
|
21316 | line: 1,
|
21317 | column: 27
|
21318 | },
|
21319 | end: {
|
21320 | line: 1,
|
21321 | column: 31
|
21322 | }
|
21323 | }
|
21324 | },
|
21325 | loc: {
|
21326 | start: {
|
21327 | line: 1,
|
21328 | column: 27
|
21329 | },
|
21330 | end: {
|
21331 | line: 1,
|
21332 | column: 32
|
21333 | }
|
21334 | }
|
21335 | },
|
21336 | {
|
21337 | type: "BreakStatement",
|
21338 | label: null,
|
21339 | loc: {
|
21340 | start: {
|
21341 | line: 1,
|
21342 | column: 33
|
21343 | },
|
21344 | end: {
|
21345 | line: 1,
|
21346 | column: 39
|
21347 | }
|
21348 | }
|
21349 | }
|
21350 | ],
|
21351 | test: {
|
21352 | type: "Literal",
|
21353 | value: 42,
|
21354 | loc: {
|
21355 | start: {
|
21356 | line: 1,
|
21357 | column: 23
|
21358 | },
|
21359 | end: {
|
21360 | line: 1,
|
21361 | column: 25
|
21362 | }
|
21363 | }
|
21364 | },
|
21365 | loc: {
|
21366 | start: {
|
21367 | line: 1,
|
21368 | column: 18
|
21369 | },
|
21370 | end: {
|
21371 | line: 1,
|
21372 | column: 39
|
21373 | }
|
21374 | }
|
21375 | },
|
21376 | {
|
21377 | type: "SwitchCase",
|
21378 | consequent: [
|
21379 | {
|
21380 | type: "BreakStatement",
|
21381 | label: null,
|
21382 | loc: {
|
21383 | start: {
|
21384 | line: 1,
|
21385 | column: 49
|
21386 | },
|
21387 | end: {
|
21388 | line: 1,
|
21389 | column: 54
|
21390 | }
|
21391 | }
|
21392 | }
|
21393 | ],
|
21394 | test: null,
|
21395 | loc: {
|
21396 | start: {
|
21397 | line: 1,
|
21398 | column: 40
|
21399 | },
|
21400 | end: {
|
21401 | line: 1,
|
21402 | column: 54
|
21403 | }
|
21404 | }
|
21405 | }
|
21406 | ],
|
21407 | loc: {
|
21408 | start: {
|
21409 | line: 1,
|
21410 | column: 0
|
21411 | },
|
21412 | end: {
|
21413 | line: 1,
|
21414 | column: 56
|
21415 | }
|
21416 | }
|
21417 | }
|
21418 | ],
|
21419 | loc: {
|
21420 | start: {
|
21421 | line: 1,
|
21422 | column: 0
|
21423 | },
|
21424 | end: {
|
21425 | line: 1,
|
21426 | column: 56
|
21427 | }
|
21428 | }
|
21429 | });
|
21430 |
|
21431 | test("start: for (;;) break start", {
|
21432 | type: "Program",
|
21433 | body: [
|
21434 | {
|
21435 | type: "LabeledStatement",
|
21436 | body: {
|
21437 | type: "ForStatement",
|
21438 | init: null,
|
21439 | test: null,
|
21440 | update: null,
|
21441 | body: {
|
21442 | type: "BreakStatement",
|
21443 | label: {
|
21444 | type: "Identifier",
|
21445 | name: "start",
|
21446 | loc: {
|
21447 | start: {
|
21448 | line: 1,
|
21449 | column: 22
|
21450 | },
|
21451 | end: {
|
21452 | line: 1,
|
21453 | column: 27
|
21454 | }
|
21455 | }
|
21456 | },
|
21457 | loc: {
|
21458 | start: {
|
21459 | line: 1,
|
21460 | column: 16
|
21461 | },
|
21462 | end: {
|
21463 | line: 1,
|
21464 | column: 27
|
21465 | }
|
21466 | }
|
21467 | },
|
21468 | loc: {
|
21469 | start: {
|
21470 | line: 1,
|
21471 | column: 7
|
21472 | },
|
21473 | end: {
|
21474 | line: 1,
|
21475 | column: 27
|
21476 | }
|
21477 | }
|
21478 | },
|
21479 | label: {
|
21480 | type: "Identifier",
|
21481 | name: "start",
|
21482 | loc: {
|
21483 | start: {
|
21484 | line: 1,
|
21485 | column: 0
|
21486 | },
|
21487 | end: {
|
21488 | line: 1,
|
21489 | column: 5
|
21490 | }
|
21491 | }
|
21492 | },
|
21493 | loc: {
|
21494 | start: {
|
21495 | line: 1,
|
21496 | column: 0
|
21497 | },
|
21498 | end: {
|
21499 | line: 1,
|
21500 | column: 27
|
21501 | }
|
21502 | }
|
21503 | }
|
21504 | ],
|
21505 | loc: {
|
21506 | start: {
|
21507 | line: 1,
|
21508 | column: 0
|
21509 | },
|
21510 | end: {
|
21511 | line: 1,
|
21512 | column: 27
|
21513 | }
|
21514 | }
|
21515 | });
|
21516 |
|
21517 | test("start: while (true) break start", {
|
21518 | type: "Program",
|
21519 | body: [
|
21520 | {
|
21521 | type: "LabeledStatement",
|
21522 | body: {
|
21523 | type: "WhileStatement",
|
21524 | test: {
|
21525 | type: "Literal",
|
21526 | value: true,
|
21527 | loc: {
|
21528 | start: {
|
21529 | line: 1,
|
21530 | column: 14
|
21531 | },
|
21532 | end: {
|
21533 | line: 1,
|
21534 | column: 18
|
21535 | }
|
21536 | }
|
21537 | },
|
21538 | body: {
|
21539 | type: "BreakStatement",
|
21540 | label: {
|
21541 | type: "Identifier",
|
21542 | name: "start",
|
21543 | loc: {
|
21544 | start: {
|
21545 | line: 1,
|
21546 | column: 26
|
21547 | },
|
21548 | end: {
|
21549 | line: 1,
|
21550 | column: 31
|
21551 | }
|
21552 | }
|
21553 | },
|
21554 | loc: {
|
21555 | start: {
|
21556 | line: 1,
|
21557 | column: 20
|
21558 | },
|
21559 | end: {
|
21560 | line: 1,
|
21561 | column: 31
|
21562 | }
|
21563 | }
|
21564 | },
|
21565 | loc: {
|
21566 | start: {
|
21567 | line: 1,
|
21568 | column: 7
|
21569 | },
|
21570 | end: {
|
21571 | line: 1,
|
21572 | column: 31
|
21573 | }
|
21574 | }
|
21575 | },
|
21576 | label: {
|
21577 | type: "Identifier",
|
21578 | name: "start",
|
21579 | loc: {
|
21580 | start: {
|
21581 | line: 1,
|
21582 | column: 0
|
21583 | },
|
21584 | end: {
|
21585 | line: 1,
|
21586 | column: 5
|
21587 | }
|
21588 | }
|
21589 | },
|
21590 | loc: {
|
21591 | start: {
|
21592 | line: 1,
|
21593 | column: 0
|
21594 | },
|
21595 | end: {
|
21596 | line: 1,
|
21597 | column: 31
|
21598 | }
|
21599 | }
|
21600 | }
|
21601 | ],
|
21602 | loc: {
|
21603 | start: {
|
21604 | line: 1,
|
21605 | column: 0
|
21606 | },
|
21607 | end: {
|
21608 | line: 1,
|
21609 | column: 31
|
21610 | }
|
21611 | }
|
21612 | });
|
21613 |
|
21614 | test("throw x;", {
|
21615 | type: "Program",
|
21616 | body: [
|
21617 | {
|
21618 | type: "ThrowStatement",
|
21619 | argument: {
|
21620 | type: "Identifier",
|
21621 | name: "x",
|
21622 | loc: {
|
21623 | start: {
|
21624 | line: 1,
|
21625 | column: 6
|
21626 | },
|
21627 | end: {
|
21628 | line: 1,
|
21629 | column: 7
|
21630 | }
|
21631 | }
|
21632 | },
|
21633 | loc: {
|
21634 | start: {
|
21635 | line: 1,
|
21636 | column: 0
|
21637 | },
|
21638 | end: {
|
21639 | line: 1,
|
21640 | column: 8
|
21641 | }
|
21642 | }
|
21643 | }
|
21644 | ],
|
21645 | loc: {
|
21646 | start: {
|
21647 | line: 1,
|
21648 | column: 0
|
21649 | },
|
21650 | end: {
|
21651 | line: 1,
|
21652 | column: 8
|
21653 | }
|
21654 | }
|
21655 | });
|
21656 |
|
21657 | test("throw x * y", {
|
21658 | type: "Program",
|
21659 | body: [
|
21660 | {
|
21661 | type: "ThrowStatement",
|
21662 | argument: {
|
21663 | type: "BinaryExpression",
|
21664 | left: {
|
21665 | type: "Identifier",
|
21666 | name: "x",
|
21667 | loc: {
|
21668 | start: {
|
21669 | line: 1,
|
21670 | column: 6
|
21671 | },
|
21672 | end: {
|
21673 | line: 1,
|
21674 | column: 7
|
21675 | }
|
21676 | }
|
21677 | },
|
21678 | operator: "*",
|
21679 | right: {
|
21680 | type: "Identifier",
|
21681 | name: "y",
|
21682 | loc: {
|
21683 | start: {
|
21684 | line: 1,
|
21685 | column: 10
|
21686 | },
|
21687 | end: {
|
21688 | line: 1,
|
21689 | column: 11
|
21690 | }
|
21691 | }
|
21692 | },
|
21693 | loc: {
|
21694 | start: {
|
21695 | line: 1,
|
21696 | column: 6
|
21697 | },
|
21698 | end: {
|
21699 | line: 1,
|
21700 | column: 11
|
21701 | }
|
21702 | }
|
21703 | },
|
21704 | loc: {
|
21705 | start: {
|
21706 | line: 1,
|
21707 | column: 0
|
21708 | },
|
21709 | end: {
|
21710 | line: 1,
|
21711 | column: 11
|
21712 | }
|
21713 | }
|
21714 | }
|
21715 | ],
|
21716 | loc: {
|
21717 | start: {
|
21718 | line: 1,
|
21719 | column: 0
|
21720 | },
|
21721 | end: {
|
21722 | line: 1,
|
21723 | column: 11
|
21724 | }
|
21725 | }
|
21726 | });
|
21727 |
|
21728 | test("throw { message: \"Error\" }", {
|
21729 | type: "Program",
|
21730 | body: [
|
21731 | {
|
21732 | type: "ThrowStatement",
|
21733 | argument: {
|
21734 | type: "ObjectExpression",
|
21735 | properties: [
|
21736 | {
|
21737 | key: {
|
21738 | type: "Identifier",
|
21739 | name: "message",
|
21740 | loc: {
|
21741 | start: {
|
21742 | line: 1,
|
21743 | column: 8
|
21744 | },
|
21745 | end: {
|
21746 | line: 1,
|
21747 | column: 15
|
21748 | }
|
21749 | }
|
21750 | },
|
21751 | value: {
|
21752 | type: "Literal",
|
21753 | value: "Error",
|
21754 | loc: {
|
21755 | start: {
|
21756 | line: 1,
|
21757 | column: 17
|
21758 | },
|
21759 | end: {
|
21760 | line: 1,
|
21761 | column: 24
|
21762 | }
|
21763 | }
|
21764 | },
|
21765 | kind: "init"
|
21766 | }
|
21767 | ],
|
21768 | loc: {
|
21769 | start: {
|
21770 | line: 1,
|
21771 | column: 6
|
21772 | },
|
21773 | end: {
|
21774 | line: 1,
|
21775 | column: 26
|
21776 | }
|
21777 | }
|
21778 | },
|
21779 | loc: {
|
21780 | start: {
|
21781 | line: 1,
|
21782 | column: 0
|
21783 | },
|
21784 | end: {
|
21785 | line: 1,
|
21786 | column: 26
|
21787 | }
|
21788 | }
|
21789 | }
|
21790 | ],
|
21791 | loc: {
|
21792 | start: {
|
21793 | line: 1,
|
21794 | column: 0
|
21795 | },
|
21796 | end: {
|
21797 | line: 1,
|
21798 | column: 26
|
21799 | }
|
21800 | }
|
21801 | });
|
21802 |
|
21803 | test("try { } catch (e) { }", {
|
21804 | type: "Program",
|
21805 | body: [
|
21806 | {
|
21807 | type: "TryStatement",
|
21808 | block: {
|
21809 | type: "BlockStatement",
|
21810 | body: [],
|
21811 | loc: {
|
21812 | start: {
|
21813 | line: 1,
|
21814 | column: 4
|
21815 | },
|
21816 | end: {
|
21817 | line: 1,
|
21818 | column: 7
|
21819 | }
|
21820 | }
|
21821 | },
|
21822 | handler: {
|
21823 | type: "CatchClause",
|
21824 | param: {
|
21825 | type: "Identifier",
|
21826 | name: "e",
|
21827 | loc: {
|
21828 | start: {
|
21829 | line: 1,
|
21830 | column: 15
|
21831 | },
|
21832 | end: {
|
21833 | line: 1,
|
21834 | column: 16
|
21835 | }
|
21836 | }
|
21837 | },
|
21838 | guard: null,
|
21839 | body: {
|
21840 | type: "BlockStatement",
|
21841 | body: [],
|
21842 | loc: {
|
21843 | start: {
|
21844 | line: 1,
|
21845 | column: 18
|
21846 | },
|
21847 | end: {
|
21848 | line: 1,
|
21849 | column: 21
|
21850 | }
|
21851 | }
|
21852 | },
|
21853 | loc: {
|
21854 | start: {
|
21855 | line: 1,
|
21856 | column: 8
|
21857 | },
|
21858 | end: {
|
21859 | line: 1,
|
21860 | column: 21
|
21861 | }
|
21862 | }
|
21863 | }
|
21864 | ,
|
21865 | finalizer: null,
|
21866 | loc: {
|
21867 | start: {
|
21868 | line: 1,
|
21869 | column: 0
|
21870 | },
|
21871 | end: {
|
21872 | line: 1,
|
21873 | column: 21
|
21874 | }
|
21875 | }
|
21876 | }
|
21877 | ],
|
21878 | loc: {
|
21879 | start: {
|
21880 | line: 1,
|
21881 | column: 0
|
21882 | },
|
21883 | end: {
|
21884 | line: 1,
|
21885 | column: 21
|
21886 | }
|
21887 | }
|
21888 | });
|
21889 |
|
21890 | test("try { } catch (eval) { }", {
|
21891 | type: "Program",
|
21892 | body: [
|
21893 | {
|
21894 | type: "TryStatement",
|
21895 | block: {
|
21896 | type: "BlockStatement",
|
21897 | body: [],
|
21898 | loc: {
|
21899 | start: {
|
21900 | line: 1,
|
21901 | column: 4
|
21902 | },
|
21903 | end: {
|
21904 | line: 1,
|
21905 | column: 7
|
21906 | }
|
21907 | }
|
21908 | },
|
21909 | handler:
|
21910 | {
|
21911 | type: "CatchClause",
|
21912 | param: {
|
21913 | type: "Identifier",
|
21914 | name: "eval",
|
21915 | loc: {
|
21916 | start: {
|
21917 | line: 1,
|
21918 | column: 15
|
21919 | },
|
21920 | end: {
|
21921 | line: 1,
|
21922 | column: 19
|
21923 | }
|
21924 | }
|
21925 | },
|
21926 | guard: null,
|
21927 | body: {
|
21928 | type: "BlockStatement",
|
21929 | body: [],
|
21930 | loc: {
|
21931 | start: {
|
21932 | line: 1,
|
21933 | column: 21
|
21934 | },
|
21935 | end: {
|
21936 | line: 1,
|
21937 | column: 24
|
21938 | }
|
21939 | }
|
21940 | },
|
21941 | loc: {
|
21942 | start: {
|
21943 | line: 1,
|
21944 | column: 8
|
21945 | },
|
21946 | end: {
|
21947 | line: 1,
|
21948 | column: 24
|
21949 | }
|
21950 | }
|
21951 | }
|
21952 | ,
|
21953 | finalizer: null,
|
21954 | loc: {
|
21955 | start: {
|
21956 | line: 1,
|
21957 | column: 0
|
21958 | },
|
21959 | end: {
|
21960 | line: 1,
|
21961 | column: 24
|
21962 | }
|
21963 | }
|
21964 | }
|
21965 | ],
|
21966 | loc: {
|
21967 | start: {
|
21968 | line: 1,
|
21969 | column: 0
|
21970 | },
|
21971 | end: {
|
21972 | line: 1,
|
21973 | column: 24
|
21974 | }
|
21975 | }
|
21976 | });
|
21977 |
|
21978 | test("try { } catch (arguments) { }", {
|
21979 | type: "Program",
|
21980 | body: [
|
21981 | {
|
21982 | type: "TryStatement",
|
21983 | block: {
|
21984 | type: "BlockStatement",
|
21985 | body: [],
|
21986 | loc: {
|
21987 | start: {
|
21988 | line: 1,
|
21989 | column: 4
|
21990 | },
|
21991 | end: {
|
21992 | line: 1,
|
21993 | column: 7
|
21994 | }
|
21995 | }
|
21996 | },
|
21997 | handler:
|
21998 | {
|
21999 | type: "CatchClause",
|
22000 | param: {
|
22001 | type: "Identifier",
|
22002 | name: "arguments",
|
22003 | loc: {
|
22004 | start: {
|
22005 | line: 1,
|
22006 | column: 15
|
22007 | },
|
22008 | end: {
|
22009 | line: 1,
|
22010 | column: 24
|
22011 | }
|
22012 | }
|
22013 | },
|
22014 | guard: null,
|
22015 | body: {
|
22016 | type: "BlockStatement",
|
22017 | body: [],
|
22018 | loc: {
|
22019 | start: {
|
22020 | line: 1,
|
22021 | column: 26
|
22022 | },
|
22023 | end: {
|
22024 | line: 1,
|
22025 | column: 29
|
22026 | }
|
22027 | }
|
22028 | },
|
22029 | loc: {
|
22030 | start: {
|
22031 | line: 1,
|
22032 | column: 8
|
22033 | },
|
22034 | end: {
|
22035 | line: 1,
|
22036 | column: 29
|
22037 | }
|
22038 | }
|
22039 | }
|
22040 | ,
|
22041 | finalizer: null,
|
22042 | loc: {
|
22043 | start: {
|
22044 | line: 1,
|
22045 | column: 0
|
22046 | },
|
22047 | end: {
|
22048 | line: 1,
|
22049 | column: 29
|
22050 | }
|
22051 | }
|
22052 | }
|
22053 | ],
|
22054 | loc: {
|
22055 | start: {
|
22056 | line: 1,
|
22057 | column: 0
|
22058 | },
|
22059 | end: {
|
22060 | line: 1,
|
22061 | column: 29
|
22062 | }
|
22063 | }
|
22064 | });
|
22065 |
|
22066 | test("try { } catch (e) { say(e) }", {
|
22067 | type: "Program",
|
22068 | body: [
|
22069 | {
|
22070 | type: "TryStatement",
|
22071 | block: {
|
22072 | type: "BlockStatement",
|
22073 | body: [],
|
22074 | loc: {
|
22075 | start: {
|
22076 | line: 1,
|
22077 | column: 4
|
22078 | },
|
22079 | end: {
|
22080 | line: 1,
|
22081 | column: 7
|
22082 | }
|
22083 | }
|
22084 | },
|
22085 | handler:
|
22086 | {
|
22087 | type: "CatchClause",
|
22088 | param: {
|
22089 | type: "Identifier",
|
22090 | name: "e",
|
22091 | loc: {
|
22092 | start: {
|
22093 | line: 1,
|
22094 | column: 15
|
22095 | },
|
22096 | end: {
|
22097 | line: 1,
|
22098 | column: 16
|
22099 | }
|
22100 | }
|
22101 | },
|
22102 | guard: null,
|
22103 | body: {
|
22104 | type: "BlockStatement",
|
22105 | body: [
|
22106 | {
|
22107 | type: "ExpressionStatement",
|
22108 | expression: {
|
22109 | type: "CallExpression",
|
22110 | callee: {
|
22111 | type: "Identifier",
|
22112 | name: "say",
|
22113 | loc: {
|
22114 | start: {
|
22115 | line: 1,
|
22116 | column: 20
|
22117 | },
|
22118 | end: {
|
22119 | line: 1,
|
22120 | column: 23
|
22121 | }
|
22122 | }
|
22123 | },
|
22124 | arguments: [
|
22125 | {
|
22126 | type: "Identifier",
|
22127 | name: "e",
|
22128 | loc: {
|
22129 | start: {
|
22130 | line: 1,
|
22131 | column: 24
|
22132 | },
|
22133 | end: {
|
22134 | line: 1,
|
22135 | column: 25
|
22136 | }
|
22137 | }
|
22138 | }
|
22139 | ],
|
22140 | loc: {
|
22141 | start: {
|
22142 | line: 1,
|
22143 | column: 20
|
22144 | },
|
22145 | end: {
|
22146 | line: 1,
|
22147 | column: 26
|
22148 | }
|
22149 | }
|
22150 | },
|
22151 | loc: {
|
22152 | start: {
|
22153 | line: 1,
|
22154 | column: 20
|
22155 | },
|
22156 | end: {
|
22157 | line: 1,
|
22158 | column: 26
|
22159 | }
|
22160 | }
|
22161 | }
|
22162 | ],
|
22163 | loc: {
|
22164 | start: {
|
22165 | line: 1,
|
22166 | column: 18
|
22167 | },
|
22168 | end: {
|
22169 | line: 1,
|
22170 | column: 28
|
22171 | }
|
22172 | }
|
22173 | },
|
22174 | loc: {
|
22175 | start: {
|
22176 | line: 1,
|
22177 | column: 8
|
22178 | },
|
22179 | end: {
|
22180 | line: 1,
|
22181 | column: 28
|
22182 | }
|
22183 | }
|
22184 | }
|
22185 | ,
|
22186 | finalizer: null,
|
22187 | loc: {
|
22188 | start: {
|
22189 | line: 1,
|
22190 | column: 0
|
22191 | },
|
22192 | end: {
|
22193 | line: 1,
|
22194 | column: 28
|
22195 | }
|
22196 | }
|
22197 | }
|
22198 | ],
|
22199 | loc: {
|
22200 | start: {
|
22201 | line: 1,
|
22202 | column: 0
|
22203 | },
|
22204 | end: {
|
22205 | line: 1,
|
22206 | column: 28
|
22207 | }
|
22208 | }
|
22209 | });
|
22210 |
|
22211 | test("try { } finally { cleanup(stuff) }", {
|
22212 | type: "Program",
|
22213 | body: [
|
22214 | {
|
22215 | type: "TryStatement",
|
22216 | block: {
|
22217 | type: "BlockStatement",
|
22218 | body: [],
|
22219 | loc: {
|
22220 | start: {
|
22221 | line: 1,
|
22222 | column: 4
|
22223 | },
|
22224 | end: {
|
22225 | line: 1,
|
22226 | column: 7
|
22227 | }
|
22228 | }
|
22229 | },
|
22230 | handler: null,
|
22231 | finalizer: {
|
22232 | type: "BlockStatement",
|
22233 | body: [
|
22234 | {
|
22235 | type: "ExpressionStatement",
|
22236 | expression: {
|
22237 | type: "CallExpression",
|
22238 | callee: {
|
22239 | type: "Identifier",
|
22240 | name: "cleanup",
|
22241 | loc: {
|
22242 | start: {
|
22243 | line: 1,
|
22244 | column: 18
|
22245 | },
|
22246 | end: {
|
22247 | line: 1,
|
22248 | column: 25
|
22249 | }
|
22250 | }
|
22251 | },
|
22252 | arguments: [
|
22253 | {
|
22254 | type: "Identifier",
|
22255 | name: "stuff",
|
22256 | loc: {
|
22257 | start: {
|
22258 | line: 1,
|
22259 | column: 26
|
22260 | },
|
22261 | end: {
|
22262 | line: 1,
|
22263 | column: 31
|
22264 | }
|
22265 | }
|
22266 | }
|
22267 | ],
|
22268 | loc: {
|
22269 | start: {
|
22270 | line: 1,
|
22271 | column: 18
|
22272 | },
|
22273 | end: {
|
22274 | line: 1,
|
22275 | column: 32
|
22276 | }
|
22277 | }
|
22278 | },
|
22279 | loc: {
|
22280 | start: {
|
22281 | line: 1,
|
22282 | column: 18
|
22283 | },
|
22284 | end: {
|
22285 | line: 1,
|
22286 | column: 32
|
22287 | }
|
22288 | }
|
22289 | }
|
22290 | ],
|
22291 | loc: {
|
22292 | start: {
|
22293 | line: 1,
|
22294 | column: 16
|
22295 | },
|
22296 | end: {
|
22297 | line: 1,
|
22298 | column: 34
|
22299 | }
|
22300 | }
|
22301 | },
|
22302 | loc: {
|
22303 | start: {
|
22304 | line: 1,
|
22305 | column: 0
|
22306 | },
|
22307 | end: {
|
22308 | line: 1,
|
22309 | column: 34
|
22310 | }
|
22311 | }
|
22312 | }
|
22313 | ],
|
22314 | loc: {
|
22315 | start: {
|
22316 | line: 1,
|
22317 | column: 0
|
22318 | },
|
22319 | end: {
|
22320 | line: 1,
|
22321 | column: 34
|
22322 | }
|
22323 | }
|
22324 | });
|
22325 |
|
22326 | test("try { doThat(); } catch (e) { say(e) }", {
|
22327 | type: "Program",
|
22328 | body: [
|
22329 | {
|
22330 | type: "TryStatement",
|
22331 | block: {
|
22332 | type: "BlockStatement",
|
22333 | body: [
|
22334 | {
|
22335 | type: "ExpressionStatement",
|
22336 | expression: {
|
22337 | type: "CallExpression",
|
22338 | callee: {
|
22339 | type: "Identifier",
|
22340 | name: "doThat",
|
22341 | loc: {
|
22342 | start: {
|
22343 | line: 1,
|
22344 | column: 6
|
22345 | },
|
22346 | end: {
|
22347 | line: 1,
|
22348 | column: 12
|
22349 | }
|
22350 | }
|
22351 | },
|
22352 | arguments: [],
|
22353 | loc: {
|
22354 | start: {
|
22355 | line: 1,
|
22356 | column: 6
|
22357 | },
|
22358 | end: {
|
22359 | line: 1,
|
22360 | column: 14
|
22361 | }
|
22362 | }
|
22363 | },
|
22364 | loc: {
|
22365 | start: {
|
22366 | line: 1,
|
22367 | column: 6
|
22368 | },
|
22369 | end: {
|
22370 | line: 1,
|
22371 | column: 15
|
22372 | }
|
22373 | }
|
22374 | }
|
22375 | ],
|
22376 | loc: {
|
22377 | start: {
|
22378 | line: 1,
|
22379 | column: 4
|
22380 | },
|
22381 | end: {
|
22382 | line: 1,
|
22383 | column: 17
|
22384 | }
|
22385 | }
|
22386 | },
|
22387 | handler:
|
22388 | {
|
22389 | type: "CatchClause",
|
22390 | param: {
|
22391 | type: "Identifier",
|
22392 | name: "e",
|
22393 | loc: {
|
22394 | start: {
|
22395 | line: 1,
|
22396 | column: 25
|
22397 | },
|
22398 | end: {
|
22399 | line: 1,
|
22400 | column: 26
|
22401 | }
|
22402 | }
|
22403 | },
|
22404 | guard: null,
|
22405 | body: {
|
22406 | type: "BlockStatement",
|
22407 | body: [
|
22408 | {
|
22409 | type: "ExpressionStatement",
|
22410 | expression: {
|
22411 | type: "CallExpression",
|
22412 | callee: {
|
22413 | type: "Identifier",
|
22414 | name: "say",
|
22415 | loc: {
|
22416 | start: {
|
22417 | line: 1,
|
22418 | column: 30
|
22419 | },
|
22420 | end: {
|
22421 | line: 1,
|
22422 | column: 33
|
22423 | }
|
22424 | }
|
22425 | },
|
22426 | arguments: [
|
22427 | {
|
22428 | type: "Identifier",
|
22429 | name: "e",
|
22430 | loc: {
|
22431 | start: {
|
22432 | line: 1,
|
22433 | column: 34
|
22434 | },
|
22435 | end: {
|
22436 | line: 1,
|
22437 | column: 35
|
22438 | }
|
22439 | }
|
22440 | }
|
22441 | ],
|
22442 | loc: {
|
22443 | start: {
|
22444 | line: 1,
|
22445 | column: 30
|
22446 | },
|
22447 | end: {
|
22448 | line: 1,
|
22449 | column: 36
|
22450 | }
|
22451 | }
|
22452 | },
|
22453 | loc: {
|
22454 | start: {
|
22455 | line: 1,
|
22456 | column: 30
|
22457 | },
|
22458 | end: {
|
22459 | line: 1,
|
22460 | column: 36
|
22461 | }
|
22462 | }
|
22463 | }
|
22464 | ],
|
22465 | loc: {
|
22466 | start: {
|
22467 | line: 1,
|
22468 | column: 28
|
22469 | },
|
22470 | end: {
|
22471 | line: 1,
|
22472 | column: 38
|
22473 | }
|
22474 | }
|
22475 | },
|
22476 | loc: {
|
22477 | start: {
|
22478 | line: 1,
|
22479 | column: 18
|
22480 | },
|
22481 | end: {
|
22482 | line: 1,
|
22483 | column: 38
|
22484 | }
|
22485 | }
|
22486 | }
|
22487 | ,
|
22488 | finalizer: null,
|
22489 | loc: {
|
22490 | start: {
|
22491 | line: 1,
|
22492 | column: 0
|
22493 | },
|
22494 | end: {
|
22495 | line: 1,
|
22496 | column: 38
|
22497 | }
|
22498 | }
|
22499 | }
|
22500 | ],
|
22501 | loc: {
|
22502 | start: {
|
22503 | line: 1,
|
22504 | column: 0
|
22505 | },
|
22506 | end: {
|
22507 | line: 1,
|
22508 | column: 38
|
22509 | }
|
22510 | }
|
22511 | });
|
22512 |
|
22513 | test("try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }", {
|
22514 | type: "Program",
|
22515 | body: [
|
22516 | {
|
22517 | type: "TryStatement",
|
22518 | block: {
|
22519 | type: "BlockStatement",
|
22520 | body: [
|
22521 | {
|
22522 | type: "ExpressionStatement",
|
22523 | expression: {
|
22524 | type: "CallExpression",
|
22525 | callee: {
|
22526 | type: "Identifier",
|
22527 | name: "doThat",
|
22528 | loc: {
|
22529 | start: {
|
22530 | line: 1,
|
22531 | column: 6
|
22532 | },
|
22533 | end: {
|
22534 | line: 1,
|
22535 | column: 12
|
22536 | }
|
22537 | }
|
22538 | },
|
22539 | arguments: [],
|
22540 | loc: {
|
22541 | start: {
|
22542 | line: 1,
|
22543 | column: 6
|
22544 | },
|
22545 | end: {
|
22546 | line: 1,
|
22547 | column: 14
|
22548 | }
|
22549 | }
|
22550 | },
|
22551 | loc: {
|
22552 | start: {
|
22553 | line: 1,
|
22554 | column: 6
|
22555 | },
|
22556 | end: {
|
22557 | line: 1,
|
22558 | column: 15
|
22559 | }
|
22560 | }
|
22561 | }
|
22562 | ],
|
22563 | loc: {
|
22564 | start: {
|
22565 | line: 1,
|
22566 | column: 4
|
22567 | },
|
22568 | end: {
|
22569 | line: 1,
|
22570 | column: 17
|
22571 | }
|
22572 | }
|
22573 | },
|
22574 | handler:
|
22575 | {
|
22576 | type: "CatchClause",
|
22577 | param: {
|
22578 | type: "Identifier",
|
22579 | name: "e",
|
22580 | loc: {
|
22581 | start: {
|
22582 | line: 1,
|
22583 | column: 25
|
22584 | },
|
22585 | end: {
|
22586 | line: 1,
|
22587 | column: 26
|
22588 | }
|
22589 | }
|
22590 | },
|
22591 | guard: null,
|
22592 | body: {
|
22593 | type: "BlockStatement",
|
22594 | body: [
|
22595 | {
|
22596 | type: "ExpressionStatement",
|
22597 | expression: {
|
22598 | type: "CallExpression",
|
22599 | callee: {
|
22600 | type: "Identifier",
|
22601 | name: "say",
|
22602 | loc: {
|
22603 | start: {
|
22604 | line: 1,
|
22605 | column: 30
|
22606 | },
|
22607 | end: {
|
22608 | line: 1,
|
22609 | column: 33
|
22610 | }
|
22611 | }
|
22612 | },
|
22613 | arguments: [
|
22614 | {
|
22615 | type: "Identifier",
|
22616 | name: "e",
|
22617 | loc: {
|
22618 | start: {
|
22619 | line: 1,
|
22620 | column: 34
|
22621 | },
|
22622 | end: {
|
22623 | line: 1,
|
22624 | column: 35
|
22625 | }
|
22626 | }
|
22627 | }
|
22628 | ],
|
22629 | loc: {
|
22630 | start: {
|
22631 | line: 1,
|
22632 | column: 30
|
22633 | },
|
22634 | end: {
|
22635 | line: 1,
|
22636 | column: 36
|
22637 | }
|
22638 | }
|
22639 | },
|
22640 | loc: {
|
22641 | start: {
|
22642 | line: 1,
|
22643 | column: 30
|
22644 | },
|
22645 | end: {
|
22646 | line: 1,
|
22647 | column: 36
|
22648 | }
|
22649 | }
|
22650 | }
|
22651 | ],
|
22652 | loc: {
|
22653 | start: {
|
22654 | line: 1,
|
22655 | column: 28
|
22656 | },
|
22657 | end: {
|
22658 | line: 1,
|
22659 | column: 38
|
22660 | }
|
22661 | }
|
22662 | },
|
22663 | loc: {
|
22664 | start: {
|
22665 | line: 1,
|
22666 | column: 18
|
22667 | },
|
22668 | end: {
|
22669 | line: 1,
|
22670 | column: 38
|
22671 | }
|
22672 | }
|
22673 | }
|
22674 | ,
|
22675 | finalizer: {
|
22676 | type: "BlockStatement",
|
22677 | body: [
|
22678 | {
|
22679 | type: "ExpressionStatement",
|
22680 | expression: {
|
22681 | type: "CallExpression",
|
22682 | callee: {
|
22683 | type: "Identifier",
|
22684 | name: "cleanup",
|
22685 | loc: {
|
22686 | start: {
|
22687 | line: 1,
|
22688 | column: 49
|
22689 | },
|
22690 | end: {
|
22691 | line: 1,
|
22692 | column: 56
|
22693 | }
|
22694 | }
|
22695 | },
|
22696 | arguments: [
|
22697 | {
|
22698 | type: "Identifier",
|
22699 | name: "stuff",
|
22700 | loc: {
|
22701 | start: {
|
22702 | line: 1,
|
22703 | column: 57
|
22704 | },
|
22705 | end: {
|
22706 | line: 1,
|
22707 | column: 62
|
22708 | }
|
22709 | }
|
22710 | }
|
22711 | ],
|
22712 | loc: {
|
22713 | start: {
|
22714 | line: 1,
|
22715 | column: 49
|
22716 | },
|
22717 | end: {
|
22718 | line: 1,
|
22719 | column: 63
|
22720 | }
|
22721 | }
|
22722 | },
|
22723 | loc: {
|
22724 | start: {
|
22725 | line: 1,
|
22726 | column: 49
|
22727 | },
|
22728 | end: {
|
22729 | line: 1,
|
22730 | column: 63
|
22731 | }
|
22732 | }
|
22733 | }
|
22734 | ],
|
22735 | loc: {
|
22736 | start: {
|
22737 | line: 1,
|
22738 | column: 47
|
22739 | },
|
22740 | end: {
|
22741 | line: 1,
|
22742 | column: 65
|
22743 | }
|
22744 | }
|
22745 | },
|
22746 | loc: {
|
22747 | start: {
|
22748 | line: 1,
|
22749 | column: 0
|
22750 | },
|
22751 | end: {
|
22752 | line: 1,
|
22753 | column: 65
|
22754 | }
|
22755 | }
|
22756 | }
|
22757 | ],
|
22758 | loc: {
|
22759 | start: {
|
22760 | line: 1,
|
22761 | column: 0
|
22762 | },
|
22763 | end: {
|
22764 | line: 1,
|
22765 | column: 65
|
22766 | }
|
22767 | }
|
22768 | });
|
22769 |
|
22770 | test("debugger;", {
|
22771 | type: "Program",
|
22772 | body: [
|
22773 | {
|
22774 | type: "DebuggerStatement",
|
22775 | loc: {
|
22776 | start: {
|
22777 | line: 1,
|
22778 | column: 0
|
22779 | },
|
22780 | end: {
|
22781 | line: 1,
|
22782 | column: 9
|
22783 | }
|
22784 | }
|
22785 | }
|
22786 | ],
|
22787 | loc: {
|
22788 | start: {
|
22789 | line: 1,
|
22790 | column: 0
|
22791 | },
|
22792 | end: {
|
22793 | line: 1,
|
22794 | column: 9
|
22795 | }
|
22796 | }
|
22797 | });
|
22798 |
|
22799 | test("function hello() { sayHi(); }", {
|
22800 | type: "Program",
|
22801 | body: [
|
22802 | {
|
22803 | type: "FunctionDeclaration",
|
22804 | id: {
|
22805 | type: "Identifier",
|
22806 | name: "hello",
|
22807 | loc: {
|
22808 | start: {
|
22809 | line: 1,
|
22810 | column: 9
|
22811 | },
|
22812 | end: {
|
22813 | line: 1,
|
22814 | column: 14
|
22815 | }
|
22816 | }
|
22817 | },
|
22818 | params: [],
|
22819 | body: {
|
22820 | type: "BlockStatement",
|
22821 | body: [
|
22822 | {
|
22823 | type: "ExpressionStatement",
|
22824 | expression: {
|
22825 | type: "CallExpression",
|
22826 | callee: {
|
22827 | type: "Identifier",
|
22828 | name: "sayHi",
|
22829 | loc: {
|
22830 | start: {
|
22831 | line: 1,
|
22832 | column: 19
|
22833 | },
|
22834 | end: {
|
22835 | line: 1,
|
22836 | column: 24
|
22837 | }
|
22838 | }
|
22839 | },
|
22840 | arguments: [],
|
22841 | loc: {
|
22842 | start: {
|
22843 | line: 1,
|
22844 | column: 19
|
22845 | },
|
22846 | end: {
|
22847 | line: 1,
|
22848 | column: 26
|
22849 | }
|
22850 | }
|
22851 | },
|
22852 | loc: {
|
22853 | start: {
|
22854 | line: 1,
|
22855 | column: 19
|
22856 | },
|
22857 | end: {
|
22858 | line: 1,
|
22859 | column: 27
|
22860 | }
|
22861 | }
|
22862 | }
|
22863 | ],
|
22864 | loc: {
|
22865 | start: {
|
22866 | line: 1,
|
22867 | column: 17
|
22868 | },
|
22869 | end: {
|
22870 | line: 1,
|
22871 | column: 29
|
22872 | }
|
22873 | }
|
22874 | },
|
22875 | loc: {
|
22876 | start: {
|
22877 | line: 1,
|
22878 | column: 0
|
22879 | },
|
22880 | end: {
|
22881 | line: 1,
|
22882 | column: 29
|
22883 | }
|
22884 | }
|
22885 | }
|
22886 | ],
|
22887 | loc: {
|
22888 | start: {
|
22889 | line: 1,
|
22890 | column: 0
|
22891 | },
|
22892 | end: {
|
22893 | line: 1,
|
22894 | column: 29
|
22895 | }
|
22896 | }
|
22897 | });
|
22898 |
|
22899 | test("function eval() { }", {
|
22900 | type: "Program",
|
22901 | body: [
|
22902 | {
|
22903 | type: "FunctionDeclaration",
|
22904 | id: {
|
22905 | type: "Identifier",
|
22906 | name: "eval",
|
22907 | loc: {
|
22908 | start: {
|
22909 | line: 1,
|
22910 | column: 9
|
22911 | },
|
22912 | end: {
|
22913 | line: 1,
|
22914 | column: 13
|
22915 | }
|
22916 | }
|
22917 | },
|
22918 | params: [],
|
22919 | body: {
|
22920 | type: "BlockStatement",
|
22921 | body: [],
|
22922 | loc: {
|
22923 | start: {
|
22924 | line: 1,
|
22925 | column: 16
|
22926 | },
|
22927 | end: {
|
22928 | line: 1,
|
22929 | column: 19
|
22930 | }
|
22931 | }
|
22932 | },
|
22933 | loc: {
|
22934 | start: {
|
22935 | line: 1,
|
22936 | column: 0
|
22937 | },
|
22938 | end: {
|
22939 | line: 1,
|
22940 | column: 19
|
22941 | }
|
22942 | }
|
22943 | }
|
22944 | ],
|
22945 | loc: {
|
22946 | start: {
|
22947 | line: 1,
|
22948 | column: 0
|
22949 | },
|
22950 | end: {
|
22951 | line: 1,
|
22952 | column: 19
|
22953 | }
|
22954 | }
|
22955 | });
|
22956 |
|
22957 | test("function arguments() { }", {
|
22958 | type: "Program",
|
22959 | body: [
|
22960 | {
|
22961 | type: "FunctionDeclaration",
|
22962 | id: {
|
22963 | type: "Identifier",
|
22964 | name: "arguments",
|
22965 | loc: {
|
22966 | start: {
|
22967 | line: 1,
|
22968 | column: 9
|
22969 | },
|
22970 | end: {
|
22971 | line: 1,
|
22972 | column: 18
|
22973 | }
|
22974 | }
|
22975 | },
|
22976 | params: [],
|
22977 | body: {
|
22978 | type: "BlockStatement",
|
22979 | body: [],
|
22980 | loc: {
|
22981 | start: {
|
22982 | line: 1,
|
22983 | column: 21
|
22984 | },
|
22985 | end: {
|
22986 | line: 1,
|
22987 | column: 24
|
22988 | }
|
22989 | }
|
22990 | },
|
22991 | loc: {
|
22992 | start: {
|
22993 | line: 1,
|
22994 | column: 0
|
22995 | },
|
22996 | end: {
|
22997 | line: 1,
|
22998 | column: 24
|
22999 | }
|
23000 | }
|
23001 | }
|
23002 | ],
|
23003 | loc: {
|
23004 | start: {
|
23005 | line: 1,
|
23006 | column: 0
|
23007 | },
|
23008 | end: {
|
23009 | line: 1,
|
23010 | column: 24
|
23011 | }
|
23012 | }
|
23013 | });
|
23014 |
|
23015 | test("function test(t, t) { }", {
|
23016 | type: "Program",
|
23017 | body: [
|
23018 | {
|
23019 | type: "FunctionDeclaration",
|
23020 | id: {
|
23021 | type: "Identifier",
|
23022 | name: "test",
|
23023 | loc: {
|
23024 | start: {
|
23025 | line: 1,
|
23026 | column: 9
|
23027 | },
|
23028 | end: {
|
23029 | line: 1,
|
23030 | column: 13
|
23031 | }
|
23032 | }
|
23033 | },
|
23034 | params: [
|
23035 | {
|
23036 | type: "Identifier",
|
23037 | name: "t",
|
23038 | loc: {
|
23039 | start: {
|
23040 | line: 1,
|
23041 | column: 14
|
23042 | },
|
23043 | end: {
|
23044 | line: 1,
|
23045 | column: 15
|
23046 | }
|
23047 | }
|
23048 | },
|
23049 | {
|
23050 | type: "Identifier",
|
23051 | name: "t",
|
23052 | loc: {
|
23053 | start: {
|
23054 | line: 1,
|
23055 | column: 17
|
23056 | },
|
23057 | end: {
|
23058 | line: 1,
|
23059 | column: 18
|
23060 | }
|
23061 | }
|
23062 | }
|
23063 | ],
|
23064 | body: {
|
23065 | type: "BlockStatement",
|
23066 | body: [],
|
23067 | loc: {
|
23068 | start: {
|
23069 | line: 1,
|
23070 | column: 20
|
23071 | },
|
23072 | end: {
|
23073 | line: 1,
|
23074 | column: 23
|
23075 | }
|
23076 | }
|
23077 | },
|
23078 | loc: {
|
23079 | start: {
|
23080 | line: 1,
|
23081 | column: 0
|
23082 | },
|
23083 | end: {
|
23084 | line: 1,
|
23085 | column: 23
|
23086 | }
|
23087 | }
|
23088 | }
|
23089 | ],
|
23090 | loc: {
|
23091 | start: {
|
23092 | line: 1,
|
23093 | column: 0
|
23094 | },
|
23095 | end: {
|
23096 | line: 1,
|
23097 | column: 23
|
23098 | }
|
23099 | }
|
23100 | });
|
23101 |
|
23102 | test("(function test(t, t) { })", {
|
23103 | type: "Program",
|
23104 | body: [
|
23105 | {
|
23106 | type: "ExpressionStatement",
|
23107 | expression: {
|
23108 | type: "FunctionExpression",
|
23109 | id: {
|
23110 | type: "Identifier",
|
23111 | name: "test",
|
23112 | loc: {
|
23113 | start: {
|
23114 | line: 1,
|
23115 | column: 10
|
23116 | },
|
23117 | end: {
|
23118 | line: 1,
|
23119 | column: 14
|
23120 | }
|
23121 | }
|
23122 | },
|
23123 | params: [
|
23124 | {
|
23125 | type: "Identifier",
|
23126 | name: "t",
|
23127 | loc: {
|
23128 | start: {
|
23129 | line: 1,
|
23130 | column: 15
|
23131 | },
|
23132 | end: {
|
23133 | line: 1,
|
23134 | column: 16
|
23135 | }
|
23136 | }
|
23137 | },
|
23138 | {
|
23139 | type: "Identifier",
|
23140 | name: "t",
|
23141 | loc: {
|
23142 | start: {
|
23143 | line: 1,
|
23144 | column: 18
|
23145 | },
|
23146 | end: {
|
23147 | line: 1,
|
23148 | column: 19
|
23149 | }
|
23150 | }
|
23151 | }
|
23152 | ],
|
23153 | body: {
|
23154 | type: "BlockStatement",
|
23155 | body: [],
|
23156 | loc: {
|
23157 | start: {
|
23158 | line: 1,
|
23159 | column: 21
|
23160 | },
|
23161 | end: {
|
23162 | line: 1,
|
23163 | column: 24
|
23164 | }
|
23165 | }
|
23166 | },
|
23167 | loc: {
|
23168 | start: {
|
23169 | line: 1,
|
23170 | column: 0
|
23171 | },
|
23172 | end: {
|
23173 | line: 1,
|
23174 | column: 25
|
23175 | }
|
23176 | }
|
23177 | },
|
23178 | loc: {
|
23179 | start: {
|
23180 | line: 1,
|
23181 | column: 0
|
23182 | },
|
23183 | end: {
|
23184 | line: 1,
|
23185 | column: 25
|
23186 | }
|
23187 | }
|
23188 | }
|
23189 | ],
|
23190 | loc: {
|
23191 | start: {
|
23192 | line: 1,
|
23193 | column: 0
|
23194 | },
|
23195 | end: {
|
23196 | line: 1,
|
23197 | column: 25
|
23198 | }
|
23199 | }
|
23200 | });
|
23201 |
|
23202 | test("function eval() { function inner() { \"use strict\" } }", {
|
23203 | type: "Program",
|
23204 | body: [
|
23205 | {
|
23206 | type: "FunctionDeclaration",
|
23207 | id: {
|
23208 | type: "Identifier",
|
23209 | name: "eval",
|
23210 | loc: {
|
23211 | start: {
|
23212 | line: 1,
|
23213 | column: 9
|
23214 | },
|
23215 | end: {
|
23216 | line: 1,
|
23217 | column: 13
|
23218 | }
|
23219 | }
|
23220 | },
|
23221 | params: [],
|
23222 | body: {
|
23223 | type: "BlockStatement",
|
23224 | body: [
|
23225 | {
|
23226 | type: "FunctionDeclaration",
|
23227 | id: {
|
23228 | type: "Identifier",
|
23229 | name: "inner",
|
23230 | loc: {
|
23231 | start: {
|
23232 | line: 1,
|
23233 | column: 27
|
23234 | },
|
23235 | end: {
|
23236 | line: 1,
|
23237 | column: 32
|
23238 | }
|
23239 | }
|
23240 | },
|
23241 | params: [],
|
23242 | body: {
|
23243 | type: "BlockStatement",
|
23244 | body: [
|
23245 | {
|
23246 | type: "ExpressionStatement",
|
23247 | expression: {
|
23248 | type: "Literal",
|
23249 | value: "use strict",
|
23250 | loc: {
|
23251 | start: {
|
23252 | line: 1,
|
23253 | column: 37
|
23254 | },
|
23255 | end: {
|
23256 | line: 1,
|
23257 | column: 49
|
23258 | }
|
23259 | }
|
23260 | },
|
23261 | loc: {
|
23262 | start: {
|
23263 | line: 1,
|
23264 | column: 37
|
23265 | },
|
23266 | end: {
|
23267 | line: 1,
|
23268 | column: 49
|
23269 | }
|
23270 | }
|
23271 | }
|
23272 | ],
|
23273 | loc: {
|
23274 | start: {
|
23275 | line: 1,
|
23276 | column: 35
|
23277 | },
|
23278 | end: {
|
23279 | line: 1,
|
23280 | column: 51
|
23281 | }
|
23282 | }
|
23283 | },
|
23284 | loc: {
|
23285 | start: {
|
23286 | line: 1,
|
23287 | column: 18
|
23288 | },
|
23289 | end: {
|
23290 | line: 1,
|
23291 | column: 51
|
23292 | }
|
23293 | }
|
23294 | }
|
23295 | ],
|
23296 | loc: {
|
23297 | start: {
|
23298 | line: 1,
|
23299 | column: 16
|
23300 | },
|
23301 | end: {
|
23302 | line: 1,
|
23303 | column: 53
|
23304 | }
|
23305 | }
|
23306 | },
|
23307 | loc: {
|
23308 | start: {
|
23309 | line: 1,
|
23310 | column: 0
|
23311 | },
|
23312 | end: {
|
23313 | line: 1,
|
23314 | column: 53
|
23315 | }
|
23316 | }
|
23317 | }
|
23318 | ],
|
23319 | loc: {
|
23320 | start: {
|
23321 | line: 1,
|
23322 | column: 0
|
23323 | },
|
23324 | end: {
|
23325 | line: 1,
|
23326 | column: 53
|
23327 | }
|
23328 | }
|
23329 | });
|
23330 |
|
23331 | test("function hello(a) { sayHi(); }", {
|
23332 | type: "Program",
|
23333 | body: [
|
23334 | {
|
23335 | type: "FunctionDeclaration",
|
23336 | id: {
|
23337 | type: "Identifier",
|
23338 | name: "hello",
|
23339 | loc: {
|
23340 | start: {
|
23341 | line: 1,
|
23342 | column: 9
|
23343 | },
|
23344 | end: {
|
23345 | line: 1,
|
23346 | column: 14
|
23347 | }
|
23348 | }
|
23349 | },
|
23350 | params: [
|
23351 | {
|
23352 | type: "Identifier",
|
23353 | name: "a",
|
23354 | loc: {
|
23355 | start: {
|
23356 | line: 1,
|
23357 | column: 15
|
23358 | },
|
23359 | end: {
|
23360 | line: 1,
|
23361 | column: 16
|
23362 | }
|
23363 | }
|
23364 | }
|
23365 | ],
|
23366 | body: {
|
23367 | type: "BlockStatement",
|
23368 | body: [
|
23369 | {
|
23370 | type: "ExpressionStatement",
|
23371 | expression: {
|
23372 | type: "CallExpression",
|
23373 | callee: {
|
23374 | type: "Identifier",
|
23375 | name: "sayHi",
|
23376 | loc: {
|
23377 | start: {
|
23378 | line: 1,
|
23379 | column: 20
|
23380 | },
|
23381 | end: {
|
23382 | line: 1,
|
23383 | column: 25
|
23384 | }
|
23385 | }
|
23386 | },
|
23387 | arguments: [],
|
23388 | loc: {
|
23389 | start: {
|
23390 | line: 1,
|
23391 | column: 20
|
23392 | },
|
23393 | end: {
|
23394 | line: 1,
|
23395 | column: 27
|
23396 | }
|
23397 | }
|
23398 | },
|
23399 | loc: {
|
23400 | start: {
|
23401 | line: 1,
|
23402 | column: 20
|
23403 | },
|
23404 | end: {
|
23405 | line: 1,
|
23406 | column: 28
|
23407 | }
|
23408 | }
|
23409 | }
|
23410 | ],
|
23411 | loc: {
|
23412 | start: {
|
23413 | line: 1,
|
23414 | column: 18
|
23415 | },
|
23416 | end: {
|
23417 | line: 1,
|
23418 | column: 30
|
23419 | }
|
23420 | }
|
23421 | },
|
23422 | loc: {
|
23423 | start: {
|
23424 | line: 1,
|
23425 | column: 0
|
23426 | },
|
23427 | end: {
|
23428 | line: 1,
|
23429 | column: 30
|
23430 | }
|
23431 | }
|
23432 | }
|
23433 | ],
|
23434 | loc: {
|
23435 | start: {
|
23436 | line: 1,
|
23437 | column: 0
|
23438 | },
|
23439 | end: {
|
23440 | line: 1,
|
23441 | column: 30
|
23442 | }
|
23443 | }
|
23444 | });
|
23445 |
|
23446 | test("function hello(a, b) { sayHi(); }", {
|
23447 | type: "Program",
|
23448 | body: [
|
23449 | {
|
23450 | type: "FunctionDeclaration",
|
23451 | id: {
|
23452 | type: "Identifier",
|
23453 | name: "hello",
|
23454 | loc: {
|
23455 | start: {
|
23456 | line: 1,
|
23457 | column: 9
|
23458 | },
|
23459 | end: {
|
23460 | line: 1,
|
23461 | column: 14
|
23462 | }
|
23463 | }
|
23464 | },
|
23465 | params: [
|
23466 | {
|
23467 | type: "Identifier",
|
23468 | name: "a",
|
23469 | loc: {
|
23470 | start: {
|
23471 | line: 1,
|
23472 | column: 15
|
23473 | },
|
23474 | end: {
|
23475 | line: 1,
|
23476 | column: 16
|
23477 | }
|
23478 | }
|
23479 | },
|
23480 | {
|
23481 | type: "Identifier",
|
23482 | name: "b",
|
23483 | loc: {
|
23484 | start: {
|
23485 | line: 1,
|
23486 | column: 18
|
23487 | },
|
23488 | end: {
|
23489 | line: 1,
|
23490 | column: 19
|
23491 | }
|
23492 | }
|
23493 | }
|
23494 | ],
|
23495 | body: {
|
23496 | type: "BlockStatement",
|
23497 | body: [
|
23498 | {
|
23499 | type: "ExpressionStatement",
|
23500 | expression: {
|
23501 | type: "CallExpression",
|
23502 | callee: {
|
23503 | type: "Identifier",
|
23504 | name: "sayHi",
|
23505 | loc: {
|
23506 | start: {
|
23507 | line: 1,
|
23508 | column: 23
|
23509 | },
|
23510 | end: {
|
23511 | line: 1,
|
23512 | column: 28
|
23513 | }
|
23514 | }
|
23515 | },
|
23516 | arguments: [],
|
23517 | loc: {
|
23518 | start: {
|
23519 | line: 1,
|
23520 | column: 23
|
23521 | },
|
23522 | end: {
|
23523 | line: 1,
|
23524 | column: 30
|
23525 | }
|
23526 | }
|
23527 | },
|
23528 | loc: {
|
23529 | start: {
|
23530 | line: 1,
|
23531 | column: 23
|
23532 | },
|
23533 | end: {
|
23534 | line: 1,
|
23535 | column: 31
|
23536 | }
|
23537 | }
|
23538 | }
|
23539 | ],
|
23540 | loc: {
|
23541 | start: {
|
23542 | line: 1,
|
23543 | column: 21
|
23544 | },
|
23545 | end: {
|
23546 | line: 1,
|
23547 | column: 33
|
23548 | }
|
23549 | }
|
23550 | },
|
23551 | loc: {
|
23552 | start: {
|
23553 | line: 1,
|
23554 | column: 0
|
23555 | },
|
23556 | end: {
|
23557 | line: 1,
|
23558 | column: 33
|
23559 | }
|
23560 | }
|
23561 | }
|
23562 | ],
|
23563 | loc: {
|
23564 | start: {
|
23565 | line: 1,
|
23566 | column: 0
|
23567 | },
|
23568 | end: {
|
23569 | line: 1,
|
23570 | column: 33
|
23571 | }
|
23572 | }
|
23573 | });
|
23574 |
|
23575 | test("function hello(...rest) { }", {
|
23576 | type: "Program",
|
23577 | body: [
|
23578 | {
|
23579 | type: "FunctionDeclaration",
|
23580 | id: {
|
23581 | type: "Identifier",
|
23582 | name: "hello",
|
23583 | loc: {
|
23584 | start: {
|
23585 | line: 1,
|
23586 | column: 9
|
23587 | },
|
23588 | end: {
|
23589 | line: 1,
|
23590 | column: 14
|
23591 | }
|
23592 | }
|
23593 | },
|
23594 | params: [],
|
23595 | rest: {
|
23596 | type: "Identifier",
|
23597 | name: "rest",
|
23598 | loc: {
|
23599 | start: {
|
23600 | line: 1,
|
23601 | column: 18
|
23602 | },
|
23603 | end: {
|
23604 | line: 1,
|
23605 | column: 22
|
23606 | }
|
23607 | }
|
23608 | },
|
23609 | body: {
|
23610 | type: "BlockStatement",
|
23611 | body: [],
|
23612 | loc: {
|
23613 | start: {
|
23614 | line: 1,
|
23615 | column: 24
|
23616 | },
|
23617 | end: {
|
23618 | line: 1,
|
23619 | column: 27
|
23620 | }
|
23621 | }
|
23622 | },
|
23623 | loc: {
|
23624 | start: {
|
23625 | line: 1,
|
23626 | column: 0
|
23627 | },
|
23628 | end: {
|
23629 | line: 1,
|
23630 | column: 27
|
23631 | }
|
23632 | }
|
23633 | }
|
23634 | ],
|
23635 | loc: {
|
23636 | start: {
|
23637 | line: 1,
|
23638 | column: 0
|
23639 | },
|
23640 | end: {
|
23641 | line: 1,
|
23642 | column: 27
|
23643 | }
|
23644 | }
|
23645 | }, {
|
23646 | ecmaVersion: 6,
|
23647 | locations: true
|
23648 | });
|
23649 |
|
23650 | test("function hello(a, ...rest) { }", {
|
23651 | type: "Program",
|
23652 | body: [
|
23653 | {
|
23654 | type: "FunctionDeclaration",
|
23655 | id: {
|
23656 | type: "Identifier",
|
23657 | name: "hello",
|
23658 | loc: {
|
23659 | start: {
|
23660 | line: 1,
|
23661 | column: 9
|
23662 | },
|
23663 | end: {
|
23664 | line: 1,
|
23665 | column: 14
|
23666 | }
|
23667 | }
|
23668 | },
|
23669 | params: [
|
23670 | {
|
23671 | type: "Identifier",
|
23672 | name: "a",
|
23673 | loc: {
|
23674 | start: {
|
23675 | line: 1,
|
23676 | column: 15
|
23677 | },
|
23678 | end: {
|
23679 | line: 1,
|
23680 | column: 16
|
23681 | }
|
23682 | }
|
23683 | }
|
23684 | ],
|
23685 | rest: {
|
23686 | type: "Identifier",
|
23687 | name: "rest",
|
23688 | loc: {
|
23689 | start: {
|
23690 | line: 1,
|
23691 | column: 21
|
23692 | },
|
23693 | end: {
|
23694 | line: 1,
|
23695 | column: 25
|
23696 | }
|
23697 | }
|
23698 | },
|
23699 | body: {
|
23700 | type: "BlockStatement",
|
23701 | body: [],
|
23702 | loc: {
|
23703 | start: {
|
23704 | line: 1,
|
23705 | column: 27
|
23706 | },
|
23707 | end: {
|
23708 | line: 1,
|
23709 | column: 30
|
23710 | }
|
23711 | }
|
23712 | },
|
23713 | loc: {
|
23714 | start: {
|
23715 | line: 1,
|
23716 | column: 0
|
23717 | },
|
23718 | end: {
|
23719 | line: 1,
|
23720 | column: 30
|
23721 | }
|
23722 | }
|
23723 | }
|
23724 | ],
|
23725 | loc: {
|
23726 | start: {
|
23727 | line: 1,
|
23728 | column: 0
|
23729 | },
|
23730 | end: {
|
23731 | line: 1,
|
23732 | column: 30
|
23733 | }
|
23734 | }
|
23735 | }, {
|
23736 | ecmaVersion: 6,
|
23737 | locations: true
|
23738 | });
|
23739 |
|
23740 | test("var hi = function() { sayHi() };", {
|
23741 | type: "Program",
|
23742 | body: [
|
23743 | {
|
23744 | type: "VariableDeclaration",
|
23745 | declarations: [
|
23746 | {
|
23747 | type: "VariableDeclarator",
|
23748 | id: {
|
23749 | type: "Identifier",
|
23750 | name: "hi",
|
23751 | loc: {
|
23752 | start: {
|
23753 | line: 1,
|
23754 | column: 4
|
23755 | },
|
23756 | end: {
|
23757 | line: 1,
|
23758 | column: 6
|
23759 | }
|
23760 | }
|
23761 | },
|
23762 | init: {
|
23763 | type: "FunctionExpression",
|
23764 | id: null,
|
23765 | params: [],
|
23766 | body: {
|
23767 | type: "BlockStatement",
|
23768 | body: [
|
23769 | {
|
23770 | type: "ExpressionStatement",
|
23771 | expression: {
|
23772 | type: "CallExpression",
|
23773 | callee: {
|
23774 | type: "Identifier",
|
23775 | name: "sayHi",
|
23776 | loc: {
|
23777 | start: {
|
23778 | line: 1,
|
23779 | column: 22
|
23780 | },
|
23781 | end: {
|
23782 | line: 1,
|
23783 | column: 27
|
23784 | }
|
23785 | }
|
23786 | },
|
23787 | arguments: [],
|
23788 | loc: {
|
23789 | start: {
|
23790 | line: 1,
|
23791 | column: 22
|
23792 | },
|
23793 | end: {
|
23794 | line: 1,
|
23795 | column: 29
|
23796 | }
|
23797 | }
|
23798 | },
|
23799 | loc: {
|
23800 | start: {
|
23801 | line: 1,
|
23802 | column: 22
|
23803 | },
|
23804 | end: {
|
23805 | line: 1,
|
23806 | column: 29
|
23807 | }
|
23808 | }
|
23809 | }
|
23810 | ],
|
23811 | loc: {
|
23812 | start: {
|
23813 | line: 1,
|
23814 | column: 20
|
23815 | },
|
23816 | end: {
|
23817 | line: 1,
|
23818 | column: 31
|
23819 | }
|
23820 | }
|
23821 | },
|
23822 | loc: {
|
23823 | start: {
|
23824 | line: 1,
|
23825 | column: 9
|
23826 | },
|
23827 | end: {
|
23828 | line: 1,
|
23829 | column: 31
|
23830 | }
|
23831 | }
|
23832 | },
|
23833 | loc: {
|
23834 | start: {
|
23835 | line: 1,
|
23836 | column: 4
|
23837 | },
|
23838 | end: {
|
23839 | line: 1,
|
23840 | column: 31
|
23841 | }
|
23842 | }
|
23843 | }
|
23844 | ],
|
23845 | kind: "var",
|
23846 | loc: {
|
23847 | start: {
|
23848 | line: 1,
|
23849 | column: 0
|
23850 | },
|
23851 | end: {
|
23852 | line: 1,
|
23853 | column: 32
|
23854 | }
|
23855 | }
|
23856 | }
|
23857 | ],
|
23858 | loc: {
|
23859 | start: {
|
23860 | line: 1,
|
23861 | column: 0
|
23862 | },
|
23863 | end: {
|
23864 | line: 1,
|
23865 | column: 32
|
23866 | }
|
23867 | }
|
23868 | });
|
23869 |
|
23870 | test("var hi = function (...r) { sayHi() };", {
|
23871 | type: "Program",
|
23872 | body: [
|
23873 | {
|
23874 | type: "VariableDeclaration",
|
23875 | declarations: [
|
23876 | {
|
23877 | type: "VariableDeclarator",
|
23878 | id: {
|
23879 | type: "Identifier",
|
23880 | name: "hi",
|
23881 | loc: {
|
23882 | start: {
|
23883 | line: 1,
|
23884 | column: 4
|
23885 | },
|
23886 | end: {
|
23887 | line: 1,
|
23888 | column: 6
|
23889 | }
|
23890 | }
|
23891 | },
|
23892 | init: {
|
23893 | type: "FunctionExpression",
|
23894 | id: null,
|
23895 | params: [],
|
23896 | rest: {
|
23897 | type: "Identifier",
|
23898 | name: "r",
|
23899 | loc: {
|
23900 | start: {
|
23901 | line: 1,
|
23902 | column: 22
|
23903 | },
|
23904 | end: {
|
23905 | line: 1,
|
23906 | column: 23
|
23907 | }
|
23908 | }
|
23909 | },
|
23910 | body: {
|
23911 | type: "BlockStatement",
|
23912 | body: [
|
23913 | {
|
23914 | type: "ExpressionStatement",
|
23915 | expression: {
|
23916 | type: "CallExpression",
|
23917 | callee: {
|
23918 | type: "Identifier",
|
23919 | name: "sayHi",
|
23920 | loc: {
|
23921 | start: {
|
23922 | line: 1,
|
23923 | column: 27
|
23924 | },
|
23925 | end: {
|
23926 | line: 1,
|
23927 | column: 32
|
23928 | }
|
23929 | }
|
23930 | },
|
23931 | arguments: [],
|
23932 | loc: {
|
23933 | start: {
|
23934 | line: 1,
|
23935 | column: 27
|
23936 | },
|
23937 | end: {
|
23938 | line: 1,
|
23939 | column: 34
|
23940 | }
|
23941 | }
|
23942 | },
|
23943 | loc: {
|
23944 | start: {
|
23945 | line: 1,
|
23946 | column: 27
|
23947 | },
|
23948 | end: {
|
23949 | line: 1,
|
23950 | column: 34
|
23951 | }
|
23952 | }
|
23953 | }
|
23954 | ],
|
23955 | loc: {
|
23956 | start: {
|
23957 | line: 1,
|
23958 | column: 25
|
23959 | },
|
23960 | end: {
|
23961 | line: 1,
|
23962 | column: 36
|
23963 | }
|
23964 | }
|
23965 | },
|
23966 | loc: {
|
23967 | start: {
|
23968 | line: 1,
|
23969 | column: 9
|
23970 | },
|
23971 | end: {
|
23972 | line: 1,
|
23973 | column: 36
|
23974 | }
|
23975 | }
|
23976 | },
|
23977 | loc: {
|
23978 | start: {
|
23979 | line: 1,
|
23980 | column: 4
|
23981 | },
|
23982 | end: {
|
23983 | line: 1,
|
23984 | column: 36
|
23985 | }
|
23986 | }
|
23987 | }
|
23988 | ],
|
23989 | kind: "var",
|
23990 | loc: {
|
23991 | start: {
|
23992 | line: 1,
|
23993 | column: 0
|
23994 | },
|
23995 | end: {
|
23996 | line: 1,
|
23997 | column: 37
|
23998 | }
|
23999 | }
|
24000 | }
|
24001 | ],
|
24002 | loc: {
|
24003 | start: {
|
24004 | line: 1,
|
24005 | column: 0
|
24006 | },
|
24007 | end: {
|
24008 | line: 1,
|
24009 | column: 37
|
24010 | }
|
24011 | }
|
24012 | }, {
|
24013 | ecmaVersion: 6,
|
24014 | locations: true
|
24015 | });
|
24016 |
|
24017 | test("var hi = function eval() { };", {
|
24018 | type: "Program",
|
24019 | body: [
|
24020 | {
|
24021 | type: "VariableDeclaration",
|
24022 | declarations: [
|
24023 | {
|
24024 | type: "VariableDeclarator",
|
24025 | id: {
|
24026 | type: "Identifier",
|
24027 | name: "hi",
|
24028 | loc: {
|
24029 | start: {
|
24030 | line: 1,
|
24031 | column: 4
|
24032 | },
|
24033 | end: {
|
24034 | line: 1,
|
24035 | column: 6
|
24036 | }
|
24037 | }
|
24038 | },
|
24039 | init: {
|
24040 | type: "FunctionExpression",
|
24041 | id: {
|
24042 | type: "Identifier",
|
24043 | name: "eval",
|
24044 | loc: {
|
24045 | start: {
|
24046 | line: 1,
|
24047 | column: 18
|
24048 | },
|
24049 | end: {
|
24050 | line: 1,
|
24051 | column: 22
|
24052 | }
|
24053 | }
|
24054 | },
|
24055 | params: [],
|
24056 | body: {
|
24057 | type: "BlockStatement",
|
24058 | body: [],
|
24059 | loc: {
|
24060 | start: {
|
24061 | line: 1,
|
24062 | column: 25
|
24063 | },
|
24064 | end: {
|
24065 | line: 1,
|
24066 | column: 28
|
24067 | }
|
24068 | }
|
24069 | },
|
24070 | loc: {
|
24071 | start: {
|
24072 | line: 1,
|
24073 | column: 9
|
24074 | },
|
24075 | end: {
|
24076 | line: 1,
|
24077 | column: 28
|
24078 | }
|
24079 | }
|
24080 | },
|
24081 | loc: {
|
24082 | start: {
|
24083 | line: 1,
|
24084 | column: 4
|
24085 | },
|
24086 | end: {
|
24087 | line: 1,
|
24088 | column: 28
|
24089 | }
|
24090 | }
|
24091 | }
|
24092 | ],
|
24093 | kind: "var",
|
24094 | loc: {
|
24095 | start: {
|
24096 | line: 1,
|
24097 | column: 0
|
24098 | },
|
24099 | end: {
|
24100 | line: 1,
|
24101 | column: 29
|
24102 | }
|
24103 | }
|
24104 | }
|
24105 | ],
|
24106 | loc: {
|
24107 | start: {
|
24108 | line: 1,
|
24109 | column: 0
|
24110 | },
|
24111 | end: {
|
24112 | line: 1,
|
24113 | column: 29
|
24114 | }
|
24115 | }
|
24116 | });
|
24117 |
|
24118 | test("var hi = function arguments() { };", {
|
24119 | type: "Program",
|
24120 | body: [
|
24121 | {
|
24122 | type: "VariableDeclaration",
|
24123 | declarations: [
|
24124 | {
|
24125 | type: "VariableDeclarator",
|
24126 | id: {
|
24127 | type: "Identifier",
|
24128 | name: "hi",
|
24129 | loc: {
|
24130 | start: {
|
24131 | line: 1,
|
24132 | column: 4
|
24133 | },
|
24134 | end: {
|
24135 | line: 1,
|
24136 | column: 6
|
24137 | }
|
24138 | }
|
24139 | },
|
24140 | init: {
|
24141 | type: "FunctionExpression",
|
24142 | id: {
|
24143 | type: "Identifier",
|
24144 | name: "arguments",
|
24145 | loc: {
|
24146 | start: {
|
24147 | line: 1,
|
24148 | column: 18
|
24149 | },
|
24150 | end: {
|
24151 | line: 1,
|
24152 | column: 27
|
24153 | }
|
24154 | }
|
24155 | },
|
24156 | params: [],
|
24157 | body: {
|
24158 | type: "BlockStatement",
|
24159 | body: [],
|
24160 | loc: {
|
24161 | start: {
|
24162 | line: 1,
|
24163 | column: 30
|
24164 | },
|
24165 | end: {
|
24166 | line: 1,
|
24167 | column: 33
|
24168 | }
|
24169 | }
|
24170 | },
|
24171 | loc: {
|
24172 | start: {
|
24173 | line: 1,
|
24174 | column: 9
|
24175 | },
|
24176 | end: {
|
24177 | line: 1,
|
24178 | column: 33
|
24179 | }
|
24180 | }
|
24181 | },
|
24182 | loc: {
|
24183 | start: {
|
24184 | line: 1,
|
24185 | column: 4
|
24186 | },
|
24187 | end: {
|
24188 | line: 1,
|
24189 | column: 33
|
24190 | }
|
24191 | }
|
24192 | }
|
24193 | ],
|
24194 | kind: "var",
|
24195 | loc: {
|
24196 | start: {
|
24197 | line: 1,
|
24198 | column: 0
|
24199 | },
|
24200 | end: {
|
24201 | line: 1,
|
24202 | column: 34
|
24203 | }
|
24204 | }
|
24205 | }
|
24206 | ],
|
24207 | loc: {
|
24208 | start: {
|
24209 | line: 1,
|
24210 | column: 0
|
24211 | },
|
24212 | end: {
|
24213 | line: 1,
|
24214 | column: 34
|
24215 | }
|
24216 | }
|
24217 | });
|
24218 |
|
24219 | test("var hello = function hi() { sayHi() };", {
|
24220 | type: "Program",
|
24221 | body: [
|
24222 | {
|
24223 | type: "VariableDeclaration",
|
24224 | declarations: [
|
24225 | {
|
24226 | type: "VariableDeclarator",
|
24227 | id: {
|
24228 | type: "Identifier",
|
24229 | name: "hello",
|
24230 | loc: {
|
24231 | start: {
|
24232 | line: 1,
|
24233 | column: 4
|
24234 | },
|
24235 | end: {
|
24236 | line: 1,
|
24237 | column: 9
|
24238 | }
|
24239 | }
|
24240 | },
|
24241 | init: {
|
24242 | type: "FunctionExpression",
|
24243 | id: {
|
24244 | type: "Identifier",
|
24245 | name: "hi",
|
24246 | loc: {
|
24247 | start: {
|
24248 | line: 1,
|
24249 | column: 21
|
24250 | },
|
24251 | end: {
|
24252 | line: 1,
|
24253 | column: 23
|
24254 | }
|
24255 | }
|
24256 | },
|
24257 | params: [],
|
24258 | body: {
|
24259 | type: "BlockStatement",
|
24260 | body: [
|
24261 | {
|
24262 | type: "ExpressionStatement",
|
24263 | expression: {
|
24264 | type: "CallExpression",
|
24265 | callee: {
|
24266 | type: "Identifier",
|
24267 | name: "sayHi",
|
24268 | loc: {
|
24269 | start: {
|
24270 | line: 1,
|
24271 | column: 28
|
24272 | },
|
24273 | end: {
|
24274 | line: 1,
|
24275 | column: 33
|
24276 | }
|
24277 | }
|
24278 | },
|
24279 | arguments: [],
|
24280 | loc: {
|
24281 | start: {
|
24282 | line: 1,
|
24283 | column: 28
|
24284 | },
|
24285 | end: {
|
24286 | line: 1,
|
24287 | column: 35
|
24288 | }
|
24289 | }
|
24290 | },
|
24291 | loc: {
|
24292 | start: {
|
24293 | line: 1,
|
24294 | column: 28
|
24295 | },
|
24296 | end: {
|
24297 | line: 1,
|
24298 | column: 35
|
24299 | }
|
24300 | }
|
24301 | }
|
24302 | ],
|
24303 | loc: {
|
24304 | start: {
|
24305 | line: 1,
|
24306 | column: 26
|
24307 | },
|
24308 | end: {
|
24309 | line: 1,
|
24310 | column: 37
|
24311 | }
|
24312 | }
|
24313 | },
|
24314 | loc: {
|
24315 | start: {
|
24316 | line: 1,
|
24317 | column: 12
|
24318 | },
|
24319 | end: {
|
24320 | line: 1,
|
24321 | column: 37
|
24322 | }
|
24323 | }
|
24324 | },
|
24325 | loc: {
|
24326 | start: {
|
24327 | line: 1,
|
24328 | column: 4
|
24329 | },
|
24330 | end: {
|
24331 | line: 1,
|
24332 | column: 37
|
24333 | }
|
24334 | }
|
24335 | }
|
24336 | ],
|
24337 | kind: "var",
|
24338 | loc: {
|
24339 | start: {
|
24340 | line: 1,
|
24341 | column: 0
|
24342 | },
|
24343 | end: {
|
24344 | line: 1,
|
24345 | column: 38
|
24346 | }
|
24347 | }
|
24348 | }
|
24349 | ],
|
24350 | loc: {
|
24351 | start: {
|
24352 | line: 1,
|
24353 | column: 0
|
24354 | },
|
24355 | end: {
|
24356 | line: 1,
|
24357 | column: 38
|
24358 | }
|
24359 | }
|
24360 | });
|
24361 |
|
24362 | test("(function(){})", {
|
24363 | type: "Program",
|
24364 | body: [
|
24365 | {
|
24366 | type: "ExpressionStatement",
|
24367 | expression: {
|
24368 | type: "FunctionExpression",
|
24369 | id: null,
|
24370 | params: [],
|
24371 | body: {
|
24372 | type: "BlockStatement",
|
24373 | body: [],
|
24374 | loc: {
|
24375 | start: {
|
24376 | line: 1,
|
24377 | column: 11
|
24378 | },
|
24379 | end: {
|
24380 | line: 1,
|
24381 | column: 13
|
24382 | }
|
24383 | }
|
24384 | },
|
24385 | loc: {
|
24386 | start: {
|
24387 | line: 1,
|
24388 | column: 0
|
24389 | },
|
24390 | end: {
|
24391 | line: 1,
|
24392 | column: 14
|
24393 | }
|
24394 | }
|
24395 | },
|
24396 | loc: {
|
24397 | start: {
|
24398 | line: 1,
|
24399 | column: 0
|
24400 | },
|
24401 | end: {
|
24402 | line: 1,
|
24403 | column: 14
|
24404 | }
|
24405 | }
|
24406 | }
|
24407 | ],
|
24408 | loc: {
|
24409 | start: {
|
24410 | line: 1,
|
24411 | column: 0
|
24412 | },
|
24413 | end: {
|
24414 | line: 1,
|
24415 | column: 14
|
24416 | }
|
24417 | }
|
24418 | });
|
24419 |
|
24420 | test("{ x\n++y }", {
|
24421 | type: "Program",
|
24422 | body: [
|
24423 | {
|
24424 | type: "BlockStatement",
|
24425 | body: [
|
24426 | {
|
24427 | type: "ExpressionStatement",
|
24428 | expression: {
|
24429 | type: "Identifier",
|
24430 | name: "x",
|
24431 | loc: {
|
24432 | start: {
|
24433 | line: 1,
|
24434 | column: 2
|
24435 | },
|
24436 | end: {
|
24437 | line: 1,
|
24438 | column: 3
|
24439 | }
|
24440 | }
|
24441 | },
|
24442 | loc: {
|
24443 | start: {
|
24444 | line: 1,
|
24445 | column: 2
|
24446 | },
|
24447 | end: {
|
24448 | line: 1,
|
24449 | column: 3
|
24450 | }
|
24451 | }
|
24452 | },
|
24453 | {
|
24454 | type: "ExpressionStatement",
|
24455 | expression: {
|
24456 | type: "UpdateExpression",
|
24457 | operator: "++",
|
24458 | prefix: true,
|
24459 | argument: {
|
24460 | type: "Identifier",
|
24461 | name: "y",
|
24462 | loc: {
|
24463 | start: {
|
24464 | line: 2,
|
24465 | column: 2
|
24466 | },
|
24467 | end: {
|
24468 | line: 2,
|
24469 | column: 3
|
24470 | }
|
24471 | }
|
24472 | },
|
24473 | loc: {
|
24474 | start: {
|
24475 | line: 2,
|
24476 | column: 0
|
24477 | },
|
24478 | end: {
|
24479 | line: 2,
|
24480 | column: 3
|
24481 | }
|
24482 | }
|
24483 | },
|
24484 | loc: {
|
24485 | start: {
|
24486 | line: 2,
|
24487 | column: 0
|
24488 | },
|
24489 | end: {
|
24490 | line: 2,
|
24491 | column: 3
|
24492 | }
|
24493 | }
|
24494 | }
|
24495 | ],
|
24496 | loc: {
|
24497 | start: {
|
24498 | line: 1,
|
24499 | column: 0
|
24500 | },
|
24501 | end: {
|
24502 | line: 2,
|
24503 | column: 5
|
24504 | }
|
24505 | }
|
24506 | }
|
24507 | ],
|
24508 | loc: {
|
24509 | start: {
|
24510 | line: 1,
|
24511 | column: 0
|
24512 | },
|
24513 | end: {
|
24514 | line: 2,
|
24515 | column: 5
|
24516 | }
|
24517 | }
|
24518 | });
|
24519 |
|
24520 | test("{ x\n--y }", {
|
24521 | type: "Program",
|
24522 | body: [
|
24523 | {
|
24524 | type: "BlockStatement",
|
24525 | body: [
|
24526 | {
|
24527 | type: "ExpressionStatement",
|
24528 | expression: {
|
24529 | type: "Identifier",
|
24530 | name: "x",
|
24531 | loc: {
|
24532 | start: {
|
24533 | line: 1,
|
24534 | column: 2
|
24535 | },
|
24536 | end: {
|
24537 | line: 1,
|
24538 | column: 3
|
24539 | }
|
24540 | }
|
24541 | },
|
24542 | loc: {
|
24543 | start: {
|
24544 | line: 1,
|
24545 | column: 2
|
24546 | },
|
24547 | end: {
|
24548 | line: 1,
|
24549 | column: 3
|
24550 | }
|
24551 | }
|
24552 | },
|
24553 | {
|
24554 | type: "ExpressionStatement",
|
24555 | expression: {
|
24556 | type: "UpdateExpression",
|
24557 | operator: "--",
|
24558 | prefix: true,
|
24559 | argument: {
|
24560 | type: "Identifier",
|
24561 | name: "y",
|
24562 | loc: {
|
24563 | start: {
|
24564 | line: 2,
|
24565 | column: 2
|
24566 | },
|
24567 | end: {
|
24568 | line: 2,
|
24569 | column: 3
|
24570 | }
|
24571 | }
|
24572 | },
|
24573 | loc: {
|
24574 | start: {
|
24575 | line: 2,
|
24576 | column: 0
|
24577 | },
|
24578 | end: {
|
24579 | line: 2,
|
24580 | column: 3
|
24581 | }
|
24582 | }
|
24583 | },
|
24584 | loc: {
|
24585 | start: {
|
24586 | line: 2,
|
24587 | column: 0
|
24588 | },
|
24589 | end: {
|
24590 | line: 2,
|
24591 | column: 3
|
24592 | }
|
24593 | }
|
24594 | }
|
24595 | ],
|
24596 | loc: {
|
24597 | start: {
|
24598 | line: 1,
|
24599 | column: 0
|
24600 | },
|
24601 | end: {
|
24602 | line: 2,
|
24603 | column: 5
|
24604 | }
|
24605 | }
|
24606 | }
|
24607 | ],
|
24608 | loc: {
|
24609 | start: {
|
24610 | line: 1,
|
24611 | column: 0
|
24612 | },
|
24613 | end: {
|
24614 | line: 2,
|
24615 | column: 5
|
24616 | }
|
24617 | }
|
24618 | });
|
24619 |
|
24620 | test("var x /* comment */;", {
|
24621 | type: "Program",
|
24622 | body: [
|
24623 | {
|
24624 | type: "VariableDeclaration",
|
24625 | declarations: [
|
24626 | {
|
24627 | type: "VariableDeclarator",
|
24628 | id: {
|
24629 | type: "Identifier",
|
24630 | name: "x",
|
24631 | loc: {
|
24632 | start: {
|
24633 | line: 1,
|
24634 | column: 4
|
24635 | },
|
24636 | end: {
|
24637 | line: 1,
|
24638 | column: 5
|
24639 | }
|
24640 | }
|
24641 | },
|
24642 | init: null,
|
24643 | loc: {
|
24644 | start: {
|
24645 | line: 1,
|
24646 | column: 4
|
24647 | },
|
24648 | end: {
|
24649 | line: 1,
|
24650 | column: 5
|
24651 | }
|
24652 | }
|
24653 | }
|
24654 | ],
|
24655 | kind: "var",
|
24656 | loc: {
|
24657 | start: {
|
24658 | line: 1,
|
24659 | column: 0
|
24660 | },
|
24661 | end: {
|
24662 | line: 1,
|
24663 | column: 20
|
24664 | }
|
24665 | }
|
24666 | }
|
24667 | ],
|
24668 | loc: {
|
24669 | start: {
|
24670 | line: 1,
|
24671 | column: 0
|
24672 | },
|
24673 | end: {
|
24674 | line: 1,
|
24675 | column: 20
|
24676 | }
|
24677 | }
|
24678 | });
|
24679 |
|
24680 | test("{ var x = 14, y = 3\nz; }", {
|
24681 | type: "Program",
|
24682 | body: [
|
24683 | {
|
24684 | type: "BlockStatement",
|
24685 | body: [
|
24686 | {
|
24687 | type: "VariableDeclaration",
|
24688 | declarations: [
|
24689 | {
|
24690 | type: "VariableDeclarator",
|
24691 | id: {
|
24692 | type: "Identifier",
|
24693 | name: "x",
|
24694 | loc: {
|
24695 | start: {
|
24696 | line: 1,
|
24697 | column: 6
|
24698 | },
|
24699 | end: {
|
24700 | line: 1,
|
24701 | column: 7
|
24702 | }
|
24703 | }
|
24704 | },
|
24705 | init: {
|
24706 | type: "Literal",
|
24707 | value: 14,
|
24708 | loc: {
|
24709 | start: {
|
24710 | line: 1,
|
24711 | column: 10
|
24712 | },
|
24713 | end: {
|
24714 | line: 1,
|
24715 | column: 12
|
24716 | }
|
24717 | }
|
24718 | },
|
24719 | loc: {
|
24720 | start: {
|
24721 | line: 1,
|
24722 | column: 6
|
24723 | },
|
24724 | end: {
|
24725 | line: 1,
|
24726 | column: 12
|
24727 | }
|
24728 | }
|
24729 | },
|
24730 | {
|
24731 | type: "VariableDeclarator",
|
24732 | id: {
|
24733 | type: "Identifier",
|
24734 | name: "y",
|
24735 | loc: {
|
24736 | start: {
|
24737 | line: 1,
|
24738 | column: 14
|
24739 | },
|
24740 | end: {
|
24741 | line: 1,
|
24742 | column: 15
|
24743 | }
|
24744 | }
|
24745 | },
|
24746 | init: {
|
24747 | type: "Literal",
|
24748 | value: 3,
|
24749 | loc: {
|
24750 | start: {
|
24751 | line: 1,
|
24752 | column: 18
|
24753 | },
|
24754 | end: {
|
24755 | line: 1,
|
24756 | column: 19
|
24757 | }
|
24758 | }
|
24759 | },
|
24760 | loc: {
|
24761 | start: {
|
24762 | line: 1,
|
24763 | column: 14
|
24764 | },
|
24765 | end: {
|
24766 | line: 1,
|
24767 | column: 19
|
24768 | }
|
24769 | }
|
24770 | }
|
24771 | ],
|
24772 | kind: "var",
|
24773 | loc: {
|
24774 | start: {
|
24775 | line: 1,
|
24776 | column: 2
|
24777 | },
|
24778 | end: {
|
24779 | line: 1,
|
24780 | column: 19
|
24781 | }
|
24782 | }
|
24783 | },
|
24784 | {
|
24785 | type: "ExpressionStatement",
|
24786 | expression: {
|
24787 | type: "Identifier",
|
24788 | name: "z",
|
24789 | loc: {
|
24790 | start: {
|
24791 | line: 2,
|
24792 | column: 0
|
24793 | },
|
24794 | end: {
|
24795 | line: 2,
|
24796 | column: 1
|
24797 | }
|
24798 | }
|
24799 | },
|
24800 | loc: {
|
24801 | start: {
|
24802 | line: 2,
|
24803 | column: 0
|
24804 | },
|
24805 | end: {
|
24806 | line: 2,
|
24807 | column: 2
|
24808 | }
|
24809 | }
|
24810 | }
|
24811 | ],
|
24812 | loc: {
|
24813 | start: {
|
24814 | line: 1,
|
24815 | column: 0
|
24816 | },
|
24817 | end: {
|
24818 | line: 2,
|
24819 | column: 4
|
24820 | }
|
24821 | }
|
24822 | }
|
24823 | ],
|
24824 | loc: {
|
24825 | start: {
|
24826 | line: 1,
|
24827 | column: 0
|
24828 | },
|
24829 | end: {
|
24830 | line: 2,
|
24831 | column: 4
|
24832 | }
|
24833 | }
|
24834 | });
|
24835 |
|
24836 | test("while (true) { continue\nthere; }", {
|
24837 | type: "Program",
|
24838 | body: [
|
24839 | {
|
24840 | type: "WhileStatement",
|
24841 | test: {
|
24842 | type: "Literal",
|
24843 | value: true,
|
24844 | loc: {
|
24845 | start: {
|
24846 | line: 1,
|
24847 | column: 7
|
24848 | },
|
24849 | end: {
|
24850 | line: 1,
|
24851 | column: 11
|
24852 | }
|
24853 | }
|
24854 | },
|
24855 | body: {
|
24856 | type: "BlockStatement",
|
24857 | body: [
|
24858 | {
|
24859 | type: "ContinueStatement",
|
24860 | label: null,
|
24861 | loc: {
|
24862 | start: {
|
24863 | line: 1,
|
24864 | column: 15
|
24865 | },
|
24866 | end: {
|
24867 | line: 1,
|
24868 | column: 23
|
24869 | }
|
24870 | }
|
24871 | },
|
24872 | {
|
24873 | type: "ExpressionStatement",
|
24874 | expression: {
|
24875 | type: "Identifier",
|
24876 | name: "there",
|
24877 | loc: {
|
24878 | start: {
|
24879 | line: 2,
|
24880 | column: 0
|
24881 | },
|
24882 | end: {
|
24883 | line: 2,
|
24884 | column: 5
|
24885 | }
|
24886 | }
|
24887 | },
|
24888 | loc: {
|
24889 | start: {
|
24890 | line: 2,
|
24891 | column: 0
|
24892 | },
|
24893 | end: {
|
24894 | line: 2,
|
24895 | column: 6
|
24896 | }
|
24897 | }
|
24898 | }
|
24899 | ],
|
24900 | loc: {
|
24901 | start: {
|
24902 | line: 1,
|
24903 | column: 13
|
24904 | },
|
24905 | end: {
|
24906 | line: 2,
|
24907 | column: 8
|
24908 | }
|
24909 | }
|
24910 | },
|
24911 | loc: {
|
24912 | start: {
|
24913 | line: 1,
|
24914 | column: 0
|
24915 | },
|
24916 | end: {
|
24917 | line: 2,
|
24918 | column: 8
|
24919 | }
|
24920 | }
|
24921 | }
|
24922 | ],
|
24923 | loc: {
|
24924 | start: {
|
24925 | line: 1,
|
24926 | column: 0
|
24927 | },
|
24928 | end: {
|
24929 | line: 2,
|
24930 | column: 8
|
24931 | }
|
24932 | }
|
24933 | });
|
24934 |
|
24935 | test("while (true) { continue // Comment\nthere; }", {
|
24936 | type: "Program",
|
24937 | body: [
|
24938 | {
|
24939 | type: "WhileStatement",
|
24940 | test: {
|
24941 | type: "Literal",
|
24942 | value: true,
|
24943 | loc: {
|
24944 | start: {
|
24945 | line: 1,
|
24946 | column: 7
|
24947 | },
|
24948 | end: {
|
24949 | line: 1,
|
24950 | column: 11
|
24951 | }
|
24952 | }
|
24953 | },
|
24954 | body: {
|
24955 | type: "BlockStatement",
|
24956 | body: [
|
24957 | {
|
24958 | type: "ContinueStatement",
|
24959 | label: null,
|
24960 | loc: {
|
24961 | start: {
|
24962 | line: 1,
|
24963 | column: 15
|
24964 | },
|
24965 | end: {
|
24966 | line: 1,
|
24967 | column: 23
|
24968 | }
|
24969 | }
|
24970 | },
|
24971 | {
|
24972 | type: "ExpressionStatement",
|
24973 | expression: {
|
24974 | type: "Identifier",
|
24975 | name: "there",
|
24976 | loc: {
|
24977 | start: {
|
24978 | line: 2,
|
24979 | column: 0
|
24980 | },
|
24981 | end: {
|
24982 | line: 2,
|
24983 | column: 5
|
24984 | }
|
24985 | }
|
24986 | },
|
24987 | loc: {
|
24988 | start: {
|
24989 | line: 2,
|
24990 | column: 0
|
24991 | },
|
24992 | end: {
|
24993 | line: 2,
|
24994 | column: 6
|
24995 | }
|
24996 | }
|
24997 | }
|
24998 | ],
|
24999 | loc: {
|
25000 | start: {
|
25001 | line: 1,
|
25002 | column: 13
|
25003 | },
|
25004 | end: {
|
25005 | line: 2,
|
25006 | column: 8
|
25007 | }
|
25008 | }
|
25009 | },
|
25010 | loc: {
|
25011 | start: {
|
25012 | line: 1,
|
25013 | column: 0
|
25014 | },
|
25015 | end: {
|
25016 | line: 2,
|
25017 | column: 8
|
25018 | }
|
25019 | }
|
25020 | }
|
25021 | ],
|
25022 | loc: {
|
25023 | start: {
|
25024 | line: 1,
|
25025 | column: 0
|
25026 | },
|
25027 | end: {
|
25028 | line: 2,
|
25029 | column: 8
|
25030 | }
|
25031 | }
|
25032 | });
|
25033 |
|
25034 | test("while (true) { continue /* Multiline\nComment */there; }", {
|
25035 | type: "Program",
|
25036 | body: [
|
25037 | {
|
25038 | type: "WhileStatement",
|
25039 | test: {
|
25040 | type: "Literal",
|
25041 | value: true,
|
25042 | loc: {
|
25043 | start: {
|
25044 | line: 1,
|
25045 | column: 7
|
25046 | },
|
25047 | end: {
|
25048 | line: 1,
|
25049 | column: 11
|
25050 | }
|
25051 | }
|
25052 | },
|
25053 | body: {
|
25054 | type: "BlockStatement",
|
25055 | body: [
|
25056 | {
|
25057 | type: "ContinueStatement",
|
25058 | label: null,
|
25059 | loc: {
|
25060 | start: {
|
25061 | line: 1,
|
25062 | column: 15
|
25063 | },
|
25064 | end: {
|
25065 | line: 1,
|
25066 | column: 23
|
25067 | }
|
25068 | }
|
25069 | },
|
25070 | {
|
25071 | type: "ExpressionStatement",
|
25072 | expression: {
|
25073 | type: "Identifier",
|
25074 | name: "there",
|
25075 | loc: {
|
25076 | start: {
|
25077 | line: 2,
|
25078 | column: 10
|
25079 | },
|
25080 | end: {
|
25081 | line: 2,
|
25082 | column: 15
|
25083 | }
|
25084 | }
|
25085 | },
|
25086 | loc: {
|
25087 | start: {
|
25088 | line: 2,
|
25089 | column: 10
|
25090 | },
|
25091 | end: {
|
25092 | line: 2,
|
25093 | column: 16
|
25094 | }
|
25095 | }
|
25096 | }
|
25097 | ],
|
25098 | loc: {
|
25099 | start: {
|
25100 | line: 1,
|
25101 | column: 13
|
25102 | },
|
25103 | end: {
|
25104 | line: 2,
|
25105 | column: 18
|
25106 | }
|
25107 | }
|
25108 | },
|
25109 | loc: {
|
25110 | start: {
|
25111 | line: 1,
|
25112 | column: 0
|
25113 | },
|
25114 | end: {
|
25115 | line: 2,
|
25116 | column: 18
|
25117 | }
|
25118 | }
|
25119 | }
|
25120 | ],
|
25121 | loc: {
|
25122 | start: {
|
25123 | line: 1,
|
25124 | column: 0
|
25125 | },
|
25126 | end: {
|
25127 | line: 2,
|
25128 | column: 18
|
25129 | }
|
25130 | }
|
25131 | });
|
25132 |
|
25133 | test("while (true) { break\nthere; }", {
|
25134 | type: "Program",
|
25135 | body: [
|
25136 | {
|
25137 | type: "WhileStatement",
|
25138 | test: {
|
25139 | type: "Literal",
|
25140 | value: true,
|
25141 | loc: {
|
25142 | start: {
|
25143 | line: 1,
|
25144 | column: 7
|
25145 | },
|
25146 | end: {
|
25147 | line: 1,
|
25148 | column: 11
|
25149 | }
|
25150 | }
|
25151 | },
|
25152 | body: {
|
25153 | type: "BlockStatement",
|
25154 | body: [
|
25155 | {
|
25156 | type: "BreakStatement",
|
25157 | label: null,
|
25158 | loc: {
|
25159 | start: {
|
25160 | line: 1,
|
25161 | column: 15
|
25162 | },
|
25163 | end: {
|
25164 | line: 1,
|
25165 | column: 20
|
25166 | }
|
25167 | }
|
25168 | },
|
25169 | {
|
25170 | type: "ExpressionStatement",
|
25171 | expression: {
|
25172 | type: "Identifier",
|
25173 | name: "there",
|
25174 | loc: {
|
25175 | start: {
|
25176 | line: 2,
|
25177 | column: 0
|
25178 | },
|
25179 | end: {
|
25180 | line: 2,
|
25181 | column: 5
|
25182 | }
|
25183 | }
|
25184 | },
|
25185 | loc: {
|
25186 | start: {
|
25187 | line: 2,
|
25188 | column: 0
|
25189 | },
|
25190 | end: {
|
25191 | line: 2,
|
25192 | column: 6
|
25193 | }
|
25194 | }
|
25195 | }
|
25196 | ],
|
25197 | loc: {
|
25198 | start: {
|
25199 | line: 1,
|
25200 | column: 13
|
25201 | },
|
25202 | end: {
|
25203 | line: 2,
|
25204 | column: 8
|
25205 | }
|
25206 | }
|
25207 | },
|
25208 | loc: {
|
25209 | start: {
|
25210 | line: 1,
|
25211 | column: 0
|
25212 | },
|
25213 | end: {
|
25214 | line: 2,
|
25215 | column: 8
|
25216 | }
|
25217 | }
|
25218 | }
|
25219 | ],
|
25220 | loc: {
|
25221 | start: {
|
25222 | line: 1,
|
25223 | column: 0
|
25224 | },
|
25225 | end: {
|
25226 | line: 2,
|
25227 | column: 8
|
25228 | }
|
25229 | }
|
25230 | });
|
25231 |
|
25232 | test("while (true) { break // Comment\nthere; }", {
|
25233 | type: "Program",
|
25234 | body: [
|
25235 | {
|
25236 | type: "WhileStatement",
|
25237 | test: {
|
25238 | type: "Literal",
|
25239 | value: true,
|
25240 | loc: {
|
25241 | start: {
|
25242 | line: 1,
|
25243 | column: 7
|
25244 | },
|
25245 | end: {
|
25246 | line: 1,
|
25247 | column: 11
|
25248 | }
|
25249 | }
|
25250 | },
|
25251 | body: {
|
25252 | type: "BlockStatement",
|
25253 | body: [
|
25254 | {
|
25255 | type: "BreakStatement",
|
25256 | label: null,
|
25257 | loc: {
|
25258 | start: {
|
25259 | line: 1,
|
25260 | column: 15
|
25261 | },
|
25262 | end: {
|
25263 | line: 1,
|
25264 | column: 20
|
25265 | }
|
25266 | }
|
25267 | },
|
25268 | {
|
25269 | type: "ExpressionStatement",
|
25270 | expression: {
|
25271 | type: "Identifier",
|
25272 | name: "there",
|
25273 | loc: {
|
25274 | start: {
|
25275 | line: 2,
|
25276 | column: 0
|
25277 | },
|
25278 | end: {
|
25279 | line: 2,
|
25280 | column: 5
|
25281 | }
|
25282 | }
|
25283 | },
|
25284 | loc: {
|
25285 | start: {
|
25286 | line: 2,
|
25287 | column: 0
|
25288 | },
|
25289 | end: {
|
25290 | line: 2,
|
25291 | column: 6
|
25292 | }
|
25293 | }
|
25294 | }
|
25295 | ],
|
25296 | loc: {
|
25297 | start: {
|
25298 | line: 1,
|
25299 | column: 13
|
25300 | },
|
25301 | end: {
|
25302 | line: 2,
|
25303 | column: 8
|
25304 | }
|
25305 | }
|
25306 | },
|
25307 | loc: {
|
25308 | start: {
|
25309 | line: 1,
|
25310 | column: 0
|
25311 | },
|
25312 | end: {
|
25313 | line: 2,
|
25314 | column: 8
|
25315 | }
|
25316 | }
|
25317 | }
|
25318 | ],
|
25319 | loc: {
|
25320 | start: {
|
25321 | line: 1,
|
25322 | column: 0
|
25323 | },
|
25324 | end: {
|
25325 | line: 2,
|
25326 | column: 8
|
25327 | }
|
25328 | }
|
25329 | });
|
25330 |
|
25331 | test("while (true) { break /* Multiline\nComment */there; }", {
|
25332 | type: "Program",
|
25333 | body: [
|
25334 | {
|
25335 | type: "WhileStatement",
|
25336 | test: {
|
25337 | type: "Literal",
|
25338 | value: true,
|
25339 | loc: {
|
25340 | start: {
|
25341 | line: 1,
|
25342 | column: 7
|
25343 | },
|
25344 | end: {
|
25345 | line: 1,
|
25346 | column: 11
|
25347 | }
|
25348 | }
|
25349 | },
|
25350 | body: {
|
25351 | type: "BlockStatement",
|
25352 | body: [
|
25353 | {
|
25354 | type: "BreakStatement",
|
25355 | label: null,
|
25356 | loc: {
|
25357 | start: {
|
25358 | line: 1,
|
25359 | column: 15
|
25360 | },
|
25361 | end: {
|
25362 | line: 1,
|
25363 | column: 20
|
25364 | }
|
25365 | }
|
25366 | },
|
25367 | {
|
25368 | type: "ExpressionStatement",
|
25369 | expression: {
|
25370 | type: "Identifier",
|
25371 | name: "there",
|
25372 | loc: {
|
25373 | start: {
|
25374 | line: 2,
|
25375 | column: 10
|
25376 | },
|
25377 | end: {
|
25378 | line: 2,
|
25379 | column: 15
|
25380 | }
|
25381 | }
|
25382 | },
|
25383 | loc: {
|
25384 | start: {
|
25385 | line: 2,
|
25386 | column: 10
|
25387 | },
|
25388 | end: {
|
25389 | line: 2,
|
25390 | column: 16
|
25391 | }
|
25392 | }
|
25393 | }
|
25394 | ],
|
25395 | loc: {
|
25396 | start: {
|
25397 | line: 1,
|
25398 | column: 13
|
25399 | },
|
25400 | end: {
|
25401 | line: 2,
|
25402 | column: 18
|
25403 | }
|
25404 | }
|
25405 | },
|
25406 | loc: {
|
25407 | start: {
|
25408 | line: 1,
|
25409 | column: 0
|
25410 | },
|
25411 | end: {
|
25412 | line: 2,
|
25413 | column: 18
|
25414 | }
|
25415 | }
|
25416 | }
|
25417 | ],
|
25418 | loc: {
|
25419 | start: {
|
25420 | line: 1,
|
25421 | column: 0
|
25422 | },
|
25423 | end: {
|
25424 | line: 2,
|
25425 | column: 18
|
25426 | }
|
25427 | }
|
25428 | });
|
25429 |
|
25430 | test("(function(){ return\nx; })", {
|
25431 | type: "Program",
|
25432 | body: [
|
25433 | {
|
25434 | type: "ExpressionStatement",
|
25435 | expression: {
|
25436 | type: "FunctionExpression",
|
25437 | id: null,
|
25438 | params: [],
|
25439 | body: {
|
25440 | type: "BlockStatement",
|
25441 | body: [
|
25442 | {
|
25443 | type: "ReturnStatement",
|
25444 | argument: null,
|
25445 | loc: {
|
25446 | start: {
|
25447 | line: 1,
|
25448 | column: 13
|
25449 | },
|
25450 | end: {
|
25451 | line: 1,
|
25452 | column: 19
|
25453 | }
|
25454 | }
|
25455 | },
|
25456 | {
|
25457 | type: "ExpressionStatement",
|
25458 | expression: {
|
25459 | type: "Identifier",
|
25460 | name: "x",
|
25461 | loc: {
|
25462 | start: {
|
25463 | line: 2,
|
25464 | column: 0
|
25465 | },
|
25466 | end: {
|
25467 | line: 2,
|
25468 | column: 1
|
25469 | }
|
25470 | }
|
25471 | },
|
25472 | loc: {
|
25473 | start: {
|
25474 | line: 2,
|
25475 | column: 0
|
25476 | },
|
25477 | end: {
|
25478 | line: 2,
|
25479 | column: 2
|
25480 | }
|
25481 | }
|
25482 | }
|
25483 | ],
|
25484 | loc: {
|
25485 | start: {
|
25486 | line: 1,
|
25487 | column: 11
|
25488 | },
|
25489 | end: {
|
25490 | line: 2,
|
25491 | column: 4
|
25492 | }
|
25493 | }
|
25494 | },
|
25495 | loc: {
|
25496 | start: {
|
25497 | line: 1,
|
25498 | column: 0
|
25499 | },
|
25500 | end: {
|
25501 | line: 2,
|
25502 | column: 5
|
25503 | }
|
25504 | }
|
25505 | },
|
25506 | loc: {
|
25507 | start: {
|
25508 | line: 1,
|
25509 | column: 0
|
25510 | },
|
25511 | end: {
|
25512 | line: 2,
|
25513 | column: 5
|
25514 | }
|
25515 | }
|
25516 | }
|
25517 | ],
|
25518 | loc: {
|
25519 | start: {
|
25520 | line: 1,
|
25521 | column: 0
|
25522 | },
|
25523 | end: {
|
25524 | line: 2,
|
25525 | column: 5
|
25526 | }
|
25527 | }
|
25528 | });
|
25529 |
|
25530 | test("(function(){ return // Comment\nx; })", {
|
25531 | type: "Program",
|
25532 | body: [
|
25533 | {
|
25534 | type: "ExpressionStatement",
|
25535 | expression: {
|
25536 | type: "FunctionExpression",
|
25537 | id: null,
|
25538 | params: [],
|
25539 | body: {
|
25540 | type: "BlockStatement",
|
25541 | body: [
|
25542 | {
|
25543 | type: "ReturnStatement",
|
25544 | argument: null,
|
25545 | loc: {
|
25546 | start: {
|
25547 | line: 1,
|
25548 | column: 13
|
25549 | },
|
25550 | end: {
|
25551 | line: 1,
|
25552 | column: 19
|
25553 | }
|
25554 | }
|
25555 | },
|
25556 | {
|
25557 | type: "ExpressionStatement",
|
25558 | expression: {
|
25559 | type: "Identifier",
|
25560 | name: "x",
|
25561 | loc: {
|
25562 | start: {
|
25563 | line: 2,
|
25564 | column: 0
|
25565 | },
|
25566 | end: {
|
25567 | line: 2,
|
25568 | column: 1
|
25569 | }
|
25570 | }
|
25571 | },
|
25572 | loc: {
|
25573 | start: {
|
25574 | line: 2,
|
25575 | column: 0
|
25576 | },
|
25577 | end: {
|
25578 | line: 2,
|
25579 | column: 2
|
25580 | }
|
25581 | }
|
25582 | }
|
25583 | ],
|
25584 | loc: {
|
25585 | start: {
|
25586 | line: 1,
|
25587 | column: 11
|
25588 | },
|
25589 | end: {
|
25590 | line: 2,
|
25591 | column: 4
|
25592 | }
|
25593 | }
|
25594 | },
|
25595 | loc: {
|
25596 | start: {
|
25597 | line: 1,
|
25598 | column: 0
|
25599 | },
|
25600 | end: {
|
25601 | line: 2,
|
25602 | column: 5
|
25603 | }
|
25604 | }
|
25605 | },
|
25606 | loc: {
|
25607 | start: {
|
25608 | line: 1,
|
25609 | column: 0
|
25610 | },
|
25611 | end: {
|
25612 | line: 2,
|
25613 | column: 5
|
25614 | }
|
25615 | }
|
25616 | }
|
25617 | ],
|
25618 | loc: {
|
25619 | start: {
|
25620 | line: 1,
|
25621 | column: 0
|
25622 | },
|
25623 | end: {
|
25624 | line: 2,
|
25625 | column: 5
|
25626 | }
|
25627 | }
|
25628 | });
|
25629 |
|
25630 | test("(function(){ return/* Multiline\nComment */x; })", {
|
25631 | type: "Program",
|
25632 | body: [
|
25633 | {
|
25634 | type: "ExpressionStatement",
|
25635 | expression: {
|
25636 | type: "FunctionExpression",
|
25637 | id: null,
|
25638 | params: [],
|
25639 | body: {
|
25640 | type: "BlockStatement",
|
25641 | body: [
|
25642 | {
|
25643 | type: "ReturnStatement",
|
25644 | argument: null,
|
25645 | loc: {
|
25646 | start: {
|
25647 | line: 1,
|
25648 | column: 13
|
25649 | },
|
25650 | end: {
|
25651 | line: 1,
|
25652 | column: 19
|
25653 | }
|
25654 | }
|
25655 | },
|
25656 | {
|
25657 | type: "ExpressionStatement",
|
25658 | expression: {
|
25659 | type: "Identifier",
|
25660 | name: "x",
|
25661 | loc: {
|
25662 | start: {
|
25663 | line: 2,
|
25664 | column: 10
|
25665 | },
|
25666 | end: {
|
25667 | line: 2,
|
25668 | column: 11
|
25669 | }
|
25670 | }
|
25671 | },
|
25672 | loc: {
|
25673 | start: {
|
25674 | line: 2,
|
25675 | column: 10
|
25676 | },
|
25677 | end: {
|
25678 | line: 2,
|
25679 | column: 12
|
25680 | }
|
25681 | }
|
25682 | }
|
25683 | ],
|
25684 | loc: {
|
25685 | start: {
|
25686 | line: 1,
|
25687 | column: 11
|
25688 | },
|
25689 | end: {
|
25690 | line: 2,
|
25691 | column: 14
|
25692 | }
|
25693 | }
|
25694 | },
|
25695 | loc: {
|
25696 | start: {
|
25697 | line: 1,
|
25698 | column: 0
|
25699 | },
|
25700 | end: {
|
25701 | line: 2,
|
25702 | column: 15
|
25703 | }
|
25704 | }
|
25705 | },
|
25706 | loc: {
|
25707 | start: {
|
25708 | line: 1,
|
25709 | column: 0
|
25710 | },
|
25711 | end: {
|
25712 | line: 2,
|
25713 | column: 15
|
25714 | }
|
25715 | }
|
25716 | }
|
25717 | ],
|
25718 | loc: {
|
25719 | start: {
|
25720 | line: 1,
|
25721 | column: 0
|
25722 | },
|
25723 | end: {
|
25724 | line: 2,
|
25725 | column: 15
|
25726 | }
|
25727 | }
|
25728 | });
|
25729 |
|
25730 | test("{ throw error\nerror; }", {
|
25731 | type: "Program",
|
25732 | body: [
|
25733 | {
|
25734 | type: "BlockStatement",
|
25735 | body: [
|
25736 | {
|
25737 | type: "ThrowStatement",
|
25738 | argument: {
|
25739 | type: "Identifier",
|
25740 | name: "error",
|
25741 | loc: {
|
25742 | start: {
|
25743 | line: 1,
|
25744 | column: 8
|
25745 | },
|
25746 | end: {
|
25747 | line: 1,
|
25748 | column: 13
|
25749 | }
|
25750 | }
|
25751 | },
|
25752 | loc: {
|
25753 | start: {
|
25754 | line: 1,
|
25755 | column: 2
|
25756 | },
|
25757 | end: {
|
25758 | line: 1,
|
25759 | column: 13
|
25760 | }
|
25761 | }
|
25762 | },
|
25763 | {
|
25764 | type: "ExpressionStatement",
|
25765 | expression: {
|
25766 | type: "Identifier",
|
25767 | name: "error",
|
25768 | loc: {
|
25769 | start: {
|
25770 | line: 2,
|
25771 | column: 0
|
25772 | },
|
25773 | end: {
|
25774 | line: 2,
|
25775 | column: 5
|
25776 | }
|
25777 | }
|
25778 | },
|
25779 | loc: {
|
25780 | start: {
|
25781 | line: 2,
|
25782 | column: 0
|
25783 | },
|
25784 | end: {
|
25785 | line: 2,
|
25786 | column: 6
|
25787 | }
|
25788 | }
|
25789 | }
|
25790 | ],
|
25791 | loc: {
|
25792 | start: {
|
25793 | line: 1,
|
25794 | column: 0
|
25795 | },
|
25796 | end: {
|
25797 | line: 2,
|
25798 | column: 8
|
25799 | }
|
25800 | }
|
25801 | }
|
25802 | ],
|
25803 | loc: {
|
25804 | start: {
|
25805 | line: 1,
|
25806 | column: 0
|
25807 | },
|
25808 | end: {
|
25809 | line: 2,
|
25810 | column: 8
|
25811 | }
|
25812 | }
|
25813 | });
|
25814 |
|
25815 | test("{ throw error// Comment\nerror; }", {
|
25816 | type: "Program",
|
25817 | body: [
|
25818 | {
|
25819 | type: "BlockStatement",
|
25820 | body: [
|
25821 | {
|
25822 | type: "ThrowStatement",
|
25823 | argument: {
|
25824 | type: "Identifier",
|
25825 | name: "error",
|
25826 | loc: {
|
25827 | start: {
|
25828 | line: 1,
|
25829 | column: 8
|
25830 | },
|
25831 | end: {
|
25832 | line: 1,
|
25833 | column: 13
|
25834 | }
|
25835 | }
|
25836 | },
|
25837 | loc: {
|
25838 | start: {
|
25839 | line: 1,
|
25840 | column: 2
|
25841 | },
|
25842 | end: {
|
25843 | line: 1,
|
25844 | column: 13
|
25845 | }
|
25846 | }
|
25847 | },
|
25848 | {
|
25849 | type: "ExpressionStatement",
|
25850 | expression: {
|
25851 | type: "Identifier",
|
25852 | name: "error",
|
25853 | loc: {
|
25854 | start: {
|
25855 | line: 2,
|
25856 | column: 0
|
25857 | },
|
25858 | end: {
|
25859 | line: 2,
|
25860 | column: 5
|
25861 | }
|
25862 | }
|
25863 | },
|
25864 | loc: {
|
25865 | start: {
|
25866 | line: 2,
|
25867 | column: 0
|
25868 | },
|
25869 | end: {
|
25870 | line: 2,
|
25871 | column: 6
|
25872 | }
|
25873 | }
|
25874 | }
|
25875 | ],
|
25876 | loc: {
|
25877 | start: {
|
25878 | line: 1,
|
25879 | column: 0
|
25880 | },
|
25881 | end: {
|
25882 | line: 2,
|
25883 | column: 8
|
25884 | }
|
25885 | }
|
25886 | }
|
25887 | ],
|
25888 | loc: {
|
25889 | start: {
|
25890 | line: 1,
|
25891 | column: 0
|
25892 | },
|
25893 | end: {
|
25894 | line: 2,
|
25895 | column: 8
|
25896 | }
|
25897 | }
|
25898 | });
|
25899 |
|
25900 | test("{ throw error/* Multiline\nComment */error; }", {
|
25901 | type: "Program",
|
25902 | body: [
|
25903 | {
|
25904 | type: "BlockStatement",
|
25905 | body: [
|
25906 | {
|
25907 | type: "ThrowStatement",
|
25908 | argument: {
|
25909 | type: "Identifier",
|
25910 | name: "error",
|
25911 | loc: {
|
25912 | start: {
|
25913 | line: 1,
|
25914 | column: 8
|
25915 | },
|
25916 | end: {
|
25917 | line: 1,
|
25918 | column: 13
|
25919 | }
|
25920 | }
|
25921 | },
|
25922 | loc: {
|
25923 | start: {
|
25924 | line: 1,
|
25925 | column: 2
|
25926 | },
|
25927 | end: {
|
25928 | line: 1,
|
25929 | column: 13
|
25930 | }
|
25931 | }
|
25932 | },
|
25933 | {
|
25934 | type: "ExpressionStatement",
|
25935 | expression: {
|
25936 | type: "Identifier",
|
25937 | name: "error",
|
25938 | loc: {
|
25939 | start: {
|
25940 | line: 2,
|
25941 | column: 10
|
25942 | },
|
25943 | end: {
|
25944 | line: 2,
|
25945 | column: 15
|
25946 | }
|
25947 | }
|
25948 | },
|
25949 | loc: {
|
25950 | start: {
|
25951 | line: 2,
|
25952 | column: 10
|
25953 | },
|
25954 | end: {
|
25955 | line: 2,
|
25956 | column: 16
|
25957 | }
|
25958 | }
|
25959 | }
|
25960 | ],
|
25961 | loc: {
|
25962 | start: {
|
25963 | line: 1,
|
25964 | column: 0
|
25965 | },
|
25966 | end: {
|
25967 | line: 2,
|
25968 | column: 18
|
25969 | }
|
25970 | }
|
25971 | }
|
25972 | ],
|
25973 | loc: {
|
25974 | start: {
|
25975 | line: 1,
|
25976 | column: 0
|
25977 | },
|
25978 | end: {
|
25979 | line: 2,
|
25980 | column: 18
|
25981 | }
|
25982 | }
|
25983 | });
|
25984 |
|
25985 | test("", {
|
25986 | type: "Program",
|
25987 | body: [],
|
25988 | loc: {
|
25989 | start: {
|
25990 | line: 1,
|
25991 | column: 0
|
25992 | },
|
25993 | end: {
|
25994 | line: 1,
|
25995 | column: 0
|
25996 | }
|
25997 | }
|
25998 | });
|
25999 |
|
26000 | test("foo: if (true) break foo;", {
|
26001 | type: "Program",
|
26002 | start: 0,
|
26003 | end: 25,
|
26004 | loc: {
|
26005 | start: {
|
26006 | line: 1,
|
26007 | column: 0
|
26008 | },
|
26009 | end: {
|
26010 | line: 1,
|
26011 | column: 25
|
26012 | }
|
26013 | },
|
26014 | body: [
|
26015 | {
|
26016 | type: "LabeledStatement",
|
26017 | start: 0,
|
26018 | end: 25,
|
26019 | loc: {
|
26020 | start: {
|
26021 | line: 1,
|
26022 | column: 0
|
26023 | },
|
26024 | end: {
|
26025 | line: 1,
|
26026 | column: 25
|
26027 | }
|
26028 | },
|
26029 | body: {
|
26030 | type: "IfStatement",
|
26031 | start: 5,
|
26032 | end: 25,
|
26033 | loc: {
|
26034 | start: {
|
26035 | line: 1,
|
26036 | column: 5
|
26037 | },
|
26038 | end: {
|
26039 | line: 1,
|
26040 | column: 25
|
26041 | }
|
26042 | },
|
26043 | test: {
|
26044 | type: "Literal",
|
26045 | start: 9,
|
26046 | end: 13,
|
26047 | loc: {
|
26048 | start: {
|
26049 | line: 1,
|
26050 | column: 9
|
26051 | },
|
26052 | end: {
|
26053 | line: 1,
|
26054 | column: 13
|
26055 | }
|
26056 | },
|
26057 | value: true
|
26058 | },
|
26059 | consequent: {
|
26060 | type: "BreakStatement",
|
26061 | start: 15,
|
26062 | end: 25,
|
26063 | loc: {
|
26064 | start: {
|
26065 | line: 1,
|
26066 | column: 15
|
26067 | },
|
26068 | end: {
|
26069 | line: 1,
|
26070 | column: 25
|
26071 | }
|
26072 | },
|
26073 | label: {
|
26074 | type: "Identifier",
|
26075 | start: 21,
|
26076 | end: 24,
|
26077 | loc: {
|
26078 | start: {
|
26079 | line: 1,
|
26080 | column: 21
|
26081 | },
|
26082 | end: {
|
26083 | line: 1,
|
26084 | column: 24
|
26085 | }
|
26086 | },
|
26087 | name: "foo"
|
26088 | }
|
26089 | },
|
26090 | alternate: null
|
26091 | },
|
26092 | label: {
|
26093 | type: "Identifier",
|
26094 | start: 0,
|
26095 | end: 3,
|
26096 | loc: {
|
26097 | start: {
|
26098 | line: 1,
|
26099 | column: 0
|
26100 | },
|
26101 | end: {
|
26102 | line: 1,
|
26103 | column: 3
|
26104 | }
|
26105 | },
|
26106 | name: "foo"
|
26107 | }
|
26108 | }
|
26109 | ]
|
26110 | });
|
26111 |
|
26112 | test("(function () {\n 'use strict';\n '\0';\n}())", {
|
26113 | type: "Program",
|
26114 | start: 0,
|
26115 | end: 40,
|
26116 | loc: {
|
26117 | start: {
|
26118 | line: 1,
|
26119 | column: 0
|
26120 | },
|
26121 | end: {
|
26122 | line: 4,
|
26123 | column: 4
|
26124 | }
|
26125 | },
|
26126 | body: [
|
26127 | {
|
26128 | type: "ExpressionStatement",
|
26129 | start: 0,
|
26130 | end: 40,
|
26131 | loc: {
|
26132 | start: {
|
26133 | line: 1,
|
26134 | column: 0
|
26135 | },
|
26136 | end: {
|
26137 | line: 4,
|
26138 | column: 4
|
26139 | }
|
26140 | },
|
26141 | expression: {
|
26142 | type: "CallExpression",
|
26143 | start: 0,
|
26144 | loc: {
|
26145 | start: {
|
26146 | line: 1,
|
26147 | column: 0
|
26148 | },
|
26149 | end: {
|
26150 | line: 4,
|
26151 | column: 4
|
26152 | }
|
26153 | },
|
26154 | callee: {
|
26155 | type: "FunctionExpression",
|
26156 | start: 1,
|
26157 | end: 37,
|
26158 | loc: {
|
26159 | start: {
|
26160 | line: 1,
|
26161 | column: 1
|
26162 | },
|
26163 | end: {
|
26164 | line: 4,
|
26165 | column: 1
|
26166 | }
|
26167 | },
|
26168 | id: null,
|
26169 | params: [],
|
26170 | body: {
|
26171 | type: "BlockStatement",
|
26172 | start: 13,
|
26173 | end: 37,
|
26174 | loc: {
|
26175 | start: {
|
26176 | line: 1,
|
26177 | column: 13
|
26178 | },
|
26179 | end: {
|
26180 | line: 4,
|
26181 | column: 1
|
26182 | }
|
26183 | },
|
26184 | body: [
|
26185 | {
|
26186 | type: "ExpressionStatement",
|
26187 | start: 16,
|
26188 | end: 29,
|
26189 | loc: {
|
26190 | start: {
|
26191 | line: 2,
|
26192 | column: 1
|
26193 | },
|
26194 | end: {
|
26195 | line: 2,
|
26196 | column: 14
|
26197 | }
|
26198 | },
|
26199 | expression: {
|
26200 | type: "Literal",
|
26201 | start: 16,
|
26202 | end: 28,
|
26203 | loc: {
|
26204 | start: {
|
26205 | line: 2,
|
26206 | column: 1
|
26207 | },
|
26208 | end: {
|
26209 | line: 2,
|
26210 | column: 13
|
26211 | }
|
26212 | },
|
26213 | value: "use strict"
|
26214 | }
|
26215 | },
|
26216 | {
|
26217 | type: "ExpressionStatement",
|
26218 | start: 31,
|
26219 | end: 35,
|
26220 | loc: {
|
26221 | start: {
|
26222 | line: 3,
|
26223 | column: 1
|
26224 | },
|
26225 | end: {
|
26226 | line: 3,
|
26227 | column: 5
|
26228 | }
|
26229 | },
|
26230 | expression: {
|
26231 | type: "Literal",
|
26232 | start: 31,
|
26233 | end: 34,
|
26234 | loc: {
|
26235 | start: {
|
26236 | line: 3,
|
26237 | column: 1
|
26238 | },
|
26239 | end: {
|
26240 | line: 3,
|
26241 | column: 4
|
26242 | }
|
26243 | },
|
26244 | value: "\u0000"
|
26245 | }
|
26246 | }
|
26247 | ]
|
26248 | }
|
26249 | },
|
26250 | arguments: [],
|
26251 | end: 40
|
26252 | }
|
26253 | }
|
26254 | ]
|
26255 | });
|
26256 |
|
26257 | test("123..toString(10)", {
|
26258 | type: "Program",
|
26259 | start: 0,
|
26260 | end: 17,
|
26261 | body: [
|
26262 | {
|
26263 | type: "ExpressionStatement",
|
26264 | start: 0,
|
26265 | end: 17,
|
26266 | expression: {
|
26267 | type: "CallExpression",
|
26268 | start: 0,
|
26269 | callee: {
|
26270 | type: "MemberExpression",
|
26271 | start: 0,
|
26272 | object: {
|
26273 | type: "Literal",
|
26274 | start: 0,
|
26275 | end: 4,
|
26276 | value: 123
|
26277 | },
|
26278 | property: {
|
26279 | type: "Identifier",
|
26280 | start: 5,
|
26281 | end: 13,
|
26282 | name: "toString"
|
26283 | },
|
26284 | computed: false,
|
26285 | end: 13
|
26286 | },
|
26287 | arguments: [
|
26288 | {
|
26289 | type: "Literal",
|
26290 | start: 14,
|
26291 | end: 16,
|
26292 | value: 10
|
26293 | }
|
26294 | ],
|
26295 | end: 17
|
26296 | }
|
26297 | }
|
26298 | ]
|
26299 | });
|
26300 |
|
26301 | test("123.+2", {
|
26302 | type: "Program",
|
26303 | start: 0,
|
26304 | end: 6,
|
26305 | body: [
|
26306 | {
|
26307 | type: "ExpressionStatement",
|
26308 | start: 0,
|
26309 | end: 6,
|
26310 | expression: {
|
26311 | type: "BinaryExpression",
|
26312 | start: 0,
|
26313 | left: {
|
26314 | type: "Literal",
|
26315 | start: 0,
|
26316 | end: 4,
|
26317 | value: 123
|
26318 | },
|
26319 | operator: "+",
|
26320 | right: {
|
26321 | type: "Literal",
|
26322 | start: 5,
|
26323 | end: 6,
|
26324 | value: 2
|
26325 | },
|
26326 | end: 6
|
26327 | }
|
26328 | }
|
26329 | ]
|
26330 | });
|
26331 |
|
26332 | test("a\u2028b", {
|
26333 | type: "Program",
|
26334 | start: 0,
|
26335 | end: 3,
|
26336 | body: [
|
26337 | {
|
26338 | type: "ExpressionStatement",
|
26339 | start: 0,
|
26340 | end: 1,
|
26341 | expression: {
|
26342 | type: "Identifier",
|
26343 | start: 0,
|
26344 | end: 1,
|
26345 | name: "a"
|
26346 | }
|
26347 | },
|
26348 | {
|
26349 | type: "ExpressionStatement",
|
26350 | start: 2,
|
26351 | end: 3,
|
26352 | expression: {
|
26353 | type: "Identifier",
|
26354 | start: 2,
|
26355 | end: 3,
|
26356 | name: "b"
|
26357 | }
|
26358 | }
|
26359 | ]
|
26360 | });
|
26361 |
|
26362 | test("'a\\u0026b'", {
|
26363 | type: "Program",
|
26364 | body: [
|
26365 | {
|
26366 | type: "ExpressionStatement",
|
26367 | expression: {
|
26368 | type: "Literal",
|
26369 | value: "a\u0026b"
|
26370 | }
|
26371 | }
|
26372 | ]
|
26373 | });
|
26374 |
|
26375 | test("foo: 10; foo: 20;", {
|
26376 | type: "Program",
|
26377 | body: [
|
26378 | {
|
26379 | type: "LabeledStatement",
|
26380 | body: {
|
26381 | type: "ExpressionStatement",
|
26382 | expression: {
|
26383 | type: "Literal",
|
26384 | value: 10,
|
26385 | raw: "10"
|
26386 | }
|
26387 | },
|
26388 | label: {
|
26389 | type: "Identifier",
|
26390 | name: "foo"
|
26391 | }
|
26392 | },
|
26393 | {
|
26394 | type: "LabeledStatement",
|
26395 | body: {
|
26396 | type: "ExpressionStatement",
|
26397 | expression: {
|
26398 | type: "Literal",
|
26399 | value: 20,
|
26400 | raw: "20"
|
26401 | }
|
26402 | },
|
26403 | label: {
|
26404 | type: "Identifier",
|
26405 | name: "foo"
|
26406 | }
|
26407 | }
|
26408 | ]
|
26409 | });
|
26410 |
|
26411 | test("if(1)/ foo/", {
|
26412 | type: "Program",
|
26413 | start: 0,
|
26414 | end: 12,
|
26415 | body: [
|
26416 | {
|
26417 | type: "IfStatement",
|
26418 | start: 0,
|
26419 | end: 12,
|
26420 | test: {
|
26421 | type: "Literal",
|
26422 | start: 3,
|
26423 | end: 4,
|
26424 | value: 1,
|
26425 | raw: "1"
|
26426 | },
|
26427 | consequent: {
|
26428 | type: "ExpressionStatement",
|
26429 | start: 5,
|
26430 | end: 12,
|
26431 | expression: {
|
26432 | type: "Literal",
|
26433 | start: 5,
|
26434 | end: 12,
|
26435 | raw: "/ foo/"
|
26436 | }
|
26437 | },
|
26438 | alternate: null
|
26439 | }
|
26440 | ]
|
26441 | });
|
26442 |
|
26443 | test("price_9̶9̶_89", {
|
26444 | type: "Program",
|
26445 | body: [
|
26446 | {
|
26447 | type: "ExpressionStatement",
|
26448 | expression: {
|
26449 | type: "Identifier",
|
26450 | name: "price_9̶9̶_89",
|
26451 | start: 0,
|
26452 | end: 13
|
26453 | }
|
26454 | }
|
26455 | ]
|
26456 | });
|
26457 |
|
26458 |
|
26459 |
|
26460 | test("var a = 1;", {
|
26461 | type: "Program",
|
26462 | start: 0,
|
26463 | end: 10,
|
26464 | loc: {
|
26465 | start: {
|
26466 | line: 1,
|
26467 | column: 0
|
26468 | },
|
26469 | end: {
|
26470 | line: 1,
|
26471 | column: 10
|
26472 | },
|
26473 | source: "test.js"
|
26474 | },
|
26475 | body: [
|
26476 | {
|
26477 | type: "VariableDeclaration",
|
26478 | start: 0,
|
26479 | end: 10,
|
26480 | loc: {
|
26481 | start: {
|
26482 | line: 1,
|
26483 | column: 0
|
26484 | },
|
26485 | end: {
|
26486 | line: 1,
|
26487 | column: 10
|
26488 | },
|
26489 | source: "test.js"
|
26490 | },
|
26491 | declarations: [
|
26492 | {
|
26493 | type: "VariableDeclarator",
|
26494 | start: 4,
|
26495 | end: 9,
|
26496 | loc: {
|
26497 | start: {
|
26498 | line: 1,
|
26499 | column: 4
|
26500 | },
|
26501 | end: {
|
26502 | line: 1,
|
26503 | column: 9
|
26504 | },
|
26505 | source: "test.js"
|
26506 | },
|
26507 | id: {
|
26508 | type: "Identifier",
|
26509 | start: 4,
|
26510 | end: 5,
|
26511 | loc: {
|
26512 | start: {
|
26513 | line: 1,
|
26514 | column: 4
|
26515 | },
|
26516 | end: {
|
26517 | line: 1,
|
26518 | column: 5
|
26519 | },
|
26520 | source: "test.js"
|
26521 | },
|
26522 | name: "a"
|
26523 | },
|
26524 | init: {
|
26525 | type: "Literal",
|
26526 | start: 8,
|
26527 | end: 9,
|
26528 | loc: {
|
26529 | start: {
|
26530 | line: 1,
|
26531 | column: 8
|
26532 | },
|
26533 | end: {
|
26534 | line: 1,
|
26535 | column: 9
|
26536 | },
|
26537 | source: "test.js"
|
26538 | },
|
26539 | value: 1,
|
26540 | raw: "1"
|
26541 | }
|
26542 | }
|
26543 | ],
|
26544 | kind: "var"
|
26545 | }
|
26546 | ]
|
26547 | }, {
|
26548 | locations: true,
|
26549 | sourceFile: "test.js"
|
26550 | });
|
26551 |
|
26552 | test("a.in / b", {
|
26553 | type: "Program",
|
26554 | body: [
|
26555 | {
|
26556 | type: "ExpressionStatement",
|
26557 | expression: {
|
26558 | type: "BinaryExpression",
|
26559 | left: {
|
26560 | type: "MemberExpression",
|
26561 | object: {
|
26562 | type: "Identifier",
|
26563 | name: "a"
|
26564 | },
|
26565 | property: {
|
26566 | type: "Identifier",
|
26567 | name: "in"
|
26568 | },
|
26569 | computed: false
|
26570 | },
|
26571 | operator: "/",
|
26572 | right: {
|
26573 | type: "Identifier",
|
26574 | name: "b"
|
26575 | }
|
26576 | }
|
26577 | }
|
26578 | ]
|
26579 | });
|
26580 |
|
26581 | test("{}/=/", {
|
26582 | type: "Program",
|
26583 | body: [
|
26584 | {
|
26585 | type: "BlockStatement",
|
26586 | body: []
|
26587 | },
|
26588 | {
|
26589 | type: "ExpressionStatement",
|
26590 | expression: {
|
26591 | type: "Literal",
|
26592 | raw: "/=/"
|
26593 | }
|
26594 | }
|
26595 | ]
|
26596 | });
|
26597 |
|
26598 | test("foo <!--bar\n+baz", {
|
26599 | type: "Program",
|
26600 | start: 0,
|
26601 | end: 16,
|
26602 | body: [
|
26603 | {
|
26604 | type: "ExpressionStatement",
|
26605 | start: 0,
|
26606 | end: 16,
|
26607 | expression: {
|
26608 | type: "BinaryExpression",
|
26609 | start: 0,
|
26610 | end: 16,
|
26611 | left: {
|
26612 | type: "Identifier",
|
26613 | start: 0,
|
26614 | end: 3,
|
26615 | name: "foo"
|
26616 | },
|
26617 | operator: "+",
|
26618 | right: {
|
26619 | type: "Identifier",
|
26620 | start: 13,
|
26621 | end: 16,
|
26622 | name: "baz"
|
26623 | }
|
26624 | }
|
26625 | }
|
26626 | ]
|
26627 | });
|
26628 |
|
26629 | test("x = y-->10;\n --> nothing", {
|
26630 | type: "Program",
|
26631 | body: [
|
26632 | {
|
26633 | type: "ExpressionStatement",
|
26634 | expression: {
|
26635 | type: "AssignmentExpression",
|
26636 | operator: "=",
|
26637 | left: {
|
26638 | type: "Identifier",
|
26639 | name: "x"
|
26640 | },
|
26641 | right: {
|
26642 | type: "BinaryExpression",
|
26643 | left: {
|
26644 | type: "UpdateExpression",
|
26645 | operator: "--",
|
26646 | prefix: false,
|
26647 | argument: {
|
26648 | type: "Identifier",
|
26649 | name: "y"
|
26650 | }
|
26651 | },
|
26652 | operator: ">",
|
26653 | right: {
|
26654 | type: "Literal",
|
26655 | value: 10
|
26656 | }
|
26657 | }
|
26658 | }
|
26659 | }
|
26660 | ]
|
26661 | });
|
26662 |
|
26663 | test("'use strict';\nobject.static();", {
|
26664 | type: "Program",
|
26665 | body: [
|
26666 | {
|
26667 | type: "ExpressionStatement",
|
26668 | expression: {
|
26669 | type: "Literal",
|
26670 | value: "use strict",
|
26671 | raw: "'use strict'"
|
26672 | }
|
26673 | },
|
26674 | {
|
26675 | type: "ExpressionStatement",
|
26676 | expression: {
|
26677 | type: "CallExpression",
|
26678 | callee: {
|
26679 | type: "MemberExpression",
|
26680 | object: {
|
26681 | type: "Identifier",
|
26682 | name: "object"
|
26683 | },
|
26684 | property: {
|
26685 | type: "Identifier",
|
26686 | name: "static"
|
26687 | },
|
26688 | computed: false
|
26689 | },
|
26690 | arguments: []
|
26691 | }
|
26692 | }
|
26693 | ]
|
26694 | });
|
26695 |
|
26696 |
|
26697 |
|
26698 | testFail("{",
|
26699 | "Unexpected token (1:1)");
|
26700 |
|
26701 | testFail("}",
|
26702 | "Unexpected token (1:0)");
|
26703 |
|
26704 | testFail("3ea",
|
26705 | "Invalid number (1:0)");
|
26706 |
|
26707 | testFail("3in []",
|
26708 | "Identifier directly after number (1:1)");
|
26709 |
|
26710 | testFail("3e",
|
26711 | "Invalid number (1:0)");
|
26712 |
|
26713 | testFail("3e+",
|
26714 | "Invalid number (1:0)");
|
26715 |
|
26716 | testFail("3e-",
|
26717 | "Invalid number (1:0)");
|
26718 |
|
26719 | testFail("3x",
|
26720 | "Identifier directly after number (1:1)");
|
26721 |
|
26722 | testFail("3x0",
|
26723 | "Identifier directly after number (1:1)");
|
26724 |
|
26725 | testFail("0x",
|
26726 | "Expected hexadecimal number (1:2)");
|
26727 |
|
26728 | testFail("09",
|
26729 | "Invalid number (1:0)");
|
26730 |
|
26731 | testFail("018",
|
26732 | "Invalid number (1:0)");
|
26733 |
|
26734 | testFail("01a",
|
26735 | "Identifier directly after number (1:2)");
|
26736 |
|
26737 | testFail("3in[]",
|
26738 | "Identifier directly after number (1:1)");
|
26739 |
|
26740 | testFail("0x3in[]",
|
26741 | "Identifier directly after number (1:3)");
|
26742 |
|
26743 | testFail("\"Hello\nWorld\"",
|
26744 | "Unterminated string constant (1:0)");
|
26745 |
|
26746 | testFail("x\\",
|
26747 | "Expecting Unicode escape sequence \\uXXXX (1:2)");
|
26748 |
|
26749 | testFail("x\\u005c",
|
26750 | "Invalid Unicode escape (1:3)");
|
26751 |
|
26752 | testFail("x\\u002a",
|
26753 | "Invalid Unicode escape (1:3)");
|
26754 |
|
26755 | testFail("/",
|
26756 | "Unterminated regular expression (1:1)");
|
26757 |
|
26758 | testFail("/test",
|
26759 | "Unterminated regular expression (1:1)");
|
26760 |
|
26761 | testFail("var x = /[a-z]/\\ux",
|
26762 | "Bad character escape sequence (1:8)");
|
26763 |
|
26764 | testFail("3 = 4",
|
26765 | "Assigning to rvalue (1:0)");
|
26766 |
|
26767 | testFail("func() = 4",
|
26768 | "Assigning to rvalue (1:0)");
|
26769 |
|
26770 | testFail("(1 + 1) = 10",
|
26771 | "Assigning to rvalue (1:0)");
|
26772 |
|
26773 | testFail("1++",
|
26774 | "Assigning to rvalue (1:0)");
|
26775 |
|
26776 | testFail("1--",
|
26777 | "Assigning to rvalue (1:0)");
|
26778 |
|
26779 | testFail("++1",
|
26780 | "Assigning to rvalue (1:2)");
|
26781 |
|
26782 | testFail("--1",
|
26783 | "Assigning to rvalue (1:2)");
|
26784 |
|
26785 | testFail("for((1 + 1) in list) process(x);",
|
26786 | "Assigning to rvalue (1:4)");
|
26787 |
|
26788 | testFail("[",
|
26789 | "Unexpected token (1:1)");
|
26790 |
|
26791 | testFail("[,",
|
26792 | "Unexpected token (1:2)");
|
26793 |
|
26794 | testFail("1 + {",
|
26795 | "Unexpected token (1:5)");
|
26796 |
|
26797 | testFail("1 + { t:t ",
|
26798 | "Unexpected token (1:10)");
|
26799 |
|
26800 | testFail("1 + { t:t,",
|
26801 | "Unexpected token (1:10)");
|
26802 |
|
26803 | testFail("var x = /\n/",
|
26804 | "Unterminated regular expression (1:9)");
|
26805 |
|
26806 | testFail("var x = \"\n",
|
26807 | "Unterminated string constant (1:8)");
|
26808 |
|
26809 | testFail("var if = 42",
|
26810 | "Unexpected token (1:4)");
|
26811 |
|
26812 | testFail("i + 2 = 42",
|
26813 | "Assigning to rvalue (1:0)");
|
26814 |
|
26815 | testFail("+i = 42",
|
26816 | "Assigning to rvalue (1:0)");
|
26817 |
|
26818 | testFail("1 + (",
|
26819 | "Unexpected token (1:5)");
|
26820 |
|
26821 | testFail("\n\n\n{",
|
26822 | "Unexpected token (4:1)");
|
26823 |
|
26824 | testFail("\n/* Some multiline\ncomment */\n)",
|
26825 | "Unexpected token (4:0)");
|
26826 |
|
26827 | testFail("{ set 1 }",
|
26828 | "Unexpected token (1:6)");
|
26829 |
|
26830 | testFail("{ get 2 }",
|
26831 | "Unexpected token (1:6)");
|
26832 |
|
26833 | testFail("({ set: s(if) { } })",
|
26834 | "Unexpected token (1:10)");
|
26835 |
|
26836 | testFail("({ set s(.) { } })",
|
26837 | "Unexpected token (1:9)");
|
26838 |
|
26839 | testFail("({ set: s() { } })",
|
26840 | "Unexpected token (1:12)");
|
26841 |
|
26842 | testFail("({ set: s(a, b) { } })",
|
26843 | "Unexpected token (1:16)");
|
26844 |
|
26845 | testFail("({ get: g(d) { } })",
|
26846 | "Unexpected token (1:13)");
|
26847 |
|
26848 | testFail("({ get i() { }, i: 42 })",
|
26849 | "Redefinition of property (1:16)");
|
26850 |
|
26851 | testFail("({ i: 42, get i() { } })",
|
26852 | "Redefinition of property (1:14)");
|
26853 |
|
26854 | testFail("({ set i(x) { }, i: 42 })",
|
26855 | "Redefinition of property (1:17)");
|
26856 |
|
26857 | testFail("({ i: 42, set i(x) { } })",
|
26858 | "Redefinition of property (1:14)");
|
26859 |
|
26860 | testFail("({ get i() { }, get i() { } })",
|
26861 | "Redefinition of property (1:20)");
|
26862 |
|
26863 | testFail("({ set i(x) { }, set i(x) { } })",
|
26864 | "Redefinition of property (1:21)");
|
26865 |
|
26866 | testFail("function t(...) { }",
|
26867 | "Unexpected token (1:11)");
|
26868 |
|
26869 | testFail("function t(...) { }",
|
26870 | "Unexpected token (1:14)",
|
26871 | { ecmaVersion: 6 });
|
26872 |
|
26873 | testFail("function t(...rest, b) { }",
|
26874 | "Unexpected token (1:18)",
|
26875 | { ecmaVersion: 6 });
|
26876 |
|
26877 | testFail("function t(if) { }",
|
26878 | "Unexpected token (1:11)");
|
26879 |
|
26880 | testFail("function t(true) { }",
|
26881 | "Unexpected token (1:11)");
|
26882 |
|
26883 | testFail("function t(false) { }",
|
26884 | "Unexpected token (1:11)");
|
26885 |
|
26886 | testFail("function t(null) { }",
|
26887 | "Unexpected token (1:11)");
|
26888 |
|
26889 | testFail("function null() { }",
|
26890 | "Unexpected token (1:9)");
|
26891 |
|
26892 | testFail("function true() { }",
|
26893 | "Unexpected token (1:9)");
|
26894 |
|
26895 | testFail("function false() { }",
|
26896 | "Unexpected token (1:9)");
|
26897 |
|
26898 | testFail("function if() { }",
|
26899 | "Unexpected token (1:9)");
|
26900 |
|
26901 | testFail("a b;",
|
26902 | "Unexpected token (1:2)");
|
26903 |
|
26904 | testFail("if.a;",
|
26905 | "Unexpected token (1:2)");
|
26906 |
|
26907 | testFail("a if;",
|
26908 | "Unexpected token (1:2)");
|
26909 |
|
26910 | testFail("a class;",
|
26911 | "Unexpected token (1:2)");
|
26912 |
|
26913 | testFail("break\n",
|
26914 | "Unsyntactic break (1:0)");
|
26915 |
|
26916 | testFail("break 1;",
|
26917 | "Unexpected token (1:6)");
|
26918 |
|
26919 | testFail("continue\n",
|
26920 | "Unsyntactic continue (1:0)");
|
26921 |
|
26922 | testFail("continue 2;",
|
26923 | "Unexpected token (1:9)");
|
26924 |
|
26925 | testFail("throw",
|
26926 | "Unexpected token (1:5)");
|
26927 |
|
26928 | testFail("throw;",
|
26929 | "Unexpected token (1:5)");
|
26930 |
|
26931 | testFail("for (var i, i2 in {});",
|
26932 | "Unexpected token (1:15)");
|
26933 |
|
26934 | testFail("for ((i in {}));",
|
26935 | "Unexpected token (1:14)");
|
26936 |
|
26937 | testFail("for (i + 1 in {});",
|
26938 | "Assigning to rvalue (1:5)");
|
26939 |
|
26940 | testFail("for (+i in {});",
|
26941 | "Assigning to rvalue (1:5)");
|
26942 |
|
26943 | testFail("if(false)",
|
26944 | "Unexpected token (1:9)");
|
26945 |
|
26946 | testFail("if(false) doThis(); else",
|
26947 | "Unexpected token (1:24)");
|
26948 |
|
26949 | testFail("do",
|
26950 | "Unexpected token (1:2)");
|
26951 |
|
26952 | testFail("while(false)",
|
26953 | "Unexpected token (1:12)");
|
26954 |
|
26955 | testFail("for(;;)",
|
26956 | "Unexpected token (1:7)");
|
26957 |
|
26958 | testFail("with(x)",
|
26959 | "Unexpected token (1:7)");
|
26960 |
|
26961 | testFail("try { }",
|
26962 | "Missing catch or finally clause (1:0)");
|
26963 |
|
26964 | testFail("‿ = 10",
|
26965 | "Unexpected character '‿' (1:0)");
|
26966 |
|
26967 | testFail("if(true) let a = 1;",
|
26968 | "Unexpected token (1:13)");
|
26969 |
|
26970 | testFail("switch (c) { default: default: }",
|
26971 | "Multiple default clauses (1:22)");
|
26972 |
|
26973 | testFail("new X().\"s\"",
|
26974 | "Unexpected token (1:8)");
|
26975 |
|
26976 | testFail("/*",
|
26977 | "Unterminated comment (1:0)");
|
26978 |
|
26979 | testFail("/*\n\n\n",
|
26980 | "Unterminated comment (1:0)");
|
26981 |
|
26982 | testFail("/**",
|
26983 | "Unterminated comment (1:0)");
|
26984 |
|
26985 | testFail("/*\n\n*",
|
26986 | "Unterminated comment (1:0)");
|
26987 |
|
26988 | testFail("/*hello",
|
26989 | "Unterminated comment (1:0)");
|
26990 |
|
26991 | testFail("/*hello *",
|
26992 | "Unterminated comment (1:0)");
|
26993 |
|
26994 | testFail("\n]",
|
26995 | "Unexpected token (2:0)");
|
26996 |
|
26997 | testFail("\r]",
|
26998 | "Unexpected token (2:0)");
|
26999 |
|
27000 | testFail("\r\n]",
|
27001 | "Unexpected token (2:0)");
|
27002 |
|
27003 | testFail("\n\r]",
|
27004 | "Unexpected token (3:0)");
|
27005 |
|
27006 | testFail("//\r\n]",
|
27007 | "Unexpected token (2:0)");
|
27008 |
|
27009 | testFail("//\n\r]",
|
27010 | "Unexpected token (3:0)");
|
27011 |
|
27012 | testFail("/a\\\n/",
|
27013 | "Unterminated regular expression (1:1)");
|
27014 |
|
27015 | testFail("//\r \n]",
|
27016 | "Unexpected token (3:0)");
|
27017 |
|
27018 | testFail("/*\r\n*/]",
|
27019 | "Unexpected token (2:2)");
|
27020 |
|
27021 | testFail("/*\n\r*/]",
|
27022 | "Unexpected token (3:2)");
|
27023 |
|
27024 | testFail("/*\r \n*/]",
|
27025 | "Unexpected token (3:2)");
|
27026 |
|
27027 | testFail("\\\\",
|
27028 | "Expecting Unicode escape sequence \\uXXXX (1:1)");
|
27029 |
|
27030 | testFail("\\u005c",
|
27031 | "Invalid Unicode escape (1:2)");
|
27032 |
|
27033 | testFail("\\x",
|
27034 | "Expecting Unicode escape sequence \\uXXXX (1:1)");
|
27035 |
|
27036 | testFail("\\u0000",
|
27037 | "Invalid Unicode escape (1:2)");
|
27038 |
|
27039 | testFail(" = []",
|
27040 | "Unexpected character '' (1:0)");
|
27041 |
|
27042 | testFail(" = []",
|
27043 | "Unexpected character '' (1:0)");
|
27044 |
|
27045 | testFail("\"\\",
|
27046 | "Unterminated string constant (1:0)");
|
27047 |
|
27048 | testFail("\"\\u",
|
27049 | "Bad character escape sequence (1:0)");
|
27050 |
|
27051 | testFail("return",
|
27052 | "'return' outside of function (1:0)");
|
27053 |
|
27054 | testFail("break",
|
27055 | "Unsyntactic break (1:0)");
|
27056 |
|
27057 | testFail("continue",
|
27058 | "Unsyntactic continue (1:0)");
|
27059 |
|
27060 | testFail("switch (x) { default: continue; }",
|
27061 | "Unsyntactic continue (1:22)");
|
27062 |
|
27063 | testFail("do { x } *",
|
27064 | "Unexpected token (1:9)");
|
27065 |
|
27066 | testFail("while (true) { break x; }",
|
27067 | "Unsyntactic break (1:15)");
|
27068 |
|
27069 | testFail("while (true) { continue x; }",
|
27070 | "Unsyntactic continue (1:15)");
|
27071 |
|
27072 | testFail("x: while (true) { (function () { break x; }); }",
|
27073 | "Unsyntactic break (1:33)");
|
27074 |
|
27075 | testFail("x: while (true) { (function () { continue x; }); }",
|
27076 | "Unsyntactic continue (1:33)");
|
27077 |
|
27078 | testFail("x: while (true) { (function () { break; }); }",
|
27079 | "Unsyntactic break (1:33)");
|
27080 |
|
27081 | testFail("x: while (true) { (function () { continue; }); }",
|
27082 | "Unsyntactic continue (1:33)");
|
27083 |
|
27084 | testFail("x: while (true) { x: while (true) { } }",
|
27085 | "Label 'x' is already declared (1:18)");
|
27086 |
|
27087 | testFail("(function () { 'use strict'; delete i; }())",
|
27088 | "Deleting local variable in strict mode (1:29)");
|
27089 |
|
27090 | testFail("(function () { 'use strict'; with (i); }())",
|
27091 | "'with' in strict mode (1:29)");
|
27092 |
|
27093 | testFail("function hello() {'use strict'; ({ i: 42, i: 42 }) }",
|
27094 | "Redefinition of property (1:42)");
|
27095 |
|
27096 | testFail("function hello() {'use strict'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }",
|
27097 | "Redefinition of property (1:55)");
|
27098 |
|
27099 | testFail("function hello() {'use strict'; var eval = 10; }",
|
27100 | "Binding eval in strict mode (1:36)");
|
27101 |
|
27102 | testFail("function hello() {'use strict'; var arguments = 10; }",
|
27103 | "Binding arguments in strict mode (1:36)");
|
27104 |
|
27105 | testFail("function hello() {'use strict'; try { } catch (eval) { } }",
|
27106 | "Binding eval in strict mode (1:47)");
|
27107 |
|
27108 | testFail("function hello() {'use strict'; try { } catch (arguments) { } }",
|
27109 | "Binding arguments in strict mode (1:47)");
|
27110 |
|
27111 | testFail("function hello() {'use strict'; eval = 10; }",
|
27112 | "Assigning to eval in strict mode (1:32)");
|
27113 |
|
27114 | testFail("function hello() {'use strict'; arguments = 10; }",
|
27115 | "Assigning to arguments in strict mode (1:32)");
|
27116 |
|
27117 | testFail("function hello() {'use strict'; ++eval; }",
|
27118 | "Assigning to eval in strict mode (1:34)");
|
27119 |
|
27120 | testFail("function hello() {'use strict'; --eval; }",
|
27121 | "Assigning to eval in strict mode (1:34)");
|
27122 |
|
27123 | testFail("function hello() {'use strict'; ++arguments; }",
|
27124 | "Assigning to arguments in strict mode (1:34)");
|
27125 |
|
27126 | testFail("function hello() {'use strict'; --arguments; }",
|
27127 | "Assigning to arguments in strict mode (1:34)");
|
27128 |
|
27129 | testFail("function hello() {'use strict'; eval++; }",
|
27130 | "Assigning to eval in strict mode (1:32)");
|
27131 |
|
27132 | testFail("function hello() {'use strict'; eval--; }",
|
27133 | "Assigning to eval in strict mode (1:32)");
|
27134 |
|
27135 | testFail("function hello() {'use strict'; arguments++; }",
|
27136 | "Assigning to arguments in strict mode (1:32)");
|
27137 |
|
27138 | testFail("function hello() {'use strict'; arguments--; }",
|
27139 | "Assigning to arguments in strict mode (1:32)");
|
27140 |
|
27141 | testFail("function hello() {'use strict'; function eval() { } }",
|
27142 | "Defining 'eval' in strict mode (1:41)");
|
27143 |
|
27144 | testFail("function hello() {'use strict'; function arguments() { } }",
|
27145 | "Defining 'arguments' in strict mode (1:41)");
|
27146 |
|
27147 | testFail("function eval() {'use strict'; }",
|
27148 | "Defining 'eval' in strict mode (1:9)");
|
27149 |
|
27150 | testFail("function arguments() {'use strict'; }",
|
27151 | "Defining 'arguments' in strict mode (1:9)");
|
27152 |
|
27153 | testFail("function hello() {'use strict'; (function eval() { }()) }",
|
27154 | "Defining 'eval' in strict mode (1:42)");
|
27155 |
|
27156 | testFail("function hello() {'use strict'; (function arguments() { }()) }",
|
27157 | "Defining 'arguments' in strict mode (1:42)");
|
27158 |
|
27159 | testFail("(function eval() {'use strict'; })()",
|
27160 | "Defining 'eval' in strict mode (1:10)");
|
27161 |
|
27162 | testFail("(function arguments() {'use strict'; })()",
|
27163 | "Defining 'arguments' in strict mode (1:10)");
|
27164 |
|
27165 | testFail("function hello() {'use strict'; ({ s: function eval() { } }); }",
|
27166 | "Defining 'eval' in strict mode (1:47)");
|
27167 |
|
27168 | testFail("(function package() {'use strict'; })()",
|
27169 | "Defining 'package' in strict mode (1:10)");
|
27170 |
|
27171 | testFail("function hello() {'use strict'; ({ i: 10, set s(eval) { } }); }",
|
27172 | "Defining 'eval' in strict mode (1:48)");
|
27173 |
|
27174 | testFail("function hello() {'use strict'; ({ set s(eval) { } }); }",
|
27175 | "Defining 'eval' in strict mode (1:41)");
|
27176 |
|
27177 | testFail("function hello() {'use strict'; ({ s: function s(eval) { } }); }",
|
27178 | "Defining 'eval' in strict mode (1:49)");
|
27179 |
|
27180 | testFail("function hello(eval) {'use strict';}",
|
27181 | "Defining 'eval' in strict mode (1:15)");
|
27182 |
|
27183 | testFail("function hello(arguments) {'use strict';}",
|
27184 | "Defining 'arguments' in strict mode (1:15)");
|
27185 |
|
27186 | testFail("function hello() { 'use strict'; function inner(eval) {} }",
|
27187 | "Defining 'eval' in strict mode (1:48)");
|
27188 |
|
27189 | testFail("function hello() { 'use strict'; function inner(arguments) {} }",
|
27190 | "Defining 'arguments' in strict mode (1:48)");
|
27191 |
|
27192 | testFail("function hello() { 'use strict'; \"\\1\"; }",
|
27193 | "Octal literal in strict mode (1:34)");
|
27194 |
|
27195 | testFail("function hello() { 'use strict'; 021; }",
|
27196 | "Invalid number (1:33)");
|
27197 |
|
27198 | testFail("function hello() { 'use strict'; ({ \"\\1\": 42 }); }",
|
27199 | "Octal literal in strict mode (1:37)");
|
27200 |
|
27201 | testFail("function hello() { 'use strict'; ({ 021: 42 }); }",
|
27202 | "Invalid number (1:36)");
|
27203 |
|
27204 | testFail("function hello() { \"use strict\"; function inner() { \"octal directive\\1\"; } }",
|
27205 | "Octal literal in strict mode (1:68)");
|
27206 |
|
27207 | testFail("function hello() { \"use strict\"; var implements; }",
|
27208 | "The keyword 'implements' is reserved (1:37)");
|
27209 |
|
27210 | testFail("function hello() { \"use strict\"; var interface; }",
|
27211 | "The keyword 'interface' is reserved (1:37)");
|
27212 |
|
27213 | testFail("function hello() { \"use strict\"; var package; }",
|
27214 | "The keyword 'package' is reserved (1:37)");
|
27215 |
|
27216 | testFail("function hello() { \"use strict\"; var private; }",
|
27217 | "The keyword 'private' is reserved (1:37)");
|
27218 |
|
27219 | testFail("function hello() { \"use strict\"; var protected; }",
|
27220 | "The keyword 'protected' is reserved (1:37)");
|
27221 |
|
27222 | testFail("function hello() { \"use strict\"; var public; }",
|
27223 | "The keyword 'public' is reserved (1:37)");
|
27224 |
|
27225 | testFail("function hello() { \"use strict\"; var static; }",
|
27226 | "The keyword 'static' is reserved (1:37)");
|
27227 |
|
27228 | testFail("function hello(static) { \"use strict\"; }",
|
27229 | "Defining 'static' in strict mode (1:15)");
|
27230 |
|
27231 | testFail("function static() { \"use strict\"; }",
|
27232 | "Defining 'static' in strict mode (1:9)");
|
27233 |
|
27234 | testFail("\"use strict\"; function static() { }",
|
27235 | "The keyword 'static' is reserved (1:23)");
|
27236 |
|
27237 | testFail("function a(t, t) { \"use strict\"; }",
|
27238 | "Argument name clash in strict mode (1:14)");
|
27239 |
|
27240 | testFail("function a(eval) { \"use strict\"; }",
|
27241 | "Defining 'eval' in strict mode (1:11)");
|
27242 |
|
27243 | testFail("function a(package) { \"use strict\"; }",
|
27244 | "Defining 'package' in strict mode (1:11)");
|
27245 |
|
27246 | testFail("function a() { \"use strict\"; function b(t, t) { }; }",
|
27247 | "Argument name clash in strict mode (1:43)");
|
27248 |
|
27249 | testFail("(function a(t, t) { \"use strict\"; })",
|
27250 | "Argument name clash in strict mode (1:15)");
|
27251 |
|
27252 | testFail("function a() { \"use strict\"; (function b(t, t) { }); }",
|
27253 | "Argument name clash in strict mode (1:44)");
|
27254 |
|
27255 | testFail("(function a(eval) { \"use strict\"; })",
|
27256 | "Defining 'eval' in strict mode (1:12)");
|
27257 |
|
27258 | testFail("(function a(package) { \"use strict\"; })",
|
27259 | "Defining 'package' in strict mode (1:12)");
|
27260 |
|
27261 | testFail("var this = 10;", "Unexpected token (1:4)");
|
27262 |
|
27263 | testFail("throw\n10;", "Illegal newline after throw (1:5)");
|
27264 |
|
27265 |
|
27266 |
|
27267 |
|
27268 | testFail("const a;", "Unexpected token (1:6)");
|
27269 |
|
27270 | testFail("let x;", "Unexpected token (1:4)");
|
27271 |
|
27272 | testFail("const a = 1;", "Unexpected token (1:6)");
|
27273 |
|
27274 | testFail("let a = 1;", "Unexpected token (1:4)");
|
27275 |
|
27276 | testFail("for(const x = 0;;);", "Unexpected token (1:10)");
|
27277 |
|
27278 | testFail("for(let x = 0;;);", "Unexpected token (1:8)");
|
27279 |
|
27280 | test("let++", {
|
27281 | type: "Program",
|
27282 | start: 0,
|
27283 | end: 5,
|
27284 | loc: {
|
27285 | start: {
|
27286 | line: 1,
|
27287 | column: 0
|
27288 | },
|
27289 | end: {
|
27290 | line: 1,
|
27291 | column: 5
|
27292 | }
|
27293 | },
|
27294 | body: [
|
27295 | {
|
27296 | type: "ExpressionStatement",
|
27297 | start: 0,
|
27298 | end: 5,
|
27299 | loc: {
|
27300 | start: {
|
27301 | line: 1,
|
27302 | column: 0
|
27303 | },
|
27304 | end: {
|
27305 | line: 1,
|
27306 | column: 5
|
27307 | }
|
27308 | },
|
27309 | expression: {
|
27310 | type: "UpdateExpression",
|
27311 | start: 0,
|
27312 | end: 5,
|
27313 | loc: {
|
27314 | start: {
|
27315 | line: 1,
|
27316 | column: 0
|
27317 | },
|
27318 | end: {
|
27319 | line: 1,
|
27320 | column: 5
|
27321 | }
|
27322 | },
|
27323 | operator: "++",
|
27324 | prefix: false,
|
27325 | argument: {
|
27326 | type: "Identifier",
|
27327 | start: 0,
|
27328 | end: 3,
|
27329 | loc: {
|
27330 | start: {
|
27331 | line: 1,
|
27332 | column: 0
|
27333 | },
|
27334 | end: {
|
27335 | line: 1,
|
27336 | column: 3
|
27337 | }
|
27338 | },
|
27339 | name: "let"
|
27340 | }
|
27341 | }
|
27342 | }
|
27343 | ]
|
27344 | });
|
27345 |
|
27346 |
|
27347 |
|
27348 | test("let x", {
|
27349 | type: "Program",
|
27350 | body: [
|
27351 | {
|
27352 | type: "VariableDeclaration",
|
27353 | declarations: [
|
27354 | {
|
27355 | type: "VariableDeclarator",
|
27356 | id: {
|
27357 | type: "Identifier",
|
27358 | name: "x",
|
27359 | loc: {
|
27360 | start: {
|
27361 | line: 1,
|
27362 | column: 4
|
27363 | },
|
27364 | end: {
|
27365 | line: 1,
|
27366 | column: 5
|
27367 | }
|
27368 | }
|
27369 | },
|
27370 | init: null,
|
27371 | loc: {
|
27372 | start: {
|
27373 | line: 1,
|
27374 | column: 4
|
27375 | },
|
27376 | end: {
|
27377 | line: 1,
|
27378 | column: 5
|
27379 | }
|
27380 | }
|
27381 | }
|
27382 | ],
|
27383 | kind: "let",
|
27384 | loc: {
|
27385 | start: {
|
27386 | line: 1,
|
27387 | column: 0
|
27388 | },
|
27389 | end: {
|
27390 | line: 1,
|
27391 | column: 5
|
27392 | }
|
27393 | }
|
27394 | }
|
27395 | ],
|
27396 | loc: {
|
27397 | start: {
|
27398 | line: 1,
|
27399 | column: 0
|
27400 | },
|
27401 | end: {
|
27402 | line: 1,
|
27403 | column: 5
|
27404 | }
|
27405 | }
|
27406 | }, {ecmaVersion: 6, locations: true});
|
27407 |
|
27408 | test("let x, y;", {
|
27409 | type: "Program",
|
27410 | body: [
|
27411 | {
|
27412 | type: "VariableDeclaration",
|
27413 | declarations: [
|
27414 | {
|
27415 | type: "VariableDeclarator",
|
27416 | id: {
|
27417 | type: "Identifier",
|
27418 | name: "x",
|
27419 | loc: {
|
27420 | start: {
|
27421 | line: 1,
|
27422 | column: 4
|
27423 | },
|
27424 | end: {
|
27425 | line: 1,
|
27426 | column: 5
|
27427 | }
|
27428 | }
|
27429 | },
|
27430 | init: null,
|
27431 | loc: {
|
27432 | start: {
|
27433 | line: 1,
|
27434 | column: 4
|
27435 | },
|
27436 | end: {
|
27437 | line: 1,
|
27438 | column: 5
|
27439 | }
|
27440 | }
|
27441 | },
|
27442 | {
|
27443 | type: "VariableDeclarator",
|
27444 | id: {
|
27445 | type: "Identifier",
|
27446 | name: "y",
|
27447 | loc: {
|
27448 | start: {
|
27449 | line: 1,
|
27450 | column: 7
|
27451 | },
|
27452 | end: {
|
27453 | line: 1,
|
27454 | column: 8
|
27455 | }
|
27456 | }
|
27457 | },
|
27458 | init: null,
|
27459 | loc: {
|
27460 | start: {
|
27461 | line: 1,
|
27462 | column: 7
|
27463 | },
|
27464 | end: {
|
27465 | line: 1,
|
27466 | column: 8
|
27467 | }
|
27468 | }
|
27469 | }
|
27470 | ],
|
27471 | kind: "let",
|
27472 | loc: {
|
27473 | start: {
|
27474 | line: 1,
|
27475 | column: 0
|
27476 | },
|
27477 | end: {
|
27478 | line: 1,
|
27479 | column: 9
|
27480 | }
|
27481 | }
|
27482 | }
|
27483 | ],
|
27484 | loc: {
|
27485 | start: {
|
27486 | line: 1,
|
27487 | column: 0
|
27488 | },
|
27489 | end: {
|
27490 | line: 1,
|
27491 | column: 9
|
27492 | }
|
27493 | }
|
27494 | }, {ecmaVersion: 6, locations: true});
|
27495 |
|
27496 | test("let x = 42", {
|
27497 | type: "Program",
|
27498 | body: [
|
27499 | {
|
27500 | type: "VariableDeclaration",
|
27501 | declarations: [
|
27502 | {
|
27503 | type: "VariableDeclarator",
|
27504 | id: {
|
27505 | type: "Identifier",
|
27506 | name: "x",
|
27507 | loc: {
|
27508 | start: {
|
27509 | line: 1,
|
27510 | column: 4
|
27511 | },
|
27512 | end: {
|
27513 | line: 1,
|
27514 | column: 5
|
27515 | }
|
27516 | }
|
27517 | },
|
27518 | init: {
|
27519 | type: "Literal",
|
27520 | value: 42,
|
27521 | loc: {
|
27522 | start: {
|
27523 | line: 1,
|
27524 | column: 8
|
27525 | },
|
27526 | end: {
|
27527 | line: 1,
|
27528 | column: 10
|
27529 | }
|
27530 | }
|
27531 | },
|
27532 | loc: {
|
27533 | start: {
|
27534 | line: 1,
|
27535 | column: 4
|
27536 | },
|
27537 | end: {
|
27538 | line: 1,
|
27539 | column: 10
|
27540 | }
|
27541 | }
|
27542 | }
|
27543 | ],
|
27544 | kind: "let",
|
27545 | loc: {
|
27546 | start: {
|
27547 | line: 1,
|
27548 | column: 0
|
27549 | },
|
27550 | end: {
|
27551 | line: 1,
|
27552 | column: 10
|
27553 | }
|
27554 | }
|
27555 | }
|
27556 | ],
|
27557 | loc: {
|
27558 | start: {
|
27559 | line: 1,
|
27560 | column: 0
|
27561 | },
|
27562 | end: {
|
27563 | line: 1,
|
27564 | column: 10
|
27565 | }
|
27566 | }
|
27567 | }, {ecmaVersion: 6, locations: true});
|
27568 |
|
27569 | test("let eval = 42, arguments = 42", {
|
27570 | type: "Program",
|
27571 | body: [
|
27572 | {
|
27573 | type: "VariableDeclaration",
|
27574 | declarations: [
|
27575 | {
|
27576 | type: "VariableDeclarator",
|
27577 | id: {
|
27578 | type: "Identifier",
|
27579 | name: "eval",
|
27580 | loc: {
|
27581 | start: {
|
27582 | line: 1,
|
27583 | column: 4
|
27584 | },
|
27585 | end: {
|
27586 | line: 1,
|
27587 | column: 8
|
27588 | }
|
27589 | }
|
27590 | },
|
27591 | init: {
|
27592 | type: "Literal",
|
27593 | value: 42,
|
27594 | loc: {
|
27595 | start: {
|
27596 | line: 1,
|
27597 | column: 11
|
27598 | },
|
27599 | end: {
|
27600 | line: 1,
|
27601 | column: 13
|
27602 | }
|
27603 | }
|
27604 | },
|
27605 | loc: {
|
27606 | start: {
|
27607 | line: 1,
|
27608 | column: 4
|
27609 | },
|
27610 | end: {
|
27611 | line: 1,
|
27612 | column: 13
|
27613 | }
|
27614 | }
|
27615 | },
|
27616 | {
|
27617 | type: "VariableDeclarator",
|
27618 | id: {
|
27619 | type: "Identifier",
|
27620 | name: "arguments",
|
27621 | loc: {
|
27622 | start: {
|
27623 | line: 1,
|
27624 | column: 15
|
27625 | },
|
27626 | end: {
|
27627 | line: 1,
|
27628 | column: 24
|
27629 | }
|
27630 | }
|
27631 | },
|
27632 | init: {
|
27633 | type: "Literal",
|
27634 | value: 42,
|
27635 | loc: {
|
27636 | start: {
|
27637 | line: 1,
|
27638 | column: 27
|
27639 | },
|
27640 | end: {
|
27641 | line: 1,
|
27642 | column: 29
|
27643 | }
|
27644 | }
|
27645 | },
|
27646 | loc: {
|
27647 | start: {
|
27648 | line: 1,
|
27649 | column: 15
|
27650 | },
|
27651 | end: {
|
27652 | line: 1,
|
27653 | column: 29
|
27654 | }
|
27655 | }
|
27656 | }
|
27657 | ],
|
27658 | kind: "let",
|
27659 | loc: {
|
27660 | start: {
|
27661 | line: 1,
|
27662 | column: 0
|
27663 | },
|
27664 | end: {
|
27665 | line: 1,
|
27666 | column: 29
|
27667 | }
|
27668 | }
|
27669 | }
|
27670 | ],
|
27671 | loc: {
|
27672 | start: {
|
27673 | line: 1,
|
27674 | column: 0
|
27675 | },
|
27676 | end: {
|
27677 | line: 1,
|
27678 | column: 29
|
27679 | }
|
27680 | }
|
27681 | }, {ecmaVersion: 6, locations: true});
|
27682 |
|
27683 | test("let x = 14, y = 3, z = 1977", {
|
27684 | type: "Program",
|
27685 | body: [
|
27686 | {
|
27687 | type: "VariableDeclaration",
|
27688 | declarations: [
|
27689 | {
|
27690 | type: "VariableDeclarator",
|
27691 | id: {
|
27692 | type: "Identifier",
|
27693 | name: "x",
|
27694 | loc: {
|
27695 | start: {
|
27696 | line: 1,
|
27697 | column: 4
|
27698 | },
|
27699 | end: {
|
27700 | line: 1,
|
27701 | column: 5
|
27702 | }
|
27703 | }
|
27704 | },
|
27705 | init: {
|
27706 | type: "Literal",
|
27707 | value: 14,
|
27708 | loc: {
|
27709 | start: {
|
27710 | line: 1,
|
27711 | column: 8
|
27712 | },
|
27713 | end: {
|
27714 | line: 1,
|
27715 | column: 10
|
27716 | }
|
27717 | }
|
27718 | },
|
27719 | loc: {
|
27720 | start: {
|
27721 | line: 1,
|
27722 | column: 4
|
27723 | },
|
27724 | end: {
|
27725 | line: 1,
|
27726 | column: 10
|
27727 | }
|
27728 | }
|
27729 | },
|
27730 | {
|
27731 | type: "VariableDeclarator",
|
27732 | id: {
|
27733 | type: "Identifier",
|
27734 | name: "y",
|
27735 | loc: {
|
27736 | start: {
|
27737 | line: 1,
|
27738 | column: 12
|
27739 | },
|
27740 | end: {
|
27741 | line: 1,
|
27742 | column: 13
|
27743 | }
|
27744 | }
|
27745 | },
|
27746 | init: {
|
27747 | type: "Literal",
|
27748 | value: 3,
|
27749 | loc: {
|
27750 | start: {
|
27751 | line: 1,
|
27752 | column: 16
|
27753 | },
|
27754 | end: {
|
27755 | line: 1,
|
27756 | column: 17
|
27757 | }
|
27758 | }
|
27759 | },
|
27760 | loc: {
|
27761 | start: {
|
27762 | line: 1,
|
27763 | column: 12
|
27764 | },
|
27765 | end: {
|
27766 | line: 1,
|
27767 | column: 17
|
27768 | }
|
27769 | }
|
27770 | },
|
27771 | {
|
27772 | type: "VariableDeclarator",
|
27773 | id: {
|
27774 | type: "Identifier",
|
27775 | name: "z",
|
27776 | loc: {
|
27777 | start: {
|
27778 | line: 1,
|
27779 | column: 19
|
27780 | },
|
27781 | end: {
|
27782 | line: 1,
|
27783 | column: 20
|
27784 | }
|
27785 | }
|
27786 | },
|
27787 | init: {
|
27788 | type: "Literal",
|
27789 | value: 1977,
|
27790 | loc: {
|
27791 | start: {
|
27792 | line: 1,
|
27793 | column: 23
|
27794 | },
|
27795 | end: {
|
27796 | line: 1,
|
27797 | column: 27
|
27798 | }
|
27799 | }
|
27800 | },
|
27801 | loc: {
|
27802 | start: {
|
27803 | line: 1,
|
27804 | column: 19
|
27805 | },
|
27806 | end: {
|
27807 | line: 1,
|
27808 | column: 27
|
27809 | }
|
27810 | }
|
27811 | }
|
27812 | ],
|
27813 | kind: "let",
|
27814 | loc: {
|
27815 | start: {
|
27816 | line: 1,
|
27817 | column: 0
|
27818 | },
|
27819 | end: {
|
27820 | line: 1,
|
27821 | column: 27
|
27822 | }
|
27823 | }
|
27824 | }
|
27825 | ],
|
27826 | loc: {
|
27827 | start: {
|
27828 | line: 1,
|
27829 | column: 0
|
27830 | },
|
27831 | end: {
|
27832 | line: 1,
|
27833 | column: 27
|
27834 | }
|
27835 | }
|
27836 | }, {ecmaVersion: 6, locations: true});
|
27837 |
|
27838 | test("for(let x = 0;;);", {
|
27839 | type: "Program",
|
27840 | body: [
|
27841 | {
|
27842 | type: "ForStatement",
|
27843 | init: {
|
27844 | type: "VariableDeclaration",
|
27845 | declarations: [
|
27846 | {
|
27847 | type: "VariableDeclarator",
|
27848 | id: {
|
27849 | type: "Identifier",
|
27850 | name: "x",
|
27851 | loc: {
|
27852 | start: {
|
27853 | line: 1,
|
27854 | column: 8
|
27855 | },
|
27856 | end: {
|
27857 | line: 1,
|
27858 | column: 9
|
27859 | }
|
27860 | }
|
27861 | },
|
27862 | init: {
|
27863 | type: "Literal",
|
27864 | value: 0,
|
27865 | loc: {
|
27866 | start: {
|
27867 | line: 1,
|
27868 | column: 12
|
27869 | },
|
27870 | end: {
|
27871 | line: 1,
|
27872 | column: 13
|
27873 | }
|
27874 | }
|
27875 | },
|
27876 | loc: {
|
27877 | start: {
|
27878 | line: 1,
|
27879 | column: 8
|
27880 | },
|
27881 | end: {
|
27882 | line: 1,
|
27883 | column: 13
|
27884 | }
|
27885 | }
|
27886 | }
|
27887 | ],
|
27888 | kind: "let",
|
27889 | loc: {
|
27890 | start: {
|
27891 | line: 1,
|
27892 | column: 4
|
27893 | },
|
27894 | end: {
|
27895 | line: 1,
|
27896 | column: 13
|
27897 | }
|
27898 | }
|
27899 | },
|
27900 | test: null,
|
27901 | update: null,
|
27902 | body: {
|
27903 | type: "EmptyStatement",
|
27904 | loc: {
|
27905 | start: {
|
27906 | line: 1,
|
27907 | column: 16
|
27908 | },
|
27909 | end: {
|
27910 | line: 1,
|
27911 | column: 17
|
27912 | }
|
27913 | }
|
27914 | },
|
27915 | loc: {
|
27916 | start: {
|
27917 | line: 1,
|
27918 | column: 0
|
27919 | },
|
27920 | end: {
|
27921 | line: 1,
|
27922 | column: 17
|
27923 | }
|
27924 | }
|
27925 | }
|
27926 | ],
|
27927 | loc: {
|
27928 | start: {
|
27929 | line: 1,
|
27930 | column: 0
|
27931 | },
|
27932 | end: {
|
27933 | line: 1,
|
27934 | column: 17
|
27935 | }
|
27936 | }
|
27937 | }, {ecmaVersion: 6, locations: true});
|
27938 |
|
27939 | test("for(let x = 0, y = 1;;);", {
|
27940 | type: "Program",
|
27941 | body: [
|
27942 | {
|
27943 | type: "ForStatement",
|
27944 | init: {
|
27945 | type: "VariableDeclaration",
|
27946 | declarations: [
|
27947 | {
|
27948 | type: "VariableDeclarator",
|
27949 | id: {
|
27950 | type: "Identifier",
|
27951 | name: "x",
|
27952 | loc: {
|
27953 | start: {
|
27954 | line: 1,
|
27955 | column: 8
|
27956 | },
|
27957 | end: {
|
27958 | line: 1,
|
27959 | column: 9
|
27960 | }
|
27961 | }
|
27962 | },
|
27963 | init: {
|
27964 | type: "Literal",
|
27965 | value: 0,
|
27966 | loc: {
|
27967 | start: {
|
27968 | line: 1,
|
27969 | column: 12
|
27970 | },
|
27971 | end: {
|
27972 | line: 1,
|
27973 | column: 13
|
27974 | }
|
27975 | }
|
27976 | },
|
27977 | loc: {
|
27978 | start: {
|
27979 | line: 1,
|
27980 | column: 8
|
27981 | },
|
27982 | end: {
|
27983 | line: 1,
|
27984 | column: 13
|
27985 | }
|
27986 | }
|
27987 | },
|
27988 | {
|
27989 | type: "VariableDeclarator",
|
27990 | id: {
|
27991 | type: "Identifier",
|
27992 | name: "y",
|
27993 | loc: {
|
27994 | start: {
|
27995 | line: 1,
|
27996 | column: 15
|
27997 | },
|
27998 | end: {
|
27999 | line: 1,
|
28000 | column: 16
|
28001 | }
|
28002 | }
|
28003 | },
|
28004 | init: {
|
28005 | type: "Literal",
|
28006 | value: 1,
|
28007 | loc: {
|
28008 | start: {
|
28009 | line: 1,
|
28010 | column: 19
|
28011 | },
|
28012 | end: {
|
28013 | line: 1,
|
28014 | column: 20
|
28015 | }
|
28016 | }
|
28017 | },
|
28018 | loc: {
|
28019 | start: {
|
28020 | line: 1,
|
28021 | column: 15
|
28022 | },
|
28023 | end: {
|
28024 | line: 1,
|
28025 | column: 20
|
28026 | }
|
28027 | }
|
28028 | }
|
28029 | ],
|
28030 | kind: "let",
|
28031 | loc: {
|
28032 | start: {
|
28033 | line: 1,
|
28034 | column: 4
|
28035 | },
|
28036 | end: {
|
28037 | line: 1,
|
28038 | column: 20
|
28039 | }
|
28040 | }
|
28041 | },
|
28042 | test: null,
|
28043 | update: null,
|
28044 | body: {
|
28045 | type: "EmptyStatement",
|
28046 | loc: {
|
28047 | start: {
|
28048 | line: 1,
|
28049 | column: 23
|
28050 | },
|
28051 | end: {
|
28052 | line: 1,
|
28053 | column: 24
|
28054 | }
|
28055 | }
|
28056 | },
|
28057 | loc: {
|
28058 | start: {
|
28059 | line: 1,
|
28060 | column: 0
|
28061 | },
|
28062 | end: {
|
28063 | line: 1,
|
28064 | column: 24
|
28065 | }
|
28066 | }
|
28067 | }
|
28068 | ],
|
28069 | loc: {
|
28070 | start: {
|
28071 | line: 1,
|
28072 | column: 0
|
28073 | },
|
28074 | end: {
|
28075 | line: 1,
|
28076 | column: 24
|
28077 | }
|
28078 | }
|
28079 | }, {ecmaVersion: 6, locations: true});
|
28080 |
|
28081 | test("for (let x in list) process(x);", {
|
28082 | type: "Program",
|
28083 | body: [
|
28084 | {
|
28085 | type: "ForInStatement",
|
28086 | left: {
|
28087 | type: "VariableDeclaration",
|
28088 | declarations: [
|
28089 | {
|
28090 | type: "VariableDeclarator",
|
28091 | id: {
|
28092 | type: "Identifier",
|
28093 | name: "x",
|
28094 | loc: {
|
28095 | start: {
|
28096 | line: 1,
|
28097 | column: 9
|
28098 | },
|
28099 | end: {
|
28100 | line: 1,
|
28101 | column: 10
|
28102 | }
|
28103 | }
|
28104 | },
|
28105 | init: null,
|
28106 | loc: {
|
28107 | start: {
|
28108 | line: 1,
|
28109 | column: 9
|
28110 | },
|
28111 | end: {
|
28112 | line: 1,
|
28113 | column: 10
|
28114 | }
|
28115 | }
|
28116 | }
|
28117 | ],
|
28118 | kind: "let",
|
28119 | loc: {
|
28120 | start: {
|
28121 | line: 1,
|
28122 | column: 5
|
28123 | },
|
28124 | end: {
|
28125 | line: 1,
|
28126 | column: 10
|
28127 | }
|
28128 | }
|
28129 | },
|
28130 | right: {
|
28131 | type: "Identifier",
|
28132 | name: "list",
|
28133 | loc: {
|
28134 | start: {
|
28135 | line: 1,
|
28136 | column: 14
|
28137 | },
|
28138 | end: {
|
28139 | line: 1,
|
28140 | column: 18
|
28141 | }
|
28142 | }
|
28143 | },
|
28144 | body: {
|
28145 | type: "ExpressionStatement",
|
28146 | expression: {
|
28147 | type: "CallExpression",
|
28148 | callee: {
|
28149 | type: "Identifier",
|
28150 | name: "process",
|
28151 | loc: {
|
28152 | start: {
|
28153 | line: 1,
|
28154 | column: 20
|
28155 | },
|
28156 | end: {
|
28157 | line: 1,
|
28158 | column: 27
|
28159 | }
|
28160 | }
|
28161 | },
|
28162 | arguments: [
|
28163 | {
|
28164 | type: "Identifier",
|
28165 | name: "x",
|
28166 | loc: {
|
28167 | start: {
|
28168 | line: 1,
|
28169 | column: 28
|
28170 | },
|
28171 | end: {
|
28172 | line: 1,
|
28173 | column: 29
|
28174 | }
|
28175 | }
|
28176 | }
|
28177 | ],
|
28178 | loc: {
|
28179 | start: {
|
28180 | line: 1,
|
28181 | column: 20
|
28182 | },
|
28183 | end: {
|
28184 | line: 1,
|
28185 | column: 30
|
28186 | }
|
28187 | }
|
28188 | },
|
28189 | loc: {
|
28190 | start: {
|
28191 | line: 1,
|
28192 | column: 20
|
28193 | },
|
28194 | end: {
|
28195 | line: 1,
|
28196 | column: 31
|
28197 | }
|
28198 | }
|
28199 | },
|
28200 | loc: {
|
28201 | start: {
|
28202 | line: 1,
|
28203 | column: 0
|
28204 | },
|
28205 | end: {
|
28206 | line: 1,
|
28207 | column: 31
|
28208 | }
|
28209 | }
|
28210 | }
|
28211 | ],
|
28212 | loc: {
|
28213 | start: {
|
28214 | line: 1,
|
28215 | column: 0
|
28216 | },
|
28217 | end: {
|
28218 | line: 1,
|
28219 | column: 31
|
28220 | }
|
28221 | }
|
28222 | }, {ecmaVersion: 6, locations: true});
|
28223 |
|
28224 | test("for (let x = 42 in list) process(x);", {
|
28225 | type: "Program",
|
28226 | body: [
|
28227 | {
|
28228 | type: "ForInStatement",
|
28229 | left: {
|
28230 | type: "VariableDeclaration",
|
28231 | declarations: [
|
28232 | {
|
28233 | type: "VariableDeclarator",
|
28234 | id: {
|
28235 | type: "Identifier",
|
28236 | name: "x",
|
28237 | loc: {
|
28238 | start: {
|
28239 | line: 1,
|
28240 | column: 9
|
28241 | },
|
28242 | end: {
|
28243 | line: 1,
|
28244 | column: 10
|
28245 | }
|
28246 | }
|
28247 | },
|
28248 | init: {
|
28249 | type: "Literal",
|
28250 | value: 42,
|
28251 | loc: {
|
28252 | start: {
|
28253 | line: 1,
|
28254 | column: 13
|
28255 | },
|
28256 | end: {
|
28257 | line: 1,
|
28258 | column: 15
|
28259 | }
|
28260 | }
|
28261 | },
|
28262 | loc: {
|
28263 | start: {
|
28264 | line: 1,
|
28265 | column: 9
|
28266 | },
|
28267 | end: {
|
28268 | line: 1,
|
28269 | column: 15
|
28270 | }
|
28271 | }
|
28272 | }
|
28273 | ],
|
28274 | kind: "let",
|
28275 | loc: {
|
28276 | start: {
|
28277 | line: 1,
|
28278 | column: 5
|
28279 | },
|
28280 | end: {
|
28281 | line: 1,
|
28282 | column: 15
|
28283 | }
|
28284 | }
|
28285 | },
|
28286 | right: {
|
28287 | type: "Identifier",
|
28288 | name: "list",
|
28289 | loc: {
|
28290 | start: {
|
28291 | line: 1,
|
28292 | column: 19
|
28293 | },
|
28294 | end: {
|
28295 | line: 1,
|
28296 | column: 23
|
28297 | }
|
28298 | }
|
28299 | },
|
28300 | body: {
|
28301 | type: "ExpressionStatement",
|
28302 | expression: {
|
28303 | type: "CallExpression",
|
28304 | callee: {
|
28305 | type: "Identifier",
|
28306 | name: "process",
|
28307 | loc: {
|
28308 | start: {
|
28309 | line: 1,
|
28310 | column: 25
|
28311 | },
|
28312 | end: {
|
28313 | line: 1,
|
28314 | column: 32
|
28315 | }
|
28316 | }
|
28317 | },
|
28318 | arguments: [
|
28319 | {
|
28320 | type: "Identifier",
|
28321 | name: "x",
|
28322 | loc: {
|
28323 | start: {
|
28324 | line: 1,
|
28325 | column: 33
|
28326 | },
|
28327 | end: {
|
28328 | line: 1,
|
28329 | column: 34
|
28330 | }
|
28331 | }
|
28332 | }
|
28333 | ],
|
28334 | loc: {
|
28335 | start: {
|
28336 | line: 1,
|
28337 | column: 25
|
28338 | },
|
28339 | end: {
|
28340 | line: 1,
|
28341 | column: 35
|
28342 | }
|
28343 | }
|
28344 | },
|
28345 | loc: {
|
28346 | start: {
|
28347 | line: 1,
|
28348 | column: 25
|
28349 | },
|
28350 | end: {
|
28351 | line: 1,
|
28352 | column: 36
|
28353 | }
|
28354 | }
|
28355 | },
|
28356 | loc: {
|
28357 | start: {
|
28358 | line: 1,
|
28359 | column: 0
|
28360 | },
|
28361 | end: {
|
28362 | line: 1,
|
28363 | column: 36
|
28364 | }
|
28365 | }
|
28366 | }
|
28367 | ],
|
28368 | loc: {
|
28369 | start: {
|
28370 | line: 1,
|
28371 | column: 0
|
28372 | },
|
28373 | end: {
|
28374 | line: 1,
|
28375 | column: 36
|
28376 | }
|
28377 | }
|
28378 | }, {ecmaVersion: 6, locations: true});
|
28379 |
|
28380 | test("for (let i = function() { return 10 in [] } in list) process(x);", {
|
28381 | type: "Program",
|
28382 | body: [
|
28383 | {
|
28384 | type: "ForInStatement",
|
28385 | left: {
|
28386 | type: "VariableDeclaration",
|
28387 | declarations: [
|
28388 | {
|
28389 | type: "VariableDeclarator",
|
28390 | id: {
|
28391 | type: "Identifier",
|
28392 | name: "i",
|
28393 | loc: {
|
28394 | start: {
|
28395 | line: 1,
|
28396 | column: 9
|
28397 | },
|
28398 | end: {
|
28399 | line: 1,
|
28400 | column: 10
|
28401 | }
|
28402 | }
|
28403 | },
|
28404 | init: {
|
28405 | type: "FunctionExpression",
|
28406 | id: null,
|
28407 | params: [],
|
28408 | body: {
|
28409 | type: "BlockStatement",
|
28410 | body: [
|
28411 | {
|
28412 | type: "ReturnStatement",
|
28413 | argument: {
|
28414 | type: "BinaryExpression",
|
28415 | left: {
|
28416 | type: "Literal",
|
28417 | value: 10,
|
28418 | loc: {
|
28419 | start: {
|
28420 | line: 1,
|
28421 | column: 33
|
28422 | },
|
28423 | end: {
|
28424 | line: 1,
|
28425 | column: 35
|
28426 | }
|
28427 | }
|
28428 | },
|
28429 | operator: "in",
|
28430 | right: {
|
28431 | type: "ArrayExpression",
|
28432 | elements: [],
|
28433 | loc: {
|
28434 | start: {
|
28435 | line: 1,
|
28436 | column: 39
|
28437 | },
|
28438 | end: {
|
28439 | line: 1,
|
28440 | column: 41
|
28441 | }
|
28442 | }
|
28443 | },
|
28444 | loc: {
|
28445 | start: {
|
28446 | line: 1,
|
28447 | column: 33
|
28448 | },
|
28449 | end: {
|
28450 | line: 1,
|
28451 | column: 41
|
28452 | }
|
28453 | }
|
28454 | },
|
28455 | loc: {
|
28456 | start: {
|
28457 | line: 1,
|
28458 | column: 26
|
28459 | },
|
28460 | end: {
|
28461 | line: 1,
|
28462 | column: 41
|
28463 | }
|
28464 | }
|
28465 | }
|
28466 | ],
|
28467 | loc: {
|
28468 | start: {
|
28469 | line: 1,
|
28470 | column: 24
|
28471 | },
|
28472 | end: {
|
28473 | line: 1,
|
28474 | column: 43
|
28475 | }
|
28476 | }
|
28477 | },
|
28478 | loc: {
|
28479 | start: {
|
28480 | line: 1,
|
28481 | column: 13
|
28482 | },
|
28483 | end: {
|
28484 | line: 1,
|
28485 | column: 43
|
28486 | }
|
28487 | }
|
28488 | },
|
28489 | loc: {
|
28490 | start: {
|
28491 | line: 1,
|
28492 | column: 9
|
28493 | },
|
28494 | end: {
|
28495 | line: 1,
|
28496 | column: 43
|
28497 | }
|
28498 | }
|
28499 | }
|
28500 | ],
|
28501 | kind: "let",
|
28502 | loc: {
|
28503 | start: {
|
28504 | line: 1,
|
28505 | column: 5
|
28506 | },
|
28507 | end: {
|
28508 | line: 1,
|
28509 | column: 43
|
28510 | }
|
28511 | }
|
28512 | },
|
28513 | right: {
|
28514 | type: "Identifier",
|
28515 | name: "list",
|
28516 | loc: {
|
28517 | start: {
|
28518 | line: 1,
|
28519 | column: 47
|
28520 | },
|
28521 | end: {
|
28522 | line: 1,
|
28523 | column: 51
|
28524 | }
|
28525 | }
|
28526 | },
|
28527 | body: {
|
28528 | type: "ExpressionStatement",
|
28529 | expression: {
|
28530 | type: "CallExpression",
|
28531 | callee: {
|
28532 | type: "Identifier",
|
28533 | name: "process",
|
28534 | loc: {
|
28535 | start: {
|
28536 | line: 1,
|
28537 | column: 53
|
28538 | },
|
28539 | end: {
|
28540 | line: 1,
|
28541 | column: 60
|
28542 | }
|
28543 | }
|
28544 | },
|
28545 | arguments: [
|
28546 | {
|
28547 | type: "Identifier",
|
28548 | name: "x",
|
28549 | loc: {
|
28550 | start: {
|
28551 | line: 1,
|
28552 | column: 61
|
28553 | },
|
28554 | end: {
|
28555 | line: 1,
|
28556 | column: 62
|
28557 | }
|
28558 | }
|
28559 | }
|
28560 | ],
|
28561 | loc: {
|
28562 | start: {
|
28563 | line: 1,
|
28564 | column: 53
|
28565 | },
|
28566 | end: {
|
28567 | line: 1,
|
28568 | column: 63
|
28569 | }
|
28570 | }
|
28571 | },
|
28572 | loc: {
|
28573 | start: {
|
28574 | line: 1,
|
28575 | column: 53
|
28576 | },
|
28577 | end: {
|
28578 | line: 1,
|
28579 | column: 64
|
28580 | }
|
28581 | }
|
28582 | },
|
28583 | loc: {
|
28584 | start: {
|
28585 | line: 1,
|
28586 | column: 0
|
28587 | },
|
28588 | end: {
|
28589 | line: 1,
|
28590 | column: 64
|
28591 | }
|
28592 | }
|
28593 | }
|
28594 | ],
|
28595 | loc: {
|
28596 | start: {
|
28597 | line: 1,
|
28598 | column: 0
|
28599 | },
|
28600 | end: {
|
28601 | line: 1,
|
28602 | column: 64
|
28603 | }
|
28604 | }
|
28605 | }, {ecmaVersion: 6, locations: true});
|
28606 |
|
28607 | test("const x = 42", {
|
28608 | type: "Program",
|
28609 | body: [
|
28610 | {
|
28611 | type: "VariableDeclaration",
|
28612 | declarations: [
|
28613 | {
|
28614 | type: "VariableDeclarator",
|
28615 | id: {
|
28616 | type: "Identifier",
|
28617 | name: "x",
|
28618 | loc: {
|
28619 | start: {
|
28620 | line: 1,
|
28621 | column: 6
|
28622 | },
|
28623 | end: {
|
28624 | line: 1,
|
28625 | column: 7
|
28626 | }
|
28627 | }
|
28628 | },
|
28629 | init: {
|
28630 | type: "Literal",
|
28631 | value: 42,
|
28632 | loc: {
|
28633 | start: {
|
28634 | line: 1,
|
28635 | column: 10
|
28636 | },
|
28637 | end: {
|
28638 | line: 1,
|
28639 | column: 12
|
28640 | }
|
28641 | }
|
28642 | },
|
28643 | loc: {
|
28644 | start: {
|
28645 | line: 1,
|
28646 | column: 6
|
28647 | },
|
28648 | end: {
|
28649 | line: 1,
|
28650 | column: 12
|
28651 | }
|
28652 | }
|
28653 | }
|
28654 | ],
|
28655 | kind: "const",
|
28656 | loc: {
|
28657 | start: {
|
28658 | line: 1,
|
28659 | column: 0
|
28660 | },
|
28661 | end: {
|
28662 | line: 1,
|
28663 | column: 12
|
28664 | }
|
28665 | }
|
28666 | }
|
28667 | ],
|
28668 | loc: {
|
28669 | start: {
|
28670 | line: 1,
|
28671 | column: 0
|
28672 | },
|
28673 | end: {
|
28674 | line: 1,
|
28675 | column: 12
|
28676 | }
|
28677 | }
|
28678 | }, {ecmaVersion: 6, locations: true});
|
28679 |
|
28680 | test("const eval = 42, arguments = 42", {
|
28681 | type: "Program",
|
28682 | body: [
|
28683 | {
|
28684 | type: "VariableDeclaration",
|
28685 | declarations: [
|
28686 | {
|
28687 | type: "VariableDeclarator",
|
28688 | id: {
|
28689 | type: "Identifier",
|
28690 | name: "eval",
|
28691 | loc: {
|
28692 | start: {
|
28693 | line: 1,
|
28694 | column: 6
|
28695 | },
|
28696 | end: {
|
28697 | line: 1,
|
28698 | column: 10
|
28699 | }
|
28700 | }
|
28701 | },
|
28702 | init: {
|
28703 | type: "Literal",
|
28704 | value: 42,
|
28705 | loc: {
|
28706 | start: {
|
28707 | line: 1,
|
28708 | column: 13
|
28709 | },
|
28710 | end: {
|
28711 | line: 1,
|
28712 | column: 15
|
28713 | }
|
28714 | }
|
28715 | },
|
28716 | loc: {
|
28717 | start: {
|
28718 | line: 1,
|
28719 | column: 6
|
28720 | },
|
28721 | end: {
|
28722 | line: 1,
|
28723 | column: 15
|
28724 | }
|
28725 | }
|
28726 | },
|
28727 | {
|
28728 | type: "VariableDeclarator",
|
28729 | id: {
|
28730 | type: "Identifier",
|
28731 | name: "arguments",
|
28732 | loc: {
|
28733 | start: {
|
28734 | line: 1,
|
28735 | column: 17
|
28736 | },
|
28737 | end: {
|
28738 | line: 1,
|
28739 | column: 26
|
28740 | }
|
28741 | }
|
28742 | },
|
28743 | init: {
|
28744 | type: "Literal",
|
28745 | value: 42,
|
28746 | loc: {
|
28747 | start: {
|
28748 | line: 1,
|
28749 | column: 29
|
28750 | },
|
28751 | end: {
|
28752 | line: 1,
|
28753 | column: 31
|
28754 | }
|
28755 | }
|
28756 | },
|
28757 | loc: {
|
28758 | start: {
|
28759 | line: 1,
|
28760 | column: 17
|
28761 | },
|
28762 | end: {
|
28763 | line: 1,
|
28764 | column: 31
|
28765 | }
|
28766 | }
|
28767 | }
|
28768 | ],
|
28769 | kind: "const",
|
28770 | loc: {
|
28771 | start: {
|
28772 | line: 1,
|
28773 | column: 0
|
28774 | },
|
28775 | end: {
|
28776 | line: 1,
|
28777 | column: 31
|
28778 | }
|
28779 | }
|
28780 | }
|
28781 | ],
|
28782 | loc: {
|
28783 | start: {
|
28784 | line: 1,
|
28785 | column: 0
|
28786 | },
|
28787 | end: {
|
28788 | line: 1,
|
28789 | column: 31
|
28790 | }
|
28791 | }
|
28792 | }, {ecmaVersion: 6, locations: true});
|
28793 |
|
28794 | test("const x = 14, y = 3, z = 1977", {
|
28795 | type: "Program",
|
28796 | body: [
|
28797 | {
|
28798 | type: "VariableDeclaration",
|
28799 | declarations: [
|
28800 | {
|
28801 | type: "VariableDeclarator",
|
28802 | id: {
|
28803 | type: "Identifier",
|
28804 | name: "x",
|
28805 | loc: {
|
28806 | start: {
|
28807 | line: 1,
|
28808 | column: 6
|
28809 | },
|
28810 | end: {
|
28811 | line: 1,
|
28812 | column: 7
|
28813 | }
|
28814 | }
|
28815 | },
|
28816 | init: {
|
28817 | type: "Literal",
|
28818 | value: 14,
|
28819 | loc: {
|
28820 | start: {
|
28821 | line: 1,
|
28822 | column: 10
|
28823 | },
|
28824 | end: {
|
28825 | line: 1,
|
28826 | column: 12
|
28827 | }
|
28828 | }
|
28829 | },
|
28830 | loc: {
|
28831 | start: {
|
28832 | line: 1,
|
28833 | column: 6
|
28834 | },
|
28835 | end: {
|
28836 | line: 1,
|
28837 | column: 12
|
28838 | }
|
28839 | }
|
28840 | },
|
28841 | {
|
28842 | type: "VariableDeclarator",
|
28843 | id: {
|
28844 | type: "Identifier",
|
28845 | name: "y",
|
28846 | loc: {
|
28847 | start: {
|
28848 | line: 1,
|
28849 | column: 14
|
28850 | },
|
28851 | end: {
|
28852 | line: 1,
|
28853 | column: 15
|
28854 | }
|
28855 | }
|
28856 | },
|
28857 | init: {
|
28858 | type: "Literal",
|
28859 | value: 3,
|
28860 | loc: {
|
28861 | start: {
|
28862 | line: 1,
|
28863 | column: 18
|
28864 | },
|
28865 | end: {
|
28866 | line: 1,
|
28867 | column: 19
|
28868 | }
|
28869 | }
|
28870 | },
|
28871 | loc: {
|
28872 | start: {
|
28873 | line: 1,
|
28874 | column: 14
|
28875 | },
|
28876 | end: {
|
28877 | line: 1,
|
28878 | column: 19
|
28879 | }
|
28880 | }
|
28881 | },
|
28882 | {
|
28883 | type: "VariableDeclarator",
|
28884 | id: {
|
28885 | type: "Identifier",
|
28886 | name: "z",
|
28887 | loc: {
|
28888 | start: {
|
28889 | line: 1,
|
28890 | column: 21
|
28891 | },
|
28892 | end: {
|
28893 | line: 1,
|
28894 | column: 22
|
28895 | }
|
28896 | }
|
28897 | },
|
28898 | init: {
|
28899 | type: "Literal",
|
28900 | value: 1977,
|
28901 | loc: {
|
28902 | start: {
|
28903 | line: 1,
|
28904 | column: 25
|
28905 | },
|
28906 | end: {
|
28907 | line: 1,
|
28908 | column: 29
|
28909 | }
|
28910 | }
|
28911 | },
|
28912 | loc: {
|
28913 | start: {
|
28914 | line: 1,
|
28915 | column: 21
|
28916 | },
|
28917 | end: {
|
28918 | line: 1,
|
28919 | column: 29
|
28920 | }
|
28921 | }
|
28922 | }
|
28923 | ],
|
28924 | kind: "const",
|
28925 | loc: {
|
28926 | start: {
|
28927 | line: 1,
|
28928 | column: 0
|
28929 | },
|
28930 | end: {
|
28931 | line: 1,
|
28932 | column: 29
|
28933 | }
|
28934 | }
|
28935 | }
|
28936 | ],
|
28937 | loc: {
|
28938 | start: {
|
28939 | line: 1,
|
28940 | column: 0
|
28941 | },
|
28942 | end: {
|
28943 | line: 1,
|
28944 | column: 29
|
28945 | }
|
28946 | }
|
28947 | }, {ecmaVersion: 6, locations: true});
|
28948 |
|
28949 | testFail("const a;", "Unexpected token (1:7)", {ecmaVersion: 6});
|
28950 |
|
28951 | testFail("for(const x = 0;;);", "Unexpected token (1:4)", {ecmaVersion: 6});
|
28952 |
|
28953 |
|
28954 | (function() {
|
28955 | var actualComments = [],
|
28956 | expectedComments = [
|
28957 | " Bear class",
|
28958 | " Whatever",
|
28959 | [" 1",
|
28960 | " 2",
|
28961 | " 3"
|
28962 | ].join('\n'),
|
28963 | "stuff"
|
28964 | ];
|
28965 | testAssert(
|
28966 | function TestComments() {
|
28967 |
|
28968 | function Bear(x,y,z) {
|
28969 | this.position = [x||0,y||0,z||0]
|
28970 | }
|
28971 |
|
28972 | Bear.prototype.roar = function(message) {
|
28973 | return 'RAWWW: ' + message;
|
28974 | };
|
28975 |
|
28976 | function Cat() {
|
28977 | |
28978 |
|
28979 |
|
28980 | }
|
28981 |
|
28982 | Cat.prototype.roar = function(message) {
|
28983 | return 'MEOOWW: ' + message;
|
28984 | };
|
28985 | }.toString(),
|
28986 | function assert(ast) {
|
28987 | if (actualComments.length !== expectedComments.length) {
|
28988 | return JSON.stringify(actualComments) + " !== " + JSON.stringify(expectedComments);
|
28989 | } else {
|
28990 | for (var i=0, n=actualComments.length; i < n; i++) {
|
28991 | if (actualComments[i] !== expectedComments[i])
|
28992 | return JSON.stringify(actualComments[i]) + ' !== ' + JSON.stringify(expectedComments[i]);
|
28993 | }
|
28994 | }
|
28995 | },
|
28996 | {
|
28997 | onComment: function(isMultiline, text) {
|
28998 | actualComments.push(text);
|
28999 | }
|
29000 | }
|
29001 | );
|
29002 | })();
|
29003 |
|
29004 | (function() {
|
29005 | var comments = 0;
|
29006 | testAssert("\nfunction plop() {\n'use strict';\n/* Comment */\n}", function() {
|
29007 | if (comments != 1) return "Comment after strict counted twice.";
|
29008 | }, {onComment: function() {++comments;}});
|
29009 | })();
|