/test/acorn/tests.js

https://bitbucket.org/cbruno/acorn-objj · JavaScript · 29128 lines · 28525 code · 581 blank · 22 comment · 6 complexity · e3a05b350c184c2285285d00b6c10b79 MD5 · raw file

  1. // Tests largely based on those of Esprima
  2. // (http://esprima.org/test/)
  3. if (typeof exports != "undefined") {
  4. var driver = require("./driver.js");
  5. var test = driver.test, testFail = driver.testFail, testAssert = driver.testAssert, misMatch = driver.misMatch;
  6. var acorn = require("acorn");
  7. }
  8. test("this\n", {
  9. type: "Program",
  10. body: [
  11. {
  12. type: "ExpressionStatement",
  13. expression: {
  14. type: "ThisExpression",
  15. loc: {
  16. start: {
  17. line: 1,
  18. column: 0
  19. },
  20. end: {
  21. line: 1,
  22. column: 4
  23. }
  24. }
  25. },
  26. loc: {
  27. start: {
  28. line: 1,
  29. column: 0
  30. },
  31. end: {
  32. line: 1,
  33. column: 4
  34. }
  35. }
  36. }
  37. ],
  38. loc: {
  39. start: {
  40. line: 1,
  41. column: 0
  42. },
  43. end: {
  44. line: 2,
  45. column: 0
  46. }
  47. }
  48. });
  49. test("null\n", {
  50. type: "Program",
  51. body: [
  52. {
  53. type: "ExpressionStatement",
  54. expression: {
  55. type: "Literal",
  56. value: null,
  57. loc: {
  58. start: {
  59. line: 1,
  60. column: 0
  61. },
  62. end: {
  63. line: 1,
  64. column: 4
  65. }
  66. }
  67. },
  68. loc: {
  69. start: {
  70. line: 1,
  71. column: 0
  72. },
  73. end: {
  74. line: 1,
  75. column: 4
  76. }
  77. }
  78. }
  79. ],
  80. loc: {
  81. start: {
  82. line: 1,
  83. column: 0
  84. },
  85. end: {
  86. line: 2,
  87. column: 0
  88. }
  89. }
  90. });
  91. test("\n 42\n\n", {
  92. type: "Program",
  93. body: [
  94. {
  95. type: "ExpressionStatement",
  96. expression: {
  97. type: "Literal",
  98. value: 42,
  99. loc: {
  100. start: {
  101. line: 2,
  102. column: 4
  103. },
  104. end: {
  105. line: 2,
  106. column: 6
  107. }
  108. }
  109. },
  110. loc: {
  111. start: {
  112. line: 2,
  113. column: 4
  114. },
  115. end: {
  116. line: 2,
  117. column: 6
  118. }
  119. }
  120. }
  121. ],
  122. loc: {
  123. start: {
  124. line: 1,
  125. column: 0
  126. },
  127. end: {
  128. line: 4,
  129. column: 0
  130. }
  131. }
  132. });
  133. test("/foobar/", {
  134. type: "Program",
  135. body: [
  136. {
  137. type: "ExpressionStatement",
  138. expression: {
  139. type: "Literal",
  140. value: /foobar/,
  141. regex: {
  142. pattern: "foobar",
  143. flags: ""
  144. },
  145. loc: {
  146. start: {
  147. line: 1,
  148. column: 0
  149. },
  150. end: {
  151. line: 1,
  152. column: 8
  153. }
  154. }
  155. }
  156. }
  157. ]
  158. });
  159. test("/[a-z]/g", {
  160. type: "Program",
  161. body: [
  162. {
  163. type: "ExpressionStatement",
  164. expression: {
  165. type: "Literal",
  166. value: /[a-z]/g,
  167. regex: {
  168. pattern: "[a-z]",
  169. flags: "g"
  170. },
  171. loc: {
  172. start: {
  173. line: 1,
  174. column: 0
  175. },
  176. end: {
  177. line: 1,
  178. column: 8
  179. }
  180. }
  181. }
  182. }
  183. ]
  184. });
  185. test("(1 + 2 ) * 3", {
  186. type: "Program",
  187. body: [
  188. {
  189. type: "ExpressionStatement",
  190. expression: {
  191. type: "BinaryExpression",
  192. left: {
  193. type: "BinaryExpression",
  194. left: {
  195. type: "Literal",
  196. value: 1,
  197. loc: {
  198. start: {
  199. line: 1,
  200. column: 1
  201. },
  202. end: {
  203. line: 1,
  204. column: 2
  205. }
  206. }
  207. },
  208. operator: "+",
  209. right: {
  210. type: "Literal",
  211. value: 2,
  212. loc: {
  213. start: {
  214. line: 1,
  215. column: 5
  216. },
  217. end: {
  218. line: 1,
  219. column: 6
  220. }
  221. }
  222. },
  223. loc: {
  224. start: {
  225. line: 1,
  226. column: 1
  227. },
  228. end: {
  229. line: 1,
  230. column: 6
  231. }
  232. }
  233. },
  234. operator: "*",
  235. right: {
  236. type: "Literal",
  237. value: 3,
  238. loc: {
  239. start: {
  240. line: 1,
  241. column: 11
  242. },
  243. end: {
  244. line: 1,
  245. column: 12
  246. }
  247. }
  248. },
  249. loc: {
  250. start: {
  251. line: 1,
  252. column: 0
  253. },
  254. end: {
  255. line: 1,
  256. column: 12
  257. }
  258. }
  259. },
  260. loc: {
  261. start: {
  262. line: 1,
  263. column: 0
  264. },
  265. end: {
  266. line: 1,
  267. column: 12
  268. }
  269. }
  270. }
  271. ],
  272. loc: {
  273. start: {
  274. line: 1,
  275. column: 0
  276. },
  277. end: {
  278. line: 1,
  279. column: 12
  280. }
  281. }
  282. });
  283. test("(1 + 2 ) * 3", {
  284. type: "Program",
  285. body: [
  286. {
  287. type: "ExpressionStatement",
  288. expression: {
  289. type: "BinaryExpression",
  290. left: {
  291. type: "ParenthesizedExpression",
  292. expression: {
  293. type: "BinaryExpression",
  294. left: {
  295. type: "Literal",
  296. value: 1,
  297. loc: {
  298. start: {
  299. line: 1,
  300. column: 1
  301. },
  302. end: {
  303. line: 1,
  304. column: 2
  305. }
  306. }
  307. },
  308. operator: "+",
  309. right: {
  310. type: "Literal",
  311. value: 2,
  312. loc: {
  313. start: {
  314. line: 1,
  315. column: 5
  316. },
  317. end: {
  318. line: 1,
  319. column: 6
  320. }
  321. }
  322. },
  323. loc: {
  324. start: {
  325. line: 1,
  326. column: 1
  327. },
  328. end: {
  329. line: 1,
  330. column: 6
  331. }
  332. }
  333. },
  334. loc: {
  335. start: {
  336. line: 1,
  337. column: 0
  338. },
  339. end: {
  340. line: 1,
  341. column: 8
  342. }
  343. }
  344. },
  345. operator: "*",
  346. right: {
  347. type: "Literal",
  348. value: 3,
  349. loc: {
  350. start: {
  351. line: 1,
  352. column: 11
  353. },
  354. end: {
  355. line: 1,
  356. column: 12
  357. }
  358. }
  359. },
  360. loc: {
  361. start: {
  362. line: 1,
  363. column: 0
  364. },
  365. end: {
  366. line: 1,
  367. column: 12
  368. }
  369. }
  370. },
  371. loc: {
  372. start: {
  373. line: 1,
  374. column: 0
  375. },
  376. end: {
  377. line: 1,
  378. column: 12
  379. }
  380. }
  381. }
  382. ],
  383. loc: {
  384. start: {
  385. line: 1,
  386. column: 0
  387. },
  388. end: {
  389. line: 1,
  390. column: 12
  391. }
  392. }
  393. }, {
  394. locations: true,
  395. preserveParens: true
  396. });
  397. test("(x) = 23", {
  398. body: [
  399. {
  400. expression: {
  401. operator: "=",
  402. left: {
  403. expression: {
  404. name: "x",
  405. type: "Identifier",
  406. },
  407. type: "ParenthesizedExpression",
  408. },
  409. right: {
  410. value: 23,
  411. raw: "23",
  412. type: "Literal",
  413. },
  414. type: "AssignmentExpression",
  415. },
  416. type: "ExpressionStatement",
  417. }
  418. ],
  419. type: "Program",
  420. }, {preserveParens: true});
  421. test("x = []", {
  422. type: "Program",
  423. body: [
  424. {
  425. type: "ExpressionStatement",
  426. expression: {
  427. type: "AssignmentExpression",
  428. operator: "=",
  429. left: {
  430. type: "Identifier",
  431. name: "x",
  432. loc: {
  433. start: {
  434. line: 1,
  435. column: 0
  436. },
  437. end: {
  438. line: 1,
  439. column: 1
  440. }
  441. }
  442. },
  443. right: {
  444. type: "ArrayExpression",
  445. elements: [],
  446. loc: {
  447. start: {
  448. line: 1,
  449. column: 4
  450. },
  451. end: {
  452. line: 1,
  453. column: 6
  454. }
  455. }
  456. },
  457. loc: {
  458. start: {
  459. line: 1,
  460. column: 0
  461. },
  462. end: {
  463. line: 1,
  464. column: 6
  465. }
  466. }
  467. },
  468. loc: {
  469. start: {
  470. line: 1,
  471. column: 0
  472. },
  473. end: {
  474. line: 1,
  475. column: 6
  476. }
  477. }
  478. }
  479. ],
  480. loc: {
  481. start: {
  482. line: 1,
  483. column: 0
  484. },
  485. end: {
  486. line: 1,
  487. column: 6
  488. }
  489. }
  490. });
  491. test("x = [ ]", {
  492. type: "Program",
  493. body: [
  494. {
  495. type: "ExpressionStatement",
  496. expression: {
  497. type: "AssignmentExpression",
  498. operator: "=",
  499. left: {
  500. type: "Identifier",
  501. name: "x",
  502. loc: {
  503. start: {
  504. line: 1,
  505. column: 0
  506. },
  507. end: {
  508. line: 1,
  509. column: 1
  510. }
  511. }
  512. },
  513. right: {
  514. type: "ArrayExpression",
  515. elements: [],
  516. loc: {
  517. start: {
  518. line: 1,
  519. column: 4
  520. },
  521. end: {
  522. line: 1,
  523. column: 7
  524. }
  525. }
  526. },
  527. loc: {
  528. start: {
  529. line: 1,
  530. column: 0
  531. },
  532. end: {
  533. line: 1,
  534. column: 7
  535. }
  536. }
  537. },
  538. loc: {
  539. start: {
  540. line: 1,
  541. column: 0
  542. },
  543. end: {
  544. line: 1,
  545. column: 7
  546. }
  547. }
  548. }
  549. ],
  550. loc: {
  551. start: {
  552. line: 1,
  553. column: 0
  554. },
  555. end: {
  556. line: 1,
  557. column: 7
  558. }
  559. }
  560. });
  561. test("x = [ 42 ]", {
  562. type: "Program",
  563. body: [
  564. {
  565. type: "ExpressionStatement",
  566. expression: {
  567. type: "AssignmentExpression",
  568. operator: "=",
  569. left: {
  570. type: "Identifier",
  571. name: "x",
  572. loc: {
  573. start: {
  574. line: 1,
  575. column: 0
  576. },
  577. end: {
  578. line: 1,
  579. column: 1
  580. }
  581. }
  582. },
  583. right: {
  584. type: "ArrayExpression",
  585. elements: [
  586. {
  587. type: "Literal",
  588. value: 42,
  589. loc: {
  590. start: {
  591. line: 1,
  592. column: 6
  593. },
  594. end: {
  595. line: 1,
  596. column: 8
  597. }
  598. }
  599. }
  600. ],
  601. loc: {
  602. start: {
  603. line: 1,
  604. column: 4
  605. },
  606. end: {
  607. line: 1,
  608. column: 10
  609. }
  610. }
  611. },
  612. loc: {
  613. start: {
  614. line: 1,
  615. column: 0
  616. },
  617. end: {
  618. line: 1,
  619. column: 10
  620. }
  621. }
  622. },
  623. loc: {
  624. start: {
  625. line: 1,
  626. column: 0
  627. },
  628. end: {
  629. line: 1,
  630. column: 10
  631. }
  632. }
  633. }
  634. ],
  635. loc: {
  636. start: {
  637. line: 1,
  638. column: 0
  639. },
  640. end: {
  641. line: 1,
  642. column: 10
  643. }
  644. }
  645. });
  646. test("x = [ 42, ]", {
  647. type: "Program",
  648. body: [
  649. {
  650. type: "ExpressionStatement",
  651. expression: {
  652. type: "AssignmentExpression",
  653. operator: "=",
  654. left: {
  655. type: "Identifier",
  656. name: "x",
  657. loc: {
  658. start: {
  659. line: 1,
  660. column: 0
  661. },
  662. end: {
  663. line: 1,
  664. column: 1
  665. }
  666. }
  667. },
  668. right: {
  669. type: "ArrayExpression",
  670. elements: [
  671. {
  672. type: "Literal",
  673. value: 42,
  674. loc: {
  675. start: {
  676. line: 1,
  677. column: 6
  678. },
  679. end: {
  680. line: 1,
  681. column: 8
  682. }
  683. }
  684. }
  685. ],
  686. loc: {
  687. start: {
  688. line: 1,
  689. column: 4
  690. },
  691. end: {
  692. line: 1,
  693. column: 11
  694. }
  695. }
  696. },
  697. loc: {
  698. start: {
  699. line: 1,
  700. column: 0
  701. },
  702. end: {
  703. line: 1,
  704. column: 11
  705. }
  706. }
  707. },
  708. loc: {
  709. start: {
  710. line: 1,
  711. column: 0
  712. },
  713. end: {
  714. line: 1,
  715. column: 11
  716. }
  717. }
  718. }
  719. ],
  720. loc: {
  721. start: {
  722. line: 1,
  723. column: 0
  724. },
  725. end: {
  726. line: 1,
  727. column: 11
  728. }
  729. }
  730. });
  731. test("x = [ ,, 42 ]", {
  732. type: "Program",
  733. body: [
  734. {
  735. type: "ExpressionStatement",
  736. expression: {
  737. type: "AssignmentExpression",
  738. operator: "=",
  739. left: {
  740. type: "Identifier",
  741. name: "x",
  742. loc: {
  743. start: {
  744. line: 1,
  745. column: 0
  746. },
  747. end: {
  748. line: 1,
  749. column: 1
  750. }
  751. }
  752. },
  753. right: {
  754. type: "ArrayExpression",
  755. elements: [
  756. null,
  757. null,
  758. {
  759. type: "Literal",
  760. value: 42,
  761. loc: {
  762. start: {
  763. line: 1,
  764. column: 9
  765. },
  766. end: {
  767. line: 1,
  768. column: 11
  769. }
  770. }
  771. }
  772. ],
  773. loc: {
  774. start: {
  775. line: 1,
  776. column: 4
  777. },
  778. end: {
  779. line: 1,
  780. column: 13
  781. }
  782. }
  783. },
  784. loc: {
  785. start: {
  786. line: 1,
  787. column: 0
  788. },
  789. end: {
  790. line: 1,
  791. column: 13
  792. }
  793. }
  794. },
  795. loc: {
  796. start: {
  797. line: 1,
  798. column: 0
  799. },
  800. end: {
  801. line: 1,
  802. column: 13
  803. }
  804. }
  805. }
  806. ],
  807. loc: {
  808. start: {
  809. line: 1,
  810. column: 0
  811. },
  812. end: {
  813. line: 1,
  814. column: 13
  815. }
  816. }
  817. });
  818. test("x = [ 1, 2, 3, ]", {
  819. type: "Program",
  820. body: [
  821. {
  822. type: "ExpressionStatement",
  823. expression: {
  824. type: "AssignmentExpression",
  825. operator: "=",
  826. left: {
  827. type: "Identifier",
  828. name: "x",
  829. loc: {
  830. start: {
  831. line: 1,
  832. column: 0
  833. },
  834. end: {
  835. line: 1,
  836. column: 1
  837. }
  838. }
  839. },
  840. right: {
  841. type: "ArrayExpression",
  842. elements: [
  843. {
  844. type: "Literal",
  845. value: 1,
  846. loc: {
  847. start: {
  848. line: 1,
  849. column: 6
  850. },
  851. end: {
  852. line: 1,
  853. column: 7
  854. }
  855. }
  856. },
  857. {
  858. type: "Literal",
  859. value: 2,
  860. loc: {
  861. start: {
  862. line: 1,
  863. column: 9
  864. },
  865. end: {
  866. line: 1,
  867. column: 10
  868. }
  869. }
  870. },
  871. {
  872. type: "Literal",
  873. value: 3,
  874. loc: {
  875. start: {
  876. line: 1,
  877. column: 12
  878. },
  879. end: {
  880. line: 1,
  881. column: 13
  882. }
  883. }
  884. }
  885. ],
  886. loc: {
  887. start: {
  888. line: 1,
  889. column: 4
  890. },
  891. end: {
  892. line: 1,
  893. column: 16
  894. }
  895. }
  896. },
  897. loc: {
  898. start: {
  899. line: 1,
  900. column: 0
  901. },
  902. end: {
  903. line: 1,
  904. column: 16
  905. }
  906. }
  907. },
  908. loc: {
  909. start: {
  910. line: 1,
  911. column: 0
  912. },
  913. end: {
  914. line: 1,
  915. column: 16
  916. }
  917. }
  918. }
  919. ],
  920. loc: {
  921. start: {
  922. line: 1,
  923. column: 0
  924. },
  925. end: {
  926. line: 1,
  927. column: 16
  928. }
  929. }
  930. });
  931. test("x = [ 1, 2,, 3, ]", {
  932. type: "Program",
  933. body: [
  934. {
  935. type: "ExpressionStatement",
  936. expression: {
  937. type: "AssignmentExpression",
  938. operator: "=",
  939. left: {
  940. type: "Identifier",
  941. name: "x",
  942. loc: {
  943. start: {
  944. line: 1,
  945. column: 0
  946. },
  947. end: {
  948. line: 1,
  949. column: 1
  950. }
  951. }
  952. },
  953. right: {
  954. type: "ArrayExpression",
  955. elements: [
  956. {
  957. type: "Literal",
  958. value: 1,
  959. loc: {
  960. start: {
  961. line: 1,
  962. column: 6
  963. },
  964. end: {
  965. line: 1,
  966. column: 7
  967. }
  968. }
  969. },
  970. {
  971. type: "Literal",
  972. value: 2,
  973. loc: {
  974. start: {
  975. line: 1,
  976. column: 9
  977. },
  978. end: {
  979. line: 1,
  980. column: 10
  981. }
  982. }
  983. },
  984. null,
  985. {
  986. type: "Literal",
  987. value: 3,
  988. loc: {
  989. start: {
  990. line: 1,
  991. column: 13
  992. },
  993. end: {
  994. line: 1,
  995. column: 14
  996. }
  997. }
  998. }
  999. ],
  1000. loc: {
  1001. start: {
  1002. line: 1,
  1003. column: 4
  1004. },
  1005. end: {
  1006. line: 1,
  1007. column: 17
  1008. }
  1009. }
  1010. },
  1011. loc: {
  1012. start: {
  1013. line: 1,
  1014. column: 0
  1015. },
  1016. end: {
  1017. line: 1,
  1018. column: 17
  1019. }
  1020. }
  1021. },
  1022. loc: {
  1023. start: {
  1024. line: 1,
  1025. column: 0
  1026. },
  1027. end: {
  1028. line: 1,
  1029. column: 17
  1030. }
  1031. }
  1032. }
  1033. ],
  1034. loc: {
  1035. start: {
  1036. line: 1,
  1037. column: 0
  1038. },
  1039. end: {
  1040. line: 1,
  1041. column: 17
  1042. }
  1043. }
  1044. });
  1045. test("日本語 = []", {
  1046. type: "Program",
  1047. body: [
  1048. {
  1049. type: "ExpressionStatement",
  1050. expression: {
  1051. type: "AssignmentExpression",
  1052. operator: "=",
  1053. left: {
  1054. type: "Identifier",
  1055. name: "日本語",
  1056. loc: {
  1057. start: {
  1058. line: 1,
  1059. column: 0
  1060. },
  1061. end: {
  1062. line: 1,
  1063. column: 3
  1064. }
  1065. }
  1066. },
  1067. right: {
  1068. type: "ArrayExpression",
  1069. elements: [],
  1070. loc: {
  1071. start: {
  1072. line: 1,
  1073. column: 6
  1074. },
  1075. end: {
  1076. line: 1,
  1077. column: 8
  1078. }
  1079. }
  1080. },
  1081. loc: {
  1082. start: {
  1083. line: 1,
  1084. column: 0
  1085. },
  1086. end: {
  1087. line: 1,
  1088. column: 8
  1089. }
  1090. }
  1091. },
  1092. loc: {
  1093. start: {
  1094. line: 1,
  1095. column: 0
  1096. },
  1097. end: {
  1098. line: 1,
  1099. column: 8
  1100. }
  1101. }
  1102. }
  1103. ],
  1104. loc: {
  1105. start: {
  1106. line: 1,
  1107. column: 0
  1108. },
  1109. end: {
  1110. line: 1,
  1111. column: 8
  1112. }
  1113. }
  1114. });
  1115. test("T‿ = []", {
  1116. type: "Program",
  1117. body: [
  1118. {
  1119. type: "ExpressionStatement",
  1120. expression: {
  1121. type: "AssignmentExpression",
  1122. operator: "=",
  1123. left: {
  1124. type: "Identifier",
  1125. name: "T‿",
  1126. loc: {
  1127. start: {
  1128. line: 1,
  1129. column: 0
  1130. },
  1131. end: {
  1132. line: 1,
  1133. column: 2
  1134. }
  1135. }
  1136. },
  1137. right: {
  1138. type: "ArrayExpression",
  1139. elements: [],
  1140. loc: {
  1141. start: {
  1142. line: 1,
  1143. column: 5
  1144. },
  1145. end: {
  1146. line: 1,
  1147. column: 7
  1148. }
  1149. }
  1150. },
  1151. loc: {
  1152. start: {
  1153. line: 1,
  1154. column: 0
  1155. },
  1156. end: {
  1157. line: 1,
  1158. column: 7
  1159. }
  1160. }
  1161. },
  1162. loc: {
  1163. start: {
  1164. line: 1,
  1165. column: 0
  1166. },
  1167. end: {
  1168. line: 1,
  1169. column: 7
  1170. }
  1171. }
  1172. }
  1173. ],
  1174. loc: {
  1175. start: {
  1176. line: 1,
  1177. column: 0
  1178. },
  1179. end: {
  1180. line: 1,
  1181. column: 7
  1182. }
  1183. }
  1184. });
  1185. test("T‌ = []", {
  1186. type: "Program",
  1187. body: [
  1188. {
  1189. type: "ExpressionStatement",
  1190. expression: {
  1191. type: "AssignmentExpression",
  1192. operator: "=",
  1193. left: {
  1194. type: "Identifier",
  1195. name: "T‌",
  1196. loc: {
  1197. start: {
  1198. line: 1,
  1199. column: 0
  1200. },
  1201. end: {
  1202. line: 1,
  1203. column: 2
  1204. }
  1205. }
  1206. },
  1207. right: {
  1208. type: "ArrayExpression",
  1209. elements: [],
  1210. loc: {
  1211. start: {
  1212. line: 1,
  1213. column: 5
  1214. },
  1215. end: {
  1216. line: 1,
  1217. column: 7
  1218. }
  1219. }
  1220. },
  1221. loc: {
  1222. start: {
  1223. line: 1,
  1224. column: 0
  1225. },
  1226. end: {
  1227. line: 1,
  1228. column: 7
  1229. }
  1230. }
  1231. },
  1232. loc: {
  1233. start: {
  1234. line: 1,
  1235. column: 0
  1236. },
  1237. end: {
  1238. line: 1,
  1239. column: 7
  1240. }
  1241. }
  1242. }
  1243. ],
  1244. loc: {
  1245. start: {
  1246. line: 1,
  1247. column: 0
  1248. },
  1249. end: {
  1250. line: 1,
  1251. column: 7
  1252. }
  1253. }
  1254. });
  1255. test("T‍ = []", {
  1256. type: "Program",
  1257. body: [
  1258. {
  1259. type: "ExpressionStatement",
  1260. expression: {
  1261. type: "AssignmentExpression",
  1262. operator: "=",
  1263. left: {
  1264. type: "Identifier",
  1265. name: "T‍",
  1266. loc: {
  1267. start: {
  1268. line: 1,
  1269. column: 0
  1270. },
  1271. end: {
  1272. line: 1,
  1273. column: 2
  1274. }
  1275. }
  1276. },
  1277. right: {
  1278. type: "ArrayExpression",
  1279. elements: [],
  1280. loc: {
  1281. start: {
  1282. line: 1,
  1283. column: 5
  1284. },
  1285. end: {
  1286. line: 1,
  1287. column: 7
  1288. }
  1289. }
  1290. },
  1291. loc: {
  1292. start: {
  1293. line: 1,
  1294. column: 0
  1295. },
  1296. end: {
  1297. line: 1,
  1298. column: 7
  1299. }
  1300. }
  1301. },
  1302. loc: {
  1303. start: {
  1304. line: 1,
  1305. column: 0
  1306. },
  1307. end: {
  1308. line: 1,
  1309. column: 7
  1310. }
  1311. }
  1312. }
  1313. ],
  1314. loc: {
  1315. start: {
  1316. line: 1,
  1317. column: 0
  1318. },
  1319. end: {
  1320. line: 1,
  1321. column: 7
  1322. }
  1323. }
  1324. });
  1325. test("ⅣⅡ = []", {
  1326. type: "Program",
  1327. body: [
  1328. {
  1329. type: "ExpressionStatement",
  1330. expression: {
  1331. type: "AssignmentExpression",
  1332. operator: "=",
  1333. left: {
  1334. type: "Identifier",
  1335. name: "ⅣⅡ",
  1336. loc: {
  1337. start: {
  1338. line: 1,
  1339. column: 0
  1340. },
  1341. end: {
  1342. line: 1,
  1343. column: 2
  1344. }
  1345. }
  1346. },
  1347. right: {
  1348. type: "ArrayExpression",
  1349. elements: [],
  1350. loc: {
  1351. start: {
  1352. line: 1,
  1353. column: 5
  1354. },
  1355. end: {
  1356. line: 1,
  1357. column: 7
  1358. }
  1359. }
  1360. },
  1361. loc: {
  1362. start: {
  1363. line: 1,
  1364. column: 0
  1365. },
  1366. end: {
  1367. line: 1,
  1368. column: 7
  1369. }
  1370. }
  1371. },
  1372. loc: {
  1373. start: {
  1374. line: 1,
  1375. column: 0
  1376. },
  1377. end: {
  1378. line: 1,
  1379. column: 7
  1380. }
  1381. }
  1382. }
  1383. ],
  1384. loc: {
  1385. start: {
  1386. line: 1,
  1387. column: 0
  1388. },
  1389. end: {
  1390. line: 1,
  1391. column: 7
  1392. }
  1393. }
  1394. });
  1395. test("ⅣⅡ = []", {
  1396. type: "Program",
  1397. body: [
  1398. {
  1399. type: "ExpressionStatement",
  1400. expression: {
  1401. type: "AssignmentExpression",
  1402. operator: "=",
  1403. left: {
  1404. type: "Identifier",
  1405. name: "ⅣⅡ",
  1406. loc: {
  1407. start: {
  1408. line: 1,
  1409. column: 0
  1410. },
  1411. end: {
  1412. line: 1,
  1413. column: 2
  1414. }
  1415. }
  1416. },
  1417. right: {
  1418. type: "ArrayExpression",
  1419. elements: [],
  1420. loc: {
  1421. start: {
  1422. line: 1,
  1423. column: 5
  1424. },
  1425. end: {
  1426. line: 1,
  1427. column: 7
  1428. }
  1429. }
  1430. },
  1431. loc: {
  1432. start: {
  1433. line: 1,
  1434. column: 0
  1435. },
  1436. end: {
  1437. line: 1,
  1438. column: 7
  1439. }
  1440. }
  1441. },
  1442. loc: {
  1443. start: {
  1444. line: 1,
  1445. column: 0
  1446. },
  1447. end: {
  1448. line: 1,
  1449. column: 7
  1450. }
  1451. }
  1452. }
  1453. ],
  1454. loc: {
  1455. start: {
  1456. line: 1,
  1457. column: 0
  1458. },
  1459. end: {
  1460. line: 1,
  1461. column: 7
  1462. }
  1463. }
  1464. });
  1465. test("x = {}", {
  1466. type: "Program",
  1467. body: [
  1468. {
  1469. type: "ExpressionStatement",
  1470. expression: {
  1471. type: "AssignmentExpression",
  1472. operator: "=",
  1473. left: {
  1474. type: "Identifier",
  1475. name: "x",
  1476. loc: {
  1477. start: {
  1478. line: 1,
  1479. column: 0
  1480. },
  1481. end: {
  1482. line: 1,
  1483. column: 1
  1484. }
  1485. }
  1486. },
  1487. right: {
  1488. type: "ObjectExpression",
  1489. properties: [],
  1490. loc: {
  1491. start: {
  1492. line: 1,
  1493. column: 4
  1494. },
  1495. end: {
  1496. line: 1,
  1497. column: 6
  1498. }
  1499. }
  1500. },
  1501. loc: {
  1502. start: {
  1503. line: 1,
  1504. column: 0
  1505. },
  1506. end: {
  1507. line: 1,
  1508. column: 6
  1509. }
  1510. }
  1511. },
  1512. loc: {
  1513. start: {
  1514. line: 1,
  1515. column: 0
  1516. },
  1517. end: {
  1518. line: 1,
  1519. column: 6
  1520. }
  1521. }
  1522. }
  1523. ],
  1524. loc: {
  1525. start: {
  1526. line: 1,
  1527. column: 0
  1528. },
  1529. end: {
  1530. line: 1,
  1531. column: 6
  1532. }
  1533. }
  1534. });
  1535. test("x = { }", {
  1536. type: "Program",
  1537. body: [
  1538. {
  1539. type: "ExpressionStatement",
  1540. expression: {
  1541. type: "AssignmentExpression",
  1542. operator: "=",
  1543. left: {
  1544. type: "Identifier",
  1545. name: "x",
  1546. loc: {
  1547. start: {
  1548. line: 1,
  1549. column: 0
  1550. },
  1551. end: {
  1552. line: 1,
  1553. column: 1
  1554. }
  1555. }
  1556. },
  1557. right: {
  1558. type: "ObjectExpression",
  1559. properties: [],
  1560. loc: {
  1561. start: {
  1562. line: 1,
  1563. column: 4
  1564. },
  1565. end: {
  1566. line: 1,
  1567. column: 7
  1568. }
  1569. }
  1570. },
  1571. loc: {
  1572. start: {
  1573. line: 1,
  1574. column: 0
  1575. },
  1576. end: {
  1577. line: 1,
  1578. column: 7
  1579. }
  1580. }
  1581. },
  1582. loc: {
  1583. start: {
  1584. line: 1,
  1585. column: 0
  1586. },
  1587. end: {
  1588. line: 1,
  1589. column: 7
  1590. }
  1591. }
  1592. }
  1593. ],
  1594. loc: {
  1595. start: {
  1596. line: 1,
  1597. column: 0
  1598. },
  1599. end: {
  1600. line: 1,
  1601. column: 7
  1602. }
  1603. }
  1604. });
  1605. test("x = { answer: 42 }", {
  1606. type: "Program",
  1607. body: [
  1608. {
  1609. type: "ExpressionStatement",
  1610. expression: {
  1611. type: "AssignmentExpression",
  1612. operator: "=",
  1613. left: {
  1614. type: "Identifier",
  1615. name: "x",
  1616. loc: {
  1617. start: {
  1618. line: 1,
  1619. column: 0
  1620. },
  1621. end: {
  1622. line: 1,
  1623. column: 1
  1624. }
  1625. }
  1626. },
  1627. right: {
  1628. type: "ObjectExpression",
  1629. properties: [
  1630. {
  1631. type: "Property",
  1632. key: {
  1633. type: "Identifier",
  1634. name: "answer",
  1635. loc: {
  1636. start: {
  1637. line: 1,
  1638. column: 6
  1639. },
  1640. end: {
  1641. line: 1,
  1642. column: 12
  1643. }
  1644. }
  1645. },
  1646. value: {
  1647. type: "Literal",
  1648. value: 42,
  1649. loc: {
  1650. start: {
  1651. line: 1,
  1652. column: 14
  1653. },
  1654. end: {
  1655. line: 1,
  1656. column: 16
  1657. }
  1658. }
  1659. },
  1660. kind: "init"
  1661. }
  1662. ],
  1663. loc: {
  1664. start: {
  1665. line: 1,
  1666. column: 4
  1667. },
  1668. end: {
  1669. line: 1,
  1670. column: 18
  1671. }
  1672. }
  1673. },
  1674. loc: {
  1675. start: {
  1676. line: 1,
  1677. column: 0
  1678. },
  1679. end: {
  1680. line: 1,
  1681. column: 18
  1682. }
  1683. }
  1684. },
  1685. loc: {
  1686. start: {
  1687. line: 1,
  1688. column: 0
  1689. },
  1690. end: {
  1691. line: 1,
  1692. column: 18
  1693. }
  1694. }
  1695. }
  1696. ],
  1697. loc: {
  1698. start: {
  1699. line: 1,
  1700. column: 0
  1701. },
  1702. end: {
  1703. line: 1,
  1704. column: 18
  1705. }
  1706. }
  1707. });
  1708. test("x = { if: 42 }", {
  1709. type: "Program",
  1710. body: [
  1711. {
  1712. type: "ExpressionStatement",
  1713. expression: {
  1714. type: "AssignmentExpression",
  1715. operator: "=",
  1716. left: {
  1717. type: "Identifier",
  1718. name: "x",
  1719. loc: {
  1720. start: {
  1721. line: 1,
  1722. column: 0
  1723. },
  1724. end: {
  1725. line: 1,
  1726. column: 1
  1727. }
  1728. }
  1729. },
  1730. right: {
  1731. type: "ObjectExpression",
  1732. properties: [
  1733. {
  1734. type: "Property",
  1735. key: {
  1736. type: "Identifier",
  1737. name: "if",
  1738. loc: {
  1739. start: {
  1740. line: 1,
  1741. column: 6
  1742. },
  1743. end: {
  1744. line: 1,
  1745. column: 8
  1746. }
  1747. }
  1748. },
  1749. value: {
  1750. type: "Literal",
  1751. value: 42,
  1752. loc: {
  1753. start: {
  1754. line: 1,
  1755. column: 10
  1756. },
  1757. end: {
  1758. line: 1,
  1759. column: 12
  1760. }
  1761. }
  1762. },
  1763. kind: "init"
  1764. }
  1765. ],
  1766. loc: {
  1767. start: {
  1768. line: 1,
  1769. column: 4
  1770. },
  1771. end: {
  1772. line: 1,
  1773. column: 14
  1774. }
  1775. }
  1776. },
  1777. loc: {
  1778. start: {
  1779. line: 1,
  1780. column: 0
  1781. },
  1782. end: {
  1783. line: 1,
  1784. column: 14
  1785. }
  1786. }
  1787. },
  1788. loc: {
  1789. start: {
  1790. line: 1,
  1791. column: 0
  1792. },
  1793. end: {
  1794. line: 1,
  1795. column: 14
  1796. }
  1797. }
  1798. }
  1799. ],
  1800. loc: {
  1801. start: {
  1802. line: 1,
  1803. column: 0
  1804. },
  1805. end: {
  1806. line: 1,
  1807. column: 14
  1808. }
  1809. }
  1810. });
  1811. test("x = { true: 42 }", {
  1812. type: "Program",
  1813. body: [
  1814. {
  1815. type: "ExpressionStatement",
  1816. expression: {
  1817. type: "AssignmentExpression",
  1818. operator: "=",
  1819. left: {
  1820. type: "Identifier",
  1821. name: "x",
  1822. loc: {
  1823. start: {
  1824. line: 1,
  1825. column: 0
  1826. },
  1827. end: {
  1828. line: 1,
  1829. column: 1
  1830. }
  1831. }
  1832. },
  1833. right: {
  1834. type: "ObjectExpression",
  1835. properties: [
  1836. {
  1837. type: "Property",
  1838. key: {
  1839. type: "Identifier",
  1840. name: "true",
  1841. loc: {
  1842. start: {
  1843. line: 1,
  1844. column: 6
  1845. },
  1846. end: {
  1847. line: 1,
  1848. column: 10
  1849. }
  1850. }
  1851. },
  1852. value: {
  1853. type: "Literal",
  1854. value: 42,
  1855. loc: {
  1856. start: {
  1857. line: 1,
  1858. column: 12
  1859. },
  1860. end: {
  1861. line: 1,
  1862. column: 14
  1863. }
  1864. }
  1865. },
  1866. kind: "init"
  1867. }
  1868. ],
  1869. loc: {
  1870. start: {
  1871. line: 1,
  1872. column: 4
  1873. },
  1874. end: {
  1875. line: 1,
  1876. column: 16
  1877. }
  1878. }
  1879. },
  1880. loc: {
  1881. start: {
  1882. line: 1,
  1883. column: 0
  1884. },
  1885. end: {
  1886. line: 1,
  1887. column: 16
  1888. }
  1889. }
  1890. },
  1891. loc: {
  1892. start: {
  1893. line: 1,
  1894. column: 0
  1895. },
  1896. end: {
  1897. line: 1,
  1898. column: 16
  1899. }
  1900. }
  1901. }
  1902. ],
  1903. loc: {
  1904. start: {
  1905. line: 1,
  1906. column: 0
  1907. },
  1908. end: {
  1909. line: 1,
  1910. column: 16
  1911. }
  1912. }
  1913. });
  1914. test("x = { false: 42 }", {
  1915. type: "Program",
  1916. body: [
  1917. {
  1918. type: "ExpressionStatement",
  1919. expression: {
  1920. type: "AssignmentExpression",
  1921. operator: "=",
  1922. left: {
  1923. type: "Identifier",
  1924. name: "x",
  1925. loc: {
  1926. start: {
  1927. line: 1,
  1928. column: 0
  1929. },
  1930. end: {
  1931. line: 1,
  1932. column: 1
  1933. }
  1934. }
  1935. },
  1936. right: {
  1937. type: "ObjectExpression",
  1938. properties: [
  1939. {
  1940. type: "Property",
  1941. key: {
  1942. type: "Identifier",
  1943. name: "false",
  1944. loc: {
  1945. start: {
  1946. line: 1,
  1947. column: 6
  1948. },
  1949. end: {
  1950. line: 1,
  1951. column: 11
  1952. }
  1953. }
  1954. },
  1955. value: {
  1956. type: "Literal",
  1957. value: 42,
  1958. loc: {
  1959. start: {
  1960. line: 1,
  1961. column: 13
  1962. },
  1963. end: {
  1964. line: 1,
  1965. column: 15
  1966. }
  1967. }
  1968. },
  1969. kind: "init"
  1970. }
  1971. ],
  1972. loc: {
  1973. start: {
  1974. line: 1,
  1975. column: 4
  1976. },
  1977. end: {
  1978. line: 1,
  1979. column: 17
  1980. }
  1981. }
  1982. },
  1983. loc: {
  1984. start: {
  1985. line: 1,
  1986. column: 0
  1987. },
  1988. end: {
  1989. line: 1,
  1990. column: 17
  1991. }
  1992. }
  1993. },
  1994. loc: {
  1995. start: {
  1996. line: 1,
  1997. column: 0
  1998. },
  1999. end: {
  2000. line: 1,
  2001. column: 17
  2002. }
  2003. }
  2004. }
  2005. ],
  2006. loc: {
  2007. start: {
  2008. line: 1,
  2009. column: 0
  2010. },
  2011. end: {
  2012. line: 1,
  2013. column: 17
  2014. }
  2015. }
  2016. });
  2017. test("x = { null: 42 }", {
  2018. type: "Program",
  2019. body: [
  2020. {
  2021. type: "ExpressionStatement",
  2022. expression: {
  2023. type: "AssignmentExpression",
  2024. operator: "=",
  2025. left: {
  2026. type: "Identifier",
  2027. name: "x",
  2028. loc: {
  2029. start: {
  2030. line: 1,
  2031. column: 0
  2032. },
  2033. end: {
  2034. line: 1,
  2035. column: 1
  2036. }
  2037. }
  2038. },
  2039. right: {
  2040. type: "ObjectExpression",
  2041. properties: [
  2042. {
  2043. type: "Property",
  2044. key: {
  2045. type: "Identifier",
  2046. name: "null",
  2047. loc: {
  2048. start: {
  2049. line: 1,
  2050. column: 6
  2051. },
  2052. end: {
  2053. line: 1,
  2054. column: 10
  2055. }
  2056. }
  2057. },
  2058. value: {
  2059. type: "Literal",
  2060. value: 42,
  2061. loc: {
  2062. start: {
  2063. line: 1,
  2064. column: 12
  2065. },
  2066. end: {
  2067. line: 1,
  2068. column: 14
  2069. }
  2070. }
  2071. },
  2072. kind: "init"
  2073. }
  2074. ],
  2075. loc: {
  2076. start: {
  2077. line: 1,
  2078. column: 4
  2079. },
  2080. end: {
  2081. line: 1,
  2082. column: 16
  2083. }
  2084. }
  2085. },
  2086. loc: {
  2087. start: {
  2088. line: 1,
  2089. column: 0
  2090. },
  2091. end: {
  2092. line: 1,
  2093. column: 16
  2094. }
  2095. }
  2096. },
  2097. loc: {
  2098. start: {
  2099. line: 1,
  2100. column: 0
  2101. },
  2102. end: {
  2103. line: 1,
  2104. column: 16
  2105. }
  2106. }
  2107. }
  2108. ],
  2109. loc: {
  2110. start: {
  2111. line: 1,
  2112. column: 0
  2113. },
  2114. end: {
  2115. line: 1,
  2116. column: 16
  2117. }
  2118. }
  2119. });
  2120. test("x = { \"answer\": 42 }", {
  2121. type: "Program",
  2122. body: [
  2123. {
  2124. type: "ExpressionStatement",
  2125. expression: {
  2126. type: "AssignmentExpression",
  2127. operator: "=",
  2128. left: {
  2129. type: "Identifier",
  2130. name: "x",
  2131. loc: {
  2132. start: {
  2133. line: 1,
  2134. column: 0
  2135. },
  2136. end: {
  2137. line: 1,
  2138. column: 1
  2139. }
  2140. }
  2141. },
  2142. right: {
  2143. type: "ObjectExpression",
  2144. properties: [
  2145. {
  2146. type: "Property",
  2147. key: {
  2148. type: "Literal",
  2149. value: "answer",
  2150. loc: {
  2151. start: {
  2152. line: 1,
  2153. column: 6
  2154. },
  2155. end: {
  2156. line: 1,
  2157. column: 14
  2158. }
  2159. }
  2160. },
  2161. value: {
  2162. type: "Literal",
  2163. value: 42,
  2164. loc: {
  2165. start: {
  2166. line: 1,
  2167. column: 16
  2168. },
  2169. end: {
  2170. line: 1,
  2171. column: 18
  2172. }
  2173. }
  2174. },
  2175. kind: "init"
  2176. }
  2177. ],
  2178. loc: {
  2179. start: {
  2180. line: 1,
  2181. column: 4
  2182. },
  2183. end: {
  2184. line: 1,
  2185. column: 20
  2186. }
  2187. }
  2188. },
  2189. loc: {
  2190. start: {
  2191. line: 1,
  2192. column: 0
  2193. },
  2194. end: {
  2195. line: 1,
  2196. column: 20
  2197. }
  2198. }
  2199. },
  2200. loc: {
  2201. start: {
  2202. line: 1,
  2203. column: 0
  2204. },
  2205. end: {
  2206. line: 1,
  2207. column: 20
  2208. }
  2209. }
  2210. }
  2211. ],
  2212. loc: {
  2213. start: {
  2214. line: 1,
  2215. column: 0
  2216. },
  2217. end: {
  2218. line: 1,
  2219. column: 20
  2220. }
  2221. }
  2222. });
  2223. test("x = { x: 1, x: 2 }", {
  2224. type: "Program",
  2225. body: [
  2226. {
  2227. type: "ExpressionStatement",
  2228. expression: {
  2229. type: "AssignmentExpression",
  2230. operator: "=",
  2231. left: {
  2232. type: "Identifier",
  2233. name: "x",
  2234. loc: {
  2235. start: {
  2236. line: 1,
  2237. column: 0
  2238. },
  2239. end: {
  2240. line: 1,
  2241. column: 1
  2242. }
  2243. }
  2244. },
  2245. right: {
  2246. type: "ObjectExpression",
  2247. properties: [
  2248. {
  2249. type: "Property",
  2250. key: {
  2251. type: "Identifier",
  2252. name: "x",
  2253. loc: {
  2254. start: {
  2255. line: 1,
  2256. column: 6
  2257. },
  2258. end: {
  2259. line: 1,
  2260. column: 7
  2261. }
  2262. }
  2263. },
  2264. value: {
  2265. type: "Literal",
  2266. value: 1,
  2267. loc: {
  2268. start: {
  2269. line: 1,
  2270. column: 9
  2271. },
  2272. end: {
  2273. line: 1,
  2274. column: 10
  2275. }
  2276. }
  2277. },
  2278. kind: "init"
  2279. },
  2280. {
  2281. type: "Property",
  2282. key: {
  2283. type: "Identifier",
  2284. name: "x",
  2285. loc: {
  2286. start: {
  2287. line: 1,
  2288. column: 12
  2289. },
  2290. end: {
  2291. line: 1,
  2292. column: 13
  2293. }
  2294. }
  2295. },
  2296. value: {
  2297. type: "Literal",
  2298. value: 2,
  2299. loc: {
  2300. start: {
  2301. line: 1,
  2302. column: 15
  2303. },
  2304. end: {
  2305. line: 1,
  2306. column: 16
  2307. }
  2308. }
  2309. },
  2310. kind: "init"
  2311. }
  2312. ],
  2313. loc: {
  2314. start: {
  2315. line: 1,
  2316. column: 4
  2317. },
  2318. end: {
  2319. line: 1,
  2320. column: 18
  2321. }
  2322. }
  2323. },
  2324. loc: {
  2325. start: {
  2326. line: 1,
  2327. column: 0
  2328. },
  2329. end: {
  2330. line: 1,
  2331. column: 18
  2332. }
  2333. }
  2334. },
  2335. loc: {
  2336. start: {
  2337. line: 1,
  2338. column: 0
  2339. },
  2340. end: {
  2341. line: 1,
  2342. column: 18
  2343. }
  2344. }
  2345. }
  2346. ],
  2347. loc: {
  2348. start: {
  2349. line: 1,
  2350. column: 0
  2351. },
  2352. end: {
  2353. line: 1,
  2354. column: 18
  2355. }
  2356. }
  2357. });
  2358. test("x = { get width() { return m_width } }", {
  2359. type: "Program",
  2360. body: [
  2361. {
  2362. type: "ExpressionStatement",
  2363. expression: {
  2364. type: "AssignmentExpression",
  2365. operator: "=",
  2366. left: {
  2367. type: "Identifier",
  2368. name: "x",
  2369. loc: {
  2370. start: {
  2371. line: 1,
  2372. column: 0
  2373. },
  2374. end: {
  2375. line: 1,
  2376. column: 1
  2377. }
  2378. }
  2379. },
  2380. right: {
  2381. type: "ObjectExpression",
  2382. properties: [
  2383. {
  2384. type: "Property",
  2385. key: {
  2386. type: "Identifier",
  2387. name: "width",
  2388. loc: {
  2389. start: {
  2390. line: 1,
  2391. column: 10
  2392. },
  2393. end: {
  2394. line: 1,
  2395. column: 15
  2396. }
  2397. }
  2398. },
  2399. kind: "get",
  2400. value: {
  2401. type: "FunctionExpression",
  2402. id: null,
  2403. params: [],
  2404. body: {
  2405. type: "BlockStatement",
  2406. body: [
  2407. {
  2408. type: "ReturnStatement",
  2409. argument: {
  2410. type: "Identifier",
  2411. name: "m_width",
  2412. loc: {
  2413. start: {
  2414. line: 1,
  2415. column: 27
  2416. },
  2417. end: {
  2418. line: 1,
  2419. column: 34
  2420. }
  2421. }
  2422. },
  2423. loc: {
  2424. start: {
  2425. line: 1,
  2426. column: 20
  2427. },
  2428. end: {
  2429. line: 1,
  2430. column: 34
  2431. }
  2432. }
  2433. }
  2434. ],
  2435. loc: {
  2436. start: {
  2437. line: 1,
  2438. column: 18
  2439. },
  2440. end: {
  2441. line: 1,
  2442. column: 36
  2443. }
  2444. }
  2445. },
  2446. loc: {
  2447. start: {
  2448. line: 1,
  2449. column: 15
  2450. },
  2451. end: {
  2452. line: 1,
  2453. column: 36
  2454. }
  2455. }
  2456. }
  2457. }
  2458. ],
  2459. loc: {
  2460. start: {
  2461. line: 1,
  2462. column: 4
  2463. },
  2464. end: {
  2465. line: 1,
  2466. column: 38
  2467. }
  2468. }
  2469. },
  2470. loc: {
  2471. start: {
  2472. line: 1,
  2473. column: 0
  2474. },
  2475. end: {
  2476. line: 1,
  2477. column: 38
  2478. }
  2479. }
  2480. },
  2481. loc: {
  2482. start: {
  2483. line: 1,
  2484. column: 0
  2485. },
  2486. end: {
  2487. line: 1,
  2488. column: 38
  2489. }
  2490. }
  2491. }
  2492. ],
  2493. loc: {
  2494. start: {
  2495. line: 1,
  2496. column: 0
  2497. },
  2498. end: {
  2499. line: 1,
  2500. column: 38
  2501. }
  2502. }
  2503. });
  2504. test("x = { get undef() {} }", {
  2505. type: "Program",
  2506. body: [
  2507. {
  2508. type: "ExpressionStatement",
  2509. expression: {
  2510. type: "AssignmentExpression",
  2511. operator: "=",
  2512. left: {
  2513. type: "Identifier",
  2514. name: "x",
  2515. loc: {
  2516. start: {
  2517. line: 1,
  2518. column: 0
  2519. },
  2520. end: {
  2521. line: 1,
  2522. column: 1
  2523. }
  2524. }
  2525. },
  2526. right: {
  2527. type: "ObjectExpression",
  2528. properties: [
  2529. {
  2530. type: "Property",
  2531. key: {
  2532. type: "Identifier",
  2533. name: "undef",
  2534. loc: {
  2535. start: {
  2536. line: 1,
  2537. column: 10
  2538. },
  2539. end: {
  2540. line: 1,
  2541. column: 15
  2542. }
  2543. }
  2544. },
  2545. kind: "get",
  2546. value: {
  2547. type: "FunctionExpression",
  2548. id: null,
  2549. params: [],
  2550. body: {
  2551. type: "BlockStatement",
  2552. body: [],
  2553. loc: {
  2554. start: {
  2555. line: 1,
  2556. column: 18
  2557. },
  2558. end: {
  2559. line: 1,
  2560. column: 20
  2561. }
  2562. }
  2563. },
  2564. loc: {
  2565. start: {
  2566. line: 1,
  2567. column: 15
  2568. },
  2569. end: {
  2570. line: 1,
  2571. column: 20
  2572. }
  2573. }
  2574. }
  2575. }
  2576. ],
  2577. loc: {
  2578. start: {
  2579. line: 1,
  2580. column: 4
  2581. },
  2582. end: {
  2583. line: 1,
  2584. column: 22
  2585. }
  2586. }
  2587. },
  2588. loc: {
  2589. start: {
  2590. line: 1,
  2591. column: 0
  2592. },
  2593. end: {
  2594. line: 1,
  2595. column: 22
  2596. }
  2597. }
  2598. },
  2599. loc: {
  2600. start: {
  2601. line: 1,
  2602. column: 0
  2603. },
  2604. end: {
  2605. line: 1,
  2606. column: 22
  2607. }
  2608. }
  2609. }
  2610. ],
  2611. loc: {
  2612. start: {
  2613. line: 1,
  2614. column: 0
  2615. },
  2616. end: {
  2617. line: 1,
  2618. column: 22
  2619. }
  2620. }
  2621. });
  2622. test("x = { get if() {} }", {
  2623. type: "Program",
  2624. body: [
  2625. {
  2626. type: "ExpressionStatement",
  2627. expression: {
  2628. type: "AssignmentExpression",
  2629. operator: "=",
  2630. left: {
  2631. type: "Identifier",
  2632. name: "x",
  2633. loc: {
  2634. start: {
  2635. line: 1,
  2636. column: 0
  2637. },
  2638. end: {
  2639. line: 1,
  2640. column: 1
  2641. }
  2642. }
  2643. },
  2644. right: {
  2645. type: "ObjectExpression",
  2646. properties: [
  2647. {
  2648. type: "Property",
  2649. key: {
  2650. type: "Identifier",
  2651. name: "if",
  2652. loc: {
  2653. start: {
  2654. line: 1,
  2655. column: 10
  2656. },
  2657. end: {
  2658. line: 1,
  2659. column: 12
  2660. }
  2661. }
  2662. },
  2663. kind: "get",
  2664. value: {
  2665. type: "FunctionExpression",
  2666. id: null,
  2667. params: [],
  2668. body: {
  2669. type: "BlockStatement",
  2670. body: [],
  2671. loc: {
  2672. start: {
  2673. line: 1,
  2674. column: 15
  2675. },
  2676. end: {
  2677. line: 1,
  2678. column: 17
  2679. }
  2680. }
  2681. },
  2682. loc: {
  2683. start: {
  2684. line: 1,
  2685. column: 12
  2686. },
  2687. end: {
  2688. line: 1,
  2689. column: 17
  2690. }
  2691. }
  2692. }
  2693. }
  2694. ],
  2695. loc: {
  2696. start: {
  2697. line: 1,
  2698. column: 4
  2699. },
  2700. end: {
  2701. line: 1,
  2702. column: 19
  2703. }
  2704. }
  2705. },
  2706. loc: {
  2707. start: {
  2708. line: 1,
  2709. column: 0
  2710. },
  2711. end: {
  2712. line: 1,
  2713. column: 19
  2714. }
  2715. }
  2716. },
  2717. loc: {
  2718. start: {
  2719. line: 1,
  2720. column: 0
  2721. },
  2722. end: {
  2723. line: 1,
  2724. column: 19
  2725. }
  2726. }
  2727. }
  2728. ],
  2729. loc: {
  2730. start: {
  2731. line: 1,
  2732. column: 0
  2733. },
  2734. end: {
  2735. line: 1,
  2736. column: 19
  2737. }
  2738. }
  2739. });
  2740. test("x = { get true() {} }", {
  2741. type: "Program",
  2742. body: [
  2743. {
  2744. type: "ExpressionStatement",
  2745. expression: {
  2746. type: "AssignmentExpression",
  2747. operator: "=",
  2748. left: {
  2749. type: "Identifier",
  2750. name: "x",
  2751. loc: {
  2752. start: {
  2753. line: 1,
  2754. column: 0
  2755. },
  2756. end: {
  2757. line: 1,
  2758. column: 1
  2759. }
  2760. }
  2761. },
  2762. right: {
  2763. type: "ObjectExpression",
  2764. properties: [
  2765. {
  2766. type: "Property",
  2767. key: {
  2768. type: "Identifier",
  2769. name: "true",
  2770. loc: {
  2771. start: {
  2772. line: 1,
  2773. column: 10
  2774. },
  2775. end: {
  2776. line: 1,
  2777. column: 14
  2778. }
  2779. }
  2780. },
  2781. kind: "get",
  2782. value: {
  2783. type: "FunctionExpression",
  2784. id: null,
  2785. params: [],
  2786. body: {
  2787. type: "BlockStatement",
  2788. body: [],
  2789. loc: {
  2790. start: {
  2791. line: 1,
  2792. column: 17
  2793. },
  2794. end: {
  2795. line: 1,
  2796. column: 19
  2797. }
  2798. }
  2799. },
  2800. loc: {
  2801. start: {
  2802. line: 1,
  2803. column: 14
  2804. },
  2805. end: {
  2806. line: 1,
  2807. column: 19
  2808. }
  2809. }
  2810. }
  2811. }
  2812. ],
  2813. loc: {
  2814. start: {
  2815. line: 1,
  2816. column: 4
  2817. },
  2818. end: {
  2819. line: 1,
  2820. column: 21
  2821. }
  2822. }
  2823. },
  2824. loc: {
  2825. start: {
  2826. line: 1,
  2827. column: 0
  2828. },
  2829. end: {
  2830. line: 1,
  2831. column: 21
  2832. }
  2833. }
  2834. },
  2835. loc: {
  2836. start: {
  2837. line: 1,
  2838. column: 0
  2839. },
  2840. end: {
  2841. line: 1,
  2842. column: 21
  2843. }
  2844. }
  2845. }
  2846. ],
  2847. loc: {
  2848. start: {
  2849. line: 1,
  2850. column: 0
  2851. },
  2852. end: {
  2853. line: 1,
  2854. column: 21
  2855. }
  2856. }
  2857. });
  2858. test("x = { get false() {} }", {
  2859. type: "Program",
  2860. body: [
  2861. {
  2862. type: "ExpressionStatement",
  2863. expression: {
  2864. type: "AssignmentExpression",
  2865. operator: "=",
  2866. left: {
  2867. type: "Identifier",
  2868. name: "x",
  2869. loc: {
  2870. start: {
  2871. line: 1,
  2872. column: 0
  2873. },
  2874. end: {
  2875. line: 1,
  2876. column: 1
  2877. }
  2878. }
  2879. },
  2880. right: {
  2881. type: "ObjectExpression",
  2882. properties: [
  2883. {
  2884. type: "Property",
  2885. key: {
  2886. type: "Identifier",
  2887. name: "false",
  2888. loc: {
  2889. start: {
  2890. line: 1,
  2891. column: 10
  2892. },
  2893. end: {
  2894. line: 1,
  2895. column: 15
  2896. }
  2897. }
  2898. },
  2899. kind: "get",
  2900. value: {
  2901. type: "FunctionExpression",
  2902. id: null,
  2903. params: [],
  2904. body: {
  2905. type: "BlockStatement",
  2906. body: [],
  2907. loc: {
  2908. start: {
  2909. line: 1,
  2910. column: 18
  2911. },
  2912. end: {
  2913. line: 1,
  2914. column: 20
  2915. }
  2916. }
  2917. },
  2918. loc: {
  2919. start: {
  2920. line: 1,
  2921. column: 15
  2922. },
  2923. end: {
  2924. line: 1,
  2925. column: 20
  2926. }
  2927. }
  2928. }
  2929. }
  2930. ],
  2931. loc: {
  2932. start: {
  2933. line: 1,
  2934. column: 4
  2935. },
  2936. end: {
  2937. line: 1,
  2938. column: 22
  2939. }
  2940. }
  2941. },
  2942. loc: {
  2943. start: {
  2944. line: 1,
  2945. column: 0
  2946. },
  2947. end: {
  2948. line: 1,
  2949. column: 22
  2950. }
  2951. }
  2952. },
  2953. loc: {
  2954. start: {
  2955. line: 1,
  2956. column: 0
  2957. },
  2958. end: {
  2959. line: 1,
  2960. column: 22
  2961. }
  2962. }
  2963. }
  2964. ],
  2965. loc: {
  2966. start: {
  2967. line: 1,
  2968. column: 0
  2969. },
  2970. end: {
  2971. line: 1,
  2972. column: 22
  2973. }
  2974. }
  2975. });
  2976. test("x = { get null() {} }", {
  2977. type: "Program",
  2978. body: [
  2979. {
  2980. type: "ExpressionStatement",
  2981. expression: {
  2982. type: "AssignmentExpression",
  2983. operator: "=",
  2984. left: {
  2985. type: "Identifier",
  2986. name: "x",
  2987. loc: {
  2988. start: {
  2989. line: 1,
  2990. column: 0
  2991. },
  2992. end: {
  2993. line: 1,
  2994. column: 1
  2995. }
  2996. }
  2997. },
  2998. right: {
  2999. type: "ObjectExpression",
  3000. properties: [
  3001. {
  3002. type: "Property",
  3003. key: {
  3004. type: "Identifier",
  3005. name: "null",
  3006. loc: {
  3007. start: {
  3008. line: 1,
  3009. column: 10
  3010. },
  3011. end: {
  3012. line: 1,
  3013. column: 14
  3014. }
  3015. }
  3016. },
  3017. kind: "get",
  3018. value: {
  3019. type: "FunctionExpression",
  3020. id: null,
  3021. params: [],
  3022. body: {
  3023. type: "BlockStatement",
  3024. body: [],
  3025. loc: {
  3026. start: {
  3027. line: 1,
  3028. column: 17
  3029. },
  3030. end: {
  3031. line: 1,
  3032. column: 19
  3033. }
  3034. }
  3035. },
  3036. loc: {
  3037. start: {
  3038. line: 1,
  3039. column: 14
  3040. },
  3041. end: {
  3042. line: 1,
  3043. column: 19
  3044. }
  3045. }
  3046. }
  3047. }
  3048. ],
  3049. loc: {
  3050. start: {
  3051. line: 1,
  3052. column: 4
  3053. },
  3054. end: {
  3055. line: 1,
  3056. column: 21
  3057. }
  3058. }
  3059. },
  3060. loc: {
  3061. start: {
  3062. line: 1,
  3063. column: 0
  3064. },
  3065. end: {
  3066. line: 1,
  3067. column: 21
  3068. }
  3069. }
  3070. },
  3071. loc: {
  3072. start: {
  3073. line: 1,
  3074. column: 0
  3075. },
  3076. end: {
  3077. line: 1,
  3078. column: 21
  3079. }
  3080. }
  3081. }
  3082. ],
  3083. loc: {
  3084. start: {
  3085. line: 1,
  3086. column: 0
  3087. },
  3088. end: {
  3089. line: 1,
  3090. column: 21
  3091. }
  3092. }
  3093. });
  3094. test("x = { get \"undef\"() {} }", {
  3095. type: "Program",
  3096. body: [
  3097. {
  3098. type: "ExpressionStatement",
  3099. expression: {
  3100. type: "AssignmentExpression",
  3101. operator: "=",
  3102. left: {
  3103. type: "Identifier",
  3104. name: "x",
  3105. loc: {
  3106. start: {
  3107. line: 1,
  3108. column: 0
  3109. },
  3110. end: {
  3111. line: 1,
  3112. column: 1
  3113. }
  3114. }
  3115. },
  3116. right: {
  3117. type: "ObjectExpression",
  3118. properties: [
  3119. {
  3120. type: "Property",
  3121. key: {
  3122. type: "Literal",
  3123. value: "undef",
  3124. loc: {
  3125. start: {
  3126. line: 1,
  3127. column: 10
  3128. },
  3129. end: {
  3130. line: 1,
  3131. column: 17
  3132. }
  3133. }
  3134. },
  3135. kind: "get",
  3136. value: {
  3137. type: "FunctionExpression",
  3138. id: null,
  3139. params: [],
  3140. body: {
  3141. type: "BlockStatement",
  3142. body: [],
  3143. loc: {
  3144. start: {
  3145. line: 1,
  3146. column: 20
  3147. },
  3148. end: {
  3149. line: 1,
  3150. column: 22
  3151. }
  3152. }
  3153. },
  3154. loc: {
  3155. start: {
  3156. line: 1,
  3157. column: 17
  3158. },
  3159. end: {
  3160. line: 1,
  3161. column: 22
  3162. }
  3163. }
  3164. }
  3165. }
  3166. ],
  3167. loc: {
  3168. start: {
  3169. line: 1,
  3170. column: 4
  3171. },
  3172. end: {
  3173. line: 1,
  3174. column: 24
  3175. }
  3176. }
  3177. },
  3178. loc: {
  3179. start: {
  3180. line: 1,
  3181. column: 0
  3182. },
  3183. end: {
  3184. line: 1,
  3185. column: 24
  3186. }
  3187. }
  3188. },
  3189. loc: {
  3190. start: {
  3191. line: 1,
  3192. column: 0
  3193. },
  3194. end: {
  3195. line: 1,
  3196. column: 24
  3197. }
  3198. }
  3199. }
  3200. ],
  3201. loc: {
  3202. start: {
  3203. line: 1,
  3204. column: 0
  3205. },
  3206. end: {
  3207. line: 1,
  3208. column: 24
  3209. }
  3210. }
  3211. });
  3212. test("x = { get 10() {} }", {
  3213. type: "Program",
  3214. body: [
  3215. {
  3216. type: "ExpressionStatement",
  3217. expression: {
  3218. type: "AssignmentExpression",
  3219. operator: "=",
  3220. left: {
  3221. type: "Identifier",
  3222. name: "x",
  3223. loc: {
  3224. start: {
  3225. line: 1,
  3226. column: 0
  3227. },
  3228. end: {
  3229. line: 1,
  3230. column: 1
  3231. }
  3232. }
  3233. },
  3234. right: {
  3235. type: "ObjectExpression",
  3236. properties: [
  3237. {
  3238. type: "Property",
  3239. key: {
  3240. type: "Literal",
  3241. value: 10,
  3242. loc: {
  3243. start: {
  3244. line: 1,
  3245. column: 10
  3246. },
  3247. end: {
  3248. line: 1,
  3249. column: 12
  3250. }
  3251. }
  3252. },
  3253. kind: "get",
  3254. value: {
  3255. type: "FunctionExpression",
  3256. id: null,
  3257. params: [],
  3258. body: {
  3259. type: "BlockStatement",
  3260. body: [],
  3261. loc: {
  3262. start: {
  3263. line: 1,
  3264. column: 15
  3265. },
  3266. end: {
  3267. line: 1,
  3268. column: 17
  3269. }
  3270. }
  3271. },
  3272. loc: {
  3273. start: {
  3274. line: 1,
  3275. column: 12
  3276. },
  3277. end: {
  3278. line: 1,
  3279. column: 17
  3280. }
  3281. }
  3282. }
  3283. }
  3284. ],
  3285. loc: {
  3286. start: {
  3287. line: 1,
  3288. column: 4
  3289. },
  3290. end: {
  3291. line: 1,
  3292. column: 19
  3293. }
  3294. }
  3295. },
  3296. loc: {
  3297. start: {
  3298. line: 1,
  3299. column: 0
  3300. },
  3301. end: {
  3302. line: 1,
  3303. column: 19
  3304. }
  3305. }
  3306. },
  3307. loc: {
  3308. start: {
  3309. line: 1,
  3310. column: 0
  3311. },
  3312. end: {
  3313. line: 1,
  3314. column: 19
  3315. }
  3316. }
  3317. }
  3318. ],
  3319. loc: {
  3320. start: {
  3321. line: 1,
  3322. column: 0
  3323. },
  3324. end: {
  3325. line: 1,
  3326. column: 19
  3327. }
  3328. }
  3329. });
  3330. test("x = { set width(w) { m_width = w } }", {
  3331. type: "Program",
  3332. body: [
  3333. {
  3334. type: "ExpressionStatement",
  3335. expression: {
  3336. type: "AssignmentExpression",
  3337. operator: "=",
  3338. left: {
  3339. type: "Identifier",
  3340. name: "x",
  3341. loc: {
  3342. start: {
  3343. line: 1,
  3344. column: 0
  3345. },
  3346. end: {
  3347. line: 1,
  3348. column: 1
  3349. }
  3350. }
  3351. },
  3352. right: {
  3353. type: "ObjectExpression",
  3354. properties: [
  3355. {
  3356. type: "Property",
  3357. key: {
  3358. type: "Identifier",
  3359. name: "width",
  3360. loc: {
  3361. start: {
  3362. line: 1,
  3363. column: 10
  3364. },
  3365. end: {
  3366. line: 1,
  3367. column: 15
  3368. }
  3369. }
  3370. },
  3371. kind: "set",
  3372. value: {
  3373. type: "FunctionExpression",
  3374. id: null,
  3375. params: [
  3376. {
  3377. type: "Identifier",
  3378. name: "w",
  3379. loc: {
  3380. start: {
  3381. line: 1,
  3382. column: 16
  3383. },
  3384. end: {
  3385. line: 1,
  3386. column: 17
  3387. }
  3388. }
  3389. }
  3390. ],
  3391. body: {
  3392. type: "BlockStatement",
  3393. body: [
  3394. {
  3395. type: "ExpressionStatement",
  3396. expression: {
  3397. type: "AssignmentExpression",
  3398. operator: "=",
  3399. left: {
  3400. type: "Identifier",
  3401. name: "m_width",
  3402. loc: {
  3403. start: {
  3404. line: 1,
  3405. column: 21
  3406. },
  3407. end: {
  3408. line: 1,
  3409. column: 28
  3410. }
  3411. }
  3412. },
  3413. right: {
  3414. type: "Identifier",
  3415. name: "w",
  3416. loc: {
  3417. start: {
  3418. line: 1,
  3419. column: 31
  3420. },
  3421. end: {
  3422. line: 1,
  3423. column: 32
  3424. }
  3425. }
  3426. },
  3427. loc: {
  3428. start: {
  3429. line: 1,
  3430. column: 21
  3431. },
  3432. end: {
  3433. line: 1,
  3434. column: 32
  3435. }
  3436. }
  3437. },
  3438. loc: {
  3439. start: {
  3440. line: 1,
  3441. column: 21
  3442. },
  3443. end: {
  3444. line: 1,
  3445. column: 32
  3446. }
  3447. }
  3448. }
  3449. ],
  3450. loc: {
  3451. start: {
  3452. line: 1,
  3453. column: 19
  3454. },
  3455. end: {
  3456. line: 1,
  3457. column: 34
  3458. }
  3459. }
  3460. },
  3461. loc: {
  3462. start: {
  3463. line: 1,
  3464. column: 15
  3465. },
  3466. end: {
  3467. line: 1,
  3468. column: 34
  3469. }
  3470. }
  3471. }
  3472. }
  3473. ],
  3474. loc: {
  3475. start: {
  3476. line: 1,
  3477. column: 4
  3478. },
  3479. end: {
  3480. line: 1,
  3481. column: 36
  3482. }
  3483. }
  3484. },
  3485. loc: {
  3486. start: {
  3487. line: 1,
  3488. column: 0
  3489. },
  3490. end: {
  3491. line: 1,
  3492. column: 36
  3493. }
  3494. }
  3495. },
  3496. loc: {
  3497. start: {
  3498. line: 1,
  3499. column: 0
  3500. },
  3501. end: {
  3502. line: 1,
  3503. column: 36
  3504. }
  3505. }
  3506. }
  3507. ],
  3508. loc: {
  3509. start: {
  3510. line: 1,
  3511. column: 0
  3512. },
  3513. end: {
  3514. line: 1,
  3515. column: 36
  3516. }
  3517. }
  3518. });
  3519. test("x = { set if(w) { m_if = w } }", {
  3520. type: "Program",
  3521. body: [
  3522. {
  3523. type: "ExpressionStatement",
  3524. expression: {
  3525. type: "AssignmentExpression",
  3526. operator: "=",
  3527. left: {
  3528. type: "Identifier",
  3529. name: "x",
  3530. loc: {
  3531. start: {
  3532. line: 1,
  3533. column: 0
  3534. },
  3535. end: {
  3536. line: 1,
  3537. column: 1
  3538. }
  3539. }
  3540. },
  3541. right: {
  3542. type: "ObjectExpression",
  3543. properties: [
  3544. {
  3545. type: "Property",
  3546. key: {
  3547. type: "Identifier",
  3548. name: "if",
  3549. loc: {
  3550. start: {
  3551. line: 1,
  3552. column: 10
  3553. },
  3554. end: {
  3555. line: 1,
  3556. column: 12
  3557. }
  3558. }
  3559. },
  3560. kind: "set",
  3561. value: {
  3562. type: "FunctionExpression",
  3563. id: null,
  3564. params: [
  3565. {
  3566. type: "Identifier",
  3567. name: "w",
  3568. loc: {
  3569. start: {
  3570. line: 1,
  3571. column: 13
  3572. },
  3573. end: {
  3574. line: 1,
  3575. column: 14
  3576. }
  3577. }
  3578. }
  3579. ],
  3580. body: {
  3581. type: "BlockStatement",
  3582. body: [
  3583. {
  3584. type: "ExpressionStatement",
  3585. expression: {
  3586. type: "AssignmentExpression",
  3587. operator: "=",
  3588. left: {
  3589. type: "Identifier",
  3590. name: "m_if",
  3591. loc: {
  3592. start: {
  3593. line: 1,
  3594. column: 18
  3595. },
  3596. end: {
  3597. line: 1,
  3598. column: 22
  3599. }
  3600. }
  3601. },
  3602. right: {
  3603. type: "Identifier",
  3604. name: "w",
  3605. loc: {
  3606. start: {
  3607. line: 1,
  3608. column: 25
  3609. },
  3610. end: {
  3611. line: 1,
  3612. column: 26
  3613. }
  3614. }
  3615. },
  3616. loc: {
  3617. start: {
  3618. line: 1,
  3619. column: 18
  3620. },
  3621. end: {
  3622. line: 1,
  3623. column: 26
  3624. }
  3625. }
  3626. },
  3627. loc: {
  3628. start: {
  3629. line: 1,
  3630. column: 18
  3631. },
  3632. end: {
  3633. line: 1,
  3634. column: 26
  3635. }
  3636. }
  3637. }
  3638. ],
  3639. loc: {
  3640. start: {
  3641. line: 1,
  3642. column: 16
  3643. },
  3644. end: {
  3645. line: 1,
  3646. column: 28
  3647. }
  3648. }
  3649. },
  3650. loc: {
  3651. start: {
  3652. line: 1,
  3653. column: 12
  3654. },
  3655. end: {
  3656. line: 1,
  3657. column: 28
  3658. }
  3659. }
  3660. }
  3661. }
  3662. ],
  3663. loc: {
  3664. start: {
  3665. line: 1,
  3666. column: 4
  3667. },
  3668. end: {
  3669. line: 1,
  3670. column: 30
  3671. }
  3672. }
  3673. },
  3674. loc: {
  3675. start: {
  3676. line: 1,
  3677. column: 0
  3678. },
  3679. end: {
  3680. line: 1,
  3681. column: 30
  3682. }
  3683. }
  3684. },
  3685. loc: {
  3686. start: {
  3687. line: 1,
  3688. column: 0
  3689. },
  3690. end: {
  3691. line: 1,
  3692. column: 30
  3693. }
  3694. }
  3695. }
  3696. ],
  3697. loc: {
  3698. start: {
  3699. line: 1,
  3700. column: 0
  3701. },
  3702. end: {
  3703. line: 1,
  3704. column: 30
  3705. }
  3706. }
  3707. });
  3708. test("x = { set true(w) { m_true = w } }", {
  3709. type: "Program",
  3710. body: [
  3711. {
  3712. type: "ExpressionStatement",
  3713. expression: {
  3714. type: "AssignmentExpression",
  3715. operator: "=",
  3716. left: {
  3717. type: "Identifier",
  3718. name: "x",
  3719. loc: {
  3720. start: {
  3721. line: 1,
  3722. column: 0
  3723. },
  3724. end: {
  3725. line: 1,
  3726. column: 1
  3727. }
  3728. }
  3729. },
  3730. right: {
  3731. type: "ObjectExpression",
  3732. properties: [
  3733. {
  3734. type: "Property",
  3735. key: {
  3736. type: "Identifier",
  3737. name: "true",
  3738. loc: {
  3739. start: {
  3740. line: 1,
  3741. column: 10
  3742. },
  3743. end: {
  3744. line: 1,
  3745. column: 14
  3746. }
  3747. }
  3748. },
  3749. kind: "set",
  3750. value: {
  3751. type: "FunctionExpression",
  3752. id: null,
  3753. params: [
  3754. {
  3755. type: "Identifier",
  3756. name: "w",
  3757. loc: {
  3758. start: {
  3759. line: 1,
  3760. column: 15
  3761. },
  3762. end: {
  3763. line: 1,
  3764. column: 16
  3765. }
  3766. }
  3767. }
  3768. ],
  3769. body: {
  3770. type: "BlockStatement",
  3771. body: [
  3772. {
  3773. type: "ExpressionStatement",
  3774. expression: {
  3775. type: "AssignmentExpression",
  3776. operator: "=",
  3777. left: {
  3778. type: "Identifier",
  3779. name: "m_true",
  3780. loc: {
  3781. start: {
  3782. line: 1,
  3783. column: 20
  3784. },
  3785. end: {
  3786. line: 1,
  3787. column: 26
  3788. }
  3789. }
  3790. },
  3791. right: {
  3792. type: "Identifier",
  3793. name: "w",
  3794. loc: {
  3795. start: {
  3796. line: 1,
  3797. column: 29
  3798. },
  3799. end: {
  3800. line: 1,
  3801. column: 30
  3802. }
  3803. }
  3804. },
  3805. loc: {
  3806. start: {
  3807. line: 1,
  3808. column: 20
  3809. },
  3810. end: {
  3811. line: 1,
  3812. column: 30
  3813. }
  3814. }
  3815. },
  3816. loc: {
  3817. start: {
  3818. line: 1,
  3819. column: 20
  3820. },
  3821. end: {
  3822. line: 1,
  3823. column: 30
  3824. }
  3825. }
  3826. }
  3827. ],
  3828. loc: {
  3829. start: {
  3830. line: 1,
  3831. column: 18
  3832. },
  3833. end: {
  3834. line: 1,
  3835. column: 32
  3836. }
  3837. }
  3838. },
  3839. loc: {
  3840. start: {
  3841. line: 1,
  3842. column: 14
  3843. },
  3844. end: {
  3845. line: 1,
  3846. column: 32
  3847. }
  3848. }
  3849. }
  3850. }
  3851. ],
  3852. loc: {
  3853. start: {
  3854. line: 1,
  3855. column: 4
  3856. },
  3857. end: {
  3858. line: 1,
  3859. column: 34
  3860. }
  3861. }
  3862. },
  3863. loc: {
  3864. start: {
  3865. line: 1,
  3866. column: 0
  3867. },
  3868. end: {
  3869. line: 1,
  3870. column: 34
  3871. }
  3872. }
  3873. },
  3874. loc: {
  3875. start: {
  3876. line: 1,
  3877. column: 0
  3878. },
  3879. end: {
  3880. line: 1,
  3881. column: 34
  3882. }
  3883. }
  3884. }
  3885. ],
  3886. loc: {
  3887. start: {
  3888. line: 1,
  3889. column: 0
  3890. },
  3891. end: {
  3892. line: 1,
  3893. column: 34
  3894. }
  3895. }
  3896. });
  3897. test("x = { set false(w) { m_false = w } }", {
  3898. type: "Program",
  3899. body: [
  3900. {
  3901. type: "ExpressionStatement",
  3902. expression: {
  3903. type: "AssignmentExpression",
  3904. operator: "=",
  3905. left: {
  3906. type: "Identifier",
  3907. name: "x",
  3908. loc: {
  3909. start: {
  3910. line: 1,
  3911. column: 0
  3912. },
  3913. end: {
  3914. line: 1,
  3915. column: 1
  3916. }
  3917. }
  3918. },
  3919. right: {
  3920. type: "ObjectExpression",
  3921. properties: [
  3922. {
  3923. type: "Property",
  3924. key: {
  3925. type: "Identifier",
  3926. name: "false",
  3927. loc: {
  3928. start: {
  3929. line: 1,
  3930. column: 10
  3931. },
  3932. end: {
  3933. line: 1,
  3934. column: 15
  3935. }
  3936. }
  3937. },
  3938. kind: "set",
  3939. value: {
  3940. type: "FunctionExpression",
  3941. id: null,
  3942. params: [
  3943. {
  3944. type: "Identifier",
  3945. name: "w",
  3946. loc: {
  3947. start: {
  3948. line: 1,
  3949. column: 16
  3950. },
  3951. end: {
  3952. line: 1,
  3953. column: 17
  3954. }
  3955. }
  3956. }
  3957. ],
  3958. body: {
  3959. type: "BlockStatement",
  3960. body: [
  3961. {
  3962. type: "ExpressionStatement",
  3963. expression: {
  3964. type: "AssignmentExpression",
  3965. operator: "=",
  3966. left: {
  3967. type: "Identifier",
  3968. name: "m_false",
  3969. loc: {
  3970. start: {
  3971. line: 1,
  3972. column: 21
  3973. },
  3974. end: {
  3975. line: 1,
  3976. column: 28
  3977. }
  3978. }
  3979. },
  3980. right: {
  3981. type: "Identifier",
  3982. name: "w",
  3983. loc: {
  3984. start: {
  3985. line: 1,
  3986. column: 31
  3987. },
  3988. end: {
  3989. line: 1,
  3990. column: 32
  3991. }
  3992. }
  3993. },
  3994. loc: {
  3995. start: {
  3996. line: 1,
  3997. column: 21
  3998. },
  3999. end: {
  4000. line: 1,
  4001. column: 32
  4002. }
  4003. }
  4004. },
  4005. loc: {
  4006. start: {
  4007. line: 1,
  4008. column: 21
  4009. },
  4010. end: {
  4011. line: 1,
  4012. column: 32
  4013. }
  4014. }
  4015. }
  4016. ],
  4017. loc: {
  4018. start: {
  4019. line: 1,
  4020. column: 19
  4021. },
  4022. end: {
  4023. line: 1,
  4024. column: 34
  4025. }
  4026. }
  4027. },
  4028. loc: {
  4029. start: {
  4030. line: 1,
  4031. column: 15
  4032. },
  4033. end: {
  4034. line: 1,
  4035. column: 34
  4036. }
  4037. }
  4038. }
  4039. }
  4040. ],
  4041. loc: {
  4042. start: {
  4043. line: 1,
  4044. column: 4
  4045. },
  4046. end: {
  4047. line: 1,
  4048. column: 36
  4049. }
  4050. }
  4051. },
  4052. loc: {
  4053. start: {
  4054. line: 1,
  4055. column: 0
  4056. },
  4057. end: {
  4058. line: 1,
  4059. column: 36
  4060. }
  4061. }
  4062. },
  4063. loc: {
  4064. start: {
  4065. line: 1,
  4066. column: 0
  4067. },
  4068. end: {
  4069. line: 1,
  4070. column: 36
  4071. }
  4072. }
  4073. }
  4074. ],
  4075. loc: {
  4076. start: {
  4077. line: 1,
  4078. column: 0
  4079. },
  4080. end: {
  4081. line: 1,
  4082. column: 36
  4083. }
  4084. }
  4085. });
  4086. test("x = { set null(w) { m_null = w } }", {
  4087. type: "Program",
  4088. body: [
  4089. {
  4090. type: "ExpressionStatement",
  4091. expression: {
  4092. type: "AssignmentExpression",
  4093. operator: "=",
  4094. left: {
  4095. type: "Identifier",
  4096. name: "x",
  4097. loc: {
  4098. start: {
  4099. line: 1,
  4100. column: 0
  4101. },
  4102. end: {
  4103. line: 1,
  4104. column: 1
  4105. }
  4106. }
  4107. },
  4108. right: {
  4109. type: "ObjectExpression",
  4110. properties: [
  4111. {
  4112. type: "Property",
  4113. key: {
  4114. type: "Identifier",
  4115. name: "null",
  4116. loc: {
  4117. start: {
  4118. line: 1,
  4119. column: 10
  4120. },
  4121. end: {
  4122. line: 1,
  4123. column: 14
  4124. }
  4125. }
  4126. },
  4127. kind: "set",
  4128. value: {
  4129. type: "FunctionExpression",
  4130. id: null,
  4131. params: [
  4132. {
  4133. type: "Identifier",
  4134. name: "w",
  4135. loc: {
  4136. start: {
  4137. line: 1,
  4138. column: 15
  4139. },
  4140. end: {
  4141. line: 1,
  4142. column: 16
  4143. }
  4144. }
  4145. }
  4146. ],
  4147. body: {
  4148. type: "BlockStatement",
  4149. body: [
  4150. {
  4151. type: "ExpressionStatement",
  4152. expression: {
  4153. type: "AssignmentExpression",
  4154. operator: "=",
  4155. left: {
  4156. type: "Identifier",
  4157. name: "m_null",
  4158. loc: {
  4159. start: {
  4160. line: 1,
  4161. column: 20
  4162. },
  4163. end: {
  4164. line: 1,
  4165. column: 26
  4166. }
  4167. }
  4168. },
  4169. right: {
  4170. type: "Identifier",
  4171. name: "w",
  4172. loc: {
  4173. start: {
  4174. line: 1,
  4175. column: 29
  4176. },
  4177. end: {
  4178. line: 1,
  4179. column: 30
  4180. }
  4181. }
  4182. },
  4183. loc: {
  4184. start: {
  4185. line: 1,
  4186. column: 20
  4187. },
  4188. end: {
  4189. line: 1,
  4190. column: 30
  4191. }
  4192. }
  4193. },
  4194. loc: {
  4195. start: {
  4196. line: 1,
  4197. column: 20
  4198. },
  4199. end: {
  4200. line: 1,
  4201. column: 30
  4202. }
  4203. }
  4204. }
  4205. ],
  4206. loc: {
  4207. start: {
  4208. line: 1,
  4209. column: 18
  4210. },
  4211. end: {
  4212. line: 1,
  4213. column: 32
  4214. }
  4215. }
  4216. },
  4217. loc: {
  4218. start: {
  4219. line: 1,
  4220. column: 14
  4221. },
  4222. end: {
  4223. line: 1,
  4224. column: 32
  4225. }
  4226. }
  4227. }
  4228. }
  4229. ],
  4230. loc: {
  4231. start: {
  4232. line: 1,
  4233. column: 4
  4234. },
  4235. end: {
  4236. line: 1,
  4237. column: 34
  4238. }
  4239. }
  4240. },
  4241. loc: {
  4242. start: {
  4243. line: 1,
  4244. column: 0
  4245. },
  4246. end: {
  4247. line: 1,
  4248. column: 34
  4249. }
  4250. }
  4251. },
  4252. loc: {
  4253. start: {
  4254. line: 1,
  4255. column: 0
  4256. },
  4257. end: {
  4258. line: 1,
  4259. column: 34
  4260. }
  4261. }
  4262. }
  4263. ],
  4264. loc: {
  4265. start: {
  4266. line: 1,
  4267. column: 0
  4268. },
  4269. end: {
  4270. line: 1,
  4271. column: 34
  4272. }
  4273. }
  4274. });
  4275. test("x = { set \"null\"(w) { m_null = w } }", {
  4276. type: "Program",
  4277. body: [
  4278. {
  4279. type: "ExpressionStatement",
  4280. expression: {
  4281. type: "AssignmentExpression",
  4282. operator: "=",
  4283. left: {
  4284. type: "Identifier",
  4285. name: "x",
  4286. loc: {
  4287. start: {
  4288. line: 1,
  4289. column: 0
  4290. },
  4291. end: {
  4292. line: 1,
  4293. column: 1
  4294. }
  4295. }
  4296. },
  4297. right: {
  4298. type: "ObjectExpression",
  4299. properties: [
  4300. {
  4301. type: "Property",
  4302. key: {
  4303. type: "Literal",
  4304. value: "null",
  4305. loc: {
  4306. start: {
  4307. line: 1,
  4308. column: 10
  4309. },
  4310. end: {
  4311. line: 1,
  4312. column: 16
  4313. }
  4314. }
  4315. },
  4316. kind: "set",
  4317. value: {
  4318. type: "FunctionExpression",
  4319. id: null,
  4320. params: [
  4321. {
  4322. type: "Identifier",
  4323. name: "w",
  4324. loc: {
  4325. start: {
  4326. line: 1,
  4327. column: 17
  4328. },
  4329. end: {
  4330. line: 1,
  4331. column: 18
  4332. }
  4333. }
  4334. }
  4335. ],
  4336. body: {
  4337. type: "BlockStatement",
  4338. body: [
  4339. {
  4340. type: "ExpressionStatement",
  4341. expression: {
  4342. type: "AssignmentExpression",
  4343. operator: "=",
  4344. left: {
  4345. type: "Identifier",
  4346. name: "m_null",
  4347. loc: {
  4348. start: {
  4349. line: 1,
  4350. column: 22
  4351. },
  4352. end: {
  4353. line: 1,
  4354. column: 28
  4355. }
  4356. }
  4357. },
  4358. right: {
  4359. type: "Identifier",
  4360. name: "w",
  4361. loc: {
  4362. start: {
  4363. line: 1,
  4364. column: 31
  4365. },
  4366. end: {
  4367. line: 1,
  4368. column: 32
  4369. }
  4370. }
  4371. },
  4372. loc: {
  4373. start: {
  4374. line: 1,
  4375. column: 22
  4376. },
  4377. end: {
  4378. line: 1,
  4379. column: 32
  4380. }
  4381. }
  4382. },
  4383. loc: {
  4384. start: {
  4385. line: 1,
  4386. column: 22
  4387. },
  4388. end: {
  4389. line: 1,
  4390. column: 32
  4391. }
  4392. }
  4393. }
  4394. ],
  4395. loc: {
  4396. start: {
  4397. line: 1,
  4398. column: 20
  4399. },
  4400. end: {
  4401. line: 1,
  4402. column: 34
  4403. }
  4404. }
  4405. },
  4406. loc: {
  4407. start: {
  4408. line: 1,
  4409. column: 16
  4410. },
  4411. end: {
  4412. line: 1,
  4413. column: 34
  4414. }
  4415. }
  4416. }
  4417. }
  4418. ],
  4419. loc: {
  4420. start: {
  4421. line: 1,
  4422. column: 4
  4423. },
  4424. end: {
  4425. line: 1,
  4426. column: 36
  4427. }
  4428. }
  4429. },
  4430. loc: {
  4431. start: {
  4432. line: 1,
  4433. column: 0
  4434. },
  4435. end: {
  4436. line: 1,
  4437. column: 36
  4438. }
  4439. }
  4440. },
  4441. loc: {
  4442. start: {
  4443. line: 1,
  4444. column: 0
  4445. },
  4446. end: {
  4447. line: 1,
  4448. column: 36
  4449. }
  4450. }
  4451. }
  4452. ],
  4453. loc: {
  4454. start: {
  4455. line: 1,
  4456. column: 0
  4457. },
  4458. end: {
  4459. line: 1,
  4460. column: 36
  4461. }
  4462. }
  4463. });
  4464. test("x = { set 10(w) { m_null = w } }", {
  4465. type: "Program",
  4466. body: [
  4467. {
  4468. type: "ExpressionStatement",
  4469. expression: {
  4470. type: "AssignmentExpression",
  4471. operator: "=",
  4472. left: {
  4473. type: "Identifier",
  4474. name: "x",
  4475. loc: {
  4476. start: {
  4477. line: 1,
  4478. column: 0
  4479. },
  4480. end: {
  4481. line: 1,
  4482. column: 1
  4483. }
  4484. }
  4485. },
  4486. right: {
  4487. type: "ObjectExpression",
  4488. properties: [
  4489. {
  4490. type: "Property",
  4491. key: {
  4492. type: "Literal",
  4493. value: 10,
  4494. loc: {
  4495. start: {
  4496. line: 1,
  4497. column: 10
  4498. },
  4499. end: {
  4500. line: 1,
  4501. column: 12
  4502. }
  4503. }
  4504. },
  4505. kind: "set",
  4506. value: {
  4507. type: "FunctionExpression",
  4508. id: null,
  4509. params: [
  4510. {
  4511. type: "Identifier",
  4512. name: "w",
  4513. loc: {
  4514. start: {
  4515. line: 1,
  4516. column: 13
  4517. },
  4518. end: {
  4519. line: 1,
  4520. column: 14
  4521. }
  4522. }
  4523. }
  4524. ],
  4525. body: {
  4526. type: "BlockStatement",
  4527. body: [
  4528. {
  4529. type: "ExpressionStatement",
  4530. expression: {
  4531. type: "AssignmentExpression",
  4532. operator: "=",
  4533. left: {
  4534. type: "Identifier",
  4535. name: "m_null",
  4536. loc: {
  4537. start: {
  4538. line: 1,
  4539. column: 18
  4540. },
  4541. end: {
  4542. line: 1,
  4543. column: 24
  4544. }
  4545. }
  4546. },
  4547. right: {
  4548. type: "Identifier",
  4549. name: "w",
  4550. loc: {
  4551. start: {
  4552. line: 1,
  4553. column: 27
  4554. },
  4555. end: {
  4556. line: 1,
  4557. column: 28
  4558. }
  4559. }
  4560. },
  4561. loc: {
  4562. start: {
  4563. line: 1,
  4564. column: 18
  4565. },
  4566. end: {
  4567. line: 1,
  4568. column: 28
  4569. }
  4570. }
  4571. },
  4572. loc: {
  4573. start: {
  4574. line: 1,
  4575. column: 18
  4576. },
  4577. end: {
  4578. line: 1,
  4579. column: 28
  4580. }
  4581. }
  4582. }
  4583. ],
  4584. loc: {
  4585. start: {
  4586. line: 1,
  4587. column: 16
  4588. },
  4589. end: {
  4590. line: 1,
  4591. column: 30
  4592. }
  4593. }
  4594. },
  4595. loc: {
  4596. start: {
  4597. line: 1,
  4598. column: 12
  4599. },
  4600. end: {
  4601. line: 1,
  4602. column: 30
  4603. }
  4604. }
  4605. }
  4606. }
  4607. ],
  4608. loc: {
  4609. start: {
  4610. line: 1,
  4611. column: 4
  4612. },
  4613. end: {
  4614. line: 1,
  4615. column: 32
  4616. }
  4617. }
  4618. },
  4619. loc: {
  4620. start: {
  4621. line: 1,
  4622. column: 0
  4623. },
  4624. end: {
  4625. line: 1,
  4626. column: 32
  4627. }
  4628. }
  4629. },
  4630. loc: {
  4631. start: {
  4632. line: 1,
  4633. column: 0
  4634. },
  4635. end: {
  4636. line: 1,
  4637. column: 32
  4638. }
  4639. }
  4640. }
  4641. ],
  4642. loc: {
  4643. start: {
  4644. line: 1,
  4645. column: 0
  4646. },
  4647. end: {
  4648. line: 1,
  4649. column: 32
  4650. }
  4651. }
  4652. });
  4653. test("x = { get: 42 }", {
  4654. type: "Program",
  4655. body: [
  4656. {
  4657. type: "ExpressionStatement",
  4658. expression: {
  4659. type: "AssignmentExpression",
  4660. operator: "=",
  4661. left: {
  4662. type: "Identifier",
  4663. name: "x",
  4664. loc: {
  4665. start: {
  4666. line: 1,
  4667. column: 0
  4668. },
  4669. end: {
  4670. line: 1,
  4671. column: 1
  4672. }
  4673. }
  4674. },
  4675. right: {
  4676. type: "ObjectExpression",
  4677. properties: [
  4678. {
  4679. type: "Property",
  4680. key: {
  4681. type: "Identifier",
  4682. name: "get",
  4683. loc: {
  4684. start: {
  4685. line: 1,
  4686. column: 6
  4687. },
  4688. end: {
  4689. line: 1,
  4690. column: 9
  4691. }
  4692. }
  4693. },
  4694. value: {
  4695. type: "Literal",
  4696. value: 42,
  4697. loc: {
  4698. start: {
  4699. line: 1,
  4700. column: 11
  4701. },
  4702. end: {
  4703. line: 1,
  4704. column: 13
  4705. }
  4706. }
  4707. },
  4708. kind: "init"
  4709. }
  4710. ],
  4711. loc: {
  4712. start: {
  4713. line: 1,
  4714. column: 4
  4715. },
  4716. end: {
  4717. line: 1,
  4718. column: 15
  4719. }
  4720. }
  4721. },
  4722. loc: {
  4723. start: {
  4724. line: 1,
  4725. column: 0
  4726. },
  4727. end: {
  4728. line: 1,
  4729. column: 15
  4730. }
  4731. }
  4732. },
  4733. loc: {
  4734. start: {
  4735. line: 1,
  4736. column: 0
  4737. },
  4738. end: {
  4739. line: 1,
  4740. column: 15
  4741. }
  4742. }
  4743. }
  4744. ],
  4745. loc: {
  4746. start: {
  4747. line: 1,
  4748. column: 0
  4749. },
  4750. end: {
  4751. line: 1,
  4752. column: 15
  4753. }
  4754. }
  4755. });
  4756. test("x = { set: 43 }", {
  4757. type: "Program",
  4758. body: [
  4759. {
  4760. type: "ExpressionStatement",
  4761. expression: {
  4762. type: "AssignmentExpression",
  4763. operator: "=",
  4764. left: {
  4765. type: "Identifier",
  4766. name: "x",
  4767. loc: {
  4768. start: {
  4769. line: 1,
  4770. column: 0
  4771. },
  4772. end: {
  4773. line: 1,
  4774. column: 1
  4775. }
  4776. }
  4777. },
  4778. right: {
  4779. type: "ObjectExpression",
  4780. properties: [
  4781. {
  4782. type: "Property",
  4783. key: {
  4784. type: "Identifier",
  4785. name: "set",
  4786. loc: {
  4787. start: {
  4788. line: 1,
  4789. column: 6
  4790. },
  4791. end: {
  4792. line: 1,
  4793. column: 9
  4794. }
  4795. }
  4796. },
  4797. value: {
  4798. type: "Literal",
  4799. value: 43,
  4800. loc: {
  4801. start: {
  4802. line: 1,
  4803. column: 11
  4804. },
  4805. end: {
  4806. line: 1,
  4807. column: 13
  4808. }
  4809. }
  4810. },
  4811. kind: "init"
  4812. }
  4813. ],
  4814. loc: {
  4815. start: {
  4816. line: 1,
  4817. column: 4
  4818. },
  4819. end: {
  4820. line: 1,
  4821. column: 15
  4822. }
  4823. }
  4824. },
  4825. loc: {
  4826. start: {
  4827. line: 1,
  4828. column: 0
  4829. },
  4830. end: {
  4831. line: 1,
  4832. column: 15
  4833. }
  4834. }
  4835. },
  4836. loc: {
  4837. start: {
  4838. line: 1,
  4839. column: 0
  4840. },
  4841. end: {
  4842. line: 1,
  4843. column: 15
  4844. }
  4845. }
  4846. }
  4847. ],
  4848. loc: {
  4849. start: {
  4850. line: 1,
  4851. column: 0
  4852. },
  4853. end: {
  4854. line: 1,
  4855. column: 15
  4856. }
  4857. }
  4858. });
  4859. test("/* block comment */ 42", {
  4860. type: "Program",
  4861. body: [
  4862. {
  4863. type: "ExpressionStatement",
  4864. expression: {
  4865. type: "Literal",
  4866. value: 42,
  4867. loc: {
  4868. start: {
  4869. line: 1,
  4870. column: 20
  4871. },
  4872. end: {
  4873. line: 1,
  4874. column: 22
  4875. }
  4876. }
  4877. },
  4878. loc: {
  4879. start: {
  4880. line: 1,
  4881. column: 20
  4882. },
  4883. end: {
  4884. line: 1,
  4885. column: 22
  4886. }
  4887. }
  4888. }
  4889. ],
  4890. loc: {
  4891. start: {
  4892. line: 1,
  4893. column: 0
  4894. },
  4895. end: {
  4896. line: 1,
  4897. column: 22
  4898. }
  4899. }
  4900. });
  4901. test("42 /*The*/ /*Answer*/", {
  4902. type: "Program",
  4903. body: [
  4904. {
  4905. type: "ExpressionStatement",
  4906. expression: {
  4907. type: "Literal",
  4908. value: 42,
  4909. loc: {
  4910. start: {
  4911. line: 1,
  4912. column: 0
  4913. },
  4914. end: {
  4915. line: 1,
  4916. column: 2
  4917. }
  4918. }
  4919. },
  4920. loc: {
  4921. start: {
  4922. line: 1,
  4923. column: 0
  4924. },
  4925. end: {
  4926. line: 1,
  4927. column: 2
  4928. }
  4929. }
  4930. }
  4931. ],
  4932. loc: {
  4933. start: {
  4934. line: 1,
  4935. column: 0
  4936. },
  4937. end: {
  4938. line: 1,
  4939. column: 21
  4940. }
  4941. }
  4942. });
  4943. test("42 /*the*/ /*answer*/", {
  4944. type: "Program",
  4945. body: [
  4946. {
  4947. type: "ExpressionStatement",
  4948. expression: {
  4949. type: "Literal",
  4950. value: 42,
  4951. loc: {
  4952. start: {
  4953. line: 1,
  4954. column: 0
  4955. },
  4956. end: {
  4957. line: 1,
  4958. column: 2
  4959. }
  4960. }
  4961. },
  4962. loc: {
  4963. start: {
  4964. line: 1,
  4965. column: 0
  4966. },
  4967. end: {
  4968. line: 1,
  4969. column: 2
  4970. }
  4971. }
  4972. }
  4973. ],
  4974. loc: {
  4975. start: {
  4976. line: 1,
  4977. column: 0
  4978. },
  4979. end: {
  4980. line: 1,
  4981. column: 21
  4982. }
  4983. }
  4984. });
  4985. test("/* multiline\ncomment\nshould\nbe\nignored */ 42", {
  4986. type: "Program",
  4987. body: [
  4988. {
  4989. type: "ExpressionStatement",
  4990. expression: {
  4991. type: "Literal",
  4992. value: 42,
  4993. loc: {
  4994. start: {
  4995. line: 5,
  4996. column: 11
  4997. },
  4998. end: {
  4999. line: 5,
  5000. column: 13
  5001. }
  5002. }
  5003. },
  5004. loc: {
  5005. start: {
  5006. line: 5,
  5007. column: 11
  5008. },
  5009. end: {
  5010. line: 5,
  5011. column: 13
  5012. }
  5013. }
  5014. }
  5015. ],
  5016. loc: {
  5017. start: {
  5018. line: 1,
  5019. column: 0
  5020. },
  5021. end: {
  5022. line: 5,
  5023. column: 13
  5024. }
  5025. }
  5026. });
  5027. test("/*a\r\nb*/ 42", {
  5028. type: "Program",
  5029. body: [
  5030. {
  5031. type: "ExpressionStatement",
  5032. expression: {
  5033. type: "Literal",
  5034. value: 42,
  5035. loc: {
  5036. start: {
  5037. line: 2,
  5038. column: 4
  5039. },
  5040. end: {
  5041. line: 2,
  5042. column: 6
  5043. }
  5044. }
  5045. },
  5046. loc: {
  5047. start: {
  5048. line: 2,
  5049. column: 4
  5050. },
  5051. end: {
  5052. line: 2,
  5053. column: 6
  5054. }
  5055. }
  5056. }
  5057. ],
  5058. loc: {
  5059. start: {
  5060. line: 1,
  5061. column: 0
  5062. },
  5063. end: {
  5064. line: 2,
  5065. column: 6
  5066. }
  5067. }
  5068. });
  5069. test("/*a\rb*/ 42", {
  5070. type: "Program",
  5071. body: [
  5072. {
  5073. type: "ExpressionStatement",
  5074. expression: {
  5075. type: "Literal",
  5076. value: 42,
  5077. loc: {
  5078. start: {
  5079. line: 2,
  5080. column: 4
  5081. },
  5082. end: {
  5083. line: 2,
  5084. column: 6
  5085. }
  5086. }
  5087. },
  5088. loc: {
  5089. start: {
  5090. line: 2,
  5091. column: 4
  5092. },
  5093. end: {
  5094. line: 2,
  5095. column: 6
  5096. }
  5097. }
  5098. }
  5099. ],
  5100. loc: {
  5101. start: {
  5102. line: 1,
  5103. column: 0
  5104. },
  5105. end: {
  5106. line: 2,
  5107. column: 6
  5108. }
  5109. }
  5110. });
  5111. test("/*a\nb*/ 42", {
  5112. type: "Program",
  5113. body: [
  5114. {
  5115. type: "ExpressionStatement",
  5116. expression: {
  5117. type: "Literal",
  5118. value: 42,
  5119. loc: {
  5120. start: {
  5121. line: 2,
  5122. column: 4
  5123. },
  5124. end: {
  5125. line: 2,
  5126. column: 6
  5127. }
  5128. }
  5129. },
  5130. loc: {
  5131. start: {
  5132. line: 2,
  5133. column: 4
  5134. },
  5135. end: {
  5136. line: 2,
  5137. column: 6
  5138. }
  5139. }
  5140. }
  5141. ],
  5142. loc: {
  5143. start: {
  5144. line: 1,
  5145. column: 0
  5146. },
  5147. end: {
  5148. line: 2,
  5149. column: 6
  5150. }
  5151. }
  5152. });
  5153. test("/*a\nc*/ 42", {
  5154. type: "Program",
  5155. body: [
  5156. {
  5157. type: "ExpressionStatement",
  5158. expression: {
  5159. type: "Literal",
  5160. value: 42,
  5161. loc: {
  5162. start: {
  5163. line: 2,
  5164. column: 4
  5165. },
  5166. end: {
  5167. line: 2,
  5168. column: 6
  5169. }
  5170. }
  5171. },
  5172. loc: {
  5173. start: {
  5174. line: 2,
  5175. column: 4
  5176. },
  5177. end: {
  5178. line: 2,
  5179. column: 6
  5180. }
  5181. }
  5182. }
  5183. ],
  5184. loc: {
  5185. start: {
  5186. line: 1,
  5187. column: 0
  5188. },
  5189. end: {
  5190. line: 2,
  5191. column: 6
  5192. }
  5193. }
  5194. });
  5195. test("// line comment\n42", {
  5196. type: "Program",
  5197. body: [
  5198. {
  5199. type: "ExpressionStatement",
  5200. expression: {
  5201. type: "Literal",
  5202. value: 42,
  5203. loc: {
  5204. start: {
  5205. line: 2,
  5206. column: 0
  5207. },
  5208. end: {
  5209. line: 2,
  5210. column: 2
  5211. }
  5212. }
  5213. },
  5214. loc: {
  5215. start: {
  5216. line: 2,
  5217. column: 0
  5218. },
  5219. end: {
  5220. line: 2,
  5221. column: 2
  5222. }
  5223. }
  5224. }
  5225. ],
  5226. loc: {
  5227. start: {
  5228. line: 1,
  5229. column: 0
  5230. },
  5231. end: {
  5232. line: 2,
  5233. column: 2
  5234. }
  5235. }
  5236. });
  5237. test("42 // line comment", {
  5238. type: "Program",
  5239. body: [
  5240. {
  5241. type: "ExpressionStatement",
  5242. expression: {
  5243. type: "Literal",
  5244. value: 42,
  5245. loc: {
  5246. start: {
  5247. line: 1,
  5248. column: 0
  5249. },
  5250. end: {
  5251. line: 1,
  5252. column: 2
  5253. }
  5254. }
  5255. },
  5256. loc: {
  5257. start: {
  5258. line: 1,
  5259. column: 0
  5260. },
  5261. end: {
  5262. line: 1,
  5263. column: 2
  5264. }
  5265. }
  5266. }
  5267. ],
  5268. loc: {
  5269. start: {
  5270. line: 1,
  5271. column: 0
  5272. },
  5273. end: {
  5274. line: 1,
  5275. column: 18
  5276. }
  5277. }
  5278. });
  5279. test("// Hello, world!\n42", {
  5280. type: "Program",
  5281. body: [
  5282. {
  5283. type: "ExpressionStatement",
  5284. expression: {
  5285. type: "Literal",
  5286. value: 42,
  5287. loc: {
  5288. start: {
  5289. line: 2,
  5290. column: 0
  5291. },
  5292. end: {
  5293. line: 2,
  5294. column: 2
  5295. }
  5296. }
  5297. },
  5298. loc: {
  5299. start: {
  5300. line: 2,
  5301. column: 0
  5302. },
  5303. end: {
  5304. line: 2,
  5305. column: 2
  5306. }
  5307. }
  5308. }
  5309. ],
  5310. loc: {
  5311. start: {
  5312. line: 1,
  5313. column: 0
  5314. },
  5315. end: {
  5316. line: 2,
  5317. column: 2
  5318. }
  5319. }
  5320. });
  5321. test("// Hello, world!\n", {
  5322. type: "Program",
  5323. body: [],
  5324. loc: {
  5325. start: {
  5326. line: 1,
  5327. column: 0
  5328. },
  5329. end: {
  5330. line: 2,
  5331. column: 0
  5332. }
  5333. }
  5334. });
  5335. test("// Hallo, world!\n", {
  5336. type: "Program",
  5337. body: [],
  5338. loc: {
  5339. start: {
  5340. line: 1,
  5341. column: 0
  5342. },
  5343. end: {
  5344. line: 2,
  5345. column: 0
  5346. }
  5347. }
  5348. });
  5349. test("//\n42", {
  5350. type: "Program",
  5351. body: [
  5352. {
  5353. type: "ExpressionStatement",
  5354. expression: {
  5355. type: "Literal",
  5356. value: 42,
  5357. loc: {
  5358. start: {
  5359. line: 2,
  5360. column: 0
  5361. },
  5362. end: {
  5363. line: 2,
  5364. column: 2
  5365. }
  5366. }
  5367. },
  5368. loc: {
  5369. start: {
  5370. line: 2,
  5371. column: 0
  5372. },
  5373. end: {
  5374. line: 2,
  5375. column: 2
  5376. }
  5377. }
  5378. }
  5379. ],
  5380. loc: {
  5381. start: {
  5382. line: 1,
  5383. column: 0
  5384. },
  5385. end: {
  5386. line: 2,
  5387. column: 2
  5388. }
  5389. }
  5390. });
  5391. test("//", {
  5392. type: "Program",
  5393. body: [],
  5394. loc: {
  5395. start: {
  5396. line: 1,
  5397. column: 0
  5398. },
  5399. end: {
  5400. line: 1,
  5401. column: 2
  5402. }
  5403. }
  5404. });
  5405. test("// ", {
  5406. type: "Program",
  5407. body: [],
  5408. loc: {
  5409. start: {
  5410. line: 1,
  5411. column: 0
  5412. },
  5413. end: {
  5414. line: 1,
  5415. column: 3
  5416. }
  5417. }
  5418. });
  5419. test("/**/42", {
  5420. type: "Program",
  5421. body: [
  5422. {
  5423. type: "ExpressionStatement",
  5424. expression: {
  5425. type: "Literal",
  5426. value: 42,
  5427. loc: {
  5428. start: {
  5429. line: 1,
  5430. column: 4
  5431. },
  5432. end: {
  5433. line: 1,
  5434. column: 6
  5435. }
  5436. }
  5437. },
  5438. loc: {
  5439. start: {
  5440. line: 1,
  5441. column: 4
  5442. },
  5443. end: {
  5444. line: 1,
  5445. column: 6
  5446. }
  5447. }
  5448. }
  5449. ],
  5450. loc: {
  5451. start: {
  5452. line: 1,
  5453. column: 0
  5454. },
  5455. end: {
  5456. line: 1,
  5457. column: 6
  5458. }
  5459. }
  5460. });
  5461. test("// Hello, world!\n\n// Another hello\n42", {
  5462. type: "Program",
  5463. body: [
  5464. {
  5465. type: "ExpressionStatement",
  5466. expression: {
  5467. type: "Literal",
  5468. value: 42,
  5469. loc: {
  5470. start: {
  5471. line: 4,
  5472. column: 0
  5473. },
  5474. end: {
  5475. line: 4,
  5476. column: 2
  5477. }
  5478. }
  5479. },
  5480. loc: {
  5481. start: {
  5482. line: 4,
  5483. column: 0
  5484. },
  5485. end: {
  5486. line: 4,
  5487. column: 2
  5488. }
  5489. }
  5490. }
  5491. ],
  5492. loc: {
  5493. start: {
  5494. line: 1,
  5495. column: 0
  5496. },
  5497. end: {
  5498. line: 4,
  5499. column: 2
  5500. }
  5501. }
  5502. });
  5503. test("if (x) { // Some comment\ndoThat(); }", {
  5504. type: "Program",
  5505. body: [
  5506. {
  5507. type: "IfStatement",
  5508. test: {
  5509. type: "Identifier",
  5510. name: "x",
  5511. loc: {
  5512. start: {
  5513. line: 1,
  5514. column: 4
  5515. },
  5516. end: {
  5517. line: 1,
  5518. column: 5
  5519. }
  5520. }
  5521. },
  5522. consequent: {
  5523. type: "BlockStatement",
  5524. body: [
  5525. {
  5526. type: "ExpressionStatement",
  5527. expression: {
  5528. type: "CallExpression",
  5529. callee: {
  5530. type: "Identifier",
  5531. name: "doThat",
  5532. loc: {
  5533. start: {
  5534. line: 2,
  5535. column: 0
  5536. },
  5537. end: {
  5538. line: 2,
  5539. column: 6
  5540. }
  5541. }
  5542. },
  5543. arguments: [],
  5544. loc: {
  5545. start: {
  5546. line: 2,
  5547. column: 0
  5548. },
  5549. end: {
  5550. line: 2,
  5551. column: 8
  5552. }
  5553. }
  5554. },
  5555. loc: {
  5556. start: {
  5557. line: 2,
  5558. column: 0
  5559. },
  5560. end: {
  5561. line: 2,
  5562. column: 9
  5563. }
  5564. }
  5565. }
  5566. ],
  5567. loc: {
  5568. start: {
  5569. line: 1,
  5570. column: 7
  5571. },
  5572. end: {
  5573. line: 2,
  5574. column: 11
  5575. }
  5576. }
  5577. },
  5578. alternate: null,
  5579. loc: {
  5580. start: {
  5581. line: 1,
  5582. column: 0
  5583. },
  5584. end: {
  5585. line: 2,
  5586. column: 11
  5587. }
  5588. }
  5589. }
  5590. ],
  5591. loc: {
  5592. start: {
  5593. line: 1,
  5594. column: 0
  5595. },
  5596. end: {
  5597. line: 2,
  5598. column: 11
  5599. }
  5600. }
  5601. });
  5602. test("switch (answer) { case 42: /* perfect */ bingo() }", {
  5603. type: "Program",
  5604. body: [
  5605. {
  5606. type: "SwitchStatement",
  5607. discriminant: {
  5608. type: "Identifier",
  5609. name: "answer",
  5610. loc: {
  5611. start: {
  5612. line: 1,
  5613. column: 8
  5614. },
  5615. end: {
  5616. line: 1,
  5617. column: 14
  5618. }
  5619. }
  5620. },
  5621. cases: [
  5622. {
  5623. type: "SwitchCase",
  5624. consequent: [
  5625. {
  5626. type: "ExpressionStatement",
  5627. expression: {
  5628. type: "CallExpression",
  5629. callee: {
  5630. type: "Identifier",
  5631. name: "bingo",
  5632. loc: {
  5633. start: {
  5634. line: 1,
  5635. column: 41
  5636. },
  5637. end: {
  5638. line: 1,
  5639. column: 46
  5640. }
  5641. }
  5642. },
  5643. arguments: [],
  5644. loc: {
  5645. start: {
  5646. line: 1,
  5647. column: 41
  5648. },
  5649. end: {
  5650. line: 1,
  5651. column: 48
  5652. }
  5653. }
  5654. },
  5655. loc: {
  5656. start: {
  5657. line: 1,
  5658. column: 41
  5659. },
  5660. end: {
  5661. line: 1,
  5662. column: 48
  5663. }
  5664. }
  5665. }
  5666. ],
  5667. test: {
  5668. type: "Literal",
  5669. value: 42,
  5670. loc: {
  5671. start: {
  5672. line: 1,
  5673. column: 23
  5674. },
  5675. end: {
  5676. line: 1,
  5677. column: 25
  5678. }
  5679. }
  5680. },
  5681. loc: {
  5682. start: {
  5683. line: 1,
  5684. column: 18
  5685. },
  5686. end: {
  5687. line: 1,
  5688. column: 48
  5689. }
  5690. }
  5691. }
  5692. ],
  5693. loc: {
  5694. start: {
  5695. line: 1,
  5696. column: 0
  5697. },
  5698. end: {
  5699. line: 1,
  5700. column: 50
  5701. }
  5702. }
  5703. }
  5704. ],
  5705. loc: {
  5706. start: {
  5707. line: 1,
  5708. column: 0
  5709. },
  5710. end: {
  5711. line: 1,
  5712. column: 50
  5713. }
  5714. }
  5715. });
  5716. test("0", {
  5717. type: "Program",
  5718. body: [
  5719. {
  5720. type: "ExpressionStatement",
  5721. expression: {
  5722. type: "Literal",
  5723. value: 0,
  5724. loc: {
  5725. start: {
  5726. line: 1,
  5727. column: 0
  5728. },
  5729. end: {
  5730. line: 1,
  5731. column: 1
  5732. }
  5733. }
  5734. },
  5735. loc: {
  5736. start: {
  5737. line: 1,
  5738. column: 0
  5739. },
  5740. end: {
  5741. line: 1,
  5742. column: 1
  5743. }
  5744. }
  5745. }
  5746. ],
  5747. loc: {
  5748. start: {
  5749. line: 1,
  5750. column: 0
  5751. },
  5752. end: {
  5753. line: 1,
  5754. column: 1
  5755. }
  5756. }
  5757. });
  5758. test("3", {
  5759. type: "Program",
  5760. body: [
  5761. {
  5762. type: "ExpressionStatement",
  5763. expression: {
  5764. type: "Literal",
  5765. value: 3,
  5766. loc: {
  5767. start: {
  5768. line: 1,
  5769. column: 0
  5770. },
  5771. end: {
  5772. line: 1,
  5773. column: 1
  5774. }
  5775. }
  5776. },
  5777. loc: {
  5778. start: {
  5779. line: 1,
  5780. column: 0
  5781. },
  5782. end: {
  5783. line: 1,
  5784. column: 1
  5785. }
  5786. }
  5787. }
  5788. ],
  5789. loc: {
  5790. start: {
  5791. line: 1,
  5792. column: 0
  5793. },
  5794. end: {
  5795. line: 1,
  5796. column: 1
  5797. }
  5798. }
  5799. });
  5800. test("5", {
  5801. type: "Program",
  5802. body: [
  5803. {
  5804. type: "ExpressionStatement",
  5805. expression: {
  5806. type: "Literal",
  5807. value: 5,
  5808. loc: {
  5809. start: {
  5810. line: 1,
  5811. column: 0
  5812. },
  5813. end: {
  5814. line: 1,
  5815. column: 1
  5816. }
  5817. }
  5818. },
  5819. loc: {
  5820. start: {
  5821. line: 1,
  5822. column: 0
  5823. },
  5824. end: {
  5825. line: 1,
  5826. column: 1
  5827. }
  5828. }
  5829. }
  5830. ],
  5831. loc: {
  5832. start: {
  5833. line: 1,
  5834. column: 0
  5835. },
  5836. end: {
  5837. line: 1,
  5838. column: 1
  5839. }
  5840. }
  5841. });
  5842. test("42", {
  5843. type: "Program",
  5844. body: [
  5845. {
  5846. type: "ExpressionStatement",
  5847. expression: {
  5848. type: "Literal",
  5849. value: 42,
  5850. loc: {
  5851. start: {
  5852. line: 1,
  5853. column: 0
  5854. },
  5855. end: {
  5856. line: 1,
  5857. column: 2
  5858. }
  5859. }
  5860. },
  5861. loc: {
  5862. start: {
  5863. line: 1,
  5864. column: 0
  5865. },
  5866. end: {
  5867. line: 1,
  5868. column: 2
  5869. }
  5870. }
  5871. }
  5872. ],
  5873. loc: {
  5874. start: {
  5875. line: 1,
  5876. column: 0
  5877. },
  5878. end: {
  5879. line: 1,
  5880. column: 2
  5881. }
  5882. }
  5883. });
  5884. test(".14", {
  5885. type: "Program",
  5886. body: [
  5887. {
  5888. type: "ExpressionStatement",
  5889. expression: {
  5890. type: "Literal",
  5891. value: 0.14,
  5892. loc: {
  5893. start: {
  5894. line: 1,
  5895. column: 0
  5896. },
  5897. end: {
  5898. line: 1,
  5899. column: 3
  5900. }
  5901. }
  5902. },
  5903. loc: {
  5904. start: {
  5905. line: 1,
  5906. column: 0
  5907. },
  5908. end: {
  5909. line: 1,
  5910. column: 3
  5911. }
  5912. }
  5913. }
  5914. ],
  5915. loc: {
  5916. start: {
  5917. line: 1,
  5918. column: 0
  5919. },
  5920. end: {
  5921. line: 1,
  5922. column: 3
  5923. }
  5924. }
  5925. });
  5926. test("3.14159", {
  5927. type: "Program",
  5928. body: [
  5929. {
  5930. type: "ExpressionStatement",
  5931. expression: {
  5932. type: "Literal",
  5933. value: 3.14159,
  5934. loc: {
  5935. start: {
  5936. line: 1,
  5937. column: 0
  5938. },
  5939. end: {
  5940. line: 1,
  5941. column: 7
  5942. }
  5943. }
  5944. },
  5945. loc: {
  5946. start: {
  5947. line: 1,
  5948. column: 0
  5949. },
  5950. end: {
  5951. line: 1,
  5952. column: 7
  5953. }
  5954. }
  5955. }
  5956. ],
  5957. loc: {
  5958. start: {
  5959. line: 1,
  5960. column: 0
  5961. },
  5962. end: {
  5963. line: 1,
  5964. column: 7
  5965. }
  5966. }
  5967. });
  5968. test("6.02214179e+23", {
  5969. type: "Program",
  5970. body: [
  5971. {
  5972. type: "ExpressionStatement",
  5973. expression: {
  5974. type: "Literal",
  5975. value: 6.02214179e+23,
  5976. loc: {
  5977. start: {
  5978. line: 1,
  5979. column: 0
  5980. },
  5981. end: {
  5982. line: 1,
  5983. column: 14
  5984. }
  5985. }
  5986. },
  5987. loc: {
  5988. start: {
  5989. line: 1,
  5990. column: 0
  5991. },
  5992. end: {
  5993. line: 1,
  5994. column: 14
  5995. }
  5996. }
  5997. }
  5998. ],
  5999. loc: {
  6000. start: {
  6001. line: 1,
  6002. column: 0
  6003. },
  6004. end: {
  6005. line: 1,
  6006. column: 14
  6007. }
  6008. }
  6009. });
  6010. test("1.492417830e-10", {
  6011. type: "Program",
  6012. body: [
  6013. {
  6014. type: "ExpressionStatement",
  6015. expression: {
  6016. type: "Literal",
  6017. value: 1.49241783e-10,
  6018. loc: {
  6019. start: {
  6020. line: 1,
  6021. column: 0
  6022. },
  6023. end: {
  6024. line: 1,
  6025. column: 15
  6026. }
  6027. }
  6028. },
  6029. loc: {
  6030. start: {
  6031. line: 1,
  6032. column: 0
  6033. },
  6034. end: {
  6035. line: 1,
  6036. column: 15
  6037. }
  6038. }
  6039. }
  6040. ],
  6041. loc: {
  6042. start: {
  6043. line: 1,
  6044. column: 0
  6045. },
  6046. end: {
  6047. line: 1,
  6048. column: 15
  6049. }
  6050. }
  6051. });
  6052. test("0x0", {
  6053. type: "Program",
  6054. body: [
  6055. {
  6056. type: "ExpressionStatement",
  6057. expression: {
  6058. type: "Literal",
  6059. value: 0,
  6060. loc: {
  6061. start: {
  6062. line: 1,
  6063. column: 0
  6064. },
  6065. end: {
  6066. line: 1,
  6067. column: 3
  6068. }
  6069. }
  6070. },
  6071. loc: {
  6072. start: {
  6073. line: 1,
  6074. column: 0
  6075. },
  6076. end: {
  6077. line: 1,
  6078. column: 3
  6079. }
  6080. }
  6081. }
  6082. ],
  6083. loc: {
  6084. start: {
  6085. line: 1,
  6086. column: 0
  6087. },
  6088. end: {
  6089. line: 1,
  6090. column: 3
  6091. }
  6092. }
  6093. });
  6094. test("0e+100", {
  6095. type: "Program",
  6096. body: [
  6097. {
  6098. type: "ExpressionStatement",
  6099. expression: {
  6100. type: "Literal",
  6101. value: 0,
  6102. loc: {
  6103. start: {
  6104. line: 1,
  6105. column: 0
  6106. },
  6107. end: {
  6108. line: 1,
  6109. column: 6
  6110. }
  6111. }
  6112. },
  6113. loc: {
  6114. start: {
  6115. line: 1,
  6116. column: 0
  6117. },
  6118. end: {
  6119. line: 1,
  6120. column: 6
  6121. }
  6122. }
  6123. }
  6124. ],
  6125. loc: {
  6126. start: {
  6127. line: 1,
  6128. column: 0
  6129. },
  6130. end: {
  6131. line: 1,
  6132. column: 6
  6133. }
  6134. }
  6135. });
  6136. test("0xabc", {
  6137. type: "Program",
  6138. body: [
  6139. {
  6140. type: "ExpressionStatement",
  6141. expression: {
  6142. type: "Literal",
  6143. value: 2748,
  6144. loc: {
  6145. start: {
  6146. line: 1,
  6147. column: 0
  6148. },
  6149. end: {
  6150. line: 1,
  6151. column: 5
  6152. }
  6153. }
  6154. },
  6155. loc: {
  6156. start: {
  6157. line: 1,
  6158. column: 0
  6159. },
  6160. end: {
  6161. line: 1,
  6162. column: 5
  6163. }
  6164. }
  6165. }
  6166. ],
  6167. loc: {
  6168. start: {
  6169. line: 1,
  6170. column: 0
  6171. },
  6172. end: {
  6173. line: 1,
  6174. column: 5
  6175. }
  6176. }
  6177. });
  6178. test("0xdef", {
  6179. type: "Program",
  6180. body: [
  6181. {
  6182. type: "ExpressionStatement",
  6183. expression: {
  6184. type: "Literal",
  6185. value: 3567,
  6186. loc: {
  6187. start: {
  6188. line: 1,
  6189. column: 0
  6190. },
  6191. end: {
  6192. line: 1,
  6193. column: 5
  6194. }
  6195. }
  6196. },
  6197. loc: {
  6198. start: {
  6199. line: 1,
  6200. column: 0
  6201. },
  6202. end: {
  6203. line: 1,
  6204. column: 5
  6205. }
  6206. }
  6207. }
  6208. ],
  6209. loc: {
  6210. start: {
  6211. line: 1,
  6212. column: 0
  6213. },
  6214. end: {
  6215. line: 1,
  6216. column: 5
  6217. }
  6218. }
  6219. });
  6220. test("0X1A", {
  6221. type: "Program",
  6222. body: [
  6223. {
  6224. type: "ExpressionStatement",
  6225. expression: {
  6226. type: "Literal",
  6227. value: 26,
  6228. loc: {
  6229. start: {
  6230. line: 1,
  6231. column: 0
  6232. },
  6233. end: {
  6234. line: 1,
  6235. column: 4
  6236. }
  6237. }
  6238. },
  6239. loc: {
  6240. start: {
  6241. line: 1,
  6242. column: 0
  6243. },
  6244. end: {
  6245. line: 1,
  6246. column: 4
  6247. }
  6248. }
  6249. }
  6250. ],
  6251. loc: {
  6252. start: {
  6253. line: 1,
  6254. column: 0
  6255. },
  6256. end: {
  6257. line: 1,
  6258. column: 4
  6259. }
  6260. }
  6261. });
  6262. test("0x10", {
  6263. type: "Program",
  6264. body: [
  6265. {
  6266. type: "ExpressionStatement",
  6267. expression: {
  6268. type: "Literal",
  6269. value: 16,
  6270. loc: {
  6271. start: {
  6272. line: 1,
  6273. column: 0
  6274. },
  6275. end: {
  6276. line: 1,
  6277. column: 4
  6278. }
  6279. }
  6280. },
  6281. loc: {
  6282. start: {
  6283. line: 1,
  6284. column: 0
  6285. },
  6286. end: {
  6287. line: 1,
  6288. column: 4
  6289. }
  6290. }
  6291. }
  6292. ],
  6293. loc: {
  6294. start: {
  6295. line: 1,
  6296. column: 0
  6297. },
  6298. end: {
  6299. line: 1,
  6300. column: 4
  6301. }
  6302. }
  6303. });
  6304. test("0x100", {
  6305. type: "Program",
  6306. body: [
  6307. {
  6308. type: "ExpressionStatement",
  6309. expression: {
  6310. type: "Literal",
  6311. value: 256,
  6312. loc: {
  6313. start: {
  6314. line: 1,
  6315. column: 0
  6316. },
  6317. end: {
  6318. line: 1,
  6319. column: 5
  6320. }
  6321. }
  6322. },
  6323. loc: {
  6324. start: {
  6325. line: 1,
  6326. column: 0
  6327. },
  6328. end: {
  6329. line: 1,
  6330. column: 5
  6331. }
  6332. }
  6333. }
  6334. ],
  6335. loc: {
  6336. start: {
  6337. line: 1,
  6338. column: 0
  6339. },
  6340. end: {
  6341. line: 1,
  6342. column: 5
  6343. }
  6344. }
  6345. });
  6346. test("0X04", {
  6347. type: "Program",
  6348. body: [
  6349. {
  6350. type: "ExpressionStatement",
  6351. expression: {
  6352. type: "Literal",
  6353. value: 4,
  6354. loc: {
  6355. start: {
  6356. line: 1,
  6357. column: 0
  6358. },
  6359. end: {
  6360. line: 1,
  6361. column: 4
  6362. }
  6363. }
  6364. },
  6365. loc: {
  6366. start: {
  6367. line: 1,
  6368. column: 0
  6369. },
  6370. end: {
  6371. line: 1,
  6372. column: 4
  6373. }
  6374. }
  6375. }
  6376. ],
  6377. loc: {
  6378. start: {
  6379. line: 1,
  6380. column: 0
  6381. },
  6382. end: {
  6383. line: 1,
  6384. column: 4
  6385. }
  6386. }
  6387. });
  6388. test("02", {
  6389. type: "Program",
  6390. body: [
  6391. {
  6392. type: "ExpressionStatement",
  6393. expression: {
  6394. type: "Literal",
  6395. value: 2,
  6396. loc: {
  6397. start: {
  6398. line: 1,
  6399. column: 0
  6400. },
  6401. end: {
  6402. line: 1,
  6403. column: 2
  6404. }
  6405. }
  6406. },
  6407. loc: {
  6408. start: {
  6409. line: 1,
  6410. column: 0
  6411. },
  6412. end: {
  6413. line: 1,
  6414. column: 2
  6415. }
  6416. }
  6417. }
  6418. ],
  6419. loc: {
  6420. start: {
  6421. line: 1,
  6422. column: 0
  6423. },
  6424. end: {
  6425. line: 1,
  6426. column: 2
  6427. }
  6428. }
  6429. });
  6430. test("012", {
  6431. type: "Program",
  6432. body: [
  6433. {
  6434. type: "ExpressionStatement",
  6435. expression: {
  6436. type: "Literal",
  6437. value: 10,
  6438. loc: {
  6439. start: {
  6440. line: 1,
  6441. column: 0
  6442. },
  6443. end: {
  6444. line: 1,
  6445. column: 3
  6446. }
  6447. }
  6448. },
  6449. loc: {
  6450. start: {
  6451. line: 1,
  6452. column: 0
  6453. },
  6454. end: {
  6455. line: 1,
  6456. column: 3
  6457. }
  6458. }
  6459. }
  6460. ],
  6461. loc: {
  6462. start: {
  6463. line: 1,
  6464. column: 0
  6465. },
  6466. end: {
  6467. line: 1,
  6468. column: 3
  6469. }
  6470. }
  6471. });
  6472. test("0012", {
  6473. type: "Program",
  6474. body: [
  6475. {
  6476. type: "ExpressionStatement",
  6477. expression: {
  6478. type: "Literal",
  6479. value: 10,
  6480. loc: {
  6481. start: {
  6482. line: 1,
  6483. column: 0
  6484. },
  6485. end: {
  6486. line: 1,
  6487. column: 4
  6488. }
  6489. }
  6490. },
  6491. loc: {
  6492. start: {
  6493. line: 1,
  6494. column: 0
  6495. },
  6496. end: {
  6497. line: 1,
  6498. column: 4
  6499. }
  6500. }
  6501. }
  6502. ],
  6503. loc: {
  6504. start: {
  6505. line: 1,
  6506. column: 0
  6507. },
  6508. end: {
  6509. line: 1,
  6510. column: 4
  6511. }
  6512. }
  6513. });
  6514. test("\"Hello\"", {
  6515. type: "Program",
  6516. body: [
  6517. {
  6518. type: "ExpressionStatement",
  6519. expression: {
  6520. type: "Literal",
  6521. value: "Hello",
  6522. loc: {
  6523. start: {
  6524. line: 1,
  6525. column: 0
  6526. },
  6527. end: {
  6528. line: 1,
  6529. column: 7
  6530. }
  6531. }
  6532. },
  6533. loc: {
  6534. start: {
  6535. line: 1,
  6536. column: 0
  6537. },
  6538. end: {
  6539. line: 1,
  6540. column: 7
  6541. }
  6542. }
  6543. }
  6544. ],
  6545. loc: {
  6546. start: {
  6547. line: 1,
  6548. column: 0
  6549. },
  6550. end: {
  6551. line: 1,
  6552. column: 7
  6553. }
  6554. }
  6555. });
  6556. test("\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", {
  6557. type: "Program",
  6558. body: [
  6559. {
  6560. type: "ExpressionStatement",
  6561. expression: {
  6562. type: "Literal",
  6563. value: "\n\r\t\u000b\b\f\\'\"\u0000",
  6564. loc: {
  6565. start: {
  6566. line: 1,
  6567. column: 0
  6568. },
  6569. end: {
  6570. line: 1,
  6571. column: 22
  6572. }
  6573. }
  6574. },
  6575. loc: {
  6576. start: {
  6577. line: 1,
  6578. column: 0
  6579. },
  6580. end: {
  6581. line: 1,
  6582. column: 22
  6583. }
  6584. }
  6585. }
  6586. ],
  6587. loc: {
  6588. start: {
  6589. line: 1,
  6590. column: 0
  6591. },
  6592. end: {
  6593. line: 1,
  6594. column: 22
  6595. }
  6596. }
  6597. });
  6598. test("\"\\u0061\"", {
  6599. type: "Program",
  6600. body: [
  6601. {
  6602. type: "ExpressionStatement",
  6603. expression: {
  6604. type: "Literal",
  6605. value: "a",
  6606. loc: {
  6607. start: {
  6608. line: 1,
  6609. column: 0
  6610. },
  6611. end: {
  6612. line: 1,
  6613. column: 8
  6614. }
  6615. }
  6616. },
  6617. loc: {
  6618. start: {
  6619. line: 1,
  6620. column: 0
  6621. },
  6622. end: {
  6623. line: 1,
  6624. column: 8
  6625. }
  6626. }
  6627. }
  6628. ],
  6629. loc: {
  6630. start: {
  6631. line: 1,
  6632. column: 0
  6633. },
  6634. end: {
  6635. line: 1,
  6636. column: 8
  6637. }
  6638. }
  6639. });
  6640. test("\"\\x61\"", {
  6641. type: "Program",
  6642. body: [
  6643. {
  6644. type: "ExpressionStatement",
  6645. expression: {
  6646. type: "Literal",
  6647. value: "a",
  6648. loc: {
  6649. start: {
  6650. line: 1,
  6651. column: 0
  6652. },
  6653. end: {
  6654. line: 1,
  6655. column: 6
  6656. }
  6657. }
  6658. },
  6659. loc: {
  6660. start: {
  6661. line: 1,
  6662. column: 0
  6663. },
  6664. end: {
  6665. line: 1,
  6666. column: 6
  6667. }
  6668. }
  6669. }
  6670. ],
  6671. loc: {
  6672. start: {
  6673. line: 1,
  6674. column: 0
  6675. },
  6676. end: {
  6677. line: 1,
  6678. column: 6
  6679. }
  6680. }
  6681. });
  6682. test("\"Hello\\nworld\"", {
  6683. type: "Program",
  6684. body: [
  6685. {
  6686. type: "ExpressionStatement",
  6687. expression: {
  6688. type: "Literal",
  6689. value: "Hello\nworld",
  6690. loc: {
  6691. start: {
  6692. line: 1,
  6693. column: 0
  6694. },
  6695. end: {
  6696. line: 1,
  6697. column: 14
  6698. }
  6699. }
  6700. },
  6701. loc: {
  6702. start: {
  6703. line: 1,
  6704. column: 0
  6705. },
  6706. end: {
  6707. line: 1,
  6708. column: 14
  6709. }
  6710. }
  6711. }
  6712. ],
  6713. loc: {
  6714. start: {
  6715. line: 1,
  6716. column: 0
  6717. },
  6718. end: {
  6719. line: 1,
  6720. column: 14
  6721. }
  6722. }
  6723. });
  6724. test("\"Hello\\\nworld\"", {
  6725. type: "Program",
  6726. body: [
  6727. {
  6728. type: "ExpressionStatement",
  6729. expression: {
  6730. type: "Literal",
  6731. value: "Helloworld",
  6732. loc: {
  6733. start: {
  6734. line: 1,
  6735. column: 0
  6736. },
  6737. end: {
  6738. line: 2,
  6739. column: 6
  6740. }
  6741. }
  6742. },
  6743. loc: {
  6744. start: {
  6745. line: 1,
  6746. column: 0
  6747. },
  6748. end: {
  6749. line: 2,
  6750. column: 6
  6751. }
  6752. }
  6753. }
  6754. ],
  6755. loc: {
  6756. start: {
  6757. line: 1,
  6758. column: 0
  6759. },
  6760. end: {
  6761. line: 2,
  6762. column: 6
  6763. }
  6764. }
  6765. });
  6766. test("\"Hello\\02World\"", {
  6767. type: "Program",
  6768. body: [
  6769. {
  6770. type: "ExpressionStatement",
  6771. expression: {
  6772. type: "Literal",
  6773. value: "Hello\u0002World",
  6774. loc: {
  6775. start: {
  6776. line: 1,
  6777. column: 0
  6778. },
  6779. end: {
  6780. line: 1,
  6781. column: 15
  6782. }
  6783. }
  6784. },
  6785. loc: {
  6786. start: {
  6787. line: 1,
  6788. column: 0
  6789. },
  6790. end: {
  6791. line: 1,
  6792. column: 15
  6793. }
  6794. }
  6795. }
  6796. ],
  6797. loc: {
  6798. start: {
  6799. line: 1,
  6800. column: 0
  6801. },
  6802. end: {
  6803. line: 1,
  6804. column: 15
  6805. }
  6806. }
  6807. });
  6808. test("\"Hello\\012World\"", {
  6809. type: "Program",
  6810. body: [
  6811. {
  6812. type: "ExpressionStatement",
  6813. expression: {
  6814. type: "Literal",
  6815. value: "Hello\nWorld",
  6816. loc: {
  6817. start: {
  6818. line: 1,
  6819. column: 0
  6820. },
  6821. end: {
  6822. line: 1,
  6823. column: 16
  6824. }
  6825. }
  6826. },
  6827. loc: {
  6828. start: {
  6829. line: 1,
  6830. column: 0
  6831. },
  6832. end: {
  6833. line: 1,
  6834. column: 16
  6835. }
  6836. }
  6837. }
  6838. ],
  6839. loc: {
  6840. start: {
  6841. line: 1,
  6842. column: 0
  6843. },
  6844. end: {
  6845. line: 1,
  6846. column: 16
  6847. }
  6848. }
  6849. });
  6850. test("\"Hello\\122World\"", {
  6851. type: "Program",
  6852. body: [
  6853. {
  6854. type: "ExpressionStatement",
  6855. expression: {
  6856. type: "Literal",
  6857. value: "HelloRWorld",
  6858. loc: {
  6859. start: {
  6860. line: 1,
  6861. column: 0
  6862. },
  6863. end: {
  6864. line: 1,
  6865. column: 16
  6866. }
  6867. }
  6868. },
  6869. loc: {
  6870. start: {
  6871. line: 1,
  6872. column: 0
  6873. },
  6874. end: {
  6875. line: 1,
  6876. column: 16
  6877. }
  6878. }
  6879. }
  6880. ],
  6881. loc: {
  6882. start: {
  6883. line: 1,
  6884. column: 0
  6885. },
  6886. end: {
  6887. line: 1,
  6888. column: 16
  6889. }
  6890. }
  6891. });
  6892. test("\"Hello\\0122World\"", {
  6893. type: "Program",
  6894. body: [
  6895. {
  6896. type: "ExpressionStatement",
  6897. expression: {
  6898. type: "Literal",
  6899. value: "Hello\n2World",
  6900. loc: {
  6901. start: {
  6902. line: 1,
  6903. column: 0
  6904. },
  6905. end: {
  6906. line: 1,
  6907. column: 17
  6908. }
  6909. }
  6910. },
  6911. loc: {
  6912. start: {
  6913. line: 1,
  6914. column: 0
  6915. },
  6916. end: {
  6917. line: 1,
  6918. column: 17
  6919. }
  6920. }
  6921. }
  6922. ],
  6923. loc: {
  6924. start: {
  6925. line: 1,
  6926. column: 0
  6927. },
  6928. end: {
  6929. line: 1,
  6930. column: 17
  6931. }
  6932. }
  6933. });
  6934. test("\"Hello\\312World\"", {
  6935. type: "Program",
  6936. body: [
  6937. {
  6938. type: "ExpressionStatement",
  6939. expression: {
  6940. type: "Literal",
  6941. value: "HelloÊWorld",
  6942. loc: {
  6943. start: {
  6944. line: 1,
  6945. column: 0
  6946. },
  6947. end: {
  6948. line: 1,
  6949. column: 16
  6950. }
  6951. }
  6952. },
  6953. loc: {
  6954. start: {
  6955. line: 1,
  6956. column: 0
  6957. },
  6958. end: {
  6959. line: 1,
  6960. column: 16
  6961. }
  6962. }
  6963. }
  6964. ],
  6965. loc: {
  6966. start: {
  6967. line: 1,
  6968. column: 0
  6969. },
  6970. end: {
  6971. line: 1,
  6972. column: 16
  6973. }
  6974. }
  6975. });
  6976. test("\"Hello\\412World\"", {
  6977. type: "Program",
  6978. body: [
  6979. {
  6980. type: "ExpressionStatement",
  6981. expression: {
  6982. type: "Literal",
  6983. value: "Hello!2World",
  6984. loc: {
  6985. start: {
  6986. line: 1,
  6987. column: 0
  6988. },
  6989. end: {
  6990. line: 1,
  6991. column: 16
  6992. }
  6993. }
  6994. },
  6995. loc: {
  6996. start: {
  6997. line: 1,
  6998. column: 0
  6999. },
  7000. end: {
  7001. line: 1,
  7002. column: 16
  7003. }
  7004. }
  7005. }
  7006. ],
  7007. loc: {
  7008. start: {
  7009. line: 1,
  7010. column: 0
  7011. },
  7012. end: {
  7013. line: 1,
  7014. column: 16
  7015. }
  7016. }
  7017. });
  7018. test("\"Hello\\812World\"", {
  7019. type: "Program",
  7020. body: [
  7021. {
  7022. type: "ExpressionStatement",
  7023. expression: {
  7024. type: "Literal",
  7025. value: "Hello812World",
  7026. loc: {
  7027. start: {
  7028. line: 1,
  7029. column: 0
  7030. },
  7031. end: {
  7032. line: 1,
  7033. column: 16
  7034. }
  7035. }
  7036. },
  7037. loc: {
  7038. start: {
  7039. line: 1,
  7040. column: 0
  7041. },
  7042. end: {
  7043. line: 1,
  7044. column: 16
  7045. }
  7046. }
  7047. }
  7048. ],
  7049. loc: {
  7050. start: {
  7051. line: 1,
  7052. column: 0
  7053. },
  7054. end: {
  7055. line: 1,
  7056. column: 16
  7057. }
  7058. }
  7059. });
  7060. test("\"Hello\\712World\"", {
  7061. type: "Program",
  7062. body: [
  7063. {
  7064. type: "ExpressionStatement",
  7065. expression: {
  7066. type: "Literal",
  7067. value: "Hello92World",
  7068. loc: {
  7069. start: {
  7070. line: 1,
  7071. column: 0
  7072. },
  7073. end: {
  7074. line: 1,
  7075. column: 16
  7076. }
  7077. }
  7078. },
  7079. loc: {
  7080. start: {
  7081. line: 1,
  7082. column: 0
  7083. },
  7084. end: {
  7085. line: 1,
  7086. column: 16
  7087. }
  7088. }
  7089. }
  7090. ],
  7091. loc: {
  7092. start: {
  7093. line: 1,
  7094. column: 0
  7095. },
  7096. end: {
  7097. line: 1,
  7098. column: 16
  7099. }
  7100. }
  7101. });
  7102. test("\"Hello\\0World\"", {
  7103. type: "Program",
  7104. body: [
  7105. {
  7106. type: "ExpressionStatement",
  7107. expression: {
  7108. type: "Literal",
  7109. value: "Hello\u0000World",
  7110. loc: {
  7111. start: {
  7112. line: 1,
  7113. column: 0
  7114. },
  7115. end: {
  7116. line: 1,
  7117. column: 14
  7118. }
  7119. }
  7120. },
  7121. loc: {
  7122. start: {
  7123. line: 1,
  7124. column: 0
  7125. },
  7126. end: {
  7127. line: 1,
  7128. column: 14
  7129. }
  7130. }
  7131. }
  7132. ],
  7133. loc: {
  7134. start: {
  7135. line: 1,
  7136. column: 0
  7137. },
  7138. end: {
  7139. line: 1,
  7140. column: 14
  7141. }
  7142. }
  7143. });
  7144. test("\"Hello\\\r\nworld\"", {
  7145. type: "Program",
  7146. body: [
  7147. {
  7148. type: "ExpressionStatement",
  7149. expression: {
  7150. type: "Literal",
  7151. value: "Helloworld",
  7152. loc: {
  7153. start: {
  7154. line: 1,
  7155. column: 0
  7156. },
  7157. end: {
  7158. line: 2,
  7159. column: 6
  7160. }
  7161. }
  7162. },
  7163. loc: {
  7164. start: {
  7165. line: 1,
  7166. column: 0
  7167. },
  7168. end: {
  7169. line: 2,
  7170. column: 6
  7171. }
  7172. }
  7173. }
  7174. ],
  7175. loc: {
  7176. start: {
  7177. line: 1,
  7178. column: 0
  7179. },
  7180. end: {
  7181. line: 2,
  7182. column: 6
  7183. }
  7184. }
  7185. });
  7186. test("\"Hello\\1World\"", {
  7187. type: "Program",
  7188. body: [
  7189. {
  7190. type: "ExpressionStatement",
  7191. expression: {
  7192. type: "Literal",
  7193. value: "Hello\u0001World",
  7194. loc: {
  7195. start: {
  7196. line: 1,
  7197. column: 0
  7198. },
  7199. end: {
  7200. line: 1,
  7201. column: 14
  7202. }
  7203. }
  7204. },
  7205. loc: {
  7206. start: {
  7207. line: 1,
  7208. column: 0
  7209. },
  7210. end: {
  7211. line: 1,
  7212. column: 14
  7213. }
  7214. }
  7215. }
  7216. ],
  7217. loc: {
  7218. start: {
  7219. line: 1,
  7220. column: 0
  7221. },
  7222. end: {
  7223. line: 1,
  7224. column: 14
  7225. }
  7226. }
  7227. });
  7228. test("var x = /[a-z]/i", {
  7229. type: "Program",
  7230. body: [
  7231. {
  7232. type: "VariableDeclaration",
  7233. declarations: [
  7234. {
  7235. type: "VariableDeclarator",
  7236. id: {
  7237. type: "Identifier",
  7238. name: "x",
  7239. loc: {
  7240. start: {
  7241. line: 1,
  7242. column: 4
  7243. },
  7244. end: {
  7245. line: 1,
  7246. column: 5
  7247. }
  7248. }
  7249. },
  7250. init: {
  7251. type: "Literal",
  7252. value: /[a-z]/i,
  7253. loc: {
  7254. start: {
  7255. line: 1,
  7256. column: 8
  7257. },
  7258. end: {
  7259. line: 1,
  7260. column: 16
  7261. }
  7262. }
  7263. },
  7264. loc: {
  7265. start: {
  7266. line: 1,
  7267. column: 4
  7268. },
  7269. end: {
  7270. line: 1,
  7271. column: 16
  7272. }
  7273. }
  7274. }
  7275. ],
  7276. kind: "var",
  7277. loc: {
  7278. start: {
  7279. line: 1,
  7280. column: 0
  7281. },
  7282. end: {
  7283. line: 1,
  7284. column: 16
  7285. }
  7286. }
  7287. }
  7288. ],
  7289. loc: {
  7290. start: {
  7291. line: 1,
  7292. column: 0
  7293. },
  7294. end: {
  7295. line: 1,
  7296. column: 16
  7297. }
  7298. }
  7299. });
  7300. test("var x = /[x-z]/i", {
  7301. type: "Program",
  7302. body: [
  7303. {
  7304. type: "VariableDeclaration",
  7305. declarations: [
  7306. {
  7307. type: "VariableDeclarator",
  7308. id: {
  7309. type: "Identifier",
  7310. name: "x",
  7311. loc: {
  7312. start: {
  7313. line: 1,
  7314. column: 4
  7315. },
  7316. end: {
  7317. line: 1,
  7318. column: 5
  7319. }
  7320. }
  7321. },
  7322. init: {
  7323. type: "Literal",
  7324. value: /[x-z]/i,
  7325. loc: {
  7326. start: {
  7327. line: 1,
  7328. column: 8
  7329. },
  7330. end: {
  7331. line: 1,
  7332. column: 16
  7333. }
  7334. }
  7335. },
  7336. loc: {
  7337. start: {
  7338. line: 1,
  7339. column: 4
  7340. },
  7341. end: {
  7342. line: 1,
  7343. column: 16
  7344. }
  7345. }
  7346. }
  7347. ],
  7348. kind: "var",
  7349. loc: {
  7350. start: {
  7351. line: 1,
  7352. column: 0
  7353. },
  7354. end: {
  7355. line: 1,
  7356. column: 16
  7357. }
  7358. }
  7359. }
  7360. ],
  7361. loc: {
  7362. start: {
  7363. line: 1,
  7364. column: 0
  7365. },
  7366. end: {
  7367. line: 1,
  7368. column: 16
  7369. }
  7370. }
  7371. });
  7372. test("var x = /[a-c]/i", {
  7373. type: "Program",
  7374. body: [
  7375. {
  7376. type: "VariableDeclaration",
  7377. declarations: [
  7378. {
  7379. type: "VariableDeclarator",
  7380. id: {
  7381. type: "Identifier",
  7382. name: "x",
  7383. loc: {
  7384. start: {
  7385. line: 1,
  7386. column: 4
  7387. },
  7388. end: {
  7389. line: 1,
  7390. column: 5
  7391. }
  7392. }
  7393. },
  7394. init: {
  7395. type: "Literal",
  7396. value: /[a-c]/i,
  7397. loc: {
  7398. start: {
  7399. line: 1,
  7400. column: 8
  7401. },
  7402. end: {
  7403. line: 1,
  7404. column: 16
  7405. }
  7406. }
  7407. },
  7408. loc: {
  7409. start: {
  7410. line: 1,
  7411. column: 4
  7412. },
  7413. end: {
  7414. line: 1,
  7415. column: 16
  7416. }
  7417. }
  7418. }
  7419. ],
  7420. kind: "var",
  7421. loc: {
  7422. start: {
  7423. line: 1,
  7424. column: 0
  7425. },
  7426. end: {
  7427. line: 1,
  7428. column: 16
  7429. }
  7430. }
  7431. }
  7432. ],
  7433. loc: {
  7434. start: {
  7435. line: 1,
  7436. column: 0
  7437. },
  7438. end: {
  7439. line: 1,
  7440. column: 16
  7441. }
  7442. }
  7443. });
  7444. test("var x = /[P QR]/i", {
  7445. type: "Program",
  7446. body: [
  7447. {
  7448. type: "VariableDeclaration",
  7449. declarations: [
  7450. {
  7451. type: "VariableDeclarator",
  7452. id: {
  7453. type: "Identifier",
  7454. name: "x",
  7455. loc: {
  7456. start: {
  7457. line: 1,
  7458. column: 4
  7459. },
  7460. end: {
  7461. line: 1,
  7462. column: 5
  7463. }
  7464. }
  7465. },
  7466. init: {
  7467. type: "Literal",
  7468. value: /[P QR]/i,
  7469. loc: {
  7470. start: {
  7471. line: 1,
  7472. column: 8
  7473. },
  7474. end: {
  7475. line: 1,
  7476. column: 17
  7477. }
  7478. }
  7479. },
  7480. loc: {
  7481. start: {
  7482. line: 1,
  7483. column: 4
  7484. },
  7485. end: {
  7486. line: 1,
  7487. column: 17
  7488. }
  7489. }
  7490. }
  7491. ],
  7492. kind: "var",
  7493. loc: {
  7494. start: {
  7495. line: 1,
  7496. column: 0
  7497. },
  7498. end: {
  7499. line: 1,
  7500. column: 17
  7501. }
  7502. }
  7503. }
  7504. ],
  7505. loc: {
  7506. start: {
  7507. line: 1,
  7508. column: 0
  7509. },
  7510. end: {
  7511. line: 1,
  7512. column: 17
  7513. }
  7514. }
  7515. });
  7516. test("var x = /foo\\/bar/", {
  7517. type: "Program",
  7518. body: [
  7519. {
  7520. type: "VariableDeclaration",
  7521. declarations: [
  7522. {
  7523. type: "VariableDeclarator",
  7524. id: {
  7525. type: "Identifier",
  7526. name: "x",
  7527. loc: {
  7528. start: {
  7529. line: 1,
  7530. column: 4
  7531. },
  7532. end: {
  7533. line: 1,
  7534. column: 5
  7535. }
  7536. }
  7537. },
  7538. init: {
  7539. type: "Literal",
  7540. value: /foo\/bar/,
  7541. loc: {
  7542. start: {
  7543. line: 1,
  7544. column: 8
  7545. },
  7546. end: {
  7547. line: 1,
  7548. column: 18
  7549. }
  7550. }
  7551. },
  7552. loc: {
  7553. start: {
  7554. line: 1,
  7555. column: 4
  7556. },
  7557. end: {
  7558. line: 1,
  7559. column: 18
  7560. }
  7561. }
  7562. }
  7563. ],
  7564. kind: "var",
  7565. loc: {
  7566. start: {
  7567. line: 1,
  7568. column: 0
  7569. },
  7570. end: {
  7571. line: 1,
  7572. column: 18
  7573. }
  7574. }
  7575. }
  7576. ],
  7577. loc: {
  7578. start: {
  7579. line: 1,
  7580. column: 0
  7581. },
  7582. end: {
  7583. line: 1,
  7584. column: 18
  7585. }
  7586. }
  7587. });
  7588. test("var x = /=([^=\\s])+/g", {
  7589. type: "Program",
  7590. body: [
  7591. {
  7592. type: "VariableDeclaration",
  7593. declarations: [
  7594. {
  7595. type: "VariableDeclarator",
  7596. id: {
  7597. type: "Identifier",
  7598. name: "x",
  7599. loc: {
  7600. start: {
  7601. line: 1,
  7602. column: 4
  7603. },
  7604. end: {
  7605. line: 1,
  7606. column: 5
  7607. }
  7608. }
  7609. },
  7610. init: {
  7611. type: "Literal",
  7612. value: /=([^=\s])+/g,
  7613. loc: {
  7614. start: {
  7615. line: 1,
  7616. column: 8
  7617. },
  7618. end: {
  7619. line: 1,
  7620. column: 21
  7621. }
  7622. }
  7623. },
  7624. loc: {
  7625. start: {
  7626. line: 1,
  7627. column: 4
  7628. },
  7629. end: {
  7630. line: 1,
  7631. column: 21
  7632. }
  7633. }
  7634. }
  7635. ],
  7636. kind: "var",
  7637. loc: {
  7638. start: {
  7639. line: 1,
  7640. column: 0
  7641. },
  7642. end: {
  7643. line: 1,
  7644. column: 21
  7645. }
  7646. }
  7647. }
  7648. ],
  7649. loc: {
  7650. start: {
  7651. line: 1,
  7652. column: 0
  7653. },
  7654. end: {
  7655. line: 1,
  7656. column: 21
  7657. }
  7658. }
  7659. });
  7660. test("var x = /[P QR]/\\u0067", {
  7661. type: "Program",
  7662. body: [
  7663. {
  7664. type: "VariableDeclaration",
  7665. declarations: [
  7666. {
  7667. type: "VariableDeclarator",
  7668. id: {
  7669. type: "Identifier",
  7670. name: "x",
  7671. loc: {
  7672. start: {
  7673. line: 1,
  7674. column: 4
  7675. },
  7676. end: {
  7677. line: 1,
  7678. column: 5
  7679. }
  7680. }
  7681. },
  7682. init: {
  7683. type: "Literal",
  7684. value: /[P QR]/g,
  7685. loc: {
  7686. start: {
  7687. line: 1,
  7688. column: 8
  7689. },
  7690. end: {
  7691. line: 1,
  7692. column: 22
  7693. }
  7694. }
  7695. },
  7696. loc: {
  7697. start: {
  7698. line: 1,
  7699. column: 4
  7700. },
  7701. end: {
  7702. line: 1,
  7703. column: 22
  7704. }
  7705. }
  7706. }
  7707. ],
  7708. kind: "var",
  7709. loc: {
  7710. start: {
  7711. line: 1,
  7712. column: 0
  7713. },
  7714. end: {
  7715. line: 1,
  7716. column: 22
  7717. }
  7718. }
  7719. }
  7720. ],
  7721. loc: {
  7722. start: {
  7723. line: 1,
  7724. column: 0
  7725. },
  7726. end: {
  7727. line: 1,
  7728. column: 22
  7729. }
  7730. }
  7731. });
  7732. test("new Button", {
  7733. type: "Program",
  7734. body: [
  7735. {
  7736. type: "ExpressionStatement",
  7737. expression: {
  7738. type: "NewExpression",
  7739. callee: {
  7740. type: "Identifier",
  7741. name: "Button",
  7742. loc: {
  7743. start: {
  7744. line: 1,
  7745. column: 4
  7746. },
  7747. end: {
  7748. line: 1,
  7749. column: 10
  7750. }
  7751. }
  7752. },
  7753. arguments: [],
  7754. loc: {
  7755. start: {
  7756. line: 1,
  7757. column: 0
  7758. },
  7759. end: {
  7760. line: 1,
  7761. column: 10
  7762. }
  7763. }
  7764. },
  7765. loc: {
  7766. start: {
  7767. line: 1,
  7768. column: 0
  7769. },
  7770. end: {
  7771. line: 1,
  7772. column: 10
  7773. }
  7774. }
  7775. }
  7776. ],
  7777. loc: {
  7778. start: {
  7779. line: 1,
  7780. column: 0
  7781. },
  7782. end: {
  7783. line: 1,
  7784. column: 10
  7785. }
  7786. }
  7787. });
  7788. test("new Button()", {
  7789. type: "Program",
  7790. body: [
  7791. {
  7792. type: "ExpressionStatement",
  7793. expression: {
  7794. type: "NewExpression",
  7795. callee: {
  7796. type: "Identifier",
  7797. name: "Button",
  7798. loc: {
  7799. start: {
  7800. line: 1,
  7801. column: 4
  7802. },
  7803. end: {
  7804. line: 1,
  7805. column: 10
  7806. }
  7807. }
  7808. },
  7809. arguments: [],
  7810. loc: {
  7811. start: {
  7812. line: 1,
  7813. column: 0
  7814. },
  7815. end: {
  7816. line: 1,
  7817. column: 12
  7818. }
  7819. }
  7820. },
  7821. loc: {
  7822. start: {
  7823. line: 1,
  7824. column: 0
  7825. },
  7826. end: {
  7827. line: 1,
  7828. column: 12
  7829. }
  7830. }
  7831. }
  7832. ],
  7833. loc: {
  7834. start: {
  7835. line: 1,
  7836. column: 0
  7837. },
  7838. end: {
  7839. line: 1,
  7840. column: 12
  7841. }
  7842. }
  7843. });
  7844. test("new new foo", {
  7845. type: "Program",
  7846. body: [
  7847. {
  7848. type: "ExpressionStatement",
  7849. expression: {
  7850. type: "NewExpression",
  7851. callee: {
  7852. type: "NewExpression",
  7853. callee: {
  7854. type: "Identifier",
  7855. name: "foo",
  7856. loc: {
  7857. start: {
  7858. line: 1,
  7859. column: 8
  7860. },
  7861. end: {
  7862. line: 1,
  7863. column: 11
  7864. }
  7865. }
  7866. },
  7867. arguments: [],
  7868. loc: {
  7869. start: {
  7870. line: 1,
  7871. column: 4
  7872. },
  7873. end: {
  7874. line: 1,
  7875. column: 11
  7876. }
  7877. }
  7878. },
  7879. arguments: [],
  7880. loc: {
  7881. start: {
  7882. line: 1,
  7883. column: 0
  7884. },
  7885. end: {
  7886. line: 1,
  7887. column: 11
  7888. }
  7889. }
  7890. },
  7891. loc: {
  7892. start: {
  7893. line: 1,
  7894. column: 0
  7895. },
  7896. end: {
  7897. line: 1,
  7898. column: 11
  7899. }
  7900. }
  7901. }
  7902. ],
  7903. loc: {
  7904. start: {
  7905. line: 1,
  7906. column: 0
  7907. },
  7908. end: {
  7909. line: 1,
  7910. column: 11
  7911. }
  7912. }
  7913. });
  7914. test("new new foo()", {
  7915. type: "Program",
  7916. body: [
  7917. {
  7918. type: "ExpressionStatement",
  7919. expression: {
  7920. type: "NewExpression",
  7921. callee: {
  7922. type: "NewExpression",
  7923. callee: {
  7924. type: "Identifier",
  7925. name: "foo",
  7926. loc: {
  7927. start: {
  7928. line: 1,
  7929. column: 8
  7930. },
  7931. end: {
  7932. line: 1,
  7933. column: 11
  7934. }
  7935. }
  7936. },
  7937. arguments: [],
  7938. loc: {
  7939. start: {
  7940. line: 1,
  7941. column: 4
  7942. },
  7943. end: {
  7944. line: 1,
  7945. column: 13
  7946. }
  7947. }
  7948. },
  7949. arguments: [],
  7950. loc: {
  7951. start: {
  7952. line: 1,
  7953. column: 0
  7954. },
  7955. end: {
  7956. line: 1,
  7957. column: 13
  7958. }
  7959. }
  7960. },
  7961. loc: {
  7962. start: {
  7963. line: 1,
  7964. column: 0
  7965. },
  7966. end: {
  7967. line: 1,
  7968. column: 13
  7969. }
  7970. }
  7971. }
  7972. ],
  7973. loc: {
  7974. start: {
  7975. line: 1,
  7976. column: 0
  7977. },
  7978. end: {
  7979. line: 1,
  7980. column: 13
  7981. }
  7982. }
  7983. });
  7984. test("new foo().bar()", {
  7985. type: "Program",
  7986. body: [
  7987. {
  7988. type: "ExpressionStatement",
  7989. expression: {
  7990. type: "CallExpression",
  7991. callee: {
  7992. type: "MemberExpression",
  7993. object: {
  7994. type: "NewExpression",
  7995. callee: {
  7996. type: "Identifier",
  7997. name: "foo",
  7998. loc: {
  7999. start: {
  8000. line: 1,
  8001. column: 4
  8002. },
  8003. end: {
  8004. line: 1,
  8005. column: 7
  8006. }
  8007. }
  8008. },
  8009. arguments: [],
  8010. loc: {
  8011. start: {
  8012. line: 1,
  8013. column: 0
  8014. },
  8015. end: {
  8016. line: 1,
  8017. column: 9
  8018. }
  8019. }
  8020. },
  8021. property: {
  8022. type: "Identifier",
  8023. name: "bar",
  8024. loc: {
  8025. start: {
  8026. line: 1,
  8027. column: 10
  8028. },
  8029. end: {
  8030. line: 1,
  8031. column: 13
  8032. }
  8033. }
  8034. },
  8035. computed: false,
  8036. loc: {
  8037. start: {
  8038. line: 1,
  8039. column: 0
  8040. },
  8041. end: {
  8042. line: 1,
  8043. column: 13
  8044. }
  8045. }
  8046. },
  8047. arguments: [],
  8048. loc: {
  8049. start: {
  8050. line: 1,
  8051. column: 0
  8052. },
  8053. end: {
  8054. line: 1,
  8055. column: 15
  8056. }
  8057. }
  8058. },
  8059. loc: {
  8060. start: {
  8061. line: 1,
  8062. column: 0
  8063. },
  8064. end: {
  8065. line: 1,
  8066. column: 15
  8067. }
  8068. }
  8069. }
  8070. ],
  8071. loc: {
  8072. start: {
  8073. line: 1,
  8074. column: 0
  8075. },
  8076. end: {
  8077. line: 1,
  8078. column: 15
  8079. }
  8080. }
  8081. });
  8082. test("new foo[bar]", {
  8083. type: "Program",
  8084. body: [
  8085. {
  8086. type: "ExpressionStatement",
  8087. expression: {
  8088. type: "NewExpression",
  8089. callee: {
  8090. type: "MemberExpression",
  8091. object: {
  8092. type: "Identifier",
  8093. name: "foo",
  8094. loc: {
  8095. start: {
  8096. line: 1,
  8097. column: 4
  8098. },
  8099. end: {
  8100. line: 1,
  8101. column: 7
  8102. }
  8103. }
  8104. },
  8105. property: {
  8106. type: "Identifier",
  8107. name: "bar",
  8108. loc: {
  8109. start: {
  8110. line: 1,
  8111. column: 8
  8112. },
  8113. end: {
  8114. line: 1,
  8115. column: 11
  8116. }
  8117. }
  8118. },
  8119. computed: true,
  8120. loc: {
  8121. start: {
  8122. line: 1,
  8123. column: 4
  8124. },
  8125. end: {
  8126. line: 1,
  8127. column: 12
  8128. }
  8129. }
  8130. },
  8131. arguments: [],
  8132. loc: {
  8133. start: {
  8134. line: 1,
  8135. column: 0
  8136. },
  8137. end: {
  8138. line: 1,
  8139. column: 12
  8140. }
  8141. }
  8142. },
  8143. loc: {
  8144. start: {
  8145. line: 1,
  8146. column: 0
  8147. },
  8148. end: {
  8149. line: 1,
  8150. column: 12
  8151. }
  8152. }
  8153. }
  8154. ],
  8155. loc: {
  8156. start: {
  8157. line: 1,
  8158. column: 0
  8159. },
  8160. end: {
  8161. line: 1,
  8162. column: 12
  8163. }
  8164. }
  8165. });
  8166. test("new foo.bar()", {
  8167. type: "Program",
  8168. body: [
  8169. {
  8170. type: "ExpressionStatement",
  8171. expression: {
  8172. type: "NewExpression",
  8173. callee: {
  8174. type: "MemberExpression",
  8175. object: {
  8176. type: "Identifier",
  8177. name: "foo",
  8178. loc: {
  8179. start: {
  8180. line: 1,
  8181. column: 4
  8182. },
  8183. end: {
  8184. line: 1,
  8185. column: 7
  8186. }
  8187. }
  8188. },
  8189. property: {
  8190. type: "Identifier",
  8191. name: "bar",
  8192. loc: {
  8193. start: {
  8194. line: 1,
  8195. column: 8
  8196. },
  8197. end: {
  8198. line: 1,
  8199. column: 11
  8200. }
  8201. }
  8202. },
  8203. computed: false,
  8204. loc: {
  8205. start: {
  8206. line: 1,
  8207. column: 4
  8208. },
  8209. end: {
  8210. line: 1,
  8211. column: 11
  8212. }
  8213. }
  8214. },
  8215. arguments: [],
  8216. loc: {
  8217. start: {
  8218. line: 1,
  8219. column: 0
  8220. },
  8221. end: {
  8222. line: 1,
  8223. column: 13
  8224. }
  8225. }
  8226. },
  8227. loc: {
  8228. start: {
  8229. line: 1,
  8230. column: 0
  8231. },
  8232. end: {
  8233. line: 1,
  8234. column: 13
  8235. }
  8236. }
  8237. }
  8238. ],
  8239. loc: {
  8240. start: {
  8241. line: 1,
  8242. column: 0
  8243. },
  8244. end: {
  8245. line: 1,
  8246. column: 13
  8247. }
  8248. }
  8249. });
  8250. test("( new foo).bar()", {
  8251. type: "Program",
  8252. body: [
  8253. {
  8254. type: "ExpressionStatement",
  8255. expression: {
  8256. type: "CallExpression",
  8257. callee: {
  8258. type: "MemberExpression",
  8259. object: {
  8260. type: "NewExpression",
  8261. callee: {
  8262. type: "Identifier",
  8263. name: "foo",
  8264. loc: {
  8265. start: {
  8266. line: 1,
  8267. column: 6
  8268. },
  8269. end: {
  8270. line: 1,
  8271. column: 9
  8272. }
  8273. }
  8274. },
  8275. arguments: [],
  8276. loc: {
  8277. start: {
  8278. line: 1,
  8279. column: 2
  8280. },
  8281. end: {
  8282. line: 1,
  8283. column: 9
  8284. }
  8285. }
  8286. },
  8287. property: {
  8288. type: "Identifier",
  8289. name: "bar",
  8290. loc: {
  8291. start: {
  8292. line: 1,
  8293. column: 11
  8294. },
  8295. end: {
  8296. line: 1,
  8297. column: 14
  8298. }
  8299. }
  8300. },
  8301. computed: false,
  8302. loc: {
  8303. start: {
  8304. line: 1,
  8305. column: 0
  8306. },
  8307. end: {
  8308. line: 1,
  8309. column: 14
  8310. }
  8311. }
  8312. },
  8313. arguments: [],
  8314. loc: {
  8315. start: {
  8316. line: 1,
  8317. column: 0
  8318. },
  8319. end: {
  8320. line: 1,
  8321. column: 16
  8322. }
  8323. }
  8324. },
  8325. loc: {
  8326. start: {
  8327. line: 1,
  8328. column: 0
  8329. },
  8330. end: {
  8331. line: 1,
  8332. column: 16
  8333. }
  8334. }
  8335. }
  8336. ],
  8337. loc: {
  8338. start: {
  8339. line: 1,
  8340. column: 0
  8341. },
  8342. end: {
  8343. line: 1,
  8344. column: 16
  8345. }
  8346. }
  8347. });
  8348. test("foo(bar, baz)", {
  8349. type: "Program",
  8350. body: [
  8351. {
  8352. type: "ExpressionStatement",
  8353. expression: {
  8354. type: "CallExpression",
  8355. callee: {
  8356. type: "Identifier",
  8357. name: "foo",
  8358. loc: {
  8359. start: {
  8360. line: 1,
  8361. column: 0
  8362. },
  8363. end: {
  8364. line: 1,
  8365. column: 3
  8366. }
  8367. }
  8368. },
  8369. arguments: [
  8370. {
  8371. type: "Identifier",
  8372. name: "bar",
  8373. loc: {
  8374. start: {
  8375. line: 1,
  8376. column: 4
  8377. },
  8378. end: {
  8379. line: 1,
  8380. column: 7
  8381. }
  8382. }
  8383. },
  8384. {
  8385. type: "Identifier",
  8386. name: "baz",
  8387. loc: {
  8388. start: {
  8389. line: 1,
  8390. column: 9
  8391. },
  8392. end: {
  8393. line: 1,
  8394. column: 12
  8395. }
  8396. }
  8397. }
  8398. ],
  8399. loc: {
  8400. start: {
  8401. line: 1,
  8402. column: 0
  8403. },
  8404. end: {
  8405. line: 1,
  8406. column: 13
  8407. }
  8408. }
  8409. },
  8410. loc: {
  8411. start: {
  8412. line: 1,
  8413. column: 0
  8414. },
  8415. end: {
  8416. line: 1,
  8417. column: 13
  8418. }
  8419. }
  8420. }
  8421. ],
  8422. loc: {
  8423. start: {
  8424. line: 1,
  8425. column: 0
  8426. },
  8427. end: {
  8428. line: 1,
  8429. column: 13
  8430. }
  8431. }
  8432. });
  8433. test("( foo )()", {
  8434. type: "Program",
  8435. body: [
  8436. {
  8437. type: "ExpressionStatement",
  8438. expression: {
  8439. type: "CallExpression",
  8440. callee: {
  8441. type: "Identifier",
  8442. name: "foo",
  8443. loc: {
  8444. start: {
  8445. line: 1,
  8446. column: 5
  8447. },
  8448. end: {
  8449. line: 1,
  8450. column: 8
  8451. }
  8452. }
  8453. },
  8454. arguments: [],
  8455. loc: {
  8456. start: {
  8457. line: 1,
  8458. column: 0
  8459. },
  8460. end: {
  8461. line: 1,
  8462. column: 13
  8463. }
  8464. }
  8465. },
  8466. loc: {
  8467. start: {
  8468. line: 1,
  8469. column: 0
  8470. },
  8471. end: {
  8472. line: 1,
  8473. column: 13
  8474. }
  8475. }
  8476. }
  8477. ],
  8478. loc: {
  8479. start: {
  8480. line: 1,
  8481. column: 0
  8482. },
  8483. end: {
  8484. line: 1,
  8485. column: 13
  8486. }
  8487. }
  8488. });
  8489. test("universe.milkyway", {
  8490. type: "Program",
  8491. body: [
  8492. {
  8493. type: "ExpressionStatement",
  8494. expression: {
  8495. type: "MemberExpression",
  8496. object: {
  8497. type: "Identifier",
  8498. name: "universe",
  8499. loc: {
  8500. start: {
  8501. line: 1,
  8502. column: 0
  8503. },
  8504. end: {
  8505. line: 1,
  8506. column: 8
  8507. }
  8508. }
  8509. },
  8510. property: {
  8511. type: "Identifier",
  8512. name: "milkyway",
  8513. loc: {
  8514. start: {
  8515. line: 1,
  8516. column: 9
  8517. },
  8518. end: {
  8519. line: 1,
  8520. column: 17
  8521. }
  8522. }
  8523. },
  8524. computed: false,
  8525. loc: {
  8526. start: {
  8527. line: 1,
  8528. column: 0
  8529. },
  8530. end: {
  8531. line: 1,
  8532. column: 17
  8533. }
  8534. }
  8535. },
  8536. loc: {
  8537. start: {
  8538. line: 1,
  8539. column: 0
  8540. },
  8541. end: {
  8542. line: 1,
  8543. column: 17
  8544. }
  8545. }
  8546. }
  8547. ],
  8548. loc: {
  8549. start: {
  8550. line: 1,
  8551. column: 0
  8552. },
  8553. end: {
  8554. line: 1,
  8555. column: 17
  8556. }
  8557. }
  8558. });
  8559. test("universe.milkyway.solarsystem", {
  8560. type: "Program",
  8561. body: [
  8562. {
  8563. type: "ExpressionStatement",
  8564. expression: {
  8565. type: "MemberExpression",
  8566. object: {
  8567. type: "MemberExpression",
  8568. object: {
  8569. type: "Identifier",
  8570. name: "universe",
  8571. loc: {
  8572. start: {
  8573. line: 1,
  8574. column: 0
  8575. },
  8576. end: {
  8577. line: 1,
  8578. column: 8
  8579. }
  8580. }
  8581. },
  8582. property: {
  8583. type: "Identifier",
  8584. name: "milkyway",
  8585. loc: {
  8586. start: {
  8587. line: 1,
  8588. column: 9
  8589. },
  8590. end: {
  8591. line: 1,
  8592. column: 17
  8593. }
  8594. }
  8595. },
  8596. computed: false,
  8597. loc: {
  8598. start: {
  8599. line: 1,
  8600. column: 0
  8601. },
  8602. end: {
  8603. line: 1,
  8604. column: 17
  8605. }
  8606. }
  8607. },
  8608. property: {
  8609. type: "Identifier",
  8610. name: "solarsystem",
  8611. loc: {
  8612. start: {
  8613. line: 1,
  8614. column: 18
  8615. },
  8616. end: {
  8617. line: 1,
  8618. column: 29
  8619. }
  8620. }
  8621. },
  8622. computed: false,
  8623. loc: {
  8624. start: {
  8625. line: 1,
  8626. column: 0
  8627. },
  8628. end: {
  8629. line: 1,
  8630. column: 29
  8631. }
  8632. }
  8633. },
  8634. loc: {
  8635. start: {
  8636. line: 1,
  8637. column: 0
  8638. },
  8639. end: {
  8640. line: 1,
  8641. column: 29
  8642. }
  8643. }
  8644. }
  8645. ],
  8646. loc: {
  8647. start: {
  8648. line: 1,
  8649. column: 0
  8650. },
  8651. end: {
  8652. line: 1,
  8653. column: 29
  8654. }
  8655. }
  8656. });
  8657. test("universe.milkyway.solarsystem.Earth", {
  8658. type: "Program",
  8659. body: [
  8660. {
  8661. type: "ExpressionStatement",
  8662. expression: {
  8663. type: "MemberExpression",
  8664. object: {
  8665. type: "MemberExpression",
  8666. object: {
  8667. type: "MemberExpression",
  8668. object: {
  8669. type: "Identifier",
  8670. name: "universe",
  8671. loc: {
  8672. start: {
  8673. line: 1,
  8674. column: 0
  8675. },
  8676. end: {
  8677. line: 1,
  8678. column: 8
  8679. }
  8680. }
  8681. },
  8682. property: {
  8683. type: "Identifier",
  8684. name: "milkyway",
  8685. loc: {
  8686. start: {
  8687. line: 1,
  8688. column: 9
  8689. },
  8690. end: {
  8691. line: 1,
  8692. column: 17
  8693. }
  8694. }
  8695. },
  8696. computed: false,
  8697. loc: {
  8698. start: {
  8699. line: 1,
  8700. column: 0
  8701. },
  8702. end: {
  8703. line: 1,
  8704. column: 17
  8705. }
  8706. }
  8707. },
  8708. property: {
  8709. type: "Identifier",
  8710. name: "solarsystem",
  8711. loc: {
  8712. start: {
  8713. line: 1,
  8714. column: 18
  8715. },
  8716. end: {
  8717. line: 1,
  8718. column: 29
  8719. }
  8720. }
  8721. },
  8722. computed: false,
  8723. loc: {
  8724. start: {
  8725. line: 1,
  8726. column: 0
  8727. },
  8728. end: {
  8729. line: 1,
  8730. column: 29
  8731. }
  8732. }
  8733. },
  8734. property: {
  8735. type: "Identifier",
  8736. name: "Earth",
  8737. loc: {
  8738. start: {
  8739. line: 1,
  8740. column: 30
  8741. },
  8742. end: {
  8743. line: 1,
  8744. column: 35
  8745. }
  8746. }
  8747. },
  8748. computed: false,
  8749. loc: {
  8750. start: {
  8751. line: 1,
  8752. column: 0
  8753. },
  8754. end: {
  8755. line: 1,
  8756. column: 35
  8757. }
  8758. }
  8759. },
  8760. loc: {
  8761. start: {
  8762. line: 1,
  8763. column: 0
  8764. },
  8765. end: {
  8766. line: 1,
  8767. column: 35
  8768. }
  8769. }
  8770. }
  8771. ],
  8772. loc: {
  8773. start: {
  8774. line: 1,
  8775. column: 0
  8776. },
  8777. end: {
  8778. line: 1,
  8779. column: 35
  8780. }
  8781. }
  8782. });
  8783. test("universe[galaxyName, otherUselessName]", {
  8784. type: "Program",
  8785. body: [
  8786. {
  8787. type: "ExpressionStatement",
  8788. expression: {
  8789. type: "MemberExpression",
  8790. object: {
  8791. type: "Identifier",
  8792. name: "universe",
  8793. loc: {
  8794. start: {
  8795. line: 1,
  8796. column: 0
  8797. },
  8798. end: {
  8799. line: 1,
  8800. column: 8
  8801. }
  8802. }
  8803. },
  8804. property: {
  8805. type: "SequenceExpression",
  8806. expressions: [
  8807. {
  8808. type: "Identifier",
  8809. name: "galaxyName",
  8810. loc: {
  8811. start: {
  8812. line: 1,
  8813. column: 9
  8814. },
  8815. end: {
  8816. line: 1,
  8817. column: 19
  8818. }
  8819. }
  8820. },
  8821. {
  8822. type: "Identifier",
  8823. name: "otherUselessName",
  8824. loc: {
  8825. start: {
  8826. line: 1,
  8827. column: 21
  8828. },
  8829. end: {
  8830. line: 1,
  8831. column: 37
  8832. }
  8833. }
  8834. }
  8835. ],
  8836. loc: {
  8837. start: {
  8838. line: 1,
  8839. column: 9
  8840. },
  8841. end: {
  8842. line: 1,
  8843. column: 37
  8844. }
  8845. }
  8846. },
  8847. computed: true,
  8848. loc: {
  8849. start: {
  8850. line: 1,
  8851. column: 0
  8852. },
  8853. end: {
  8854. line: 1,
  8855. column: 38
  8856. }
  8857. }
  8858. },
  8859. loc: {
  8860. start: {
  8861. line: 1,
  8862. column: 0
  8863. },
  8864. end: {
  8865. line: 1,
  8866. column: 38
  8867. }
  8868. }
  8869. }
  8870. ],
  8871. loc: {
  8872. start: {
  8873. line: 1,
  8874. column: 0
  8875. },
  8876. end: {
  8877. line: 1,
  8878. column: 38
  8879. }
  8880. }
  8881. });
  8882. test("universe[galaxyName]", {
  8883. type: "Program",
  8884. body: [
  8885. {
  8886. type: "ExpressionStatement",
  8887. expression: {
  8888. type: "MemberExpression",
  8889. object: {
  8890. type: "Identifier",
  8891. name: "universe",
  8892. loc: {
  8893. start: {
  8894. line: 1,
  8895. column: 0
  8896. },
  8897. end: {
  8898. line: 1,
  8899. column: 8
  8900. }
  8901. }
  8902. },
  8903. property: {
  8904. type: "Identifier",
  8905. name: "galaxyName",
  8906. loc: {
  8907. start: {
  8908. line: 1,
  8909. column: 9
  8910. },
  8911. end: {
  8912. line: 1,
  8913. column: 19
  8914. }
  8915. }
  8916. },
  8917. computed: true,
  8918. loc: {
  8919. start: {
  8920. line: 1,
  8921. column: 0
  8922. },
  8923. end: {
  8924. line: 1,
  8925. column: 20
  8926. }
  8927. }
  8928. },
  8929. loc: {
  8930. start: {
  8931. line: 1,
  8932. column: 0
  8933. },
  8934. end: {
  8935. line: 1,
  8936. column: 20
  8937. }
  8938. }
  8939. }
  8940. ],
  8941. loc: {
  8942. start: {
  8943. line: 1,
  8944. column: 0
  8945. },
  8946. end: {
  8947. line: 1,
  8948. column: 20
  8949. }
  8950. }
  8951. });
  8952. test("universe[42].galaxies", {
  8953. type: "Program",
  8954. body: [
  8955. {
  8956. type: "ExpressionStatement",
  8957. expression: {
  8958. type: "MemberExpression",
  8959. object: {
  8960. type: "MemberExpression",
  8961. object: {
  8962. type: "Identifier",
  8963. name: "universe",
  8964. loc: {
  8965. start: {
  8966. line: 1,
  8967. column: 0
  8968. },
  8969. end: {
  8970. line: 1,
  8971. column: 8
  8972. }
  8973. }
  8974. },
  8975. property: {
  8976. type: "Literal",
  8977. value: 42,
  8978. loc: {
  8979. start: {
  8980. line: 1,
  8981. column: 9
  8982. },
  8983. end: {
  8984. line: 1,
  8985. column: 11
  8986. }
  8987. }
  8988. },
  8989. computed: true,
  8990. loc: {
  8991. start: {
  8992. line: 1,
  8993. column: 0
  8994. },
  8995. end: {
  8996. line: 1,
  8997. column: 12
  8998. }
  8999. }
  9000. },
  9001. property: {
  9002. type: "Identifier",
  9003. name: "galaxies",
  9004. loc: {
  9005. start: {
  9006. line: 1,
  9007. column: 13
  9008. },
  9009. end: {
  9010. line: 1,
  9011. column: 21
  9012. }
  9013. }
  9014. },
  9015. computed: false,
  9016. loc: {
  9017. start: {
  9018. line: 1,
  9019. column: 0
  9020. },
  9021. end: {
  9022. line: 1,
  9023. column: 21
  9024. }
  9025. }
  9026. },
  9027. loc: {
  9028. start: {
  9029. line: 1,
  9030. column: 0
  9031. },
  9032. end: {
  9033. line: 1,
  9034. column: 21
  9035. }
  9036. }
  9037. }
  9038. ],
  9039. loc: {
  9040. start: {
  9041. line: 1,
  9042. column: 0
  9043. },
  9044. end: {
  9045. line: 1,
  9046. column: 21
  9047. }
  9048. }
  9049. });
  9050. test("universe(42).galaxies", {
  9051. type: "Program",
  9052. body: [
  9053. {
  9054. type: "ExpressionStatement",
  9055. expression: {
  9056. type: "MemberExpression",
  9057. object: {
  9058. type: "CallExpression",
  9059. callee: {
  9060. type: "Identifier",
  9061. name: "universe",
  9062. loc: {
  9063. start: {
  9064. line: 1,
  9065. column: 0
  9066. },
  9067. end: {
  9068. line: 1,
  9069. column: 8
  9070. }
  9071. }
  9072. },
  9073. arguments: [
  9074. {
  9075. type: "Literal",
  9076. value: 42,
  9077. loc: {
  9078. start: {
  9079. line: 1,
  9080. column: 9
  9081. },
  9082. end: {
  9083. line: 1,
  9084. column: 11
  9085. }
  9086. }
  9087. }
  9088. ],
  9089. loc: {
  9090. start: {
  9091. line: 1,
  9092. column: 0
  9093. },
  9094. end: {
  9095. line: 1,
  9096. column: 12
  9097. }
  9098. }
  9099. },
  9100. property: {
  9101. type: "Identifier",
  9102. name: "galaxies",
  9103. loc: {
  9104. start: {
  9105. line: 1,
  9106. column: 13
  9107. },
  9108. end: {
  9109. line: 1,
  9110. column: 21
  9111. }
  9112. }
  9113. },
  9114. computed: false,
  9115. loc: {
  9116. start: {
  9117. line: 1,
  9118. column: 0
  9119. },
  9120. end: {
  9121. line: 1,
  9122. column: 21
  9123. }
  9124. }
  9125. },
  9126. loc: {
  9127. start: {
  9128. line: 1,
  9129. column: 0
  9130. },
  9131. end: {
  9132. line: 1,
  9133. column: 21
  9134. }
  9135. }
  9136. }
  9137. ],
  9138. loc: {
  9139. start: {
  9140. line: 1,
  9141. column: 0
  9142. },
  9143. end: {
  9144. line: 1,
  9145. column: 21
  9146. }
  9147. }
  9148. });
  9149. test("universe(42).galaxies(14, 3, 77).milkyway", {
  9150. type: "Program",
  9151. body: [
  9152. {
  9153. type: "ExpressionStatement",
  9154. expression: {
  9155. type: "MemberExpression",
  9156. object: {
  9157. type: "CallExpression",
  9158. callee: {
  9159. type: "MemberExpression",
  9160. object: {
  9161. type: "CallExpression",
  9162. callee: {
  9163. type: "Identifier",
  9164. name: "universe",
  9165. loc: {
  9166. start: {
  9167. line: 1,
  9168. column: 0
  9169. },
  9170. end: {
  9171. line: 1,
  9172. column: 8
  9173. }
  9174. }
  9175. },
  9176. arguments: [
  9177. {
  9178. type: "Literal",
  9179. value: 42,
  9180. loc: {
  9181. start: {
  9182. line: 1,
  9183. column: 9
  9184. },
  9185. end: {
  9186. line: 1,
  9187. column: 11
  9188. }
  9189. }
  9190. }
  9191. ],
  9192. loc: {
  9193. start: {
  9194. line: 1,
  9195. column: 0
  9196. },
  9197. end: {
  9198. line: 1,
  9199. column: 12
  9200. }
  9201. }
  9202. },
  9203. property: {
  9204. type: "Identifier",
  9205. name: "galaxies",
  9206. loc: {
  9207. start: {
  9208. line: 1,
  9209. column: 13
  9210. },
  9211. end: {
  9212. line: 1,
  9213. column: 21
  9214. }
  9215. }
  9216. },
  9217. computed: false,
  9218. loc: {
  9219. start: {
  9220. line: 1,
  9221. column: 0
  9222. },
  9223. end: {
  9224. line: 1,
  9225. column: 21
  9226. }
  9227. }
  9228. },
  9229. arguments: [
  9230. {
  9231. type: "Literal",
  9232. value: 14,
  9233. loc: {
  9234. start: {
  9235. line: 1,
  9236. column: 22
  9237. },
  9238. end: {
  9239. line: 1,
  9240. column: 24
  9241. }
  9242. }
  9243. },
  9244. {
  9245. type: "Literal",
  9246. value: 3,
  9247. loc: {
  9248. start: {
  9249. line: 1,
  9250. column: 26
  9251. },
  9252. end: {
  9253. line: 1,
  9254. column: 27
  9255. }
  9256. }
  9257. },
  9258. {
  9259. type: "Literal",
  9260. value: 77,
  9261. loc: {
  9262. start: {
  9263. line: 1,
  9264. column: 29
  9265. },
  9266. end: {
  9267. line: 1,
  9268. column: 31
  9269. }
  9270. }
  9271. }
  9272. ],
  9273. loc: {
  9274. start: {
  9275. line: 1,
  9276. column: 0
  9277. },
  9278. end: {
  9279. line: 1,
  9280. column: 32
  9281. }
  9282. }
  9283. },
  9284. property: {
  9285. type: "Identifier",
  9286. name: "milkyway",
  9287. loc: {
  9288. start: {
  9289. line: 1,
  9290. column: 33
  9291. },
  9292. end: {
  9293. line: 1,
  9294. column: 41
  9295. }
  9296. }
  9297. },
  9298. computed: false,
  9299. loc: {
  9300. start: {
  9301. line: 1,
  9302. column: 0
  9303. },
  9304. end: {
  9305. line: 1,
  9306. column: 41
  9307. }
  9308. }
  9309. },
  9310. loc: {
  9311. start: {
  9312. line: 1,
  9313. column: 0
  9314. },
  9315. end: {
  9316. line: 1,
  9317. column: 41
  9318. }
  9319. }
  9320. }
  9321. ],
  9322. loc: {
  9323. start: {
  9324. line: 1,
  9325. column: 0
  9326. },
  9327. end: {
  9328. line: 1,
  9329. column: 41
  9330. }
  9331. }
  9332. });
  9333. test("earth.asia.Indonesia.prepareForElection(2014)", {
  9334. type: "Program",
  9335. body: [
  9336. {
  9337. type: "ExpressionStatement",
  9338. expression: {
  9339. type: "CallExpression",
  9340. callee: {
  9341. type: "MemberExpression",
  9342. object: {
  9343. type: "MemberExpression",
  9344. object: {
  9345. type: "MemberExpression",
  9346. object: {
  9347. type: "Identifier",
  9348. name: "earth",
  9349. loc: {
  9350. start: {
  9351. line: 1,
  9352. column: 0
  9353. },
  9354. end: {
  9355. line: 1,
  9356. column: 5
  9357. }
  9358. }
  9359. },
  9360. property: {
  9361. type: "Identifier",
  9362. name: "asia",
  9363. loc: {
  9364. start: {
  9365. line: 1,
  9366. column: 6
  9367. },
  9368. end: {
  9369. line: 1,
  9370. column: 10
  9371. }
  9372. }
  9373. },
  9374. computed: false,
  9375. loc: {
  9376. start: {
  9377. line: 1,
  9378. column: 0
  9379. },
  9380. end: {
  9381. line: 1,
  9382. column: 10
  9383. }
  9384. }
  9385. },
  9386. property: {
  9387. type: "Identifier",
  9388. name: "Indonesia",
  9389. loc: {
  9390. start: {
  9391. line: 1,
  9392. column: 11
  9393. },
  9394. end: {
  9395. line: 1,
  9396. column: 20
  9397. }
  9398. }
  9399. },
  9400. computed: false,
  9401. loc: {
  9402. start: {
  9403. line: 1,
  9404. column: 0
  9405. },
  9406. end: {
  9407. line: 1,
  9408. column: 20
  9409. }
  9410. }
  9411. },
  9412. property: {
  9413. type: "Identifier",
  9414. name: "prepareForElection",
  9415. loc: {
  9416. start: {
  9417. line: 1,
  9418. column: 21
  9419. },
  9420. end: {
  9421. line: 1,
  9422. column: 39
  9423. }
  9424. }
  9425. },
  9426. computed: false,
  9427. loc: {
  9428. start: {
  9429. line: 1,
  9430. column: 0
  9431. },
  9432. end: {
  9433. line: 1,
  9434. column: 39
  9435. }
  9436. }
  9437. },
  9438. arguments: [
  9439. {
  9440. type: "Literal",
  9441. value: 2014,
  9442. loc: {
  9443. start: {
  9444. line: 1,
  9445. column: 40
  9446. },
  9447. end: {
  9448. line: 1,
  9449. column: 44
  9450. }
  9451. }
  9452. }
  9453. ],
  9454. loc: {
  9455. start: {
  9456. line: 1,
  9457. column: 0
  9458. },
  9459. end: {
  9460. line: 1,
  9461. column: 45
  9462. }
  9463. }
  9464. },
  9465. loc: {
  9466. start: {
  9467. line: 1,
  9468. column: 0
  9469. },
  9470. end: {
  9471. line: 1,
  9472. column: 45
  9473. }
  9474. }
  9475. }
  9476. ],
  9477. loc: {
  9478. start: {
  9479. line: 1,
  9480. column: 0
  9481. },
  9482. end: {
  9483. line: 1,
  9484. column: 45
  9485. }
  9486. }
  9487. });
  9488. test("universe.if", {
  9489. type: "Program",
  9490. body: [
  9491. {
  9492. type: "ExpressionStatement",
  9493. expression: {
  9494. type: "MemberExpression",
  9495. object: {
  9496. type: "Identifier",
  9497. name: "universe",
  9498. loc: {
  9499. start: {
  9500. line: 1,
  9501. column: 0
  9502. },
  9503. end: {
  9504. line: 1,
  9505. column: 8
  9506. }
  9507. }
  9508. },
  9509. property: {
  9510. type: "Identifier",
  9511. name: "if",
  9512. loc: {
  9513. start: {
  9514. line: 1,
  9515. column: 9
  9516. },
  9517. end: {
  9518. line: 1,
  9519. column: 11
  9520. }
  9521. }
  9522. },
  9523. computed: false,
  9524. loc: {
  9525. start: {
  9526. line: 1,
  9527. column: 0
  9528. },
  9529. end: {
  9530. line: 1,
  9531. column: 11
  9532. }
  9533. }
  9534. },
  9535. loc: {
  9536. start: {
  9537. line: 1,
  9538. column: 0
  9539. },
  9540. end: {
  9541. line: 1,
  9542. column: 11
  9543. }
  9544. }
  9545. }
  9546. ],
  9547. loc: {
  9548. start: {
  9549. line: 1,
  9550. column: 0
  9551. },
  9552. end: {
  9553. line: 1,
  9554. column: 11
  9555. }
  9556. }
  9557. });
  9558. test("universe.true", {
  9559. type: "Program",
  9560. body: [
  9561. {
  9562. type: "ExpressionStatement",
  9563. expression: {
  9564. type: "MemberExpression",
  9565. object: {
  9566. type: "Identifier",
  9567. name: "universe",
  9568. loc: {
  9569. start: {
  9570. line: 1,
  9571. column: 0
  9572. },
  9573. end: {
  9574. line: 1,
  9575. column: 8
  9576. }
  9577. }
  9578. },
  9579. property: {
  9580. type: "Identifier",
  9581. name: "true",
  9582. loc: {
  9583. start: {
  9584. line: 1,
  9585. column: 9
  9586. },
  9587. end: {
  9588. line: 1,
  9589. column: 13
  9590. }
  9591. }
  9592. },
  9593. computed: false,
  9594. loc: {
  9595. start: {
  9596. line: 1,
  9597. column: 0
  9598. },
  9599. end: {
  9600. line: 1,
  9601. column: 13
  9602. }
  9603. }
  9604. },
  9605. loc: {
  9606. start: {
  9607. line: 1,
  9608. column: 0
  9609. },
  9610. end: {
  9611. line: 1,
  9612. column: 13
  9613. }
  9614. }
  9615. }
  9616. ],
  9617. loc: {
  9618. start: {
  9619. line: 1,
  9620. column: 0
  9621. },
  9622. end: {
  9623. line: 1,
  9624. column: 13
  9625. }
  9626. }
  9627. });
  9628. test("universe.false", {
  9629. type: "Program",
  9630. body: [
  9631. {
  9632. type: "ExpressionStatement",
  9633. expression: {
  9634. type: "MemberExpression",
  9635. object: {
  9636. type: "Identifier",
  9637. name: "universe",
  9638. loc: {
  9639. start: {
  9640. line: 1,
  9641. column: 0
  9642. },
  9643. end: {
  9644. line: 1,
  9645. column: 8
  9646. }
  9647. }
  9648. },
  9649. property: {
  9650. type: "Identifier",
  9651. name: "false",
  9652. loc: {
  9653. start: {
  9654. line: 1,
  9655. column: 9
  9656. },
  9657. end: {
  9658. line: 1,
  9659. column: 14
  9660. }
  9661. }
  9662. },
  9663. computed: false,
  9664. loc: {
  9665. start: {
  9666. line: 1,
  9667. column: 0
  9668. },
  9669. end: {
  9670. line: 1,
  9671. column: 14
  9672. }
  9673. }
  9674. },
  9675. loc: {
  9676. start: {
  9677. line: 1,
  9678. column: 0
  9679. },
  9680. end: {
  9681. line: 1,
  9682. column: 14
  9683. }
  9684. }
  9685. }
  9686. ],
  9687. loc: {
  9688. start: {
  9689. line: 1,
  9690. column: 0
  9691. },
  9692. end: {
  9693. line: 1,
  9694. column: 14
  9695. }
  9696. }
  9697. });
  9698. test("universe.null", {
  9699. type: "Program",
  9700. body: [
  9701. {
  9702. type: "ExpressionStatement",
  9703. expression: {
  9704. type: "MemberExpression",
  9705. object: {
  9706. type: "Identifier",
  9707. name: "universe",
  9708. loc: {
  9709. start: {
  9710. line: 1,
  9711. column: 0
  9712. },
  9713. end: {
  9714. line: 1,
  9715. column: 8
  9716. }
  9717. }
  9718. },
  9719. property: {
  9720. type: "Identifier",
  9721. name: "null",
  9722. loc: {
  9723. start: {
  9724. line: 1,
  9725. column: 9
  9726. },
  9727. end: {
  9728. line: 1,
  9729. column: 13
  9730. }
  9731. }
  9732. },
  9733. computed: false,
  9734. loc: {
  9735. start: {
  9736. line: 1,
  9737. column: 0
  9738. },
  9739. end: {
  9740. line: 1,
  9741. column: 13
  9742. }
  9743. }
  9744. },
  9745. loc: {
  9746. start: {
  9747. line: 1,
  9748. column: 0
  9749. },
  9750. end: {
  9751. line: 1,
  9752. column: 13
  9753. }
  9754. }
  9755. }
  9756. ],
  9757. loc: {
  9758. start: {
  9759. line: 1,
  9760. column: 0
  9761. },
  9762. end: {
  9763. line: 1,
  9764. column: 13
  9765. }
  9766. }
  9767. });
  9768. test("x++", {
  9769. type: "Program",
  9770. body: [
  9771. {
  9772. type: "ExpressionStatement",
  9773. expression: {
  9774. type: "UpdateExpression",
  9775. operator: "++",
  9776. prefix: false,
  9777. argument: {
  9778. type: "Identifier",
  9779. name: "x",
  9780. loc: {
  9781. start: {
  9782. line: 1,
  9783. column: 0
  9784. },
  9785. end: {
  9786. line: 1,
  9787. column: 1
  9788. }
  9789. }
  9790. },
  9791. loc: {
  9792. start: {
  9793. line: 1,
  9794. column: 0
  9795. },
  9796. end: {
  9797. line: 1,
  9798. column: 3
  9799. }
  9800. }
  9801. },
  9802. loc: {
  9803. start: {
  9804. line: 1,
  9805. column: 0
  9806. },
  9807. end: {
  9808. line: 1,
  9809. column: 3
  9810. }
  9811. }
  9812. }
  9813. ],
  9814. loc: {
  9815. start: {
  9816. line: 1,
  9817. column: 0
  9818. },
  9819. end: {
  9820. line: 1,
  9821. column: 3
  9822. }
  9823. }
  9824. });
  9825. test("x--", {
  9826. type: "Program",
  9827. body: [
  9828. {
  9829. type: "ExpressionStatement",
  9830. expression: {
  9831. type: "UpdateExpression",
  9832. operator: "--",
  9833. prefix: false,
  9834. argument: {
  9835. type: "Identifier",
  9836. name: "x",
  9837. loc: {
  9838. start: {
  9839. line: 1,
  9840. column: 0
  9841. },
  9842. end: {
  9843. line: 1,
  9844. column: 1
  9845. }
  9846. }
  9847. },
  9848. loc: {
  9849. start: {
  9850. line: 1,
  9851. column: 0
  9852. },
  9853. end: {
  9854. line: 1,
  9855. column: 3
  9856. }
  9857. }
  9858. },
  9859. loc: {
  9860. start: {
  9861. line: 1,
  9862. column: 0
  9863. },
  9864. end: {
  9865. line: 1,
  9866. column: 3
  9867. }
  9868. }
  9869. }
  9870. ],
  9871. loc: {
  9872. start: {
  9873. line: 1,
  9874. column: 0
  9875. },
  9876. end: {
  9877. line: 1,
  9878. column: 3
  9879. }
  9880. }
  9881. });
  9882. test("eval++", {
  9883. type: "Program",
  9884. body: [
  9885. {
  9886. type: "ExpressionStatement",
  9887. expression: {
  9888. type: "UpdateExpression",
  9889. operator: "++",
  9890. prefix: false,
  9891. argument: {
  9892. type: "Identifier",
  9893. name: "eval",
  9894. loc: {
  9895. start: {
  9896. line: 1,
  9897. column: 0
  9898. },
  9899. end: {
  9900. line: 1,
  9901. column: 4
  9902. }
  9903. }
  9904. },
  9905. loc: {
  9906. start: {
  9907. line: 1,
  9908. column: 0
  9909. },
  9910. end: {
  9911. line: 1,
  9912. column: 6
  9913. }
  9914. }
  9915. },
  9916. loc: {
  9917. start: {
  9918. line: 1,
  9919. column: 0
  9920. },
  9921. end: {
  9922. line: 1,
  9923. column: 6
  9924. }
  9925. }
  9926. }
  9927. ],
  9928. loc: {
  9929. start: {
  9930. line: 1,
  9931. column: 0
  9932. },
  9933. end: {
  9934. line: 1,
  9935. column: 6
  9936. }
  9937. }
  9938. });
  9939. test("eval--", {
  9940. type: "Program",
  9941. body: [
  9942. {
  9943. type: "ExpressionStatement",
  9944. expression: {
  9945. type: "UpdateExpression",
  9946. operator: "--",
  9947. prefix: false,
  9948. argument: {
  9949. type: "Identifier",
  9950. name: "eval",
  9951. loc: {
  9952. start: {
  9953. line: 1,
  9954. column: 0
  9955. },
  9956. end: {
  9957. line: 1,
  9958. column: 4
  9959. }
  9960. }
  9961. },
  9962. loc: {
  9963. start: {
  9964. line: 1,
  9965. column: 0
  9966. },
  9967. end: {
  9968. line: 1,
  9969. column: 6
  9970. }
  9971. }
  9972. },
  9973. loc: {
  9974. start: {
  9975. line: 1,
  9976. column: 0
  9977. },
  9978. end: {
  9979. line: 1,
  9980. column: 6
  9981. }
  9982. }
  9983. }
  9984. ],
  9985. loc: {
  9986. start: {
  9987. line: 1,
  9988. column: 0
  9989. },
  9990. end: {
  9991. line: 1,
  9992. column: 6
  9993. }
  9994. }
  9995. });
  9996. test("arguments++", {
  9997. type: "Program",
  9998. body: [
  9999. {
  10000. type: "ExpressionStatement",
  10001. expression: {
  10002. type: "UpdateExpression",
  10003. operator: "++",
  10004. prefix: false,
  10005. argument: {
  10006. type: "Identifier",
  10007. name: "arguments",
  10008. loc: {
  10009. start: {
  10010. line: 1,
  10011. column: 0
  10012. },
  10013. end: {
  10014. line: 1,
  10015. column: 9
  10016. }
  10017. }
  10018. },
  10019. loc: {
  10020. start: {
  10021. line: 1,
  10022. column: 0
  10023. },
  10024. end: {
  10025. line: 1,
  10026. column: 11
  10027. }
  10028. }
  10029. },
  10030. loc: {
  10031. start: {
  10032. line: 1,
  10033. column: 0
  10034. },
  10035. end: {
  10036. line: 1,
  10037. column: 11
  10038. }
  10039. }
  10040. }
  10041. ],
  10042. loc: {
  10043. start: {
  10044. line: 1,
  10045. column: 0
  10046. },
  10047. end: {
  10048. line: 1,
  10049. column: 11
  10050. }
  10051. }
  10052. });
  10053. test("arguments--", {
  10054. type: "Program",
  10055. body: [
  10056. {
  10057. type: "ExpressionStatement",
  10058. expression: {
  10059. type: "UpdateExpression",
  10060. operator: "--",
  10061. prefix: false,
  10062. argument: {
  10063. type: "Identifier",
  10064. name: "arguments",
  10065. loc: {
  10066. start: {
  10067. line: 1,
  10068. column: 0
  10069. },
  10070. end: {
  10071. line: 1,
  10072. column: 9
  10073. }
  10074. }
  10075. },
  10076. loc: {
  10077. start: {
  10078. line: 1,
  10079. column: 0
  10080. },
  10081. end: {
  10082. line: 1,
  10083. column: 11
  10084. }
  10085. }
  10086. },
  10087. loc: {
  10088. start: {
  10089. line: 1,
  10090. column: 0
  10091. },
  10092. end: {
  10093. line: 1,
  10094. column: 11
  10095. }
  10096. }
  10097. }
  10098. ],
  10099. loc: {
  10100. start: {
  10101. line: 1,
  10102. column: 0
  10103. },
  10104. end: {
  10105. line: 1,
  10106. column: 11
  10107. }
  10108. }
  10109. });
  10110. test("++x", {
  10111. type: "Program",
  10112. body: [
  10113. {
  10114. type: "ExpressionStatement",
  10115. expression: {
  10116. type: "UpdateExpression",
  10117. operator: "++",
  10118. prefix: true,
  10119. argument: {
  10120. type: "Identifier",
  10121. name: "x",
  10122. loc: {
  10123. start: {
  10124. line: 1,
  10125. column: 2
  10126. },
  10127. end: {
  10128. line: 1,
  10129. column: 3
  10130. }
  10131. }
  10132. },
  10133. loc: {
  10134. start: {
  10135. line: 1,
  10136. column: 0
  10137. },
  10138. end: {
  10139. line: 1,
  10140. column: 3
  10141. }
  10142. }
  10143. },
  10144. loc: {
  10145. start: {
  10146. line: 1,
  10147. column: 0
  10148. },
  10149. end: {
  10150. line: 1,
  10151. column: 3
  10152. }
  10153. }
  10154. }
  10155. ],
  10156. loc: {
  10157. start: {
  10158. line: 1,
  10159. column: 0
  10160. },
  10161. end: {
  10162. line: 1,
  10163. column: 3
  10164. }
  10165. }
  10166. });
  10167. test("--x", {
  10168. type: "Program",
  10169. body: [
  10170. {
  10171. type: "ExpressionStatement",
  10172. expression: {
  10173. type: "UpdateExpression",
  10174. operator: "--",
  10175. prefix: true,
  10176. argument: {
  10177. type: "Identifier",
  10178. name: "x",
  10179. loc: {
  10180. start: {
  10181. line: 1,
  10182. column: 2
  10183. },
  10184. end: {
  10185. line: 1,
  10186. column: 3
  10187. }
  10188. }
  10189. },
  10190. loc: {
  10191. start: {
  10192. line: 1,
  10193. column: 0
  10194. },
  10195. end: {
  10196. line: 1,
  10197. column: 3
  10198. }
  10199. }
  10200. },
  10201. loc: {
  10202. start: {
  10203. line: 1,
  10204. column: 0
  10205. },
  10206. end: {
  10207. line: 1,
  10208. column: 3
  10209. }
  10210. }
  10211. }
  10212. ],
  10213. loc: {
  10214. start: {
  10215. line: 1,
  10216. column: 0
  10217. },
  10218. end: {
  10219. line: 1,
  10220. column: 3
  10221. }
  10222. }
  10223. });
  10224. test("++eval", {
  10225. type: "Program",
  10226. body: [
  10227. {
  10228. type: "ExpressionStatement",
  10229. expression: {
  10230. type: "UpdateExpression",
  10231. operator: "++",
  10232. prefix: true,
  10233. argument: {
  10234. type: "Identifier",
  10235. name: "eval",
  10236. loc: {
  10237. start: {
  10238. line: 1,
  10239. column: 2
  10240. },
  10241. end: {
  10242. line: 1,
  10243. column: 6
  10244. }
  10245. }
  10246. },
  10247. loc: {
  10248. start: {
  10249. line: 1,
  10250. column: 0
  10251. },
  10252. end: {
  10253. line: 1,
  10254. column: 6
  10255. }
  10256. }
  10257. },
  10258. loc: {
  10259. start: {
  10260. line: 1,
  10261. column: 0
  10262. },
  10263. end: {
  10264. line: 1,
  10265. column: 6
  10266. }
  10267. }
  10268. }
  10269. ],
  10270. loc: {
  10271. start: {
  10272. line: 1,
  10273. column: 0
  10274. },
  10275. end: {
  10276. line: 1,
  10277. column: 6
  10278. }
  10279. }
  10280. });
  10281. test("--eval", {
  10282. type: "Program",
  10283. body: [
  10284. {
  10285. type: "ExpressionStatement",
  10286. expression: {
  10287. type: "UpdateExpression",
  10288. operator: "--",
  10289. prefix: true,
  10290. argument: {
  10291. type: "Identifier",
  10292. name: "eval",
  10293. loc: {
  10294. start: {
  10295. line: 1,
  10296. column: 2
  10297. },
  10298. end: {
  10299. line: 1,
  10300. column: 6
  10301. }
  10302. }
  10303. },
  10304. loc: {
  10305. start: {
  10306. line: 1,
  10307. column: 0
  10308. },
  10309. end: {
  10310. line: 1,
  10311. column: 6
  10312. }
  10313. }
  10314. },
  10315. loc: {
  10316. start: {
  10317. line: 1,
  10318. column: 0
  10319. },
  10320. end: {
  10321. line: 1,
  10322. column: 6
  10323. }
  10324. }
  10325. }
  10326. ],
  10327. loc: {
  10328. start: {
  10329. line: 1,
  10330. column: 0
  10331. },
  10332. end: {
  10333. line: 1,
  10334. column: 6
  10335. }
  10336. }
  10337. });
  10338. test("++arguments", {
  10339. type: "Program",
  10340. body: [
  10341. {
  10342. type: "ExpressionStatement",
  10343. expression: {
  10344. type: "UpdateExpression",
  10345. operator: "++",
  10346. prefix: true,
  10347. argument: {
  10348. type: "Identifier",
  10349. name: "arguments",
  10350. loc: {
  10351. start: {
  10352. line: 1,
  10353. column: 2
  10354. },
  10355. end: {
  10356. line: 1,
  10357. column: 11
  10358. }
  10359. }
  10360. },
  10361. loc: {
  10362. start: {
  10363. line: 1,
  10364. column: 0
  10365. },
  10366. end: {
  10367. line: 1,
  10368. column: 11
  10369. }
  10370. }
  10371. },
  10372. loc: {
  10373. start: {
  10374. line: 1,
  10375. column: 0
  10376. },
  10377. end: {
  10378. line: 1,
  10379. column: 11
  10380. }
  10381. }
  10382. }
  10383. ],
  10384. loc: {
  10385. start: {
  10386. line: 1,
  10387. column: 0
  10388. },
  10389. end: {
  10390. line: 1,
  10391. column: 11
  10392. }
  10393. }
  10394. });
  10395. test("--arguments", {
  10396. type: "Program",
  10397. body: [
  10398. {
  10399. type: "ExpressionStatement",
  10400. expression: {
  10401. type: "UpdateExpression",
  10402. operator: "--",
  10403. prefix: true,
  10404. argument: {
  10405. type: "Identifier",
  10406. name: "arguments",
  10407. loc: {
  10408. start: {
  10409. line: 1,
  10410. column: 2
  10411. },
  10412. end: {
  10413. line: 1,
  10414. column: 11
  10415. }
  10416. }
  10417. },
  10418. loc: {
  10419. start: {
  10420. line: 1,
  10421. column: 0
  10422. },
  10423. end: {
  10424. line: 1,
  10425. column: 11
  10426. }
  10427. }
  10428. },
  10429. loc: {
  10430. start: {
  10431. line: 1,
  10432. column: 0
  10433. },
  10434. end: {
  10435. line: 1,
  10436. column: 11
  10437. }
  10438. }
  10439. }
  10440. ],
  10441. loc: {
  10442. start: {
  10443. line: 1,
  10444. column: 0
  10445. },
  10446. end: {
  10447. line: 1,
  10448. column: 11
  10449. }
  10450. }
  10451. });
  10452. test("+x", {
  10453. type: "Program",
  10454. body: [
  10455. {
  10456. type: "ExpressionStatement",
  10457. expression: {
  10458. type: "UnaryExpression",
  10459. operator: "+",
  10460. prefix: true,
  10461. argument: {
  10462. type: "Identifier",
  10463. name: "x",
  10464. loc: {
  10465. start: {
  10466. line: 1,
  10467. column: 1
  10468. },
  10469. end: {
  10470. line: 1,
  10471. column: 2
  10472. }
  10473. }
  10474. },
  10475. loc: {
  10476. start: {
  10477. line: 1,
  10478. column: 0
  10479. },
  10480. end: {
  10481. line: 1,
  10482. column: 2
  10483. }
  10484. }
  10485. },
  10486. loc: {
  10487. start: {
  10488. line: 1,
  10489. column: 0
  10490. },
  10491. end: {
  10492. line: 1,
  10493. column: 2
  10494. }
  10495. }
  10496. }
  10497. ],
  10498. loc: {
  10499. start: {
  10500. line: 1,
  10501. column: 0
  10502. },
  10503. end: {
  10504. line: 1,
  10505. column: 2
  10506. }
  10507. }
  10508. });
  10509. test("-x", {
  10510. type: "Program",
  10511. body: [
  10512. {
  10513. type: "ExpressionStatement",
  10514. expression: {
  10515. type: "UnaryExpression",
  10516. operator: "-",
  10517. prefix: true,
  10518. argument: {
  10519. type: "Identifier",
  10520. name: "x",
  10521. loc: {
  10522. start: {
  10523. line: 1,
  10524. column: 1
  10525. },
  10526. end: {
  10527. line: 1,
  10528. column: 2
  10529. }
  10530. }
  10531. },
  10532. loc: {
  10533. start: {
  10534. line: 1,
  10535. column: 0
  10536. },
  10537. end: {
  10538. line: 1,
  10539. column: 2
  10540. }
  10541. }
  10542. },
  10543. loc: {
  10544. start: {
  10545. line: 1,
  10546. column: 0
  10547. },
  10548. end: {
  10549. line: 1,
  10550. column: 2
  10551. }
  10552. }
  10553. }
  10554. ],
  10555. loc: {
  10556. start: {
  10557. line: 1,
  10558. column: 0
  10559. },
  10560. end: {
  10561. line: 1,
  10562. column: 2
  10563. }
  10564. }
  10565. });
  10566. test("~x", {
  10567. type: "Program",
  10568. body: [
  10569. {
  10570. type: "ExpressionStatement",
  10571. expression: {
  10572. type: "UnaryExpression",
  10573. operator: "~",
  10574. prefix: true,
  10575. argument: {
  10576. type: "Identifier",
  10577. name: "x",
  10578. loc: {
  10579. start: {
  10580. line: 1,
  10581. column: 1
  10582. },
  10583. end: {
  10584. line: 1,
  10585. column: 2
  10586. }
  10587. }
  10588. },
  10589. loc: {
  10590. start: {
  10591. line: 1,
  10592. column: 0
  10593. },
  10594. end: {
  10595. line: 1,
  10596. column: 2
  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. loc: {
  10613. start: {
  10614. line: 1,
  10615. column: 0
  10616. },
  10617. end: {
  10618. line: 1,
  10619. column: 2
  10620. }
  10621. }
  10622. });
  10623. test("!x", {
  10624. type: "Program",
  10625. body: [
  10626. {
  10627. type: "ExpressionStatement",
  10628. expression: {
  10629. type: "UnaryExpression",
  10630. operator: "!",
  10631. prefix: true,
  10632. argument: {
  10633. type: "Identifier",
  10634. name: "x",
  10635. loc: {
  10636. start: {
  10637. line: 1,
  10638. column: 1
  10639. },
  10640. end: {
  10641. line: 1,
  10642. column: 2
  10643. }
  10644. }
  10645. },
  10646. loc: {
  10647. start: {
  10648. line: 1,
  10649. column: 0
  10650. },
  10651. end: {
  10652. line: 1,
  10653. column: 2
  10654. }
  10655. }
  10656. },
  10657. loc: {
  10658. start: {
  10659. line: 1,
  10660. column: 0
  10661. },
  10662. end: {
  10663. line: 1,
  10664. column: 2
  10665. }
  10666. }
  10667. }
  10668. ],
  10669. loc: {
  10670. start: {
  10671. line: 1,
  10672. column: 0
  10673. },
  10674. end: {
  10675. line: 1,
  10676. column: 2
  10677. }
  10678. }
  10679. });
  10680. test("void x", {
  10681. type: "Program",
  10682. body: [
  10683. {
  10684. type: "ExpressionStatement",
  10685. expression: {
  10686. type: "UnaryExpression",
  10687. operator: "void",
  10688. prefix: true,
  10689. argument: {
  10690. type: "Identifier",
  10691. name: "x",
  10692. loc: {
  10693. start: {
  10694. line: 1,
  10695. column: 5
  10696. },
  10697. end: {
  10698. line: 1,
  10699. column: 6
  10700. }
  10701. }
  10702. },
  10703. loc: {
  10704. start: {
  10705. line: 1,
  10706. column: 0
  10707. },
  10708. end: {
  10709. line: 1,
  10710. column: 6
  10711. }
  10712. }
  10713. },
  10714. loc: {
  10715. start: {
  10716. line: 1,
  10717. column: 0
  10718. },
  10719. end: {
  10720. line: 1,
  10721. column: 6
  10722. }
  10723. }
  10724. }
  10725. ],
  10726. loc: {
  10727. start: {
  10728. line: 1,
  10729. column: 0
  10730. },
  10731. end: {
  10732. line: 1,
  10733. column: 6
  10734. }
  10735. }
  10736. });
  10737. test("delete x", {
  10738. type: "Program",
  10739. body: [
  10740. {
  10741. type: "ExpressionStatement",
  10742. expression: {
  10743. type: "UnaryExpression",
  10744. operator: "delete",
  10745. prefix: true,
  10746. argument: {
  10747. type: "Identifier",
  10748. name: "x",
  10749. loc: {
  10750. start: {
  10751. line: 1,
  10752. column: 7
  10753. },
  10754. end: {
  10755. line: 1,
  10756. column: 8
  10757. }
  10758. }
  10759. },
  10760. loc: {
  10761. start: {
  10762. line: 1,
  10763. column: 0
  10764. },
  10765. end: {
  10766. line: 1,
  10767. column: 8
  10768. }
  10769. }
  10770. },
  10771. loc: {
  10772. start: {
  10773. line: 1,
  10774. column: 0
  10775. },
  10776. end: {
  10777. line: 1,
  10778. column: 8
  10779. }
  10780. }
  10781. }
  10782. ],
  10783. loc: {
  10784. start: {
  10785. line: 1,
  10786. column: 0
  10787. },
  10788. end: {
  10789. line: 1,
  10790. column: 8
  10791. }
  10792. }
  10793. });
  10794. test("typeof x", {
  10795. type: "Program",
  10796. body: [
  10797. {
  10798. type: "ExpressionStatement",
  10799. expression: {
  10800. type: "UnaryExpression",
  10801. operator: "typeof",
  10802. prefix: true,
  10803. argument: {
  10804. type: "Identifier",
  10805. name: "x",
  10806. loc: {
  10807. start: {
  10808. line: 1,
  10809. column: 7
  10810. },
  10811. end: {
  10812. line: 1,
  10813. column: 8
  10814. }
  10815. }
  10816. },
  10817. loc: {
  10818. start: {
  10819. line: 1,
  10820. column: 0
  10821. },
  10822. end: {
  10823. line: 1,
  10824. column: 8
  10825. }
  10826. }
  10827. },
  10828. loc: {
  10829. start: {
  10830. line: 1,
  10831. column: 0
  10832. },
  10833. end: {
  10834. line: 1,
  10835. column: 8
  10836. }
  10837. }
  10838. }
  10839. ],
  10840. loc: {
  10841. start: {
  10842. line: 1,
  10843. column: 0
  10844. },
  10845. end: {
  10846. line: 1,
  10847. column: 8
  10848. }
  10849. }
  10850. });
  10851. test("x * y", {
  10852. type: "Program",
  10853. body: [
  10854. {
  10855. type: "ExpressionStatement",
  10856. expression: {
  10857. type: "BinaryExpression",
  10858. left: {
  10859. type: "Identifier",
  10860. name: "x",
  10861. loc: {
  10862. start: {
  10863. line: 1,
  10864. column: 0
  10865. },
  10866. end: {
  10867. line: 1,
  10868. column: 1
  10869. }
  10870. }
  10871. },
  10872. operator: "*",
  10873. right: {
  10874. type: "Identifier",
  10875. name: "y",
  10876. loc: {
  10877. start: {
  10878. line: 1,
  10879. column: 4
  10880. },
  10881. end: {
  10882. line: 1,
  10883. column: 5
  10884. }
  10885. }
  10886. },
  10887. loc: {
  10888. start: {
  10889. line: 1,
  10890. column: 0
  10891. },
  10892. end: {
  10893. line: 1,
  10894. column: 5
  10895. }
  10896. }
  10897. },
  10898. loc: {
  10899. start: {
  10900. line: 1,
  10901. column: 0
  10902. },
  10903. end: {
  10904. line: 1,
  10905. column: 5
  10906. }
  10907. }
  10908. }
  10909. ],
  10910. loc: {
  10911. start: {
  10912. line: 1,
  10913. column: 0
  10914. },
  10915. end: {
  10916. line: 1,
  10917. column: 5
  10918. }
  10919. }
  10920. });
  10921. test("x / y", {
  10922. type: "Program",
  10923. body: [
  10924. {
  10925. type: "ExpressionStatement",
  10926. expression: {
  10927. type: "BinaryExpression",
  10928. left: {
  10929. type: "Identifier",
  10930. name: "x",
  10931. loc: {
  10932. start: {
  10933. line: 1,
  10934. column: 0
  10935. },
  10936. end: {
  10937. line: 1,
  10938. column: 1
  10939. }
  10940. }
  10941. },
  10942. operator: "/",
  10943. right: {
  10944. type: "Identifier",
  10945. name: "y",
  10946. loc: {
  10947. start: {
  10948. line: 1,
  10949. column: 4
  10950. },
  10951. end: {
  10952. line: 1,
  10953. column: 5
  10954. }
  10955. }
  10956. },
  10957. loc: {
  10958. start: {
  10959. line: 1,
  10960. column: 0
  10961. },
  10962. end: {
  10963. line: 1,
  10964. column: 5
  10965. }
  10966. }
  10967. },
  10968. loc: {
  10969. start: {
  10970. line: 1,
  10971. column: 0
  10972. },
  10973. end: {
  10974. line: 1,
  10975. column: 5
  10976. }
  10977. }
  10978. }
  10979. ],
  10980. loc: {
  10981. start: {
  10982. line: 1,
  10983. column: 0
  10984. },
  10985. end: {
  10986. line: 1,
  10987. column: 5
  10988. }
  10989. }
  10990. });
  10991. test("x % y", {
  10992. type: "Program",
  10993. body: [
  10994. {
  10995. type: "ExpressionStatement",
  10996. expression: {
  10997. type: "BinaryExpression",
  10998. left: {
  10999. type: "Identifier",
  11000. name: "x",
  11001. loc: {
  11002. start: {
  11003. line: 1,
  11004. column: 0
  11005. },
  11006. end: {
  11007. line: 1,
  11008. column: 1
  11009. }
  11010. }
  11011. },
  11012. operator: "%",
  11013. right: {
  11014. type: "Identifier",
  11015. name: "y",
  11016. loc: {
  11017. start: {
  11018. line: 1,
  11019. column: 4
  11020. },
  11021. end: {
  11022. line: 1,
  11023. column: 5
  11024. }
  11025. }
  11026. },
  11027. loc: {
  11028. start: {
  11029. line: 1,
  11030. column: 0
  11031. },
  11032. end: {
  11033. line: 1,
  11034. column: 5
  11035. }
  11036. }
  11037. },
  11038. loc: {
  11039. start: {
  11040. line: 1,
  11041. column: 0
  11042. },
  11043. end: {
  11044. line: 1,
  11045. column: 5
  11046. }
  11047. }
  11048. }
  11049. ],
  11050. loc: {
  11051. start: {
  11052. line: 1,
  11053. column: 0
  11054. },
  11055. end: {
  11056. line: 1,
  11057. column: 5
  11058. }
  11059. }
  11060. });
  11061. test("x + y", {
  11062. type: "Program",
  11063. body: [
  11064. {
  11065. type: "ExpressionStatement",
  11066. expression: {
  11067. type: "BinaryExpression",
  11068. left: {
  11069. type: "Identifier",
  11070. name: "x",
  11071. loc: {
  11072. start: {
  11073. line: 1,
  11074. column: 0
  11075. },
  11076. end: {
  11077. line: 1,
  11078. column: 1
  11079. }
  11080. }
  11081. },
  11082. operator: "+",
  11083. right: {
  11084. type: "Identifier",
  11085. name: "y",
  11086. loc: {
  11087. start: {
  11088. line: 1,
  11089. column: 4
  11090. },
  11091. end: {
  11092. line: 1,
  11093. column: 5
  11094. }
  11095. }
  11096. },
  11097. loc: {
  11098. start: {
  11099. line: 1,
  11100. column: 0
  11101. },
  11102. end: {
  11103. line: 1,
  11104. column: 5
  11105. }
  11106. }
  11107. },
  11108. loc: {
  11109. start: {
  11110. line: 1,
  11111. column: 0
  11112. },
  11113. end: {
  11114. line: 1,
  11115. column: 5
  11116. }
  11117. }
  11118. }
  11119. ],
  11120. loc: {
  11121. start: {
  11122. line: 1,
  11123. column: 0
  11124. },
  11125. end: {
  11126. line: 1,
  11127. column: 5
  11128. }
  11129. }
  11130. });
  11131. test("x - y", {
  11132. type: "Program",
  11133. body: [
  11134. {
  11135. type: "ExpressionStatement",
  11136. expression: {
  11137. type: "BinaryExpression",
  11138. left: {
  11139. type: "Identifier",
  11140. name: "x",
  11141. loc: {
  11142. start: {
  11143. line: 1,
  11144. column: 0
  11145. },
  11146. end: {
  11147. line: 1,
  11148. column: 1
  11149. }
  11150. }
  11151. },
  11152. operator: "-",
  11153. right: {
  11154. type: "Identifier",
  11155. name: "y",
  11156. loc: {
  11157. start: {
  11158. line: 1,
  11159. column: 4
  11160. },
  11161. end: {
  11162. line: 1,
  11163. column: 5
  11164. }
  11165. }
  11166. },
  11167. loc: {
  11168. start: {
  11169. line: 1,
  11170. column: 0
  11171. },
  11172. end: {
  11173. line: 1,
  11174. column: 5
  11175. }
  11176. }
  11177. },
  11178. loc: {
  11179. start: {
  11180. line: 1,
  11181. column: 0
  11182. },
  11183. end: {
  11184. line: 1,
  11185. column: 5
  11186. }
  11187. }
  11188. }
  11189. ],
  11190. loc: {
  11191. start: {
  11192. line: 1,
  11193. column: 0
  11194. },
  11195. end: {
  11196. line: 1,
  11197. column: 5
  11198. }
  11199. }
  11200. });
  11201. test("x << y", {
  11202. type: "Program",
  11203. body: [
  11204. {
  11205. type: "ExpressionStatement",
  11206. expression: {
  11207. type: "BinaryExpression",
  11208. left: {
  11209. type: "Identifier",
  11210. name: "x",
  11211. loc: {
  11212. start: {
  11213. line: 1,
  11214. column: 0
  11215. },
  11216. end: {
  11217. line: 1,
  11218. column: 1
  11219. }
  11220. }
  11221. },
  11222. operator: "<<",
  11223. right: {
  11224. type: "Identifier",
  11225. name: "y",
  11226. loc: {
  11227. start: {
  11228. line: 1,
  11229. column: 5
  11230. },
  11231. end: {
  11232. line: 1,
  11233. column: 6
  11234. }
  11235. }
  11236. },
  11237. loc: {
  11238. start: {
  11239. line: 1,
  11240. column: 0
  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. ],
  11260. loc: {
  11261. start: {
  11262. line: 1,
  11263. column: 0
  11264. },
  11265. end: {
  11266. line: 1,
  11267. column: 6
  11268. }
  11269. }
  11270. });
  11271. test("x >> y", {
  11272. type: "Program",
  11273. body: [
  11274. {
  11275. type: "ExpressionStatement",
  11276. expression: {
  11277. type: "BinaryExpression",
  11278. left: {
  11279. type: "Identifier",
  11280. name: "x",
  11281. loc: {
  11282. start: {
  11283. line: 1,
  11284. column: 0
  11285. },
  11286. end: {
  11287. line: 1,
  11288. column: 1
  11289. }
  11290. }
  11291. },
  11292. operator: ">>",
  11293. right: {
  11294. type: "Identifier",
  11295. name: "y",
  11296. loc: {
  11297. start: {
  11298. line: 1,
  11299. column: 5
  11300. },
  11301. end: {
  11302. line: 1,
  11303. column: 6
  11304. }
  11305. }
  11306. },
  11307. loc: {
  11308. start: {
  11309. line: 1,
  11310. column: 0
  11311. },
  11312. end: {
  11313. line: 1,
  11314. column: 6
  11315. }
  11316. }
  11317. },
  11318. loc: {
  11319. start: {
  11320. line: 1,
  11321. column: 0
  11322. },
  11323. end: {
  11324. line: 1,
  11325. column: 6
  11326. }
  11327. }
  11328. }
  11329. ],
  11330. loc: {
  11331. start: {
  11332. line: 1,
  11333. column: 0
  11334. },
  11335. end: {
  11336. line: 1,
  11337. column: 6
  11338. }
  11339. }
  11340. });
  11341. test("x >>> y", {
  11342. type: "Program",
  11343. body: [
  11344. {
  11345. type: "ExpressionStatement",
  11346. expression: {
  11347. type: "BinaryExpression",
  11348. left: {
  11349. type: "Identifier",
  11350. name: "x",
  11351. loc: {
  11352. start: {
  11353. line: 1,
  11354. column: 0
  11355. },
  11356. end: {
  11357. line: 1,
  11358. column: 1
  11359. }
  11360. }
  11361. },
  11362. operator: ">>>",
  11363. right: {
  11364. type: "Identifier",
  11365. name: "y",
  11366. loc: {
  11367. start: {
  11368. line: 1,
  11369. column: 6
  11370. },
  11371. end: {
  11372. line: 1,
  11373. column: 7
  11374. }
  11375. }
  11376. },
  11377. loc: {
  11378. start: {
  11379. line: 1,
  11380. column: 0
  11381. },
  11382. end: {
  11383. line: 1,
  11384. column: 7
  11385. }
  11386. }
  11387. },
  11388. loc: {
  11389. start: {
  11390. line: 1,
  11391. column: 0
  11392. },
  11393. end: {
  11394. line: 1,
  11395. column: 7
  11396. }
  11397. }
  11398. }
  11399. ],
  11400. loc: {
  11401. start: {
  11402. line: 1,
  11403. column: 0
  11404. },
  11405. end: {
  11406. line: 1,
  11407. column: 7
  11408. }
  11409. }
  11410. });
  11411. test("x < y", {
  11412. type: "Program",
  11413. body: [
  11414. {
  11415. type: "ExpressionStatement",
  11416. expression: {
  11417. type: "BinaryExpression",
  11418. left: {
  11419. type: "Identifier",
  11420. name: "x",
  11421. loc: {
  11422. start: {
  11423. line: 1,
  11424. column: 0
  11425. },
  11426. end: {
  11427. line: 1,
  11428. column: 1
  11429. }
  11430. }
  11431. },
  11432. operator: "<",
  11433. right: {
  11434. type: "Identifier",
  11435. name: "y",
  11436. loc: {
  11437. start: {
  11438. line: 1,
  11439. column: 4
  11440. },
  11441. end: {
  11442. line: 1,
  11443. column: 5
  11444. }
  11445. }
  11446. },
  11447. loc: {
  11448. start: {
  11449. line: 1,
  11450. column: 0
  11451. },
  11452. end: {
  11453. line: 1,
  11454. column: 5
  11455. }
  11456. }
  11457. },
  11458. loc: {
  11459. start: {
  11460. line: 1,
  11461. column: 0
  11462. },
  11463. end: {
  11464. line: 1,
  11465. column: 5
  11466. }
  11467. }
  11468. }
  11469. ],
  11470. loc: {
  11471. start: {
  11472. line: 1,
  11473. column: 0
  11474. },
  11475. end: {
  11476. line: 1,
  11477. column: 5
  11478. }
  11479. }
  11480. });
  11481. test("x > y", {
  11482. type: "Program",
  11483. body: [
  11484. {
  11485. type: "ExpressionStatement",
  11486. expression: {
  11487. type: "BinaryExpression",
  11488. left: {
  11489. type: "Identifier",
  11490. name: "x",
  11491. loc: {
  11492. start: {
  11493. line: 1,
  11494. column: 0
  11495. },
  11496. end: {
  11497. line: 1,
  11498. column: 1
  11499. }
  11500. }
  11501. },
  11502. operator: ">",
  11503. right: {
  11504. type: "Identifier",
  11505. name: "y",
  11506. loc: {
  11507. start: {
  11508. line: 1,
  11509. column: 4
  11510. },
  11511. end: {
  11512. line: 1,
  11513. column: 5
  11514. }
  11515. }
  11516. },
  11517. loc: {
  11518. start: {
  11519. line: 1,
  11520. column: 0
  11521. },
  11522. end: {
  11523. line: 1,
  11524. column: 5
  11525. }
  11526. }
  11527. },
  11528. loc: {
  11529. start: {
  11530. line: 1,
  11531. column: 0
  11532. },
  11533. end: {
  11534. line: 1,
  11535. column: 5
  11536. }
  11537. }
  11538. }
  11539. ],
  11540. loc: {
  11541. start: {
  11542. line: 1,
  11543. column: 0
  11544. },
  11545. end: {
  11546. line: 1,
  11547. column: 5
  11548. }
  11549. }
  11550. });
  11551. test("x <= y", {
  11552. type: "Program",
  11553. body: [
  11554. {
  11555. type: "ExpressionStatement",
  11556. expression: {
  11557. type: "BinaryExpression",
  11558. left: {
  11559. type: "Identifier",
  11560. name: "x",
  11561. loc: {
  11562. start: {
  11563. line: 1,
  11564. column: 0
  11565. },
  11566. end: {
  11567. line: 1,
  11568. column: 1
  11569. }
  11570. }
  11571. },
  11572. operator: "<=",
  11573. right: {
  11574. type: "Identifier",
  11575. name: "y",
  11576. loc: {
  11577. start: {
  11578. line: 1,
  11579. column: 5
  11580. },
  11581. end: {
  11582. line: 1,
  11583. column: 6
  11584. }
  11585. }
  11586. },
  11587. loc: {
  11588. start: {
  11589. line: 1,
  11590. column: 0
  11591. },
  11592. end: {
  11593. line: 1,
  11594. column: 6
  11595. }
  11596. }
  11597. },
  11598. loc: {
  11599. start: {
  11600. line: 1,
  11601. column: 0
  11602. },
  11603. end: {
  11604. line: 1,
  11605. column: 6
  11606. }
  11607. }
  11608. }
  11609. ],
  11610. loc: {
  11611. start: {
  11612. line: 1,
  11613. column: 0
  11614. },
  11615. end: {
  11616. line: 1,
  11617. column: 6
  11618. }
  11619. }
  11620. });
  11621. test("x >= y", {
  11622. type: "Program",
  11623. body: [
  11624. {
  11625. type: "ExpressionStatement",
  11626. expression: {
  11627. type: "BinaryExpression",
  11628. left: {
  11629. type: "Identifier",
  11630. name: "x",
  11631. loc: {
  11632. start: {
  11633. line: 1,
  11634. column: 0
  11635. },
  11636. end: {
  11637. line: 1,
  11638. column: 1
  11639. }
  11640. }
  11641. },
  11642. operator: ">=",
  11643. right: {
  11644. type: "Identifier",
  11645. name: "y",
  11646. loc: {
  11647. start: {
  11648. line: 1,
  11649. column: 5
  11650. },
  11651. end: {
  11652. line: 1,
  11653. column: 6
  11654. }
  11655. }
  11656. },
  11657. loc: {
  11658. start: {
  11659. line: 1,
  11660. column: 0
  11661. },
  11662. end: {
  11663. line: 1,
  11664. column: 6
  11665. }
  11666. }
  11667. },
  11668. loc: {
  11669. start: {
  11670. line: 1,
  11671. column: 0
  11672. },
  11673. end: {
  11674. line: 1,
  11675. column: 6
  11676. }
  11677. }
  11678. }
  11679. ],
  11680. loc: {
  11681. start: {
  11682. line: 1,
  11683. column: 0
  11684. },
  11685. end: {
  11686. line: 1,
  11687. column: 6
  11688. }
  11689. }
  11690. });
  11691. test("x in y", {
  11692. type: "Program",
  11693. body: [
  11694. {
  11695. type: "ExpressionStatement",
  11696. expression: {
  11697. type: "BinaryExpression",
  11698. left: {
  11699. type: "Identifier",
  11700. name: "x",
  11701. loc: {
  11702. start: {
  11703. line: 1,
  11704. column: 0
  11705. },
  11706. end: {
  11707. line: 1,
  11708. column: 1
  11709. }
  11710. }
  11711. },
  11712. operator: "in",
  11713. right: {
  11714. type: "Identifier",
  11715. name: "y",
  11716. loc: {
  11717. start: {
  11718. line: 1,
  11719. column: 5
  11720. },
  11721. end: {
  11722. line: 1,
  11723. column: 6
  11724. }
  11725. }
  11726. },
  11727. loc: {
  11728. start: {
  11729. line: 1,
  11730. column: 0
  11731. },
  11732. end: {
  11733. line: 1,
  11734. column: 6
  11735. }
  11736. }
  11737. },
  11738. loc: {
  11739. start: {
  11740. line: 1,
  11741. column: 0
  11742. },
  11743. end: {
  11744. line: 1,
  11745. column: 6
  11746. }
  11747. }
  11748. }
  11749. ],
  11750. loc: {
  11751. start: {
  11752. line: 1,
  11753. column: 0
  11754. },
  11755. end: {
  11756. line: 1,
  11757. column: 6
  11758. }
  11759. }
  11760. });
  11761. test("x instanceof y", {
  11762. type: "Program",
  11763. body: [
  11764. {
  11765. type: "ExpressionStatement",
  11766. expression: {
  11767. type: "BinaryExpression",
  11768. left: {
  11769. type: "Identifier",
  11770. name: "x",
  11771. loc: {
  11772. start: {
  11773. line: 1,
  11774. column: 0
  11775. },
  11776. end: {
  11777. line: 1,
  11778. column: 1
  11779. }
  11780. }
  11781. },
  11782. operator: "instanceof",
  11783. right: {
  11784. type: "Identifier",
  11785. name: "y",
  11786. loc: {
  11787. start: {
  11788. line: 1,
  11789. column: 13
  11790. },
  11791. end: {
  11792. line: 1,
  11793. column: 14
  11794. }
  11795. }
  11796. },
  11797. loc: {
  11798. start: {
  11799. line: 1,
  11800. column: 0
  11801. },
  11802. end: {
  11803. line: 1,
  11804. column: 14
  11805. }
  11806. }
  11807. },
  11808. loc: {
  11809. start: {
  11810. line: 1,
  11811. column: 0
  11812. },
  11813. end: {
  11814. line: 1,
  11815. column: 14
  11816. }
  11817. }
  11818. }
  11819. ],
  11820. loc: {
  11821. start: {
  11822. line: 1,
  11823. column: 0
  11824. },
  11825. end: {
  11826. line: 1,
  11827. column: 14
  11828. }
  11829. }
  11830. });
  11831. test("x < y < z", {
  11832. type: "Program",
  11833. body: [
  11834. {
  11835. type: "ExpressionStatement",
  11836. expression: {
  11837. type: "BinaryExpression",
  11838. left: {
  11839. type: "BinaryExpression",
  11840. left: {
  11841. type: "Identifier",
  11842. name: "x",
  11843. loc: {
  11844. start: {
  11845. line: 1,
  11846. column: 0
  11847. },
  11848. end: {
  11849. line: 1,
  11850. column: 1
  11851. }
  11852. }
  11853. },
  11854. operator: "<",
  11855. right: {
  11856. type: "Identifier",
  11857. name: "y",
  11858. loc: {
  11859. start: {
  11860. line: 1,
  11861. column: 4
  11862. },
  11863. end: {
  11864. line: 1,
  11865. column: 5
  11866. }
  11867. }
  11868. },
  11869. loc: {
  11870. start: {
  11871. line: 1,
  11872. column: 0
  11873. },
  11874. end: {
  11875. line: 1,
  11876. column: 5
  11877. }
  11878. }
  11879. },
  11880. operator: "<",
  11881. right: {
  11882. type: "Identifier",
  11883. name: "z",
  11884. loc: {
  11885. start: {
  11886. line: 1,
  11887. column: 8
  11888. },
  11889. end: {
  11890. line: 1,
  11891. column: 9
  11892. }
  11893. }
  11894. },
  11895. loc: {
  11896. start: {
  11897. line: 1,
  11898. column: 0
  11899. },
  11900. end: {
  11901. line: 1,
  11902. column: 9
  11903. }
  11904. }
  11905. },
  11906. loc: {
  11907. start: {
  11908. line: 1,
  11909. column: 0
  11910. },
  11911. end: {
  11912. line: 1,
  11913. column: 9
  11914. }
  11915. }
  11916. }
  11917. ],
  11918. loc: {
  11919. start: {
  11920. line: 1,
  11921. column: 0
  11922. },
  11923. end: {
  11924. line: 1,
  11925. column: 9
  11926. }
  11927. }
  11928. });
  11929. test("x == y", {
  11930. type: "Program",
  11931. body: [
  11932. {
  11933. type: "ExpressionStatement",
  11934. expression: {
  11935. type: "BinaryExpression",
  11936. left: {
  11937. type: "Identifier",
  11938. name: "x",
  11939. loc: {
  11940. start: {
  11941. line: 1,
  11942. column: 0
  11943. },
  11944. end: {
  11945. line: 1,
  11946. column: 1
  11947. }
  11948. }
  11949. },
  11950. operator: "==",
  11951. right: {
  11952. type: "Identifier",
  11953. name: "y",
  11954. loc: {
  11955. start: {
  11956. line: 1,
  11957. column: 5
  11958. },
  11959. end: {
  11960. line: 1,
  11961. column: 6
  11962. }
  11963. }
  11964. },
  11965. loc: {
  11966. start: {
  11967. line: 1,
  11968. column: 0
  11969. },
  11970. end: {
  11971. line: 1,
  11972. column: 6
  11973. }
  11974. }
  11975. },
  11976. loc: {
  11977. start: {
  11978. line: 1,
  11979. column: 0
  11980. },
  11981. end: {
  11982. line: 1,
  11983. column: 6
  11984. }
  11985. }
  11986. }
  11987. ],
  11988. loc: {
  11989. start: {
  11990. line: 1,
  11991. column: 0
  11992. },
  11993. end: {
  11994. line: 1,
  11995. column: 6
  11996. }
  11997. }
  11998. });
  11999. test("x != y", {
  12000. type: "Program",
  12001. body: [
  12002. {
  12003. type: "ExpressionStatement",
  12004. expression: {
  12005. type: "BinaryExpression",
  12006. left: {
  12007. type: "Identifier",
  12008. name: "x",
  12009. loc: {
  12010. start: {
  12011. line: 1,
  12012. column: 0
  12013. },
  12014. end: {
  12015. line: 1,
  12016. column: 1
  12017. }
  12018. }
  12019. },
  12020. operator: "!=",
  12021. right: {
  12022. type: "Identifier",
  12023. name: "y",
  12024. loc: {
  12025. start: {
  12026. line: 1,
  12027. column: 5
  12028. },
  12029. end: {
  12030. line: 1,
  12031. column: 6
  12032. }
  12033. }
  12034. },
  12035. loc: {
  12036. start: {
  12037. line: 1,
  12038. column: 0
  12039. },
  12040. end: {
  12041. line: 1,
  12042. column: 6
  12043. }
  12044. }
  12045. },
  12046. loc: {
  12047. start: {
  12048. line: 1,
  12049. column: 0
  12050. },
  12051. end: {
  12052. line: 1,
  12053. column: 6
  12054. }
  12055. }
  12056. }
  12057. ],
  12058. loc: {
  12059. start: {
  12060. line: 1,
  12061. column: 0
  12062. },
  12063. end: {
  12064. line: 1,
  12065. column: 6
  12066. }
  12067. }
  12068. });
  12069. test("x === y", {
  12070. type: "Program",
  12071. body: [
  12072. {
  12073. type: "ExpressionStatement",
  12074. expression: {
  12075. type: "BinaryExpression",
  12076. left: {
  12077. type: "Identifier",
  12078. name: "x",
  12079. loc: {
  12080. start: {
  12081. line: 1,
  12082. column: 0
  12083. },
  12084. end: {
  12085. line: 1,
  12086. column: 1
  12087. }
  12088. }
  12089. },
  12090. operator: "===",
  12091. right: {
  12092. type: "Identifier",
  12093. name: "y",
  12094. loc: {
  12095. start: {
  12096. line: 1,
  12097. column: 6
  12098. },
  12099. end: {
  12100. line: 1,
  12101. column: 7
  12102. }
  12103. }
  12104. },
  12105. loc: {
  12106. start: {
  12107. line: 1,
  12108. column: 0
  12109. },
  12110. end: {
  12111. line: 1,
  12112. column: 7
  12113. }
  12114. }
  12115. },
  12116. loc: {
  12117. start: {
  12118. line: 1,
  12119. column: 0
  12120. },
  12121. end: {
  12122. line: 1,
  12123. column: 7
  12124. }
  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. test("x !== y", {
  12140. type: "Program",
  12141. body: [
  12142. {
  12143. type: "ExpressionStatement",
  12144. expression: {
  12145. type: "BinaryExpression",
  12146. left: {
  12147. type: "Identifier",
  12148. name: "x",
  12149. loc: {
  12150. start: {
  12151. line: 1,
  12152. column: 0
  12153. },
  12154. end: {
  12155. line: 1,
  12156. column: 1
  12157. }
  12158. }
  12159. },
  12160. operator: "!==",
  12161. right: {
  12162. type: "Identifier",
  12163. name: "y",
  12164. loc: {
  12165. start: {
  12166. line: 1,
  12167. column: 6
  12168. },
  12169. end: {
  12170. line: 1,
  12171. column: 7
  12172. }
  12173. }
  12174. },
  12175. loc: {
  12176. start: {
  12177. line: 1,
  12178. column: 0
  12179. },
  12180. end: {
  12181. line: 1,
  12182. column: 7
  12183. }
  12184. }
  12185. },
  12186. loc: {
  12187. start: {
  12188. line: 1,
  12189. column: 0
  12190. },
  12191. end: {
  12192. line: 1,
  12193. column: 7
  12194. }
  12195. }
  12196. }
  12197. ],
  12198. loc: {
  12199. start: {
  12200. line: 1,
  12201. column: 0
  12202. },
  12203. end: {
  12204. line: 1,
  12205. column: 7
  12206. }
  12207. }
  12208. });
  12209. test("x & y", {
  12210. type: "Program",
  12211. body: [
  12212. {
  12213. type: "ExpressionStatement",
  12214. expression: {
  12215. type: "BinaryExpression",
  12216. left: {
  12217. type: "Identifier",
  12218. name: "x",
  12219. loc: {
  12220. start: {
  12221. line: 1,
  12222. column: 0
  12223. },
  12224. end: {
  12225. line: 1,
  12226. column: 1
  12227. }
  12228. }
  12229. },
  12230. operator: "&",
  12231. right: {
  12232. type: "Identifier",
  12233. name: "y",
  12234. loc: {
  12235. start: {
  12236. line: 1,
  12237. column: 4
  12238. },
  12239. end: {
  12240. line: 1,
  12241. column: 5
  12242. }
  12243. }
  12244. },
  12245. loc: {
  12246. start: {
  12247. line: 1,
  12248. column: 0
  12249. },
  12250. end: {
  12251. line: 1,
  12252. column: 5
  12253. }
  12254. }
  12255. },
  12256. loc: {
  12257. start: {
  12258. line: 1,
  12259. column: 0
  12260. },
  12261. end: {
  12262. line: 1,
  12263. column: 5
  12264. }
  12265. }
  12266. }
  12267. ],
  12268. loc: {
  12269. start: {
  12270. line: 1,
  12271. column: 0
  12272. },
  12273. end: {
  12274. line: 1,
  12275. column: 5
  12276. }
  12277. }
  12278. });
  12279. test("x ^ y", {
  12280. type: "Program",
  12281. body: [
  12282. {
  12283. type: "ExpressionStatement",
  12284. expression: {
  12285. type: "BinaryExpression",
  12286. left: {
  12287. type: "Identifier",
  12288. name: "x",
  12289. loc: {
  12290. start: {
  12291. line: 1,
  12292. column: 0
  12293. },
  12294. end: {
  12295. line: 1,
  12296. column: 1
  12297. }
  12298. }
  12299. },
  12300. operator: "^",
  12301. right: {
  12302. type: "Identifier",
  12303. name: "y",
  12304. loc: {
  12305. start: {
  12306. line: 1,
  12307. column: 4
  12308. },
  12309. end: {
  12310. line: 1,
  12311. column: 5
  12312. }
  12313. }
  12314. },
  12315. loc: {
  12316. start: {
  12317. line: 1,
  12318. column: 0
  12319. },
  12320. end: {
  12321. line: 1,
  12322. column: 5
  12323. }
  12324. }
  12325. },
  12326. loc: {
  12327. start: {
  12328. line: 1,
  12329. column: 0
  12330. },
  12331. end: {
  12332. line: 1,
  12333. column: 5
  12334. }
  12335. }
  12336. }
  12337. ],
  12338. loc: {
  12339. start: {
  12340. line: 1,
  12341. column: 0
  12342. },
  12343. end: {
  12344. line: 1,
  12345. column: 5
  12346. }
  12347. }
  12348. });
  12349. test("x | y", {
  12350. type: "Program",
  12351. body: [
  12352. {
  12353. type: "ExpressionStatement",
  12354. expression: {
  12355. type: "BinaryExpression",
  12356. left: {
  12357. type: "Identifier",
  12358. name: "x",
  12359. loc: {
  12360. start: {
  12361. line: 1,
  12362. column: 0
  12363. },
  12364. end: {
  12365. line: 1,
  12366. column: 1
  12367. }
  12368. }
  12369. },
  12370. operator: "|",
  12371. right: {
  12372. type: "Identifier",
  12373. name: "y",
  12374. loc: {
  12375. start: {
  12376. line: 1,
  12377. column: 4
  12378. },
  12379. end: {
  12380. line: 1,
  12381. column: 5
  12382. }
  12383. }
  12384. },
  12385. loc: {
  12386. start: {
  12387. line: 1,
  12388. column: 0
  12389. },
  12390. end: {
  12391. line: 1,
  12392. column: 5
  12393. }
  12394. }
  12395. },
  12396. loc: {
  12397. start: {
  12398. line: 1,
  12399. column: 0
  12400. },
  12401. end: {
  12402. line: 1,
  12403. column: 5
  12404. }
  12405. }
  12406. }
  12407. ],
  12408. loc: {
  12409. start: {
  12410. line: 1,
  12411. column: 0
  12412. },
  12413. end: {
  12414. line: 1,
  12415. column: 5
  12416. }
  12417. }
  12418. });
  12419. test("x + y + z", {
  12420. type: "Program",
  12421. body: [
  12422. {
  12423. type: "ExpressionStatement",
  12424. expression: {
  12425. type: "BinaryExpression",
  12426. left: {
  12427. type: "BinaryExpression",
  12428. left: {
  12429. type: "Identifier",
  12430. name: "x",
  12431. loc: {
  12432. start: {
  12433. line: 1,
  12434. column: 0
  12435. },
  12436. end: {
  12437. line: 1,
  12438. column: 1
  12439. }
  12440. }
  12441. },
  12442. operator: "+",
  12443. right: {
  12444. type: "Identifier",
  12445. name: "y",
  12446. loc: {
  12447. start: {
  12448. line: 1,
  12449. column: 4
  12450. },
  12451. end: {
  12452. line: 1,
  12453. column: 5
  12454. }
  12455. }
  12456. },
  12457. loc: {
  12458. start: {
  12459. line: 1,
  12460. column: 0
  12461. },
  12462. end: {
  12463. line: 1,
  12464. column: 5
  12465. }
  12466. }
  12467. },
  12468. operator: "+",
  12469. right: {
  12470. type: "Identifier",
  12471. name: "z",
  12472. loc: {
  12473. start: {
  12474. line: 1,
  12475. column: 8
  12476. },
  12477. end: {
  12478. line: 1,
  12479. column: 9
  12480. }
  12481. }
  12482. },
  12483. loc: {
  12484. start: {
  12485. line: 1,
  12486. column: 0
  12487. },
  12488. end: {
  12489. line: 1,
  12490. column: 9
  12491. }
  12492. }
  12493. },
  12494. loc: {
  12495. start: {
  12496. line: 1,
  12497. column: 0
  12498. },
  12499. end: {
  12500. line: 1,
  12501. column: 9
  12502. }
  12503. }
  12504. }
  12505. ],
  12506. loc: {
  12507. start: {
  12508. line: 1,
  12509. column: 0
  12510. },
  12511. end: {
  12512. line: 1,
  12513. column: 9
  12514. }
  12515. }
  12516. });
  12517. test("x - y + z", {
  12518. type: "Program",
  12519. body: [
  12520. {
  12521. type: "ExpressionStatement",
  12522. expression: {
  12523. type: "BinaryExpression",
  12524. left: {
  12525. type: "BinaryExpression",
  12526. left: {
  12527. type: "Identifier",
  12528. name: "x",
  12529. loc: {
  12530. start: {
  12531. line: 1,
  12532. column: 0
  12533. },
  12534. end: {
  12535. line: 1,
  12536. column: 1
  12537. }
  12538. }
  12539. },
  12540. operator: "-",
  12541. right: {
  12542. type: "Identifier",
  12543. name: "y",
  12544. loc: {
  12545. start: {
  12546. line: 1,
  12547. column: 4
  12548. },
  12549. end: {
  12550. line: 1,
  12551. column: 5
  12552. }
  12553. }
  12554. },
  12555. loc: {
  12556. start: {
  12557. line: 1,
  12558. column: 0
  12559. },
  12560. end: {
  12561. line: 1,
  12562. column: 5
  12563. }
  12564. }
  12565. },
  12566. operator: "+",
  12567. right: {
  12568. type: "Identifier",
  12569. name: "z",
  12570. loc: {
  12571. start: {
  12572. line: 1,
  12573. column: 8
  12574. },
  12575. end: {
  12576. line: 1,
  12577. column: 9
  12578. }
  12579. }
  12580. },
  12581. loc: {
  12582. start: {
  12583. line: 1,
  12584. column: 0
  12585. },
  12586. end: {
  12587. line: 1,
  12588. column: 9
  12589. }
  12590. }
  12591. },
  12592. loc: {
  12593. start: {
  12594. line: 1,
  12595. column: 0
  12596. },
  12597. end: {
  12598. line: 1,
  12599. column: 9
  12600. }
  12601. }
  12602. }
  12603. ],
  12604. loc: {
  12605. start: {
  12606. line: 1,
  12607. column: 0
  12608. },
  12609. end: {
  12610. line: 1,
  12611. column: 9
  12612. }
  12613. }
  12614. });
  12615. test("x + y - z", {
  12616. type: "Program",
  12617. body: [
  12618. {
  12619. type: "ExpressionStatement",
  12620. expression: {
  12621. type: "BinaryExpression",
  12622. left: {
  12623. type: "BinaryExpression",
  12624. left: {
  12625. type: "Identifier",
  12626. name: "x",
  12627. loc: {
  12628. start: {
  12629. line: 1,
  12630. column: 0
  12631. },
  12632. end: {
  12633. line: 1,
  12634. column: 1
  12635. }
  12636. }
  12637. },
  12638. operator: "+",
  12639. right: {
  12640. type: "Identifier",
  12641. name: "y",
  12642. loc: {
  12643. start: {
  12644. line: 1,
  12645. column: 4
  12646. },
  12647. end: {
  12648. line: 1,
  12649. column: 5
  12650. }
  12651. }
  12652. },
  12653. loc: {
  12654. start: {
  12655. line: 1,
  12656. column: 0
  12657. },
  12658. end: {
  12659. line: 1,
  12660. column: 5
  12661. }
  12662. }
  12663. },
  12664. operator: "-",
  12665. right: {
  12666. type: "Identifier",
  12667. name: "z",
  12668. loc: {
  12669. start: {
  12670. line: 1,
  12671. column: 8
  12672. },
  12673. end: {
  12674. line: 1,
  12675. column: 9
  12676. }
  12677. }
  12678. },
  12679. loc: {
  12680. start: {
  12681. line: 1,
  12682. column: 0
  12683. },
  12684. end: {
  12685. line: 1,
  12686. column: 9
  12687. }
  12688. }
  12689. },
  12690. loc: {
  12691. start: {
  12692. line: 1,
  12693. column: 0
  12694. },
  12695. end: {
  12696. line: 1,
  12697. column: 9
  12698. }
  12699. }
  12700. }
  12701. ],
  12702. loc: {
  12703. start: {
  12704. line: 1,
  12705. column: 0
  12706. },
  12707. end: {
  12708. line: 1,
  12709. column: 9
  12710. }
  12711. }
  12712. });
  12713. test("x - y - z", {
  12714. type: "Program",
  12715. body: [
  12716. {
  12717. type: "ExpressionStatement",
  12718. expression: {
  12719. type: "BinaryExpression",
  12720. left: {
  12721. type: "BinaryExpression",
  12722. left: {
  12723. type: "Identifier",
  12724. name: "x",
  12725. loc: {
  12726. start: {
  12727. line: 1,
  12728. column: 0
  12729. },
  12730. end: {
  12731. line: 1,
  12732. column: 1
  12733. }
  12734. }
  12735. },
  12736. operator: "-",
  12737. right: {
  12738. type: "Identifier",
  12739. name: "y",
  12740. loc: {
  12741. start: {
  12742. line: 1,
  12743. column: 4
  12744. },
  12745. end: {
  12746. line: 1,
  12747. column: 5
  12748. }
  12749. }
  12750. },
  12751. loc: {
  12752. start: {
  12753. line: 1,
  12754. column: 0
  12755. },
  12756. end: {
  12757. line: 1,
  12758. column: 5
  12759. }
  12760. }
  12761. },
  12762. operator: "-",
  12763. right: {
  12764. type: "Identifier",
  12765. name: "z",
  12766. loc: {
  12767. start: {
  12768. line: 1,
  12769. column: 8
  12770. },
  12771. end: {
  12772. line: 1,
  12773. column: 9
  12774. }
  12775. }
  12776. },
  12777. loc: {
  12778. start: {
  12779. line: 1,
  12780. column: 0
  12781. },
  12782. end: {
  12783. line: 1,
  12784. column: 9
  12785. }
  12786. }
  12787. },
  12788. loc: {
  12789. start: {
  12790. line: 1,
  12791. column: 0
  12792. },
  12793. end: {
  12794. line: 1,
  12795. column: 9
  12796. }
  12797. }
  12798. }
  12799. ],
  12800. loc: {
  12801. start: {
  12802. line: 1,
  12803. column: 0
  12804. },
  12805. end: {
  12806. line: 1,
  12807. column: 9
  12808. }
  12809. }
  12810. });
  12811. test("x + y * z", {
  12812. type: "Program",
  12813. body: [
  12814. {
  12815. type: "ExpressionStatement",
  12816. expression: {
  12817. type: "BinaryExpression",
  12818. left: {
  12819. type: "Identifier",
  12820. name: "x",
  12821. loc: {
  12822. start: {
  12823. line: 1,
  12824. column: 0
  12825. },
  12826. end: {
  12827. line: 1,
  12828. column: 1
  12829. }
  12830. }
  12831. },
  12832. operator: "+",
  12833. right: {
  12834. type: "BinaryExpression",
  12835. left: {
  12836. type: "Identifier",
  12837. name: "y",
  12838. loc: {
  12839. start: {
  12840. line: 1,
  12841. column: 4
  12842. },
  12843. end: {
  12844. line: 1,
  12845. column: 5
  12846. }
  12847. }
  12848. },
  12849. operator: "*",
  12850. right: {
  12851. type: "Identifier",
  12852. name: "z",
  12853. loc: {
  12854. start: {
  12855. line: 1,
  12856. column: 8
  12857. },
  12858. end: {
  12859. line: 1,
  12860. column: 9
  12861. }
  12862. }
  12863. },
  12864. loc: {
  12865. start: {
  12866. line: 1,
  12867. column: 4
  12868. },
  12869. end: {
  12870. line: 1,
  12871. column: 9
  12872. }
  12873. }
  12874. },
  12875. loc: {
  12876. start: {
  12877. line: 1,
  12878. column: 0
  12879. },
  12880. end: {
  12881. line: 1,
  12882. column: 9
  12883. }
  12884. }
  12885. },
  12886. loc: {
  12887. start: {
  12888. line: 1,
  12889. column: 0
  12890. },
  12891. end: {
  12892. line: 1,
  12893. column: 9
  12894. }
  12895. }
  12896. }
  12897. ],
  12898. loc: {
  12899. start: {
  12900. line: 1,
  12901. column: 0
  12902. },
  12903. end: {
  12904. line: 1,
  12905. column: 9
  12906. }
  12907. }
  12908. });
  12909. test("x + y / z", {
  12910. type: "Program",
  12911. body: [
  12912. {
  12913. type: "ExpressionStatement",
  12914. expression: {
  12915. type: "BinaryExpression",
  12916. left: {
  12917. type: "Identifier",
  12918. name: "x",
  12919. loc: {
  12920. start: {
  12921. line: 1,
  12922. column: 0
  12923. },
  12924. end: {
  12925. line: 1,
  12926. column: 1
  12927. }
  12928. }
  12929. },
  12930. operator: "+",
  12931. right: {
  12932. type: "BinaryExpression",
  12933. left: {
  12934. type: "Identifier",
  12935. name: "y",
  12936. loc: {
  12937. start: {
  12938. line: 1,
  12939. column: 4
  12940. },
  12941. end: {
  12942. line: 1,
  12943. column: 5
  12944. }
  12945. }
  12946. },
  12947. operator: "/",
  12948. right: {
  12949. type: "Identifier",
  12950. name: "z",
  12951. loc: {
  12952. start: {
  12953. line: 1,
  12954. column: 8
  12955. },
  12956. end: {
  12957. line: 1,
  12958. column: 9
  12959. }
  12960. }
  12961. },
  12962. loc: {
  12963. start: {
  12964. line: 1,
  12965. column: 4
  12966. },
  12967. end: {
  12968. line: 1,
  12969. column: 9
  12970. }
  12971. }
  12972. },
  12973. loc: {
  12974. start: {
  12975. line: 1,
  12976. column: 0
  12977. },
  12978. end: {
  12979. line: 1,
  12980. column: 9
  12981. }
  12982. }
  12983. },
  12984. loc: {
  12985. start: {
  12986. line: 1,
  12987. column: 0
  12988. },
  12989. end: {
  12990. line: 1,
  12991. column: 9
  12992. }
  12993. }
  12994. }
  12995. ],
  12996. loc: {
  12997. start: {
  12998. line: 1,
  12999. column: 0
  13000. },
  13001. end: {
  13002. line: 1,
  13003. column: 9
  13004. }
  13005. }
  13006. });
  13007. test("x - y % z", {
  13008. type: "Program",
  13009. body: [
  13010. {
  13011. type: "ExpressionStatement",
  13012. expression: {
  13013. type: "BinaryExpression",
  13014. left: {
  13015. type: "Identifier",
  13016. name: "x",
  13017. loc: {
  13018. start: {
  13019. line: 1,
  13020. column: 0
  13021. },
  13022. end: {
  13023. line: 1,
  13024. column: 1
  13025. }
  13026. }
  13027. },
  13028. operator: "-",
  13029. right: {
  13030. type: "BinaryExpression",
  13031. left: {
  13032. type: "Identifier",
  13033. name: "y",
  13034. loc: {
  13035. start: {
  13036. line: 1,
  13037. column: 4
  13038. },
  13039. end: {
  13040. line: 1,
  13041. column: 5
  13042. }
  13043. }
  13044. },
  13045. operator: "%",
  13046. right: {
  13047. type: "Identifier",
  13048. name: "z",
  13049. loc: {
  13050. start: {
  13051. line: 1,
  13052. column: 8
  13053. },
  13054. end: {
  13055. line: 1,
  13056. column: 9
  13057. }
  13058. }
  13059. },
  13060. loc: {
  13061. start: {
  13062. line: 1,
  13063. column: 4
  13064. },
  13065. end: {
  13066. line: 1,
  13067. column: 9
  13068. }
  13069. }
  13070. },
  13071. loc: {
  13072. start: {
  13073. line: 1,
  13074. column: 0
  13075. },
  13076. end: {
  13077. line: 1,
  13078. column: 9
  13079. }
  13080. }
  13081. },
  13082. loc: {
  13083. start: {
  13084. line: 1,
  13085. column: 0
  13086. },
  13087. end: {
  13088. line: 1,
  13089. column: 9
  13090. }
  13091. }
  13092. }
  13093. ],
  13094. loc: {
  13095. start: {
  13096. line: 1,
  13097. column: 0
  13098. },
  13099. end: {
  13100. line: 1,
  13101. column: 9
  13102. }
  13103. }
  13104. });
  13105. test("x * y * z", {
  13106. type: "Program",
  13107. body: [
  13108. {
  13109. type: "ExpressionStatement",
  13110. expression: {
  13111. type: "BinaryExpression",
  13112. left: {
  13113. type: "BinaryExpression",
  13114. left: {
  13115. type: "Identifier",
  13116. name: "x",
  13117. loc: {
  13118. start: {
  13119. line: 1,
  13120. column: 0
  13121. },
  13122. end: {
  13123. line: 1,
  13124. column: 1
  13125. }
  13126. }
  13127. },
  13128. operator: "*",
  13129. right: {
  13130. type: "Identifier",
  13131. name: "y",
  13132. loc: {
  13133. start: {
  13134. line: 1,
  13135. column: 4
  13136. },
  13137. end: {
  13138. line: 1,
  13139. column: 5
  13140. }
  13141. }
  13142. },
  13143. loc: {
  13144. start: {
  13145. line: 1,
  13146. column: 0
  13147. },
  13148. end: {
  13149. line: 1,
  13150. column: 5
  13151. }
  13152. }
  13153. },
  13154. operator: "*",
  13155. right: {
  13156. type: "Identifier",
  13157. name: "z",
  13158. loc: {
  13159. start: {
  13160. line: 1,
  13161. column: 8
  13162. },
  13163. end: {
  13164. line: 1,
  13165. column: 9
  13166. }
  13167. }
  13168. },
  13169. loc: {
  13170. start: {
  13171. line: 1,
  13172. column: 0
  13173. },
  13174. end: {
  13175. line: 1,
  13176. column: 9
  13177. }
  13178. }
  13179. },
  13180. loc: {
  13181. start: {
  13182. line: 1,
  13183. column: 0
  13184. },
  13185. end: {
  13186. line: 1,
  13187. column: 9
  13188. }
  13189. }
  13190. }
  13191. ],
  13192. loc: {
  13193. start: {
  13194. line: 1,
  13195. column: 0
  13196. },
  13197. end: {
  13198. line: 1,
  13199. column: 9
  13200. }
  13201. }
  13202. });
  13203. test("x * y / z", {
  13204. type: "Program",
  13205. body: [
  13206. {
  13207. type: "ExpressionStatement",
  13208. expression: {
  13209. type: "BinaryExpression",
  13210. left: {
  13211. type: "BinaryExpression",
  13212. left: {
  13213. type: "Identifier",
  13214. name: "x",
  13215. loc: {
  13216. start: {
  13217. line: 1,
  13218. column: 0
  13219. },
  13220. end: {
  13221. line: 1,
  13222. column: 1
  13223. }
  13224. }
  13225. },
  13226. operator: "*",
  13227. right: {
  13228. type: "Identifier",
  13229. name: "y",
  13230. loc: {
  13231. start: {
  13232. line: 1,
  13233. column: 4
  13234. },
  13235. end: {
  13236. line: 1,
  13237. column: 5
  13238. }
  13239. }
  13240. },
  13241. loc: {
  13242. start: {
  13243. line: 1,
  13244. column: 0
  13245. },
  13246. end: {
  13247. line: 1,
  13248. column: 5
  13249. }
  13250. }
  13251. },
  13252. operator: "/",
  13253. right: {
  13254. type: "Identifier",
  13255. name: "z",
  13256. loc: {
  13257. start: {
  13258. line: 1,
  13259. column: 8
  13260. },
  13261. end: {
  13262. line: 1,
  13263. column: 9
  13264. }
  13265. }
  13266. },
  13267. loc: {
  13268. start: {
  13269. line: 1,
  13270. column: 0
  13271. },
  13272. end: {
  13273. line: 1,
  13274. column: 9
  13275. }
  13276. }
  13277. },
  13278. loc: {
  13279. start: {
  13280. line: 1,
  13281. column: 0
  13282. },
  13283. end: {
  13284. line: 1,
  13285. column: 9
  13286. }
  13287. }
  13288. }
  13289. ],
  13290. loc: {
  13291. start: {
  13292. line: 1,
  13293. column: 0
  13294. },
  13295. end: {
  13296. line: 1,
  13297. column: 9
  13298. }
  13299. }
  13300. });
  13301. test("x * y % z", {
  13302. type: "Program",
  13303. body: [
  13304. {
  13305. type: "ExpressionStatement",
  13306. expression: {
  13307. type: "BinaryExpression",
  13308. left: {
  13309. type: "BinaryExpression",
  13310. left: {
  13311. type: "Identifier",
  13312. name: "x",
  13313. loc: {
  13314. start: {
  13315. line: 1,
  13316. column: 0
  13317. },
  13318. end: {
  13319. line: 1,
  13320. column: 1
  13321. }
  13322. }
  13323. },
  13324. operator: "*",
  13325. right: {
  13326. type: "Identifier",
  13327. name: "y",
  13328. loc: {
  13329. start: {
  13330. line: 1,
  13331. column: 4
  13332. },
  13333. end: {
  13334. line: 1,
  13335. column: 5
  13336. }
  13337. }
  13338. },
  13339. loc: {
  13340. start: {
  13341. line: 1,
  13342. column: 0
  13343. },
  13344. end: {
  13345. line: 1,
  13346. column: 5
  13347. }
  13348. }
  13349. },
  13350. operator: "%",
  13351. right: {
  13352. type: "Identifier",
  13353. name: "z",
  13354. loc: {
  13355. start: {
  13356. line: 1,
  13357. column: 8
  13358. },
  13359. end: {
  13360. line: 1,
  13361. column: 9
  13362. }
  13363. }
  13364. },
  13365. loc: {
  13366. start: {
  13367. line: 1,
  13368. column: 0
  13369. },
  13370. end: {
  13371. line: 1,
  13372. column: 9
  13373. }
  13374. }
  13375. },
  13376. loc: {
  13377. start: {
  13378. line: 1,
  13379. column: 0
  13380. },
  13381. end: {
  13382. line: 1,
  13383. column: 9
  13384. }
  13385. }
  13386. }
  13387. ],
  13388. loc: {
  13389. start: {
  13390. line: 1,
  13391. column: 0
  13392. },
  13393. end: {
  13394. line: 1,
  13395. column: 9
  13396. }
  13397. }
  13398. });
  13399. test("x % y * z", {
  13400. type: "Program",
  13401. body: [
  13402. {
  13403. type: "ExpressionStatement",
  13404. expression: {
  13405. type: "BinaryExpression",
  13406. left: {
  13407. type: "BinaryExpression",
  13408. left: {
  13409. type: "Identifier",
  13410. name: "x",
  13411. loc: {
  13412. start: {
  13413. line: 1,
  13414. column: 0
  13415. },
  13416. end: {
  13417. line: 1,
  13418. column: 1
  13419. }
  13420. }
  13421. },
  13422. operator: "%",
  13423. right: {
  13424. type: "Identifier",
  13425. name: "y",
  13426. loc: {
  13427. start: {
  13428. line: 1,
  13429. column: 4
  13430. },
  13431. end: {
  13432. line: 1,
  13433. column: 5
  13434. }
  13435. }
  13436. },
  13437. loc: {
  13438. start: {
  13439. line: 1,
  13440. column: 0
  13441. },
  13442. end: {
  13443. line: 1,
  13444. column: 5
  13445. }
  13446. }
  13447. },
  13448. operator: "*",
  13449. right: {
  13450. type: "Identifier",
  13451. name: "z",
  13452. loc: {
  13453. start: {
  13454. line: 1,
  13455. column: 8
  13456. },
  13457. end: {
  13458. line: 1,
  13459. column: 9
  13460. }
  13461. }
  13462. },
  13463. loc: {
  13464. start: {
  13465. line: 1,
  13466. column: 0
  13467. },
  13468. end: {
  13469. line: 1,
  13470. column: 9
  13471. }
  13472. }
  13473. },
  13474. loc: {
  13475. start: {
  13476. line: 1,
  13477. column: 0
  13478. },
  13479. end: {
  13480. line: 1,
  13481. column: 9
  13482. }
  13483. }
  13484. }
  13485. ],
  13486. loc: {
  13487. start: {
  13488. line: 1,
  13489. column: 0
  13490. },
  13491. end: {
  13492. line: 1,
  13493. column: 9
  13494. }
  13495. }
  13496. });
  13497. test("x << y << z", {
  13498. type: "Program",
  13499. body: [
  13500. {
  13501. type: "ExpressionStatement",
  13502. expression: {
  13503. type: "BinaryExpression",
  13504. left: {
  13505. type: "BinaryExpression",
  13506. left: {
  13507. type: "Identifier",
  13508. name: "x",
  13509. loc: {
  13510. start: {
  13511. line: 1,
  13512. column: 0
  13513. },
  13514. end: {
  13515. line: 1,
  13516. column: 1
  13517. }
  13518. }
  13519. },
  13520. operator: "<<",
  13521. right: {
  13522. type: "Identifier",
  13523. name: "y",
  13524. loc: {
  13525. start: {
  13526. line: 1,
  13527. column: 5
  13528. },
  13529. end: {
  13530. line: 1,
  13531. column: 6
  13532. }
  13533. }
  13534. },
  13535. loc: {
  13536. start: {
  13537. line: 1,
  13538. column: 0
  13539. },
  13540. end: {
  13541. line: 1,
  13542. column: 6
  13543. }
  13544. }
  13545. },
  13546. operator: "<<",
  13547. right: {
  13548. type: "Identifier",
  13549. name: "z",
  13550. loc: {
  13551. start: {
  13552. line: 1,
  13553. column: 10
  13554. },
  13555. end: {
  13556. line: 1,
  13557. column: 11
  13558. }
  13559. }
  13560. },
  13561. loc: {
  13562. start: {
  13563. line: 1,
  13564. column: 0
  13565. },
  13566. end: {
  13567. line: 1,
  13568. column: 11
  13569. }
  13570. }
  13571. },
  13572. loc: {
  13573. start: {
  13574. line: 1,
  13575. column: 0
  13576. },
  13577. end: {
  13578. line: 1,
  13579. column: 11
  13580. }
  13581. }
  13582. }
  13583. ],
  13584. loc: {
  13585. start: {
  13586. line: 1,
  13587. column: 0
  13588. },
  13589. end: {
  13590. line: 1,
  13591. column: 11
  13592. }
  13593. }
  13594. });
  13595. test("x | y | z", {
  13596. type: "Program",
  13597. body: [
  13598. {
  13599. type: "ExpressionStatement",
  13600. expression: {
  13601. type: "BinaryExpression",
  13602. left: {
  13603. type: "BinaryExpression",
  13604. left: {
  13605. type: "Identifier",
  13606. name: "x",
  13607. loc: {
  13608. start: {
  13609. line: 1,
  13610. column: 0
  13611. },
  13612. end: {
  13613. line: 1,
  13614. column: 1
  13615. }
  13616. }
  13617. },
  13618. operator: "|",
  13619. right: {
  13620. type: "Identifier",
  13621. name: "y",
  13622. loc: {
  13623. start: {
  13624. line: 1,
  13625. column: 4
  13626. },
  13627. end: {
  13628. line: 1,
  13629. column: 5
  13630. }
  13631. }
  13632. },
  13633. loc: {
  13634. start: {
  13635. line: 1,
  13636. column: 0
  13637. },
  13638. end: {
  13639. line: 1,
  13640. column: 5
  13641. }
  13642. }
  13643. },
  13644. operator: "|",
  13645. right: {
  13646. type: "Identifier",
  13647. name: "z",
  13648. loc: {
  13649. start: {
  13650. line: 1,
  13651. column: 8
  13652. },
  13653. end: {
  13654. line: 1,
  13655. column: 9
  13656. }
  13657. }
  13658. },
  13659. loc: {
  13660. start: {
  13661. line: 1,
  13662. column: 0
  13663. },
  13664. end: {
  13665. line: 1,
  13666. column: 9
  13667. }
  13668. }
  13669. },
  13670. loc: {
  13671. start: {
  13672. line: 1,
  13673. column: 0
  13674. },
  13675. end: {
  13676. line: 1,
  13677. column: 9
  13678. }
  13679. }
  13680. }
  13681. ],
  13682. loc: {
  13683. start: {
  13684. line: 1,
  13685. column: 0
  13686. },
  13687. end: {
  13688. line: 1,
  13689. column: 9
  13690. }
  13691. }
  13692. });
  13693. test("x & y & z", {
  13694. type: "Program",
  13695. body: [
  13696. {
  13697. type: "ExpressionStatement",
  13698. expression: {
  13699. type: "BinaryExpression",
  13700. left: {
  13701. type: "BinaryExpression",
  13702. left: {
  13703. type: "Identifier",
  13704. name: "x",
  13705. loc: {
  13706. start: {
  13707. line: 1,
  13708. column: 0
  13709. },
  13710. end: {
  13711. line: 1,
  13712. column: 1
  13713. }
  13714. }
  13715. },
  13716. operator: "&",
  13717. right: {
  13718. type: "Identifier",
  13719. name: "y",
  13720. loc: {
  13721. start: {
  13722. line: 1,
  13723. column: 4
  13724. },
  13725. end: {
  13726. line: 1,
  13727. column: 5
  13728. }
  13729. }
  13730. },
  13731. loc: {
  13732. start: {
  13733. line: 1,
  13734. column: 0
  13735. },
  13736. end: {
  13737. line: 1,
  13738. column: 5
  13739. }
  13740. }
  13741. },
  13742. operator: "&",
  13743. right: {
  13744. type: "Identifier",
  13745. name: "z",
  13746. loc: {
  13747. start: {
  13748. line: 1,
  13749. column: 8
  13750. },
  13751. end: {
  13752. line: 1,
  13753. column: 9
  13754. }
  13755. }
  13756. },
  13757. loc: {
  13758. start: {
  13759. line: 1,
  13760. column: 0
  13761. },
  13762. end: {
  13763. line: 1,
  13764. column: 9
  13765. }
  13766. }
  13767. },
  13768. loc: {
  13769. start: {
  13770. line: 1,
  13771. column: 0
  13772. },
  13773. end: {
  13774. line: 1,
  13775. column: 9
  13776. }
  13777. }
  13778. }
  13779. ],
  13780. loc: {
  13781. start: {
  13782. line: 1,
  13783. column: 0
  13784. },
  13785. end: {
  13786. line: 1,
  13787. column: 9
  13788. }
  13789. }
  13790. });
  13791. test("x ^ y ^ z", {
  13792. type: "Program",
  13793. body: [
  13794. {
  13795. type: "ExpressionStatement",
  13796. expression: {
  13797. type: "BinaryExpression",
  13798. left: {
  13799. type: "BinaryExpression",
  13800. left: {
  13801. type: "Identifier",
  13802. name: "x",
  13803. loc: {
  13804. start: {
  13805. line: 1,
  13806. column: 0
  13807. },
  13808. end: {
  13809. line: 1,
  13810. column: 1
  13811. }
  13812. }
  13813. },
  13814. operator: "^",
  13815. right: {
  13816. type: "Identifier",
  13817. name: "y",
  13818. loc: {
  13819. start: {
  13820. line: 1,
  13821. column: 4
  13822. },
  13823. end: {
  13824. line: 1,
  13825. column: 5
  13826. }
  13827. }
  13828. },
  13829. loc: {
  13830. start: {
  13831. line: 1,
  13832. column: 0
  13833. },
  13834. end: {
  13835. line: 1,
  13836. column: 5
  13837. }
  13838. }
  13839. },
  13840. operator: "^",
  13841. right: {
  13842. type: "Identifier",
  13843. name: "z",
  13844. loc: {
  13845. start: {
  13846. line: 1,
  13847. column: 8
  13848. },
  13849. end: {
  13850. line: 1,
  13851. column: 9
  13852. }
  13853. }
  13854. },
  13855. loc: {
  13856. start: {
  13857. line: 1,
  13858. column: 0
  13859. },
  13860. end: {
  13861. line: 1,
  13862. column: 9
  13863. }
  13864. }
  13865. },
  13866. loc: {
  13867. start: {
  13868. line: 1,
  13869. column: 0
  13870. },
  13871. end: {
  13872. line: 1,
  13873. column: 9
  13874. }
  13875. }
  13876. }
  13877. ],
  13878. loc: {
  13879. start: {
  13880. line: 1,
  13881. column: 0
  13882. },
  13883. end: {
  13884. line: 1,
  13885. column: 9
  13886. }
  13887. }
  13888. });
  13889. test("x & y | z", {
  13890. type: "Program",
  13891. body: [
  13892. {
  13893. type: "ExpressionStatement",
  13894. expression: {
  13895. type: "BinaryExpression",
  13896. left: {
  13897. type: "BinaryExpression",
  13898. left: {
  13899. type: "Identifier",
  13900. name: "x",
  13901. loc: {
  13902. start: {
  13903. line: 1,
  13904. column: 0
  13905. },
  13906. end: {
  13907. line: 1,
  13908. column: 1
  13909. }
  13910. }
  13911. },
  13912. operator: "&",
  13913. right: {
  13914. type: "Identifier",
  13915. name: "y",
  13916. loc: {
  13917. start: {
  13918. line: 1,
  13919. column: 4
  13920. },
  13921. end: {
  13922. line: 1,
  13923. column: 5
  13924. }
  13925. }
  13926. },
  13927. loc: {
  13928. start: {
  13929. line: 1,
  13930. column: 0
  13931. },
  13932. end: {
  13933. line: 1,
  13934. column: 5
  13935. }
  13936. }
  13937. },
  13938. operator: "|",
  13939. right: {
  13940. type: "Identifier",
  13941. name: "z",
  13942. loc: {
  13943. start: {
  13944. line: 1,
  13945. column: 8
  13946. },
  13947. end: {
  13948. line: 1,
  13949. column: 9
  13950. }
  13951. }
  13952. },
  13953. loc: {
  13954. start: {
  13955. line: 1,
  13956. column: 0
  13957. },
  13958. end: {
  13959. line: 1,
  13960. column: 9
  13961. }
  13962. }
  13963. },
  13964. loc: {
  13965. start: {
  13966. line: 1,
  13967. column: 0
  13968. },
  13969. end: {
  13970. line: 1,
  13971. column: 9
  13972. }
  13973. }
  13974. }
  13975. ],
  13976. loc: {
  13977. start: {
  13978. line: 1,
  13979. column: 0
  13980. },
  13981. end: {
  13982. line: 1,
  13983. column: 9
  13984. }
  13985. }
  13986. });
  13987. test("x | y ^ z", {
  13988. type: "Program",
  13989. body: [
  13990. {
  13991. type: "ExpressionStatement",
  13992. expression: {
  13993. type: "BinaryExpression",
  13994. left: {
  13995. type: "Identifier",
  13996. name: "x",
  13997. loc: {
  13998. start: {
  13999. line: 1,
  14000. column: 0
  14001. },
  14002. end: {
  14003. line: 1,
  14004. column: 1
  14005. }
  14006. }
  14007. },
  14008. operator: "|",
  14009. right: {
  14010. type: "BinaryExpression",
  14011. left: {
  14012. type: "Identifier",
  14013. name: "y",
  14014. loc: {
  14015. start: {
  14016. line: 1,
  14017. column: 4
  14018. },
  14019. end: {
  14020. line: 1,
  14021. column: 5
  14022. }
  14023. }
  14024. },
  14025. operator: "^",
  14026. right: {
  14027. type: "Identifier",
  14028. name: "z",
  14029. loc: {
  14030. start: {
  14031. line: 1,
  14032. column: 8
  14033. },
  14034. end: {
  14035. line: 1,
  14036. column: 9
  14037. }
  14038. }
  14039. },
  14040. loc: {
  14041. start: {
  14042. line: 1,
  14043. column: 4
  14044. },
  14045. end: {
  14046. line: 1,
  14047. column: 9
  14048. }
  14049. }
  14050. },
  14051. loc: {
  14052. start: {
  14053. line: 1,
  14054. column: 0
  14055. },
  14056. end: {
  14057. line: 1,
  14058. column: 9
  14059. }
  14060. }
  14061. },
  14062. loc: {
  14063. start: {
  14064. line: 1,
  14065. column: 0
  14066. },
  14067. end: {
  14068. line: 1,
  14069. column: 9
  14070. }
  14071. }
  14072. }
  14073. ],
  14074. loc: {
  14075. start: {
  14076. line: 1,
  14077. column: 0
  14078. },
  14079. end: {
  14080. line: 1,
  14081. column: 9
  14082. }
  14083. }
  14084. });
  14085. test("x | y & z", {
  14086. type: "Program",
  14087. body: [
  14088. {
  14089. type: "ExpressionStatement",
  14090. expression: {
  14091. type: "BinaryExpression",
  14092. left: {
  14093. type: "Identifier",
  14094. name: "x",
  14095. loc: {
  14096. start: {
  14097. line: 1,
  14098. column: 0
  14099. },
  14100. end: {
  14101. line: 1,
  14102. column: 1
  14103. }
  14104. }
  14105. },
  14106. operator: "|",
  14107. right: {
  14108. type: "BinaryExpression",
  14109. left: {
  14110. type: "Identifier",
  14111. name: "y",
  14112. loc: {
  14113. start: {
  14114. line: 1,
  14115. column: 4
  14116. },
  14117. end: {
  14118. line: 1,
  14119. column: 5
  14120. }
  14121. }
  14122. },
  14123. operator: "&",
  14124. right: {
  14125. type: "Identifier",
  14126. name: "z",
  14127. loc: {
  14128. start: {
  14129. line: 1,
  14130. column: 8
  14131. },
  14132. end: {
  14133. line: 1,
  14134. column: 9
  14135. }
  14136. }
  14137. },
  14138. loc: {
  14139. start: {
  14140. line: 1,
  14141. column: 4
  14142. },
  14143. end: {
  14144. line: 1,
  14145. column: 9
  14146. }
  14147. }
  14148. },
  14149. loc: {
  14150. start: {
  14151. line: 1,
  14152. column: 0
  14153. },
  14154. end: {
  14155. line: 1,
  14156. column: 9
  14157. }
  14158. }
  14159. },
  14160. loc: {
  14161. start: {
  14162. line: 1,
  14163. column: 0
  14164. },
  14165. end: {
  14166. line: 1,
  14167. column: 9
  14168. }
  14169. }
  14170. }
  14171. ],
  14172. loc: {
  14173. start: {
  14174. line: 1,
  14175. column: 0
  14176. },
  14177. end: {
  14178. line: 1,
  14179. column: 9
  14180. }
  14181. }
  14182. });
  14183. test("x || y", {
  14184. type: "Program",
  14185. body: [
  14186. {
  14187. type: "ExpressionStatement",
  14188. expression: {
  14189. type: "LogicalExpression",
  14190. left: {
  14191. type: "Identifier",
  14192. name: "x",
  14193. loc: {
  14194. start: {
  14195. line: 1,
  14196. column: 0
  14197. },
  14198. end: {
  14199. line: 1,
  14200. column: 1
  14201. }
  14202. }
  14203. },
  14204. operator: "||",
  14205. right: {
  14206. type: "Identifier",
  14207. name: "y",
  14208. loc: {
  14209. start: {
  14210. line: 1,
  14211. column: 5
  14212. },
  14213. end: {
  14214. line: 1,
  14215. column: 6
  14216. }
  14217. }
  14218. },
  14219. loc: {
  14220. start: {
  14221. line: 1,
  14222. column: 0
  14223. },
  14224. end: {
  14225. line: 1,
  14226. column: 6
  14227. }
  14228. }
  14229. },
  14230. loc: {
  14231. start: {
  14232. line: 1,
  14233. column: 0
  14234. },
  14235. end: {
  14236. line: 1,
  14237. column: 6
  14238. }
  14239. }
  14240. }
  14241. ],
  14242. loc: {
  14243. start: {
  14244. line: 1,
  14245. column: 0
  14246. },
  14247. end: {
  14248. line: 1,
  14249. column: 6
  14250. }
  14251. }
  14252. });
  14253. test("x && y", {
  14254. type: "Program",
  14255. body: [
  14256. {
  14257. type: "ExpressionStatement",
  14258. expression: {
  14259. type: "LogicalExpression",
  14260. left: {
  14261. type: "Identifier",
  14262. name: "x",
  14263. loc: {
  14264. start: {
  14265. line: 1,
  14266. column: 0
  14267. },
  14268. end: {
  14269. line: 1,
  14270. column: 1
  14271. }
  14272. }
  14273. },
  14274. operator: "&&",
  14275. right: {
  14276. type: "Identifier",
  14277. name: "y",
  14278. loc: {
  14279. start: {
  14280. line: 1,
  14281. column: 5
  14282. },
  14283. end: {
  14284. line: 1,
  14285. column: 6
  14286. }
  14287. }
  14288. },
  14289. loc: {
  14290. start: {
  14291. line: 1,
  14292. column: 0
  14293. },
  14294. end: {
  14295. line: 1,
  14296. column: 6
  14297. }
  14298. }
  14299. },
  14300. loc: {
  14301. start: {
  14302. line: 1,
  14303. column: 0
  14304. },
  14305. end: {
  14306. line: 1,
  14307. column: 6
  14308. }
  14309. }
  14310. }
  14311. ],
  14312. loc: {
  14313. start: {
  14314. line: 1,
  14315. column: 0
  14316. },
  14317. end: {
  14318. line: 1,
  14319. column: 6
  14320. }
  14321. }
  14322. });
  14323. test("x || y || z", {
  14324. type: "Program",
  14325. body: [
  14326. {
  14327. type: "ExpressionStatement",
  14328. expression: {
  14329. type: "LogicalExpression",
  14330. left: {
  14331. type: "LogicalExpression",
  14332. left: {
  14333. type: "Identifier",
  14334. name: "x",
  14335. loc: {
  14336. start: {
  14337. line: 1,
  14338. column: 0
  14339. },
  14340. end: {
  14341. line: 1,
  14342. column: 1
  14343. }
  14344. }
  14345. },
  14346. operator: "||",
  14347. right: {
  14348. type: "Identifier",
  14349. name: "y",
  14350. loc: {
  14351. start: {
  14352. line: 1,
  14353. column: 5
  14354. },
  14355. end: {
  14356. line: 1,
  14357. column: 6
  14358. }
  14359. }
  14360. },
  14361. loc: {
  14362. start: {
  14363. line: 1,
  14364. column: 0
  14365. },
  14366. end: {
  14367. line: 1,
  14368. column: 6
  14369. }
  14370. }
  14371. },
  14372. operator: "||",
  14373. right: {
  14374. type: "Identifier",
  14375. name: "z",
  14376. loc: {
  14377. start: {
  14378. line: 1,
  14379. column: 10
  14380. },
  14381. end: {
  14382. line: 1,
  14383. column: 11
  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. loc: {
  14399. start: {
  14400. line: 1,
  14401. column: 0
  14402. },
  14403. end: {
  14404. line: 1,
  14405. column: 11
  14406. }
  14407. }
  14408. }
  14409. ],
  14410. loc: {
  14411. start: {
  14412. line: 1,
  14413. column: 0
  14414. },
  14415. end: {
  14416. line: 1,
  14417. column: 11
  14418. }
  14419. }
  14420. });
  14421. test("x && y && z", {
  14422. type: "Program",
  14423. body: [
  14424. {
  14425. type: "ExpressionStatement",
  14426. expression: {
  14427. type: "LogicalExpression",
  14428. left: {
  14429. type: "LogicalExpression",
  14430. left: {
  14431. type: "Identifier",
  14432. name: "x",
  14433. loc: {
  14434. start: {
  14435. line: 1,
  14436. column: 0
  14437. },
  14438. end: {
  14439. line: 1,
  14440. column: 1
  14441. }
  14442. }
  14443. },
  14444. operator: "&&",
  14445. right: {
  14446. type: "Identifier",
  14447. name: "y",
  14448. loc: {
  14449. start: {
  14450. line: 1,
  14451. column: 5
  14452. },
  14453. end: {
  14454. line: 1,
  14455. column: 6
  14456. }
  14457. }
  14458. },
  14459. loc: {
  14460. start: {
  14461. line: 1,
  14462. column: 0
  14463. },
  14464. end: {
  14465. line: 1,
  14466. column: 6
  14467. }
  14468. }
  14469. },
  14470. operator: "&&",
  14471. right: {
  14472. type: "Identifier",
  14473. name: "z",
  14474. loc: {
  14475. start: {
  14476. line: 1,
  14477. column: 10
  14478. },
  14479. end: {
  14480. line: 1,
  14481. column: 11
  14482. }
  14483. }
  14484. },
  14485. loc: {
  14486. start: {
  14487. line: 1,
  14488. column: 0
  14489. },
  14490. end: {
  14491. line: 1,
  14492. column: 11
  14493. }
  14494. }
  14495. },
  14496. loc: {
  14497. start: {
  14498. line: 1,
  14499. column: 0
  14500. },
  14501. end: {
  14502. line: 1,
  14503. column: 11
  14504. }
  14505. }
  14506. }
  14507. ],
  14508. loc: {
  14509. start: {
  14510. line: 1,
  14511. column: 0
  14512. },
  14513. end: {
  14514. line: 1,
  14515. column: 11
  14516. }
  14517. }
  14518. });
  14519. test("x || y && z", {
  14520. type: "Program",
  14521. body: [
  14522. {
  14523. type: "ExpressionStatement",
  14524. expression: {
  14525. type: "LogicalExpression",
  14526. left: {
  14527. type: "Identifier",
  14528. name: "x",
  14529. loc: {
  14530. start: {
  14531. line: 1,
  14532. column: 0
  14533. },
  14534. end: {
  14535. line: 1,
  14536. column: 1
  14537. }
  14538. }
  14539. },
  14540. operator: "||",
  14541. right: {
  14542. type: "LogicalExpression",
  14543. left: {
  14544. type: "Identifier",
  14545. name: "y",
  14546. loc: {
  14547. start: {
  14548. line: 1,
  14549. column: 5
  14550. },
  14551. end: {
  14552. line: 1,
  14553. column: 6
  14554. }
  14555. }
  14556. },
  14557. operator: "&&",
  14558. right: {
  14559. type: "Identifier",
  14560. name: "z",
  14561. loc: {
  14562. start: {
  14563. line: 1,
  14564. column: 10
  14565. },
  14566. end: {
  14567. line: 1,
  14568. column: 11
  14569. }
  14570. }
  14571. },
  14572. loc: {
  14573. start: {
  14574. line: 1,
  14575. column: 5
  14576. },
  14577. end: {
  14578. line: 1,
  14579. column: 11
  14580. }
  14581. }
  14582. },
  14583. loc: {
  14584. start: {
  14585. line: 1,
  14586. column: 0
  14587. },
  14588. end: {
  14589. line: 1,
  14590. column: 11
  14591. }
  14592. }
  14593. },
  14594. loc: {
  14595. start: {
  14596. line: 1,
  14597. column: 0
  14598. },
  14599. end: {
  14600. line: 1,
  14601. column: 11
  14602. }
  14603. }
  14604. }
  14605. ],
  14606. loc: {
  14607. start: {
  14608. line: 1,
  14609. column: 0
  14610. },
  14611. end: {
  14612. line: 1,
  14613. column: 11
  14614. }
  14615. }
  14616. });
  14617. test("x || y ^ z", {
  14618. type: "Program",
  14619. body: [
  14620. {
  14621. type: "ExpressionStatement",
  14622. expression: {
  14623. type: "LogicalExpression",
  14624. left: {
  14625. type: "Identifier",
  14626. name: "x",
  14627. loc: {
  14628. start: {
  14629. line: 1,
  14630. column: 0
  14631. },
  14632. end: {
  14633. line: 1,
  14634. column: 1
  14635. }
  14636. }
  14637. },
  14638. operator: "||",
  14639. right: {
  14640. type: "BinaryExpression",
  14641. left: {
  14642. type: "Identifier",
  14643. name: "y",
  14644. loc: {
  14645. start: {
  14646. line: 1,
  14647. column: 5
  14648. },
  14649. end: {
  14650. line: 1,
  14651. column: 6
  14652. }
  14653. }
  14654. },
  14655. operator: "^",
  14656. right: {
  14657. type: "Identifier",
  14658. name: "z",
  14659. loc: {
  14660. start: {
  14661. line: 1,
  14662. column: 9
  14663. },
  14664. end: {
  14665. line: 1,
  14666. column: 10
  14667. }
  14668. }
  14669. },
  14670. loc: {
  14671. start: {
  14672. line: 1,
  14673. column: 5
  14674. },
  14675. end: {
  14676. line: 1,
  14677. column: 10
  14678. }
  14679. }
  14680. },
  14681. loc: {
  14682. start: {
  14683. line: 1,
  14684. column: 0
  14685. },
  14686. end: {
  14687. line: 1,
  14688. column: 10
  14689. }
  14690. }
  14691. },
  14692. loc: {
  14693. start: {
  14694. line: 1,
  14695. column: 0
  14696. },
  14697. end: {
  14698. line: 1,
  14699. column: 10
  14700. }
  14701. }
  14702. }
  14703. ],
  14704. loc: {
  14705. start: {
  14706. line: 1,
  14707. column: 0
  14708. },
  14709. end: {
  14710. line: 1,
  14711. column: 10
  14712. }
  14713. }
  14714. });
  14715. test("y ? 1 : 2", {
  14716. type: "Program",
  14717. body: [
  14718. {
  14719. type: "ExpressionStatement",
  14720. expression: {
  14721. type: "ConditionalExpression",
  14722. test: {
  14723. type: "Identifier",
  14724. name: "y",
  14725. loc: {
  14726. start: {
  14727. line: 1,
  14728. column: 0
  14729. },
  14730. end: {
  14731. line: 1,
  14732. column: 1
  14733. }
  14734. }
  14735. },
  14736. consequent: {
  14737. type: "Literal",
  14738. value: 1,
  14739. loc: {
  14740. start: {
  14741. line: 1,
  14742. column: 4
  14743. },
  14744. end: {
  14745. line: 1,
  14746. column: 5
  14747. }
  14748. }
  14749. },
  14750. alternate: {
  14751. type: "Literal",
  14752. value: 2,
  14753. loc: {
  14754. start: {
  14755. line: 1,
  14756. column: 8
  14757. },
  14758. end: {
  14759. line: 1,
  14760. column: 9
  14761. }
  14762. }
  14763. },
  14764. loc: {
  14765. start: {
  14766. line: 1,
  14767. column: 0
  14768. },
  14769. end: {
  14770. line: 1,
  14771. column: 9
  14772. }
  14773. }
  14774. },
  14775. loc: {
  14776. start: {
  14777. line: 1,
  14778. column: 0
  14779. },
  14780. end: {
  14781. line: 1,
  14782. column: 9
  14783. }
  14784. }
  14785. }
  14786. ],
  14787. loc: {
  14788. start: {
  14789. line: 1,
  14790. column: 0
  14791. },
  14792. end: {
  14793. line: 1,
  14794. column: 9
  14795. }
  14796. }
  14797. });
  14798. test("x && y ? 1 : 2", {
  14799. type: "Program",
  14800. body: [
  14801. {
  14802. type: "ExpressionStatement",
  14803. expression: {
  14804. type: "ConditionalExpression",
  14805. test: {
  14806. type: "LogicalExpression",
  14807. left: {
  14808. type: "Identifier",
  14809. name: "x",
  14810. loc: {
  14811. start: {
  14812. line: 1,
  14813. column: 0
  14814. },
  14815. end: {
  14816. line: 1,
  14817. column: 1
  14818. }
  14819. }
  14820. },
  14821. operator: "&&",
  14822. right: {
  14823. type: "Identifier",
  14824. name: "y",
  14825. loc: {
  14826. start: {
  14827. line: 1,
  14828. column: 5
  14829. },
  14830. end: {
  14831. line: 1,
  14832. column: 6
  14833. }
  14834. }
  14835. },
  14836. loc: {
  14837. start: {
  14838. line: 1,
  14839. column: 0
  14840. },
  14841. end: {
  14842. line: 1,
  14843. column: 6
  14844. }
  14845. }
  14846. },
  14847. consequent: {
  14848. type: "Literal",
  14849. value: 1,
  14850. loc: {
  14851. start: {
  14852. line: 1,
  14853. column: 9
  14854. },
  14855. end: {
  14856. line: 1,
  14857. column: 10
  14858. }
  14859. }
  14860. },
  14861. alternate: {
  14862. type: "Literal",
  14863. value: 2,
  14864. loc: {
  14865. start: {
  14866. line: 1,
  14867. column: 13
  14868. },
  14869. end: {
  14870. line: 1,
  14871. column: 14
  14872. }
  14873. }
  14874. },
  14875. loc: {
  14876. start: {
  14877. line: 1,
  14878. column: 0
  14879. },
  14880. end: {
  14881. line: 1,
  14882. column: 14
  14883. }
  14884. }
  14885. },
  14886. loc: {
  14887. start: {
  14888. line: 1,
  14889. column: 0
  14890. },
  14891. end: {
  14892. line: 1,
  14893. column: 14
  14894. }
  14895. }
  14896. }
  14897. ],
  14898. loc: {
  14899. start: {
  14900. line: 1,
  14901. column: 0
  14902. },
  14903. end: {
  14904. line: 1,
  14905. column: 14
  14906. }
  14907. }
  14908. });
  14909. test("x = 42", {
  14910. type: "Program",
  14911. body: [
  14912. {
  14913. type: "ExpressionStatement",
  14914. expression: {
  14915. type: "AssignmentExpression",
  14916. operator: "=",
  14917. left: {
  14918. type: "Identifier",
  14919. name: "x",
  14920. loc: {
  14921. start: {
  14922. line: 1,
  14923. column: 0
  14924. },
  14925. end: {
  14926. line: 1,
  14927. column: 1
  14928. }
  14929. }
  14930. },
  14931. right: {
  14932. type: "Literal",
  14933. value: 42,
  14934. loc: {
  14935. start: {
  14936. line: 1,
  14937. column: 4
  14938. },
  14939. end: {
  14940. line: 1,
  14941. column: 6
  14942. }
  14943. }
  14944. },
  14945. loc: {
  14946. start: {
  14947. line: 1,
  14948. column: 0
  14949. },
  14950. end: {
  14951. line: 1,
  14952. column: 6
  14953. }
  14954. }
  14955. },
  14956. loc: {
  14957. start: {
  14958. line: 1,
  14959. column: 0
  14960. },
  14961. end: {
  14962. line: 1,
  14963. column: 6
  14964. }
  14965. }
  14966. }
  14967. ],
  14968. loc: {
  14969. start: {
  14970. line: 1,
  14971. column: 0
  14972. },
  14973. end: {
  14974. line: 1,
  14975. column: 6
  14976. }
  14977. }
  14978. });
  14979. test("eval = 42", {
  14980. type: "Program",
  14981. body: [
  14982. {
  14983. type: "ExpressionStatement",
  14984. expression: {
  14985. type: "AssignmentExpression",
  14986. operator: "=",
  14987. left: {
  14988. type: "Identifier",
  14989. name: "eval",
  14990. loc: {
  14991. start: {
  14992. line: 1,
  14993. column: 0
  14994. },
  14995. end: {
  14996. line: 1,
  14997. column: 4
  14998. }
  14999. }
  15000. },
  15001. right: {
  15002. type: "Literal",
  15003. value: 42,
  15004. loc: {
  15005. start: {
  15006. line: 1,
  15007. column: 7
  15008. },
  15009. end: {
  15010. line: 1,
  15011. column: 9
  15012. }
  15013. }
  15014. },
  15015. loc: {
  15016. start: {
  15017. line: 1,
  15018. column: 0
  15019. },
  15020. end: {
  15021. line: 1,
  15022. column: 9
  15023. }
  15024. }
  15025. },
  15026. loc: {
  15027. start: {
  15028. line: 1,
  15029. column: 0
  15030. },
  15031. end: {
  15032. line: 1,
  15033. column: 9
  15034. }
  15035. }
  15036. }
  15037. ],
  15038. loc: {
  15039. start: {
  15040. line: 1,
  15041. column: 0
  15042. },
  15043. end: {
  15044. line: 1,
  15045. column: 9
  15046. }
  15047. }
  15048. });
  15049. test("arguments = 42", {
  15050. type: "Program",
  15051. body: [
  15052. {
  15053. type: "ExpressionStatement",
  15054. expression: {
  15055. type: "AssignmentExpression",
  15056. operator: "=",
  15057. left: {
  15058. type: "Identifier",
  15059. name: "arguments",
  15060. loc: {
  15061. start: {
  15062. line: 1,
  15063. column: 0
  15064. },
  15065. end: {
  15066. line: 1,
  15067. column: 9
  15068. }
  15069. }
  15070. },
  15071. right: {
  15072. type: "Literal",
  15073. value: 42,
  15074. loc: {
  15075. start: {
  15076. line: 1,
  15077. column: 12
  15078. },
  15079. end: {
  15080. line: 1,
  15081. column: 14
  15082. }
  15083. }
  15084. },
  15085. loc: {
  15086. start: {
  15087. line: 1,
  15088. column: 0
  15089. },
  15090. end: {
  15091. line: 1,
  15092. column: 14
  15093. }
  15094. }
  15095. },
  15096. loc: {
  15097. start: {
  15098. line: 1,
  15099. column: 0
  15100. },
  15101. end: {
  15102. line: 1,
  15103. column: 14
  15104. }
  15105. }
  15106. }
  15107. ],
  15108. loc: {
  15109. start: {
  15110. line: 1,
  15111. column: 0
  15112. },
  15113. end: {
  15114. line: 1,
  15115. column: 14
  15116. }
  15117. }
  15118. });
  15119. test("x *= 42", {
  15120. type: "Program",
  15121. body: [
  15122. {
  15123. type: "ExpressionStatement",
  15124. expression: {
  15125. type: "AssignmentExpression",
  15126. operator: "*=",
  15127. left: {
  15128. type: "Identifier",
  15129. name: "x",
  15130. loc: {
  15131. start: {
  15132. line: 1,
  15133. column: 0
  15134. },
  15135. end: {
  15136. line: 1,
  15137. column: 1
  15138. }
  15139. }
  15140. },
  15141. right: {
  15142. type: "Literal",
  15143. value: 42,
  15144. loc: {
  15145. start: {
  15146. line: 1,
  15147. column: 5
  15148. },
  15149. end: {
  15150. line: 1,
  15151. column: 7
  15152. }
  15153. }
  15154. },
  15155. loc: {
  15156. start: {
  15157. line: 1,
  15158. column: 0
  15159. },
  15160. end: {
  15161. line: 1,
  15162. column: 7
  15163. }
  15164. }
  15165. },
  15166. loc: {
  15167. start: {
  15168. line: 1,
  15169. column: 0
  15170. },
  15171. end: {
  15172. line: 1,
  15173. column: 7
  15174. }
  15175. }
  15176. }
  15177. ],
  15178. loc: {
  15179. start: {
  15180. line: 1,
  15181. column: 0
  15182. },
  15183. end: {
  15184. line: 1,
  15185. column: 7
  15186. }
  15187. }
  15188. });
  15189. test("x /= 42", {
  15190. type: "Program",
  15191. body: [
  15192. {
  15193. type: "ExpressionStatement",
  15194. expression: {
  15195. type: "AssignmentExpression",
  15196. operator: "/=",
  15197. left: {
  15198. type: "Identifier",
  15199. name: "x",
  15200. loc: {
  15201. start: {
  15202. line: 1,
  15203. column: 0
  15204. },
  15205. end: {
  15206. line: 1,
  15207. column: 1
  15208. }
  15209. }
  15210. },
  15211. right: {
  15212. type: "Literal",
  15213. value: 42,
  15214. loc: {
  15215. start: {
  15216. line: 1,
  15217. column: 5
  15218. },
  15219. end: {
  15220. line: 1,
  15221. column: 7
  15222. }
  15223. }
  15224. },
  15225. loc: {
  15226. start: {
  15227. line: 1,
  15228. column: 0
  15229. },
  15230. end: {
  15231. line: 1,
  15232. column: 7
  15233. }
  15234. }
  15235. },
  15236. loc: {
  15237. start: {
  15238. line: 1,
  15239. column: 0
  15240. },
  15241. end: {
  15242. line: 1,
  15243. column: 7
  15244. }
  15245. }
  15246. }
  15247. ],
  15248. loc: {
  15249. start: {
  15250. line: 1,
  15251. column: 0
  15252. },
  15253. end: {
  15254. line: 1,
  15255. column: 7
  15256. }
  15257. }
  15258. });
  15259. test("x %= 42", {
  15260. type: "Program",
  15261. body: [
  15262. {
  15263. type: "ExpressionStatement",
  15264. expression: {
  15265. type: "AssignmentExpression",
  15266. operator: "%=",
  15267. left: {
  15268. type: "Identifier",
  15269. name: "x",
  15270. loc: {
  15271. start: {
  15272. line: 1,
  15273. column: 0
  15274. },
  15275. end: {
  15276. line: 1,
  15277. column: 1
  15278. }
  15279. }
  15280. },
  15281. right: {
  15282. type: "Literal",
  15283. value: 42,
  15284. loc: {
  15285. start: {
  15286. line: 1,
  15287. column: 5
  15288. },
  15289. end: {
  15290. line: 1,
  15291. column: 7
  15292. }
  15293. }
  15294. },
  15295. loc: {
  15296. start: {
  15297. line: 1,
  15298. column: 0
  15299. },
  15300. end: {
  15301. line: 1,
  15302. column: 7
  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. loc: {
  15319. start: {
  15320. line: 1,
  15321. column: 0
  15322. },
  15323. end: {
  15324. line: 1,
  15325. column: 7
  15326. }
  15327. }
  15328. });
  15329. test("x += 42", {
  15330. type: "Program",
  15331. body: [
  15332. {
  15333. type: "ExpressionStatement",
  15334. expression: {
  15335. type: "AssignmentExpression",
  15336. operator: "+=",
  15337. left: {
  15338. type: "Identifier",
  15339. name: "x",
  15340. loc: {
  15341. start: {
  15342. line: 1,
  15343. column: 0
  15344. },
  15345. end: {
  15346. line: 1,
  15347. column: 1
  15348. }
  15349. }
  15350. },
  15351. right: {
  15352. type: "Literal",
  15353. value: 42,
  15354. loc: {
  15355. start: {
  15356. line: 1,
  15357. column: 5
  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. loc: {
  15377. start: {
  15378. line: 1,
  15379. column: 0
  15380. },
  15381. end: {
  15382. line: 1,
  15383. column: 7
  15384. }
  15385. }
  15386. }
  15387. ],
  15388. loc: {
  15389. start: {
  15390. line: 1,
  15391. column: 0
  15392. },
  15393. end: {
  15394. line: 1,
  15395. column: 7
  15396. }
  15397. }
  15398. });
  15399. test("x -= 42", {
  15400. type: "Program",
  15401. body: [
  15402. {
  15403. type: "ExpressionStatement",
  15404. expression: {
  15405. type: "AssignmentExpression",
  15406. operator: "-=",
  15407. left: {
  15408. type: "Identifier",
  15409. name: "x",
  15410. loc: {
  15411. start: {
  15412. line: 1,
  15413. column: 0
  15414. },
  15415. end: {
  15416. line: 1,
  15417. column: 1
  15418. }
  15419. }
  15420. },
  15421. right: {
  15422. type: "Literal",
  15423. value: 42,
  15424. loc: {
  15425. start: {
  15426. line: 1,
  15427. column: 5
  15428. },
  15429. end: {
  15430. line: 1,
  15431. column: 7
  15432. }
  15433. }
  15434. },
  15435. loc: {
  15436. start: {
  15437. line: 1,
  15438. column: 0
  15439. },
  15440. end: {
  15441. line: 1,
  15442. column: 7
  15443. }
  15444. }
  15445. },
  15446. loc: {
  15447. start: {
  15448. line: 1,
  15449. column: 0
  15450. },
  15451. end: {
  15452. line: 1,
  15453. column: 7
  15454. }
  15455. }
  15456. }
  15457. ],
  15458. loc: {
  15459. start: {
  15460. line: 1,
  15461. column: 0
  15462. },
  15463. end: {
  15464. line: 1,
  15465. column: 7
  15466. }
  15467. }
  15468. });
  15469. test("x <<= 42", {
  15470. type: "Program",
  15471. body: [
  15472. {
  15473. type: "ExpressionStatement",
  15474. expression: {
  15475. type: "AssignmentExpression",
  15476. operator: "<<=",
  15477. left: {
  15478. type: "Identifier",
  15479. name: "x",
  15480. loc: {
  15481. start: {
  15482. line: 1,
  15483. column: 0
  15484. },
  15485. end: {
  15486. line: 1,
  15487. column: 1
  15488. }
  15489. }
  15490. },
  15491. right: {
  15492. type: "Literal",
  15493. value: 42,
  15494. loc: {
  15495. start: {
  15496. line: 1,
  15497. column: 6
  15498. },
  15499. end: {
  15500. line: 1,
  15501. column: 8
  15502. }
  15503. }
  15504. },
  15505. loc: {
  15506. start: {
  15507. line: 1,
  15508. column: 0
  15509. },
  15510. end: {
  15511. line: 1,
  15512. column: 8
  15513. }
  15514. }
  15515. },
  15516. loc: {
  15517. start: {
  15518. line: 1,
  15519. column: 0
  15520. },
  15521. end: {
  15522. line: 1,
  15523. column: 8
  15524. }
  15525. }
  15526. }
  15527. ],
  15528. loc: {
  15529. start: {
  15530. line: 1,
  15531. column: 0
  15532. },
  15533. end: {
  15534. line: 1,
  15535. column: 8
  15536. }
  15537. }
  15538. });
  15539. test("x >>= 42", {
  15540. type: "Program",
  15541. body: [
  15542. {
  15543. type: "ExpressionStatement",
  15544. expression: {
  15545. type: "AssignmentExpression",
  15546. operator: ">>=",
  15547. left: {
  15548. type: "Identifier",
  15549. name: "x",
  15550. loc: {
  15551. start: {
  15552. line: 1,
  15553. column: 0
  15554. },
  15555. end: {
  15556. line: 1,
  15557. column: 1
  15558. }
  15559. }
  15560. },
  15561. right: {
  15562. type: "Literal",
  15563. value: 42,
  15564. loc: {
  15565. start: {
  15566. line: 1,
  15567. column: 6
  15568. },
  15569. end: {
  15570. line: 1,
  15571. column: 8
  15572. }
  15573. }
  15574. },
  15575. loc: {
  15576. start: {
  15577. line: 1,
  15578. column: 0
  15579. },
  15580. end: {
  15581. line: 1,
  15582. column: 8
  15583. }
  15584. }
  15585. },
  15586. loc: {
  15587. start: {
  15588. line: 1,
  15589. column: 0
  15590. },
  15591. end: {
  15592. line: 1,
  15593. column: 8
  15594. }
  15595. }
  15596. }
  15597. ],
  15598. loc: {
  15599. start: {
  15600. line: 1,
  15601. column: 0
  15602. },
  15603. end: {
  15604. line: 1,
  15605. column: 8
  15606. }
  15607. }
  15608. });
  15609. test("x >>>= 42", {
  15610. type: "Program",
  15611. body: [
  15612. {
  15613. type: "ExpressionStatement",
  15614. expression: {
  15615. type: "AssignmentExpression",
  15616. operator: ">>>=",
  15617. left: {
  15618. type: "Identifier",
  15619. name: "x",
  15620. loc: {
  15621. start: {
  15622. line: 1,
  15623. column: 0
  15624. },
  15625. end: {
  15626. line: 1,
  15627. column: 1
  15628. }
  15629. }
  15630. },
  15631. right: {
  15632. type: "Literal",
  15633. value: 42,
  15634. loc: {
  15635. start: {
  15636. line: 1,
  15637. column: 7
  15638. },
  15639. end: {
  15640. line: 1,
  15641. column: 9
  15642. }
  15643. }
  15644. },
  15645. loc: {
  15646. start: {
  15647. line: 1,
  15648. column: 0
  15649. },
  15650. end: {
  15651. line: 1,
  15652. column: 9
  15653. }
  15654. }
  15655. },
  15656. loc: {
  15657. start: {
  15658. line: 1,
  15659. column: 0
  15660. },
  15661. end: {
  15662. line: 1,
  15663. column: 9
  15664. }
  15665. }
  15666. }
  15667. ],
  15668. loc: {
  15669. start: {
  15670. line: 1,
  15671. column: 0
  15672. },
  15673. end: {
  15674. line: 1,
  15675. column: 9
  15676. }
  15677. }
  15678. });
  15679. test("x &= 42", {
  15680. type: "Program",
  15681. body: [
  15682. {
  15683. type: "ExpressionStatement",
  15684. expression: {
  15685. type: "AssignmentExpression",
  15686. operator: "&=",
  15687. left: {
  15688. type: "Identifier",
  15689. name: "x",
  15690. loc: {
  15691. start: {
  15692. line: 1,
  15693. column: 0
  15694. },
  15695. end: {
  15696. line: 1,
  15697. column: 1
  15698. }
  15699. }
  15700. },
  15701. right: {
  15702. type: "Literal",
  15703. value: 42,
  15704. loc: {
  15705. start: {
  15706. line: 1,
  15707. column: 5
  15708. },
  15709. end: {
  15710. line: 1,
  15711. column: 7
  15712. }
  15713. }
  15714. },
  15715. loc: {
  15716. start: {
  15717. line: 1,
  15718. column: 0
  15719. },
  15720. end: {
  15721. line: 1,
  15722. column: 7
  15723. }
  15724. }
  15725. },
  15726. loc: {
  15727. start: {
  15728. line: 1,
  15729. column: 0
  15730. },
  15731. end: {
  15732. line: 1,
  15733. column: 7
  15734. }
  15735. }
  15736. }
  15737. ],
  15738. loc: {
  15739. start: {
  15740. line: 1,
  15741. column: 0
  15742. },
  15743. end: {
  15744. line: 1,
  15745. column: 7
  15746. }
  15747. }
  15748. });
  15749. test("x ^= 42", {
  15750. type: "Program",
  15751. body: [
  15752. {
  15753. type: "ExpressionStatement",
  15754. expression: {
  15755. type: "AssignmentExpression",
  15756. operator: "^=",
  15757. left: {
  15758. type: "Identifier",
  15759. name: "x",
  15760. loc: {
  15761. start: {
  15762. line: 1,
  15763. column: 0
  15764. },
  15765. end: {
  15766. line: 1,
  15767. column: 1
  15768. }
  15769. }
  15770. },
  15771. right: {
  15772. type: "Literal",
  15773. value: 42,
  15774. loc: {
  15775. start: {
  15776. line: 1,
  15777. column: 5
  15778. },
  15779. end: {
  15780. line: 1,
  15781. column: 7
  15782. }
  15783. }
  15784. },
  15785. loc: {
  15786. start: {
  15787. line: 1,
  15788. column: 0
  15789. },
  15790. end: {
  15791. line: 1,
  15792. column: 7
  15793. }
  15794. }
  15795. },
  15796. loc: {
  15797. start: {
  15798. line: 1,
  15799. column: 0
  15800. },
  15801. end: {
  15802. line: 1,
  15803. column: 7
  15804. }
  15805. }
  15806. }
  15807. ],
  15808. loc: {
  15809. start: {
  15810. line: 1,
  15811. column: 0
  15812. },
  15813. end: {
  15814. line: 1,
  15815. column: 7
  15816. }
  15817. }
  15818. });
  15819. test("x |= 42", {
  15820. type: "Program",
  15821. body: [
  15822. {
  15823. type: "ExpressionStatement",
  15824. expression: {
  15825. type: "AssignmentExpression",
  15826. operator: "|=",
  15827. left: {
  15828. type: "Identifier",
  15829. name: "x",
  15830. loc: {
  15831. start: {
  15832. line: 1,
  15833. column: 0
  15834. },
  15835. end: {
  15836. line: 1,
  15837. column: 1
  15838. }
  15839. }
  15840. },
  15841. right: {
  15842. type: "Literal",
  15843. value: 42,
  15844. loc: {
  15845. start: {
  15846. line: 1,
  15847. column: 5
  15848. },
  15849. end: {
  15850. line: 1,
  15851. column: 7
  15852. }
  15853. }
  15854. },
  15855. loc: {
  15856. start: {
  15857. line: 1,
  15858. column: 0
  15859. },
  15860. end: {
  15861. line: 1,
  15862. column: 7
  15863. }
  15864. }
  15865. },
  15866. loc: {
  15867. start: {
  15868. line: 1,
  15869. column: 0
  15870. },
  15871. end: {
  15872. line: 1,
  15873. column: 7
  15874. }
  15875. }
  15876. }
  15877. ],
  15878. loc: {
  15879. start: {
  15880. line: 1,
  15881. column: 0
  15882. },
  15883. end: {
  15884. line: 1,
  15885. column: 7
  15886. }
  15887. }
  15888. });
  15889. test("{ foo }", {
  15890. type: "Program",
  15891. body: [
  15892. {
  15893. type: "BlockStatement",
  15894. body: [
  15895. {
  15896. type: "ExpressionStatement",
  15897. expression: {
  15898. type: "Identifier",
  15899. name: "foo",
  15900. loc: {
  15901. start: {
  15902. line: 1,
  15903. column: 2
  15904. },
  15905. end: {
  15906. line: 1,
  15907. column: 5
  15908. }
  15909. }
  15910. },
  15911. loc: {
  15912. start: {
  15913. line: 1,
  15914. column: 2
  15915. },
  15916. end: {
  15917. line: 1,
  15918. column: 5
  15919. }
  15920. }
  15921. }
  15922. ],
  15923. loc: {
  15924. start: {
  15925. line: 1,
  15926. column: 0
  15927. },
  15928. end: {
  15929. line: 1,
  15930. column: 7
  15931. }
  15932. }
  15933. }
  15934. ],
  15935. loc: {
  15936. start: {
  15937. line: 1,
  15938. column: 0
  15939. },
  15940. end: {
  15941. line: 1,
  15942. column: 7
  15943. }
  15944. }
  15945. });
  15946. test("{ doThis(); doThat(); }", {
  15947. type: "Program",
  15948. body: [
  15949. {
  15950. type: "BlockStatement",
  15951. body: [
  15952. {
  15953. type: "ExpressionStatement",
  15954. expression: {
  15955. type: "CallExpression",
  15956. callee: {
  15957. type: "Identifier",
  15958. name: "doThis",
  15959. loc: {
  15960. start: {
  15961. line: 1,
  15962. column: 2
  15963. },
  15964. end: {
  15965. line: 1,
  15966. column: 8
  15967. }
  15968. }
  15969. },
  15970. arguments: [],
  15971. loc: {
  15972. start: {
  15973. line: 1,
  15974. column: 2
  15975. },
  15976. end: {
  15977. line: 1,
  15978. column: 10
  15979. }
  15980. }
  15981. },
  15982. loc: {
  15983. start: {
  15984. line: 1,
  15985. column: 2
  15986. },
  15987. end: {
  15988. line: 1,
  15989. column: 11
  15990. }
  15991. }
  15992. },
  15993. {
  15994. type: "ExpressionStatement",
  15995. expression: {
  15996. type: "CallExpression",
  15997. callee: {
  15998. type: "Identifier",
  15999. name: "doThat",
  16000. loc: {
  16001. start: {
  16002. line: 1,
  16003. column: 12
  16004. },
  16005. end: {
  16006. line: 1,
  16007. column: 18
  16008. }
  16009. }
  16010. },
  16011. arguments: [],
  16012. loc: {
  16013. start: {
  16014. line: 1,
  16015. column: 12
  16016. },
  16017. end: {
  16018. line: 1,
  16019. column: 20
  16020. }
  16021. }
  16022. },
  16023. loc: {
  16024. start: {
  16025. line: 1,
  16026. column: 12
  16027. },
  16028. end: {
  16029. line: 1,
  16030. column: 21
  16031. }
  16032. }
  16033. }
  16034. ],
  16035. loc: {
  16036. start: {
  16037. line: 1,
  16038. column: 0
  16039. },
  16040. end: {
  16041. line: 1,
  16042. column: 23
  16043. }
  16044. }
  16045. }
  16046. ],
  16047. loc: {
  16048. start: {
  16049. line: 1,
  16050. column: 0
  16051. },
  16052. end: {
  16053. line: 1,
  16054. column: 23
  16055. }
  16056. }
  16057. });
  16058. test("{}", {
  16059. type: "Program",
  16060. body: [
  16061. {
  16062. type: "BlockStatement",
  16063. body: [],
  16064. loc: {
  16065. start: {
  16066. line: 1,
  16067. column: 0
  16068. },
  16069. end: {
  16070. line: 1,
  16071. column: 2
  16072. }
  16073. }
  16074. }
  16075. ],
  16076. loc: {
  16077. start: {
  16078. line: 1,
  16079. column: 0
  16080. },
  16081. end: {
  16082. line: 1,
  16083. column: 2
  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. test("var await", {
  16147. type: "Program",
  16148. body: [
  16149. {
  16150. type: "VariableDeclaration",
  16151. declarations: [
  16152. {
  16153. type: "VariableDeclarator",
  16154. id: {
  16155. type: "Identifier",
  16156. name: "await",
  16157. loc: {
  16158. start: {
  16159. line: 1,
  16160. column: 4
  16161. },
  16162. end: {
  16163. line: 1,
  16164. column: 9
  16165. }
  16166. }
  16167. },
  16168. init: null,
  16169. loc: {
  16170. start: {
  16171. line: 1,
  16172. column: 4
  16173. },
  16174. end: {
  16175. line: 1,
  16176. column: 9
  16177. }
  16178. }
  16179. }
  16180. ],
  16181. kind: "var",
  16182. loc: {
  16183. start: {
  16184. line: 1,
  16185. column: 0
  16186. },
  16187. end: {
  16188. line: 1,
  16189. column: 9
  16190. }
  16191. }
  16192. }
  16193. ],
  16194. loc: {
  16195. start: {
  16196. line: 1,
  16197. column: 0
  16198. },
  16199. end: {
  16200. line: 1,
  16201. column: 9
  16202. }
  16203. }
  16204. });
  16205. test("var x, y;", {
  16206. type: "Program",
  16207. body: [
  16208. {
  16209. type: "VariableDeclaration",
  16210. declarations: [
  16211. {
  16212. type: "VariableDeclarator",
  16213. id: {
  16214. type: "Identifier",
  16215. name: "x",
  16216. loc: {
  16217. start: {
  16218. line: 1,
  16219. column: 4
  16220. },
  16221. end: {
  16222. line: 1,
  16223. column: 5
  16224. }
  16225. }
  16226. },
  16227. init: null,
  16228. loc: {
  16229. start: {
  16230. line: 1,
  16231. column: 4
  16232. },
  16233. end: {
  16234. line: 1,
  16235. column: 5
  16236. }
  16237. }
  16238. },
  16239. {
  16240. type: "VariableDeclarator",
  16241. id: {
  16242. type: "Identifier",
  16243. name: "y",
  16244. loc: {
  16245. start: {
  16246. line: 1,
  16247. column: 7
  16248. },
  16249. end: {
  16250. line: 1,
  16251. column: 8
  16252. }
  16253. }
  16254. },
  16255. init: null,
  16256. loc: {
  16257. start: {
  16258. line: 1,
  16259. column: 7
  16260. },
  16261. end: {
  16262. line: 1,
  16263. column: 8
  16264. }
  16265. }
  16266. }
  16267. ],
  16268. kind: "var",
  16269. loc: {
  16270. start: {
  16271. line: 1,
  16272. column: 0
  16273. },
  16274. end: {
  16275. line: 1,
  16276. column: 9
  16277. }
  16278. }
  16279. }
  16280. ],
  16281. loc: {
  16282. start: {
  16283. line: 1,
  16284. column: 0
  16285. },
  16286. end: {
  16287. line: 1,
  16288. column: 9
  16289. }
  16290. }
  16291. });
  16292. test("var x = 42", {
  16293. type: "Program",
  16294. body: [
  16295. {
  16296. type: "VariableDeclaration",
  16297. declarations: [
  16298. {
  16299. type: "VariableDeclarator",
  16300. id: {
  16301. type: "Identifier",
  16302. name: "x",
  16303. loc: {
  16304. start: {
  16305. line: 1,
  16306. column: 4
  16307. },
  16308. end: {
  16309. line: 1,
  16310. column: 5
  16311. }
  16312. }
  16313. },
  16314. init: {
  16315. type: "Literal",
  16316. value: 42,
  16317. loc: {
  16318. start: {
  16319. line: 1,
  16320. column: 8
  16321. },
  16322. end: {
  16323. line: 1,
  16324. column: 10
  16325. }
  16326. }
  16327. },
  16328. loc: {
  16329. start: {
  16330. line: 1,
  16331. column: 4
  16332. },
  16333. end: {
  16334. line: 1,
  16335. column: 10
  16336. }
  16337. }
  16338. }
  16339. ],
  16340. kind: "var",
  16341. loc: {
  16342. start: {
  16343. line: 1,
  16344. column: 0
  16345. },
  16346. end: {
  16347. line: 1,
  16348. column: 10
  16349. }
  16350. }
  16351. }
  16352. ],
  16353. loc: {
  16354. start: {
  16355. line: 1,
  16356. column: 0
  16357. },
  16358. end: {
  16359. line: 1,
  16360. column: 10
  16361. }
  16362. }
  16363. });
  16364. test("var eval = 42, arguments = 42", {
  16365. type: "Program",
  16366. body: [
  16367. {
  16368. type: "VariableDeclaration",
  16369. declarations: [
  16370. {
  16371. type: "VariableDeclarator",
  16372. id: {
  16373. type: "Identifier",
  16374. name: "eval",
  16375. loc: {
  16376. start: {
  16377. line: 1,
  16378. column: 4
  16379. },
  16380. end: {
  16381. line: 1,
  16382. column: 8
  16383. }
  16384. }
  16385. },
  16386. init: {
  16387. type: "Literal",
  16388. value: 42,
  16389. loc: {
  16390. start: {
  16391. line: 1,
  16392. column: 11
  16393. },
  16394. end: {
  16395. line: 1,
  16396. column: 13
  16397. }
  16398. }
  16399. },
  16400. loc: {
  16401. start: {
  16402. line: 1,
  16403. column: 4
  16404. },
  16405. end: {
  16406. line: 1,
  16407. column: 13
  16408. }
  16409. }
  16410. },
  16411. {
  16412. type: "VariableDeclarator",
  16413. id: {
  16414. type: "Identifier",
  16415. name: "arguments",
  16416. loc: {
  16417. start: {
  16418. line: 1,
  16419. column: 15
  16420. },
  16421. end: {
  16422. line: 1,
  16423. column: 24
  16424. }
  16425. }
  16426. },
  16427. init: {
  16428. type: "Literal",
  16429. value: 42,
  16430. loc: {
  16431. start: {
  16432. line: 1,
  16433. column: 27
  16434. },
  16435. end: {
  16436. line: 1,
  16437. column: 29
  16438. }
  16439. }
  16440. },
  16441. loc: {
  16442. start: {
  16443. line: 1,
  16444. column: 15
  16445. },
  16446. end: {
  16447. line: 1,
  16448. column: 29
  16449. }
  16450. }
  16451. }
  16452. ],
  16453. kind: "var",
  16454. loc: {
  16455. start: {
  16456. line: 1,
  16457. column: 0
  16458. },
  16459. end: {
  16460. line: 1,
  16461. column: 29
  16462. }
  16463. }
  16464. }
  16465. ],
  16466. loc: {
  16467. start: {
  16468. line: 1,
  16469. column: 0
  16470. },
  16471. end: {
  16472. line: 1,
  16473. column: 29
  16474. }
  16475. }
  16476. });
  16477. test("var x = 14, y = 3, z = 1977", {
  16478. type: "Program",
  16479. body: [
  16480. {
  16481. type: "VariableDeclaration",
  16482. declarations: [
  16483. {
  16484. type: "VariableDeclarator",
  16485. id: {
  16486. type: "Identifier",
  16487. name: "x",
  16488. loc: {
  16489. start: {
  16490. line: 1,
  16491. column: 4
  16492. },
  16493. end: {
  16494. line: 1,
  16495. column: 5
  16496. }
  16497. }
  16498. },
  16499. init: {
  16500. type: "Literal",
  16501. value: 14,
  16502. loc: {
  16503. start: {
  16504. line: 1,
  16505. column: 8
  16506. },
  16507. end: {
  16508. line: 1,
  16509. column: 10
  16510. }
  16511. }
  16512. },
  16513. loc: {
  16514. start: {
  16515. line: 1,
  16516. column: 4
  16517. },
  16518. end: {
  16519. line: 1,
  16520. column: 10
  16521. }
  16522. }
  16523. },
  16524. {
  16525. type: "VariableDeclarator",
  16526. id: {
  16527. type: "Identifier",
  16528. name: "y",
  16529. loc: {
  16530. start: {
  16531. line: 1,
  16532. column: 12
  16533. },
  16534. end: {
  16535. line: 1,
  16536. column: 13
  16537. }
  16538. }
  16539. },
  16540. init: {
  16541. type: "Literal",
  16542. value: 3,
  16543. loc: {
  16544. start: {
  16545. line: 1,
  16546. column: 16
  16547. },
  16548. end: {
  16549. line: 1,
  16550. column: 17
  16551. }
  16552. }
  16553. },
  16554. loc: {
  16555. start: {
  16556. line: 1,
  16557. column: 12
  16558. },
  16559. end: {
  16560. line: 1,
  16561. column: 17
  16562. }
  16563. }
  16564. },
  16565. {
  16566. type: "VariableDeclarator",
  16567. id: {
  16568. type: "Identifier",
  16569. name: "z",
  16570. loc: {
  16571. start: {
  16572. line: 1,
  16573. column: 19
  16574. },
  16575. end: {
  16576. line: 1,
  16577. column: 20
  16578. }
  16579. }
  16580. },
  16581. init: {
  16582. type: "Literal",
  16583. value: 1977,
  16584. loc: {
  16585. start: {
  16586. line: 1,
  16587. column: 23
  16588. },
  16589. end: {
  16590. line: 1,
  16591. column: 27
  16592. }
  16593. }
  16594. },
  16595. loc: {
  16596. start: {
  16597. line: 1,
  16598. column: 19
  16599. },
  16600. end: {
  16601. line: 1,
  16602. column: 27
  16603. }
  16604. }
  16605. }
  16606. ],
  16607. kind: "var",
  16608. loc: {
  16609. start: {
  16610. line: 1,
  16611. column: 0
  16612. },
  16613. end: {
  16614. line: 1,
  16615. column: 27
  16616. }
  16617. }
  16618. }
  16619. ],
  16620. loc: {
  16621. start: {
  16622. line: 1,
  16623. column: 0
  16624. },
  16625. end: {
  16626. line: 1,
  16627. column: 27
  16628. }
  16629. }
  16630. });
  16631. test("var implements, interface, package", {
  16632. type: "Program",
  16633. body: [
  16634. {
  16635. type: "VariableDeclaration",
  16636. declarations: [
  16637. {
  16638. type: "VariableDeclarator",
  16639. id: {
  16640. type: "Identifier",
  16641. name: "implements",
  16642. loc: {
  16643. start: {
  16644. line: 1,
  16645. column: 4
  16646. },
  16647. end: {
  16648. line: 1,
  16649. column: 14
  16650. }
  16651. }
  16652. },
  16653. init: null,
  16654. loc: {
  16655. start: {
  16656. line: 1,
  16657. column: 4
  16658. },
  16659. end: {
  16660. line: 1,
  16661. column: 14
  16662. }
  16663. }
  16664. },
  16665. {
  16666. type: "VariableDeclarator",
  16667. id: {
  16668. type: "Identifier",
  16669. name: "interface",
  16670. loc: {
  16671. start: {
  16672. line: 1,
  16673. column: 16
  16674. },
  16675. end: {
  16676. line: 1,
  16677. column: 25
  16678. }
  16679. }
  16680. },
  16681. init: null,
  16682. loc: {
  16683. start: {
  16684. line: 1,
  16685. column: 16
  16686. },
  16687. end: {
  16688. line: 1,
  16689. column: 25
  16690. }
  16691. }
  16692. },
  16693. {
  16694. type: "VariableDeclarator",
  16695. id: {
  16696. type: "Identifier",
  16697. name: "package",
  16698. loc: {
  16699. start: {
  16700. line: 1,
  16701. column: 27
  16702. },
  16703. end: {
  16704. line: 1,
  16705. column: 34
  16706. }
  16707. }
  16708. },
  16709. init: null,
  16710. loc: {
  16711. start: {
  16712. line: 1,
  16713. column: 27
  16714. },
  16715. end: {
  16716. line: 1,
  16717. column: 34
  16718. }
  16719. }
  16720. }
  16721. ],
  16722. kind: "var",
  16723. loc: {
  16724. start: {
  16725. line: 1,
  16726. column: 0
  16727. },
  16728. end: {
  16729. line: 1,
  16730. column: 34
  16731. }
  16732. }
  16733. }
  16734. ],
  16735. loc: {
  16736. start: {
  16737. line: 1,
  16738. column: 0
  16739. },
  16740. end: {
  16741. line: 1,
  16742. column: 34
  16743. }
  16744. }
  16745. });
  16746. test("var private, protected, public, static", {
  16747. type: "Program",
  16748. body: [
  16749. {
  16750. type: "VariableDeclaration",
  16751. declarations: [
  16752. {
  16753. type: "VariableDeclarator",
  16754. id: {
  16755. type: "Identifier",
  16756. name: "private",
  16757. loc: {
  16758. start: {
  16759. line: 1,
  16760. column: 4
  16761. },
  16762. end: {
  16763. line: 1,
  16764. column: 11
  16765. }
  16766. }
  16767. },
  16768. init: null,
  16769. loc: {
  16770. start: {
  16771. line: 1,
  16772. column: 4
  16773. },
  16774. end: {
  16775. line: 1,
  16776. column: 11
  16777. }
  16778. }
  16779. },
  16780. {
  16781. type: "VariableDeclarator",
  16782. id: {
  16783. type: "Identifier",
  16784. name: "protected",
  16785. loc: {
  16786. start: {
  16787. line: 1,
  16788. column: 13
  16789. },
  16790. end: {
  16791. line: 1,
  16792. column: 22
  16793. }
  16794. }
  16795. },
  16796. init: null,
  16797. loc: {
  16798. start: {
  16799. line: 1,
  16800. column: 13
  16801. },
  16802. end: {
  16803. line: 1,
  16804. column: 22
  16805. }
  16806. }
  16807. },
  16808. {
  16809. type: "VariableDeclarator",
  16810. id: {
  16811. type: "Identifier",
  16812. name: "public",
  16813. loc: {
  16814. start: {
  16815. line: 1,
  16816. column: 24
  16817. },
  16818. end: {
  16819. line: 1,
  16820. column: 30
  16821. }
  16822. }
  16823. },
  16824. init: null,
  16825. loc: {
  16826. start: {
  16827. line: 1,
  16828. column: 24
  16829. },
  16830. end: {
  16831. line: 1,
  16832. column: 30
  16833. }
  16834. }
  16835. },
  16836. {
  16837. type: "VariableDeclarator",
  16838. id: {
  16839. type: "Identifier",
  16840. name: "static",
  16841. loc: {
  16842. start: {
  16843. line: 1,
  16844. column: 32
  16845. },
  16846. end: {
  16847. line: 1,
  16848. column: 38
  16849. }
  16850. }
  16851. },
  16852. init: null,
  16853. loc: {
  16854. start: {
  16855. line: 1,
  16856. column: 32
  16857. },
  16858. end: {
  16859. line: 1,
  16860. column: 38
  16861. }
  16862. }
  16863. }
  16864. ],
  16865. kind: "var",
  16866. loc: {
  16867. start: {
  16868. line: 1,
  16869. column: 0
  16870. },
  16871. end: {
  16872. line: 1,
  16873. column: 38
  16874. }
  16875. }
  16876. }
  16877. ],
  16878. loc: {
  16879. start: {
  16880. line: 1,
  16881. column: 0
  16882. },
  16883. end: {
  16884. line: 1,
  16885. column: 38
  16886. }
  16887. }
  16888. });
  16889. test(";", {
  16890. type: "Program",
  16891. body: [
  16892. {
  16893. type: "EmptyStatement",
  16894. loc: {
  16895. start: {
  16896. line: 1,
  16897. column: 0
  16898. },
  16899. end: {
  16900. line: 1,
  16901. column: 1
  16902. }
  16903. }
  16904. }
  16905. ],
  16906. loc: {
  16907. start: {
  16908. line: 1,
  16909. column: 0
  16910. },
  16911. end: {
  16912. line: 1,
  16913. column: 1
  16914. }
  16915. }
  16916. });
  16917. test("x", {
  16918. type: "Program",
  16919. body: [
  16920. {
  16921. type: "ExpressionStatement",
  16922. expression: {
  16923. type: "Identifier",
  16924. name: "x",
  16925. loc: {
  16926. start: {
  16927. line: 1,
  16928. column: 0
  16929. },
  16930. end: {
  16931. line: 1,
  16932. column: 1
  16933. }
  16934. }
  16935. },
  16936. loc: {
  16937. start: {
  16938. line: 1,
  16939. column: 0
  16940. },
  16941. end: {
  16942. line: 1,
  16943. column: 1
  16944. }
  16945. }
  16946. }
  16947. ],
  16948. loc: {
  16949. start: {
  16950. line: 1,
  16951. column: 0
  16952. },
  16953. end: {
  16954. line: 1,
  16955. column: 1
  16956. }
  16957. }
  16958. });
  16959. test("x, y", {
  16960. type: "Program",
  16961. body: [
  16962. {
  16963. type: "ExpressionStatement",
  16964. expression: {
  16965. type: "SequenceExpression",
  16966. expressions: [
  16967. {
  16968. type: "Identifier",
  16969. name: "x",
  16970. loc: {
  16971. start: {
  16972. line: 1,
  16973. column: 0
  16974. },
  16975. end: {
  16976. line: 1,
  16977. column: 1
  16978. }
  16979. }
  16980. },
  16981. {
  16982. type: "Identifier",
  16983. name: "y",
  16984. loc: {
  16985. start: {
  16986. line: 1,
  16987. column: 3
  16988. },
  16989. end: {
  16990. line: 1,
  16991. column: 4
  16992. }
  16993. }
  16994. }
  16995. ],
  16996. loc: {
  16997. start: {
  16998. line: 1,
  16999. column: 0
  17000. },
  17001. end: {
  17002. line: 1,
  17003. column: 4
  17004. }
  17005. }
  17006. },
  17007. loc: {
  17008. start: {
  17009. line: 1,
  17010. column: 0
  17011. },
  17012. end: {
  17013. line: 1,
  17014. column: 4
  17015. }
  17016. }
  17017. }
  17018. ],
  17019. loc: {
  17020. start: {
  17021. line: 1,
  17022. column: 0
  17023. },
  17024. end: {
  17025. line: 1,
  17026. column: 4
  17027. }
  17028. }
  17029. });
  17030. test("\\u0061", {
  17031. type: "Program",
  17032. body: [
  17033. {
  17034. type: "ExpressionStatement",
  17035. expression: {
  17036. type: "Identifier",
  17037. name: "a",
  17038. loc: {
  17039. start: {
  17040. line: 1,
  17041. column: 0
  17042. },
  17043. end: {
  17044. line: 1,
  17045. column: 6
  17046. }
  17047. }
  17048. },
  17049. loc: {
  17050. start: {
  17051. line: 1,
  17052. column: 0
  17053. },
  17054. end: {
  17055. line: 1,
  17056. column: 6
  17057. }
  17058. }
  17059. }
  17060. ],
  17061. loc: {
  17062. start: {
  17063. line: 1,
  17064. column: 0
  17065. },
  17066. end: {
  17067. line: 1,
  17068. column: 6
  17069. }
  17070. }
  17071. });
  17072. test("a\\u0061", {
  17073. type: "Program",
  17074. body: [
  17075. {
  17076. type: "ExpressionStatement",
  17077. expression: {
  17078. type: "Identifier",
  17079. name: "aa",
  17080. loc: {
  17081. start: {
  17082. line: 1,
  17083. column: 0
  17084. },
  17085. end: {
  17086. line: 1,
  17087. column: 7
  17088. }
  17089. }
  17090. },
  17091. loc: {
  17092. start: {
  17093. line: 1,
  17094. column: 0
  17095. },
  17096. end: {
  17097. line: 1,
  17098. column: 7
  17099. }
  17100. }
  17101. }
  17102. ],
  17103. loc: {
  17104. start: {
  17105. line: 1,
  17106. column: 0
  17107. },
  17108. end: {
  17109. line: 1,
  17110. column: 7
  17111. }
  17112. }
  17113. });
  17114. test("if (morning) goodMorning()", {
  17115. type: "Program",
  17116. body: [
  17117. {
  17118. type: "IfStatement",
  17119. test: {
  17120. type: "Identifier",
  17121. name: "morning",
  17122. loc: {
  17123. start: {
  17124. line: 1,
  17125. column: 4
  17126. },
  17127. end: {
  17128. line: 1,
  17129. column: 11
  17130. }
  17131. }
  17132. },
  17133. consequent: {
  17134. type: "ExpressionStatement",
  17135. expression: {
  17136. type: "CallExpression",
  17137. callee: {
  17138. type: "Identifier",
  17139. name: "goodMorning",
  17140. loc: {
  17141. start: {
  17142. line: 1,
  17143. column: 13
  17144. },
  17145. end: {
  17146. line: 1,
  17147. column: 24
  17148. }
  17149. }
  17150. },
  17151. arguments: [],
  17152. loc: {
  17153. start: {
  17154. line: 1,
  17155. column: 13
  17156. },
  17157. end: {
  17158. line: 1,
  17159. column: 26
  17160. }
  17161. }
  17162. },
  17163. loc: {
  17164. start: {
  17165. line: 1,
  17166. column: 13
  17167. },
  17168. end: {
  17169. line: 1,
  17170. column: 26
  17171. }
  17172. }
  17173. },
  17174. alternate: null,
  17175. loc: {
  17176. start: {
  17177. line: 1,
  17178. column: 0
  17179. },
  17180. end: {
  17181. line: 1,
  17182. column: 26
  17183. }
  17184. }
  17185. }
  17186. ],
  17187. loc: {
  17188. start: {
  17189. line: 1,
  17190. column: 0
  17191. },
  17192. end: {
  17193. line: 1,
  17194. column: 26
  17195. }
  17196. }
  17197. });
  17198. test("if (morning) (function(){})", {
  17199. type: "Program",
  17200. body: [
  17201. {
  17202. type: "IfStatement",
  17203. test: {
  17204. type: "Identifier",
  17205. name: "morning",
  17206. loc: {
  17207. start: {
  17208. line: 1,
  17209. column: 4
  17210. },
  17211. end: {
  17212. line: 1,
  17213. column: 11
  17214. }
  17215. }
  17216. },
  17217. consequent: {
  17218. type: "ExpressionStatement",
  17219. expression: {
  17220. type: "FunctionExpression",
  17221. id: null,
  17222. params: [],
  17223. body: {
  17224. type: "BlockStatement",
  17225. body: [],
  17226. loc: {
  17227. start: {
  17228. line: 1,
  17229. column: 24
  17230. },
  17231. end: {
  17232. line: 1,
  17233. column: 26
  17234. }
  17235. }
  17236. },
  17237. loc: {
  17238. start: {
  17239. line: 1,
  17240. column: 14
  17241. },
  17242. end: {
  17243. line: 1,
  17244. column: 26
  17245. }
  17246. }
  17247. },
  17248. loc: {
  17249. start: {
  17250. line: 1,
  17251. column: 13
  17252. },
  17253. end: {
  17254. line: 1,
  17255. column: 27
  17256. }
  17257. }
  17258. },
  17259. alternate: null,
  17260. loc: {
  17261. start: {
  17262. line: 1,
  17263. column: 0
  17264. },
  17265. end: {
  17266. line: 1,
  17267. column: 27
  17268. }
  17269. }
  17270. }
  17271. ],
  17272. loc: {
  17273. start: {
  17274. line: 1,
  17275. column: 0
  17276. },
  17277. end: {
  17278. line: 1,
  17279. column: 27
  17280. }
  17281. }
  17282. });
  17283. test("if (morning) var x = 0;", {
  17284. type: "Program",
  17285. body: [
  17286. {
  17287. type: "IfStatement",
  17288. test: {
  17289. type: "Identifier",
  17290. name: "morning",
  17291. loc: {
  17292. start: {
  17293. line: 1,
  17294. column: 4
  17295. },
  17296. end: {
  17297. line: 1,
  17298. column: 11
  17299. }
  17300. }
  17301. },
  17302. consequent: {
  17303. type: "VariableDeclaration",
  17304. declarations: [
  17305. {
  17306. type: "VariableDeclarator",
  17307. id: {
  17308. type: "Identifier",
  17309. name: "x",
  17310. loc: {
  17311. start: {
  17312. line: 1,
  17313. column: 17
  17314. },
  17315. end: {
  17316. line: 1,
  17317. column: 18
  17318. }
  17319. }
  17320. },
  17321. init: {
  17322. type: "Literal",
  17323. value: 0,
  17324. loc: {
  17325. start: {
  17326. line: 1,
  17327. column: 21
  17328. },
  17329. end: {
  17330. line: 1,
  17331. column: 22
  17332. }
  17333. }
  17334. },
  17335. loc: {
  17336. start: {
  17337. line: 1,
  17338. column: 17
  17339. },
  17340. end: {
  17341. line: 1,
  17342. column: 22
  17343. }
  17344. }
  17345. }
  17346. ],
  17347. kind: "var",
  17348. loc: {
  17349. start: {
  17350. line: 1,
  17351. column: 13
  17352. },
  17353. end: {
  17354. line: 1,
  17355. column: 23
  17356. }
  17357. }
  17358. },
  17359. alternate: null,
  17360. loc: {
  17361. start: {
  17362. line: 1,
  17363. column: 0
  17364. },
  17365. end: {
  17366. line: 1,
  17367. column: 23
  17368. }
  17369. }
  17370. }
  17371. ],
  17372. loc: {
  17373. start: {
  17374. line: 1,
  17375. column: 0
  17376. },
  17377. end: {
  17378. line: 1,
  17379. column: 23
  17380. }
  17381. }
  17382. });
  17383. test("if (morning) function a(){}", {
  17384. type: "Program",
  17385. body: [
  17386. {
  17387. type: "IfStatement",
  17388. test: {
  17389. type: "Identifier",
  17390. name: "morning",
  17391. loc: {
  17392. start: {
  17393. line: 1,
  17394. column: 4
  17395. },
  17396. end: {
  17397. line: 1,
  17398. column: 11
  17399. }
  17400. }
  17401. },
  17402. consequent: {
  17403. type: "FunctionDeclaration",
  17404. id: {
  17405. type: "Identifier",
  17406. name: "a",
  17407. loc: {
  17408. start: {
  17409. line: 1,
  17410. column: 22
  17411. },
  17412. end: {
  17413. line: 1,
  17414. column: 23
  17415. }
  17416. }
  17417. },
  17418. params: [],
  17419. body: {
  17420. type: "BlockStatement",
  17421. body: [],
  17422. loc: {
  17423. start: {
  17424. line: 1,
  17425. column: 25
  17426. },
  17427. end: {
  17428. line: 1,
  17429. column: 27
  17430. }
  17431. }
  17432. },
  17433. loc: {
  17434. start: {
  17435. line: 1,
  17436. column: 13
  17437. },
  17438. end: {
  17439. line: 1,
  17440. column: 27
  17441. }
  17442. }
  17443. },
  17444. alternate: null,
  17445. loc: {
  17446. start: {
  17447. line: 1,
  17448. column: 0
  17449. },
  17450. end: {
  17451. line: 1,
  17452. column: 27
  17453. }
  17454. }
  17455. }
  17456. ],
  17457. loc: {
  17458. start: {
  17459. line: 1,
  17460. column: 0
  17461. },
  17462. end: {
  17463. line: 1,
  17464. column: 27
  17465. }
  17466. }
  17467. });
  17468. test("if (morning) goodMorning(); else goodDay()", {
  17469. type: "Program",
  17470. body: [
  17471. {
  17472. type: "IfStatement",
  17473. test: {
  17474. type: "Identifier",
  17475. name: "morning",
  17476. loc: {
  17477. start: {
  17478. line: 1,
  17479. column: 4
  17480. },
  17481. end: {
  17482. line: 1,
  17483. column: 11
  17484. }
  17485. }
  17486. },
  17487. consequent: {
  17488. type: "ExpressionStatement",
  17489. expression: {
  17490. type: "CallExpression",
  17491. callee: {
  17492. type: "Identifier",
  17493. name: "goodMorning",
  17494. loc: {
  17495. start: {
  17496. line: 1,
  17497. column: 13
  17498. },
  17499. end: {
  17500. line: 1,
  17501. column: 24
  17502. }
  17503. }
  17504. },
  17505. arguments: [],
  17506. loc: {
  17507. start: {
  17508. line: 1,
  17509. column: 13
  17510. },
  17511. end: {
  17512. line: 1,
  17513. column: 26
  17514. }
  17515. }
  17516. },
  17517. loc: {
  17518. start: {
  17519. line: 1,
  17520. column: 13
  17521. },
  17522. end: {
  17523. line: 1,
  17524. column: 27
  17525. }
  17526. }
  17527. },
  17528. alternate: {
  17529. type: "ExpressionStatement",
  17530. expression: {
  17531. type: "CallExpression",
  17532. callee: {
  17533. type: "Identifier",
  17534. name: "goodDay",
  17535. loc: {
  17536. start: {
  17537. line: 1,
  17538. column: 33
  17539. },
  17540. end: {
  17541. line: 1,
  17542. column: 40
  17543. }
  17544. }
  17545. },
  17546. arguments: [],
  17547. loc: {
  17548. start: {
  17549. line: 1,
  17550. column: 33
  17551. },
  17552. end: {
  17553. line: 1,
  17554. column: 42
  17555. }
  17556. }
  17557. },
  17558. loc: {
  17559. start: {
  17560. line: 1,
  17561. column: 33
  17562. },
  17563. end: {
  17564. line: 1,
  17565. column: 42
  17566. }
  17567. }
  17568. },
  17569. loc: {
  17570. start: {
  17571. line: 1,
  17572. column: 0
  17573. },
  17574. end: {
  17575. line: 1,
  17576. column: 42
  17577. }
  17578. }
  17579. }
  17580. ],
  17581. loc: {
  17582. start: {
  17583. line: 1,
  17584. column: 0
  17585. },
  17586. end: {
  17587. line: 1,
  17588. column: 42
  17589. }
  17590. }
  17591. });
  17592. test("do keep(); while (true)", {
  17593. type: "Program",
  17594. body: [
  17595. {
  17596. type: "DoWhileStatement",
  17597. body: {
  17598. type: "ExpressionStatement",
  17599. expression: {
  17600. type: "CallExpression",
  17601. callee: {
  17602. type: "Identifier",
  17603. name: "keep",
  17604. loc: {
  17605. start: {
  17606. line: 1,
  17607. column: 3
  17608. },
  17609. end: {
  17610. line: 1,
  17611. column: 7
  17612. }
  17613. }
  17614. },
  17615. arguments: [],
  17616. loc: {
  17617. start: {
  17618. line: 1,
  17619. column: 3
  17620. },
  17621. end: {
  17622. line: 1,
  17623. column: 9
  17624. }
  17625. }
  17626. },
  17627. loc: {
  17628. start: {
  17629. line: 1,
  17630. column: 3
  17631. },
  17632. end: {
  17633. line: 1,
  17634. column: 10
  17635. }
  17636. }
  17637. },
  17638. test: {
  17639. type: "Literal",
  17640. value: true,
  17641. loc: {
  17642. start: {
  17643. line: 1,
  17644. column: 18
  17645. },
  17646. end: {
  17647. line: 1,
  17648. column: 22
  17649. }
  17650. }
  17651. },
  17652. loc: {
  17653. start: {
  17654. line: 1,
  17655. column: 0
  17656. },
  17657. end: {
  17658. line: 1,
  17659. column: 23
  17660. }
  17661. }
  17662. }
  17663. ],
  17664. loc: {
  17665. start: {
  17666. line: 1,
  17667. column: 0
  17668. },
  17669. end: {
  17670. line: 1,
  17671. column: 23
  17672. }
  17673. }
  17674. });
  17675. test("do keep(); while (true);", {
  17676. type: "Program",
  17677. body: [
  17678. {
  17679. type: "DoWhileStatement",
  17680. body: {
  17681. type: "ExpressionStatement",
  17682. expression: {
  17683. type: "CallExpression",
  17684. callee: {
  17685. type: "Identifier",
  17686. name: "keep",
  17687. loc: {
  17688. start: {
  17689. line: 1,
  17690. column: 3
  17691. },
  17692. end: {
  17693. line: 1,
  17694. column: 7
  17695. }
  17696. }
  17697. },
  17698. arguments: [],
  17699. loc: {
  17700. start: {
  17701. line: 1,
  17702. column: 3
  17703. },
  17704. end: {
  17705. line: 1,
  17706. column: 9
  17707. }
  17708. }
  17709. },
  17710. loc: {
  17711. start: {
  17712. line: 1,
  17713. column: 3
  17714. },
  17715. end: {
  17716. line: 1,
  17717. column: 10
  17718. }
  17719. }
  17720. },
  17721. test: {
  17722. type: "Literal",
  17723. value: true,
  17724. loc: {
  17725. start: {
  17726. line: 1,
  17727. column: 18
  17728. },
  17729. end: {
  17730. line: 1,
  17731. column: 22
  17732. }
  17733. }
  17734. },
  17735. loc: {
  17736. start: {
  17737. line: 1,
  17738. column: 0
  17739. },
  17740. end: {
  17741. line: 1,
  17742. column: 24
  17743. }
  17744. }
  17745. }
  17746. ],
  17747. loc: {
  17748. start: {
  17749. line: 1,
  17750. column: 0
  17751. },
  17752. end: {
  17753. line: 1,
  17754. column: 24
  17755. }
  17756. }
  17757. });
  17758. test("do { x++; y--; } while (x < 10)", {
  17759. type: "Program",
  17760. body: [
  17761. {
  17762. type: "DoWhileStatement",
  17763. body: {
  17764. type: "BlockStatement",
  17765. body: [
  17766. {
  17767. type: "ExpressionStatement",
  17768. expression: {
  17769. type: "UpdateExpression",
  17770. operator: "++",
  17771. prefix: false,
  17772. argument: {
  17773. type: "Identifier",
  17774. name: "x",
  17775. loc: {
  17776. start: {
  17777. line: 1,
  17778. column: 5
  17779. },
  17780. end: {
  17781. line: 1,
  17782. column: 6
  17783. }
  17784. }
  17785. },
  17786. loc: {
  17787. start: {
  17788. line: 1,
  17789. column: 5
  17790. },
  17791. end: {
  17792. line: 1,
  17793. column: 8
  17794. }
  17795. }
  17796. },
  17797. loc: {
  17798. start: {
  17799. line: 1,
  17800. column: 5
  17801. },
  17802. end: {
  17803. line: 1,
  17804. column: 9
  17805. }
  17806. }
  17807. },
  17808. {
  17809. type: "ExpressionStatement",
  17810. expression: {
  17811. type: "UpdateExpression",
  17812. operator: "--",
  17813. prefix: false,
  17814. argument: {
  17815. type: "Identifier",
  17816. name: "y",
  17817. loc: {
  17818. start: {
  17819. line: 1,
  17820. column: 10
  17821. },
  17822. end: {
  17823. line: 1,
  17824. column: 11
  17825. }
  17826. }
  17827. },
  17828. loc: {
  17829. start: {
  17830. line: 1,
  17831. column: 10
  17832. },
  17833. end: {
  17834. line: 1,
  17835. column: 13
  17836. }
  17837. }
  17838. },
  17839. loc: {
  17840. start: {
  17841. line: 1,
  17842. column: 10
  17843. },
  17844. end: {
  17845. line: 1,
  17846. column: 14
  17847. }
  17848. }
  17849. }
  17850. ],
  17851. loc: {
  17852. start: {
  17853. line: 1,
  17854. column: 3
  17855. },
  17856. end: {
  17857. line: 1,
  17858. column: 16
  17859. }
  17860. }
  17861. },
  17862. test: {
  17863. type: "BinaryExpression",
  17864. left: {
  17865. type: "Identifier",
  17866. name: "x",
  17867. loc: {
  17868. start: {
  17869. line: 1,
  17870. column: 24
  17871. },
  17872. end: {
  17873. line: 1,
  17874. column: 25
  17875. }
  17876. }
  17877. },
  17878. operator: "<",
  17879. right: {
  17880. type: "Literal",
  17881. value: 10,
  17882. loc: {
  17883. start: {
  17884. line: 1,
  17885. column: 28
  17886. },
  17887. end: {
  17888. line: 1,
  17889. column: 30
  17890. }
  17891. }
  17892. },
  17893. loc: {
  17894. start: {
  17895. line: 1,
  17896. column: 24
  17897. },
  17898. end: {
  17899. line: 1,
  17900. column: 30
  17901. }
  17902. }
  17903. },
  17904. loc: {
  17905. start: {
  17906. line: 1,
  17907. column: 0
  17908. },
  17909. end: {
  17910. line: 1,
  17911. column: 31
  17912. }
  17913. }
  17914. }
  17915. ],
  17916. loc: {
  17917. start: {
  17918. line: 1,
  17919. column: 0
  17920. },
  17921. end: {
  17922. line: 1,
  17923. column: 31
  17924. }
  17925. }
  17926. });
  17927. test("{ do { } while (false);false }", {
  17928. type: "Program",
  17929. body: [
  17930. {
  17931. type: "BlockStatement",
  17932. body: [
  17933. {
  17934. type: "DoWhileStatement",
  17935. body: {
  17936. type: "BlockStatement",
  17937. body: [],
  17938. loc: {
  17939. start: {
  17940. line: 1,
  17941. column: 5
  17942. },
  17943. end: {
  17944. line: 1,
  17945. column: 8
  17946. }
  17947. }
  17948. },
  17949. test: {
  17950. type: "Literal",
  17951. value: false,
  17952. loc: {
  17953. start: {
  17954. line: 1,
  17955. column: 16
  17956. },
  17957. end: {
  17958. line: 1,
  17959. column: 21
  17960. }
  17961. }
  17962. },
  17963. loc: {
  17964. start: {
  17965. line: 1,
  17966. column: 2
  17967. },
  17968. end: {
  17969. line: 1,
  17970. column: 23
  17971. }
  17972. }
  17973. },
  17974. {
  17975. type: "ExpressionStatement",
  17976. expression: {
  17977. type: "Literal",
  17978. value: false,
  17979. loc: {
  17980. start: {
  17981. line: 1,
  17982. column: 23
  17983. },
  17984. end: {
  17985. line: 1,
  17986. column: 28
  17987. }
  17988. }
  17989. },
  17990. loc: {
  17991. start: {
  17992. line: 1,
  17993. column: 23
  17994. },
  17995. end: {
  17996. line: 1,
  17997. column: 28
  17998. }
  17999. }
  18000. }
  18001. ],
  18002. loc: {
  18003. start: {
  18004. line: 1,
  18005. column: 0
  18006. },
  18007. end: {
  18008. line: 1,
  18009. column: 30
  18010. }
  18011. }
  18012. }
  18013. ],
  18014. loc: {
  18015. start: {
  18016. line: 1,
  18017. column: 0
  18018. },
  18019. end: {
  18020. line: 1,
  18021. column: 30
  18022. }
  18023. }
  18024. });
  18025. test("while (true) doSomething()", {
  18026. type: "Program",
  18027. body: [
  18028. {
  18029. type: "WhileStatement",
  18030. test: {
  18031. type: "Literal",
  18032. value: true,
  18033. loc: {
  18034. start: {
  18035. line: 1,
  18036. column: 7
  18037. },
  18038. end: {
  18039. line: 1,
  18040. column: 11
  18041. }
  18042. }
  18043. },
  18044. body: {
  18045. type: "ExpressionStatement",
  18046. expression: {
  18047. type: "CallExpression",
  18048. callee: {
  18049. type: "Identifier",
  18050. name: "doSomething",
  18051. loc: {
  18052. start: {
  18053. line: 1,
  18054. column: 13
  18055. },
  18056. end: {
  18057. line: 1,
  18058. column: 24
  18059. }
  18060. }
  18061. },
  18062. arguments: [],
  18063. loc: {
  18064. start: {
  18065. line: 1,
  18066. column: 13
  18067. },
  18068. end: {
  18069. line: 1,
  18070. column: 26
  18071. }
  18072. }
  18073. },
  18074. loc: {
  18075. start: {
  18076. line: 1,
  18077. column: 13
  18078. },
  18079. end: {
  18080. line: 1,
  18081. column: 26
  18082. }
  18083. }
  18084. },
  18085. loc: {
  18086. start: {
  18087. line: 1,
  18088. column: 0
  18089. },
  18090. end: {
  18091. line: 1,
  18092. column: 26
  18093. }
  18094. }
  18095. }
  18096. ],
  18097. loc: {
  18098. start: {
  18099. line: 1,
  18100. column: 0
  18101. },
  18102. end: {
  18103. line: 1,
  18104. column: 26
  18105. }
  18106. }
  18107. });
  18108. test("while (x < 10) { x++; y--; }", {
  18109. type: "Program",
  18110. body: [
  18111. {
  18112. type: "WhileStatement",
  18113. test: {
  18114. type: "BinaryExpression",
  18115. left: {
  18116. type: "Identifier",
  18117. name: "x",
  18118. loc: {
  18119. start: {
  18120. line: 1,
  18121. column: 7
  18122. },
  18123. end: {
  18124. line: 1,
  18125. column: 8
  18126. }
  18127. }
  18128. },
  18129. operator: "<",
  18130. right: {
  18131. type: "Literal",
  18132. value: 10,
  18133. loc: {
  18134. start: {
  18135. line: 1,
  18136. column: 11
  18137. },
  18138. end: {
  18139. line: 1,
  18140. column: 13
  18141. }
  18142. }
  18143. },
  18144. loc: {
  18145. start: {
  18146. line: 1,
  18147. column: 7
  18148. },
  18149. end: {
  18150. line: 1,
  18151. column: 13
  18152. }
  18153. }
  18154. },
  18155. body: {
  18156. type: "BlockStatement",
  18157. body: [
  18158. {
  18159. type: "ExpressionStatement",
  18160. expression: {
  18161. type: "UpdateExpression",
  18162. operator: "++",
  18163. prefix: false,
  18164. argument: {
  18165. type: "Identifier",
  18166. name: "x",
  18167. loc: {
  18168. start: {
  18169. line: 1,
  18170. column: 17
  18171. },
  18172. end: {
  18173. line: 1,
  18174. column: 18
  18175. }
  18176. }
  18177. },
  18178. loc: {
  18179. start: {
  18180. line: 1,
  18181. column: 17
  18182. },
  18183. end: {
  18184. line: 1,
  18185. column: 20
  18186. }
  18187. }
  18188. },
  18189. loc: {
  18190. start: {
  18191. line: 1,
  18192. column: 17
  18193. },
  18194. end: {
  18195. line: 1,
  18196. column: 21
  18197. }
  18198. }
  18199. },
  18200. {
  18201. type: "ExpressionStatement",
  18202. expression: {
  18203. type: "UpdateExpression",
  18204. operator: "--",
  18205. prefix: false,
  18206. argument: {
  18207. type: "Identifier",
  18208. name: "y",
  18209. loc: {
  18210. start: {
  18211. line: 1,
  18212. column: 22
  18213. },
  18214. end: {
  18215. line: 1,
  18216. column: 23
  18217. }
  18218. }
  18219. },
  18220. loc: {
  18221. start: {
  18222. line: 1,
  18223. column: 22
  18224. },
  18225. end: {
  18226. line: 1,
  18227. column: 25
  18228. }
  18229. }
  18230. },
  18231. loc: {
  18232. start: {
  18233. line: 1,
  18234. column: 22
  18235. },
  18236. end: {
  18237. line: 1,
  18238. column: 26
  18239. }
  18240. }
  18241. }
  18242. ],
  18243. loc: {
  18244. start: {
  18245. line: 1,
  18246. column: 15
  18247. },
  18248. end: {
  18249. line: 1,
  18250. column: 28
  18251. }
  18252. }
  18253. },
  18254. loc: {
  18255. start: {
  18256. line: 1,
  18257. column: 0
  18258. },
  18259. end: {
  18260. line: 1,
  18261. column: 28
  18262. }
  18263. }
  18264. }
  18265. ],
  18266. loc: {
  18267. start: {
  18268. line: 1,
  18269. column: 0
  18270. },
  18271. end: {
  18272. line: 1,
  18273. column: 28
  18274. }
  18275. }
  18276. });
  18277. test("for(;;);", {
  18278. type: "Program",
  18279. body: [
  18280. {
  18281. type: "ForStatement",
  18282. init: null,
  18283. test: null,
  18284. update: null,
  18285. body: {
  18286. type: "EmptyStatement",
  18287. loc: {
  18288. start: {
  18289. line: 1,
  18290. column: 7
  18291. },
  18292. end: {
  18293. line: 1,
  18294. column: 8
  18295. }
  18296. }
  18297. },
  18298. loc: {
  18299. start: {
  18300. line: 1,
  18301. column: 0
  18302. },
  18303. end: {
  18304. line: 1,
  18305. column: 8
  18306. }
  18307. }
  18308. }
  18309. ],
  18310. loc: {
  18311. start: {
  18312. line: 1,
  18313. column: 0
  18314. },
  18315. end: {
  18316. line: 1,
  18317. column: 8
  18318. }
  18319. }
  18320. });
  18321. test("for(;;){}", {
  18322. type: "Program",
  18323. body: [
  18324. {
  18325. type: "ForStatement",
  18326. init: null,
  18327. test: null,
  18328. update: null,
  18329. body: {
  18330. type: "BlockStatement",
  18331. body: [],
  18332. loc: {
  18333. start: {
  18334. line: 1,
  18335. column: 7
  18336. },
  18337. end: {
  18338. line: 1,
  18339. column: 9
  18340. }
  18341. }
  18342. },
  18343. loc: {
  18344. start: {
  18345. line: 1,
  18346. column: 0
  18347. },
  18348. end: {
  18349. line: 1,
  18350. column: 9
  18351. }
  18352. }
  18353. }
  18354. ],
  18355. loc: {
  18356. start: {
  18357. line: 1,
  18358. column: 0
  18359. },
  18360. end: {
  18361. line: 1,
  18362. column: 9
  18363. }
  18364. }
  18365. });
  18366. test("for(x = 0;;);", {
  18367. type: "Program",
  18368. body: [
  18369. {
  18370. type: "ForStatement",
  18371. init: {
  18372. type: "AssignmentExpression",
  18373. operator: "=",
  18374. left: {
  18375. type: "Identifier",
  18376. name: "x",
  18377. loc: {
  18378. start: {
  18379. line: 1,
  18380. column: 4
  18381. },
  18382. end: {
  18383. line: 1,
  18384. column: 5
  18385. }
  18386. }
  18387. },
  18388. right: {
  18389. type: "Literal",
  18390. value: 0,
  18391. loc: {
  18392. start: {
  18393. line: 1,
  18394. column: 8
  18395. },
  18396. end: {
  18397. line: 1,
  18398. column: 9
  18399. }
  18400. }
  18401. },
  18402. loc: {
  18403. start: {
  18404. line: 1,
  18405. column: 4
  18406. },
  18407. end: {
  18408. line: 1,
  18409. column: 9
  18410. }
  18411. }
  18412. },
  18413. test: null,
  18414. update: null,
  18415. body: {
  18416. type: "EmptyStatement",
  18417. loc: {
  18418. start: {
  18419. line: 1,
  18420. column: 12
  18421. },
  18422. end: {
  18423. line: 1,
  18424. column: 13
  18425. }
  18426. }
  18427. },
  18428. loc: {
  18429. start: {
  18430. line: 1,
  18431. column: 0
  18432. },
  18433. end: {
  18434. line: 1,
  18435. column: 13
  18436. }
  18437. }
  18438. }
  18439. ],
  18440. loc: {
  18441. start: {
  18442. line: 1,
  18443. column: 0
  18444. },
  18445. end: {
  18446. line: 1,
  18447. column: 13
  18448. }
  18449. }
  18450. });
  18451. test("for(var x = 0;;);", {
  18452. type: "Program",
  18453. body: [
  18454. {
  18455. type: "ForStatement",
  18456. init: {
  18457. type: "VariableDeclaration",
  18458. declarations: [
  18459. {
  18460. type: "VariableDeclarator",
  18461. id: {
  18462. type: "Identifier",
  18463. name: "x",
  18464. loc: {
  18465. start: {
  18466. line: 1,
  18467. column: 8
  18468. },
  18469. end: {
  18470. line: 1,
  18471. column: 9
  18472. }
  18473. }
  18474. },
  18475. init: {
  18476. type: "Literal",
  18477. value: 0,
  18478. loc: {
  18479. start: {
  18480. line: 1,
  18481. column: 12
  18482. },
  18483. end: {
  18484. line: 1,
  18485. column: 13
  18486. }
  18487. }
  18488. },
  18489. loc: {
  18490. start: {
  18491. line: 1,
  18492. column: 8
  18493. },
  18494. end: {
  18495. line: 1,
  18496. column: 13
  18497. }
  18498. }
  18499. }
  18500. ],
  18501. kind: "var",
  18502. loc: {
  18503. start: {
  18504. line: 1,
  18505. column: 4
  18506. },
  18507. end: {
  18508. line: 1,
  18509. column: 13
  18510. }
  18511. }
  18512. },
  18513. test: null,
  18514. update: null,
  18515. body: {
  18516. type: "EmptyStatement",
  18517. loc: {
  18518. start: {
  18519. line: 1,
  18520. column: 16
  18521. },
  18522. end: {
  18523. line: 1,
  18524. column: 17
  18525. }
  18526. }
  18527. },
  18528. loc: {
  18529. start: {
  18530. line: 1,
  18531. column: 0
  18532. },
  18533. end: {
  18534. line: 1,
  18535. column: 17
  18536. }
  18537. }
  18538. }
  18539. ],
  18540. loc: {
  18541. start: {
  18542. line: 1,
  18543. column: 0
  18544. },
  18545. end: {
  18546. line: 1,
  18547. column: 17
  18548. }
  18549. }
  18550. });
  18551. test("for(var x = 0, y = 1;;);", {
  18552. type: "Program",
  18553. body: [
  18554. {
  18555. type: "ForStatement",
  18556. init: {
  18557. type: "VariableDeclaration",
  18558. declarations: [
  18559. {
  18560. type: "VariableDeclarator",
  18561. id: {
  18562. type: "Identifier",
  18563. name: "x",
  18564. loc: {
  18565. start: {
  18566. line: 1,
  18567. column: 8
  18568. },
  18569. end: {
  18570. line: 1,
  18571. column: 9
  18572. }
  18573. }
  18574. },
  18575. init: {
  18576. type: "Literal",
  18577. value: 0,
  18578. loc: {
  18579. start: {
  18580. line: 1,
  18581. column: 12
  18582. },
  18583. end: {
  18584. line: 1,
  18585. column: 13
  18586. }
  18587. }
  18588. },
  18589. loc: {
  18590. start: {
  18591. line: 1,
  18592. column: 8
  18593. },
  18594. end: {
  18595. line: 1,
  18596. column: 13
  18597. }
  18598. }
  18599. },
  18600. {
  18601. type: "VariableDeclarator",
  18602. id: {
  18603. type: "Identifier",
  18604. name: "y",
  18605. loc: {
  18606. start: {
  18607. line: 1,
  18608. column: 15
  18609. },
  18610. end: {
  18611. line: 1,
  18612. column: 16
  18613. }
  18614. }
  18615. },
  18616. init: {
  18617. type: "Literal",
  18618. value: 1,
  18619. loc: {
  18620. start: {
  18621. line: 1,
  18622. column: 19
  18623. },
  18624. end: {
  18625. line: 1,
  18626. column: 20
  18627. }
  18628. }
  18629. },
  18630. loc: {
  18631. start: {
  18632. line: 1,
  18633. column: 15
  18634. },
  18635. end: {
  18636. line: 1,
  18637. column: 20
  18638. }
  18639. }
  18640. }
  18641. ],
  18642. kind: "var",
  18643. loc: {
  18644. start: {
  18645. line: 1,
  18646. column: 4
  18647. },
  18648. end: {
  18649. line: 1,
  18650. column: 20
  18651. }
  18652. }
  18653. },
  18654. test: null,
  18655. update: null,
  18656. body: {
  18657. type: "EmptyStatement",
  18658. loc: {
  18659. start: {
  18660. line: 1,
  18661. column: 23
  18662. },
  18663. end: {
  18664. line: 1,
  18665. column: 24
  18666. }
  18667. }
  18668. },
  18669. loc: {
  18670. start: {
  18671. line: 1,
  18672. column: 0
  18673. },
  18674. end: {
  18675. line: 1,
  18676. column: 24
  18677. }
  18678. }
  18679. }
  18680. ],
  18681. loc: {
  18682. start: {
  18683. line: 1,
  18684. column: 0
  18685. },
  18686. end: {
  18687. line: 1,
  18688. column: 24
  18689. }
  18690. }
  18691. });
  18692. test("for(x = 0; x < 42;);", {
  18693. type: "Program",
  18694. body: [
  18695. {
  18696. type: "ForStatement",
  18697. init: {
  18698. type: "AssignmentExpression",
  18699. operator: "=",
  18700. left: {
  18701. type: "Identifier",
  18702. name: "x",
  18703. loc: {
  18704. start: {
  18705. line: 1,
  18706. column: 4
  18707. },
  18708. end: {
  18709. line: 1,
  18710. column: 5
  18711. }
  18712. }
  18713. },
  18714. right: {
  18715. type: "Literal",
  18716. value: 0,
  18717. loc: {
  18718. start: {
  18719. line: 1,
  18720. column: 8
  18721. },
  18722. end: {
  18723. line: 1,
  18724. column: 9
  18725. }
  18726. }
  18727. },
  18728. loc: {
  18729. start: {
  18730. line: 1,
  18731. column: 4
  18732. },
  18733. end: {
  18734. line: 1,
  18735. column: 9
  18736. }
  18737. }
  18738. },
  18739. test: {
  18740. type: "BinaryExpression",
  18741. left: {
  18742. type: "Identifier",
  18743. name: "x",
  18744. loc: {
  18745. start: {
  18746. line: 1,
  18747. column: 11
  18748. },
  18749. end: {
  18750. line: 1,
  18751. column: 12
  18752. }
  18753. }
  18754. },
  18755. operator: "<",
  18756. right: {
  18757. type: "Literal",
  18758. value: 42,
  18759. loc: {
  18760. start: {
  18761. line: 1,
  18762. column: 15
  18763. },
  18764. end: {
  18765. line: 1,
  18766. column: 17
  18767. }
  18768. }
  18769. },
  18770. loc: {
  18771. start: {
  18772. line: 1,
  18773. column: 11
  18774. },
  18775. end: {
  18776. line: 1,
  18777. column: 17
  18778. }
  18779. }
  18780. },
  18781. update: null,
  18782. body: {
  18783. type: "EmptyStatement",
  18784. loc: {
  18785. start: {
  18786. line: 1,
  18787. column: 19
  18788. },
  18789. end: {
  18790. line: 1,
  18791. column: 20
  18792. }
  18793. }
  18794. },
  18795. loc: {
  18796. start: {
  18797. line: 1,
  18798. column: 0
  18799. },
  18800. end: {
  18801. line: 1,
  18802. column: 20
  18803. }
  18804. }
  18805. }
  18806. ],
  18807. loc: {
  18808. start: {
  18809. line: 1,
  18810. column: 0
  18811. },
  18812. end: {
  18813. line: 1,
  18814. column: 20
  18815. }
  18816. }
  18817. });
  18818. test("for(x = 0; x < 42; x++);", {
  18819. type: "Program",
  18820. body: [
  18821. {
  18822. type: "ForStatement",
  18823. init: {
  18824. type: "AssignmentExpression",
  18825. operator: "=",
  18826. left: {
  18827. type: "Identifier",
  18828. name: "x",
  18829. loc: {
  18830. start: {
  18831. line: 1,
  18832. column: 4
  18833. },
  18834. end: {
  18835. line: 1,
  18836. column: 5
  18837. }
  18838. }
  18839. },
  18840. right: {
  18841. type: "Literal",
  18842. value: 0,
  18843. loc: {
  18844. start: {
  18845. line: 1,
  18846. column: 8
  18847. },
  18848. end: {
  18849. line: 1,
  18850. column: 9
  18851. }
  18852. }
  18853. },
  18854. loc: {
  18855. start: {
  18856. line: 1,
  18857. column: 4
  18858. },
  18859. end: {
  18860. line: 1,
  18861. column: 9
  18862. }
  18863. }
  18864. },
  18865. test: {
  18866. type: "BinaryExpression",
  18867. left: {
  18868. type: "Identifier",
  18869. name: "x",
  18870. loc: {
  18871. start: {
  18872. line: 1,
  18873. column: 11
  18874. },
  18875. end: {
  18876. line: 1,
  18877. column: 12
  18878. }
  18879. }
  18880. },
  18881. operator: "<",
  18882. right: {
  18883. type: "Literal",
  18884. value: 42,
  18885. loc: {
  18886. start: {
  18887. line: 1,
  18888. column: 15
  18889. },
  18890. end: {
  18891. line: 1,
  18892. column: 17
  18893. }
  18894. }
  18895. },
  18896. loc: {
  18897. start: {
  18898. line: 1,
  18899. column: 11
  18900. },
  18901. end: {
  18902. line: 1,
  18903. column: 17
  18904. }
  18905. }
  18906. },
  18907. update: {
  18908. type: "UpdateExpression",
  18909. operator: "++",
  18910. prefix: false,
  18911. argument: {
  18912. type: "Identifier",
  18913. name: "x",
  18914. loc: {
  18915. start: {
  18916. line: 1,
  18917. column: 19
  18918. },
  18919. end: {
  18920. line: 1,
  18921. column: 20
  18922. }
  18923. }
  18924. },
  18925. loc: {
  18926. start: {
  18927. line: 1,
  18928. column: 19
  18929. },
  18930. end: {
  18931. line: 1,
  18932. column: 22
  18933. }
  18934. }
  18935. },
  18936. body: {
  18937. type: "EmptyStatement",
  18938. loc: {
  18939. start: {
  18940. line: 1,
  18941. column: 23
  18942. },
  18943. end: {
  18944. line: 1,
  18945. column: 24
  18946. }
  18947. }
  18948. },
  18949. loc: {
  18950. start: {
  18951. line: 1,
  18952. column: 0
  18953. },
  18954. end: {
  18955. line: 1,
  18956. column: 24
  18957. }
  18958. }
  18959. }
  18960. ],
  18961. loc: {
  18962. start: {
  18963. line: 1,
  18964. column: 0
  18965. },
  18966. end: {
  18967. line: 1,
  18968. column: 24
  18969. }
  18970. }
  18971. });
  18972. test("for(x = 0; x < 42; x++) process(x);", {
  18973. type: "Program",
  18974. body: [
  18975. {
  18976. type: "ForStatement",
  18977. init: {
  18978. type: "AssignmentExpression",
  18979. operator: "=",
  18980. left: {
  18981. type: "Identifier",
  18982. name: "x",
  18983. loc: {
  18984. start: {
  18985. line: 1,
  18986. column: 4
  18987. },
  18988. end: {
  18989. line: 1,
  18990. column: 5
  18991. }
  18992. }
  18993. },
  18994. right: {
  18995. type: "Literal",
  18996. value: 0,
  18997. loc: {
  18998. start: {
  18999. line: 1,
  19000. column: 8
  19001. },
  19002. end: {
  19003. line: 1,
  19004. column: 9
  19005. }
  19006. }
  19007. },
  19008. loc: {
  19009. start: {
  19010. line: 1,
  19011. column: 4
  19012. },
  19013. end: {
  19014. line: 1,
  19015. column: 9
  19016. }
  19017. }
  19018. },
  19019. test: {
  19020. type: "BinaryExpression",
  19021. left: {
  19022. type: "Identifier",
  19023. name: "x",
  19024. loc: {
  19025. start: {
  19026. line: 1,
  19027. column: 11
  19028. },
  19029. end: {
  19030. line: 1,
  19031. column: 12
  19032. }
  19033. }
  19034. },
  19035. operator: "<",
  19036. right: {
  19037. type: "Literal",
  19038. value: 42,
  19039. loc: {
  19040. start: {
  19041. line: 1,
  19042. column: 15
  19043. },
  19044. end: {
  19045. line: 1,
  19046. column: 17
  19047. }
  19048. }
  19049. },
  19050. loc: {
  19051. start: {
  19052. line: 1,
  19053. column: 11
  19054. },
  19055. end: {
  19056. line: 1,
  19057. column: 17
  19058. }
  19059. }
  19060. },
  19061. update: {
  19062. type: "UpdateExpression",
  19063. operator: "++",
  19064. prefix: false,
  19065. argument: {
  19066. type: "Identifier",
  19067. name: "x",
  19068. loc: {
  19069. start: {
  19070. line: 1,
  19071. column: 19
  19072. },
  19073. end: {
  19074. line: 1,
  19075. column: 20
  19076. }
  19077. }
  19078. },
  19079. loc: {
  19080. start: {
  19081. line: 1,
  19082. column: 19
  19083. },
  19084. end: {
  19085. line: 1,
  19086. column: 22
  19087. }
  19088. }
  19089. },
  19090. body: {
  19091. type: "ExpressionStatement",
  19092. expression: {
  19093. type: "CallExpression",
  19094. callee: {
  19095. type: "Identifier",
  19096. name: "process",
  19097. loc: {
  19098. start: {
  19099. line: 1,
  19100. column: 24
  19101. },
  19102. end: {
  19103. line: 1,
  19104. column: 31
  19105. }
  19106. }
  19107. },
  19108. arguments: [
  19109. {
  19110. type: "Identifier",
  19111. name: "x",
  19112. loc: {
  19113. start: {
  19114. line: 1,
  19115. column: 32
  19116. },
  19117. end: {
  19118. line: 1,
  19119. column: 33
  19120. }
  19121. }
  19122. }
  19123. ],
  19124. loc: {
  19125. start: {
  19126. line: 1,
  19127. column: 24
  19128. },
  19129. end: {
  19130. line: 1,
  19131. column: 34
  19132. }
  19133. }
  19134. },
  19135. loc: {
  19136. start: {
  19137. line: 1,
  19138. column: 24
  19139. },
  19140. end: {
  19141. line: 1,
  19142. column: 35
  19143. }
  19144. }
  19145. },
  19146. loc: {
  19147. start: {
  19148. line: 1,
  19149. column: 0
  19150. },
  19151. end: {
  19152. line: 1,
  19153. column: 35
  19154. }
  19155. }
  19156. }
  19157. ],
  19158. loc: {
  19159. start: {
  19160. line: 1,
  19161. column: 0
  19162. },
  19163. end: {
  19164. line: 1,
  19165. column: 35
  19166. }
  19167. }
  19168. });
  19169. test("for(x in list) process(x);", {
  19170. type: "Program",
  19171. body: [
  19172. {
  19173. type: "ForInStatement",
  19174. left: {
  19175. type: "Identifier",
  19176. name: "x",
  19177. loc: {
  19178. start: {
  19179. line: 1,
  19180. column: 4
  19181. },
  19182. end: {
  19183. line: 1,
  19184. column: 5
  19185. }
  19186. }
  19187. },
  19188. right: {
  19189. type: "Identifier",
  19190. name: "list",
  19191. loc: {
  19192. start: {
  19193. line: 1,
  19194. column: 9
  19195. },
  19196. end: {
  19197. line: 1,
  19198. column: 13
  19199. }
  19200. }
  19201. },
  19202. body: {
  19203. type: "ExpressionStatement",
  19204. expression: {
  19205. type: "CallExpression",
  19206. callee: {
  19207. type: "Identifier",
  19208. name: "process",
  19209. loc: {
  19210. start: {
  19211. line: 1,
  19212. column: 15
  19213. },
  19214. end: {
  19215. line: 1,
  19216. column: 22
  19217. }
  19218. }
  19219. },
  19220. arguments: [
  19221. {
  19222. type: "Identifier",
  19223. name: "x",
  19224. loc: {
  19225. start: {
  19226. line: 1,
  19227. column: 23
  19228. },
  19229. end: {
  19230. line: 1,
  19231. column: 24
  19232. }
  19233. }
  19234. }
  19235. ],
  19236. loc: {
  19237. start: {
  19238. line: 1,
  19239. column: 15
  19240. },
  19241. end: {
  19242. line: 1,
  19243. column: 25
  19244. }
  19245. }
  19246. },
  19247. loc: {
  19248. start: {
  19249. line: 1,
  19250. column: 15
  19251. },
  19252. end: {
  19253. line: 1,
  19254. column: 26
  19255. }
  19256. }
  19257. },
  19258. loc: {
  19259. start: {
  19260. line: 1,
  19261. column: 0
  19262. },
  19263. end: {
  19264. line: 1,
  19265. column: 26
  19266. }
  19267. }
  19268. }
  19269. ],
  19270. loc: {
  19271. start: {
  19272. line: 1,
  19273. column: 0
  19274. },
  19275. end: {
  19276. line: 1,
  19277. column: 26
  19278. }
  19279. }
  19280. });
  19281. test("for (var x in list) process(x);", {
  19282. type: "Program",
  19283. body: [
  19284. {
  19285. type: "ForInStatement",
  19286. left: {
  19287. type: "VariableDeclaration",
  19288. declarations: [
  19289. {
  19290. type: "VariableDeclarator",
  19291. id: {
  19292. type: "Identifier",
  19293. name: "x",
  19294. loc: {
  19295. start: {
  19296. line: 1,
  19297. column: 9
  19298. },
  19299. end: {
  19300. line: 1,
  19301. column: 10
  19302. }
  19303. }
  19304. },
  19305. init: null,
  19306. loc: {
  19307. start: {
  19308. line: 1,
  19309. column: 9
  19310. },
  19311. end: {
  19312. line: 1,
  19313. column: 10
  19314. }
  19315. }
  19316. }
  19317. ],
  19318. kind: "var",
  19319. loc: {
  19320. start: {
  19321. line: 1,
  19322. column: 5
  19323. },
  19324. end: {
  19325. line: 1,
  19326. column: 10
  19327. }
  19328. }
  19329. },
  19330. right: {
  19331. type: "Identifier",
  19332. name: "list",
  19333. loc: {
  19334. start: {
  19335. line: 1,
  19336. column: 14
  19337. },
  19338. end: {
  19339. line: 1,
  19340. column: 18
  19341. }
  19342. }
  19343. },
  19344. body: {
  19345. type: "ExpressionStatement",
  19346. expression: {
  19347. type: "CallExpression",
  19348. callee: {
  19349. type: "Identifier",
  19350. name: "process",
  19351. loc: {
  19352. start: {
  19353. line: 1,
  19354. column: 20
  19355. },
  19356. end: {
  19357. line: 1,
  19358. column: 27
  19359. }
  19360. }
  19361. },
  19362. arguments: [
  19363. {
  19364. type: "Identifier",
  19365. name: "x",
  19366. loc: {
  19367. start: {
  19368. line: 1,
  19369. column: 28
  19370. },
  19371. end: {
  19372. line: 1,
  19373. column: 29
  19374. }
  19375. }
  19376. }
  19377. ],
  19378. loc: {
  19379. start: {
  19380. line: 1,
  19381. column: 20
  19382. },
  19383. end: {
  19384. line: 1,
  19385. column: 30
  19386. }
  19387. }
  19388. },
  19389. loc: {
  19390. start: {
  19391. line: 1,
  19392. column: 20
  19393. },
  19394. end: {
  19395. line: 1,
  19396. column: 31
  19397. }
  19398. }
  19399. },
  19400. loc: {
  19401. start: {
  19402. line: 1,
  19403. column: 0
  19404. },
  19405. end: {
  19406. line: 1,
  19407. column: 31
  19408. }
  19409. }
  19410. }
  19411. ],
  19412. loc: {
  19413. start: {
  19414. line: 1,
  19415. column: 0
  19416. },
  19417. end: {
  19418. line: 1,
  19419. column: 31
  19420. }
  19421. }
  19422. });
  19423. test("for (var x = 42 in list) process(x);", {
  19424. type: "Program",
  19425. body: [
  19426. {
  19427. type: "ForInStatement",
  19428. left: {
  19429. type: "VariableDeclaration",
  19430. declarations: [
  19431. {
  19432. type: "VariableDeclarator",
  19433. id: {
  19434. type: "Identifier",
  19435. name: "x",
  19436. loc: {
  19437. start: {
  19438. line: 1,
  19439. column: 9
  19440. },
  19441. end: {
  19442. line: 1,
  19443. column: 10
  19444. }
  19445. }
  19446. },
  19447. init: {
  19448. type: "Literal",
  19449. value: 42,
  19450. loc: {
  19451. start: {
  19452. line: 1,
  19453. column: 13
  19454. },
  19455. end: {
  19456. line: 1,
  19457. column: 15
  19458. }
  19459. }
  19460. },
  19461. loc: {
  19462. start: {
  19463. line: 1,
  19464. column: 9
  19465. },
  19466. end: {
  19467. line: 1,
  19468. column: 15
  19469. }
  19470. }
  19471. }
  19472. ],
  19473. kind: "var",
  19474. loc: {
  19475. start: {
  19476. line: 1,
  19477. column: 5
  19478. },
  19479. end: {
  19480. line: 1,
  19481. column: 15
  19482. }
  19483. }
  19484. },
  19485. right: {
  19486. type: "Identifier",
  19487. name: "list",
  19488. loc: {
  19489. start: {
  19490. line: 1,
  19491. column: 19
  19492. },
  19493. end: {
  19494. line: 1,
  19495. column: 23
  19496. }
  19497. }
  19498. },
  19499. body: {
  19500. type: "ExpressionStatement",
  19501. expression: {
  19502. type: "CallExpression",
  19503. callee: {
  19504. type: "Identifier",
  19505. name: "process",
  19506. loc: {
  19507. start: {
  19508. line: 1,
  19509. column: 25
  19510. },
  19511. end: {
  19512. line: 1,
  19513. column: 32
  19514. }
  19515. }
  19516. },
  19517. arguments: [
  19518. {
  19519. type: "Identifier",
  19520. name: "x",
  19521. loc: {
  19522. start: {
  19523. line: 1,
  19524. column: 33
  19525. },
  19526. end: {
  19527. line: 1,
  19528. column: 34
  19529. }
  19530. }
  19531. }
  19532. ],
  19533. loc: {
  19534. start: {
  19535. line: 1,
  19536. column: 25
  19537. },
  19538. end: {
  19539. line: 1,
  19540. column: 35
  19541. }
  19542. }
  19543. },
  19544. loc: {
  19545. start: {
  19546. line: 1,
  19547. column: 25
  19548. },
  19549. end: {
  19550. line: 1,
  19551. column: 36
  19552. }
  19553. }
  19554. },
  19555. loc: {
  19556. start: {
  19557. line: 1,
  19558. column: 0
  19559. },
  19560. end: {
  19561. line: 1,
  19562. column: 36
  19563. }
  19564. }
  19565. }
  19566. ],
  19567. loc: {
  19568. start: {
  19569. line: 1,
  19570. column: 0
  19571. },
  19572. end: {
  19573. line: 1,
  19574. column: 36
  19575. }
  19576. }
  19577. });
  19578. test("for (var i = function() { return 10 in [] } in list) process(x);", {
  19579. type: "Program",
  19580. body: [
  19581. {
  19582. type: "ForInStatement",
  19583. left: {
  19584. type: "VariableDeclaration",
  19585. declarations: [
  19586. {
  19587. type: "VariableDeclarator",
  19588. id: {
  19589. type: "Identifier",
  19590. name: "i",
  19591. loc: {
  19592. start: {
  19593. line: 1,
  19594. column: 9
  19595. },
  19596. end: {
  19597. line: 1,
  19598. column: 10
  19599. }
  19600. }
  19601. },
  19602. init: {
  19603. type: "FunctionExpression",
  19604. id: null,
  19605. params: [],
  19606. body: {
  19607. type: "BlockStatement",
  19608. body: [
  19609. {
  19610. type: "ReturnStatement",
  19611. argument: {
  19612. type: "BinaryExpression",
  19613. left: {
  19614. type: "Literal",
  19615. value: 10,
  19616. loc: {
  19617. start: {
  19618. line: 1,
  19619. column: 33
  19620. },
  19621. end: {
  19622. line: 1,
  19623. column: 35
  19624. }
  19625. }
  19626. },
  19627. operator: "in",
  19628. right: {
  19629. type: "ArrayExpression",
  19630. elements: [],
  19631. loc: {
  19632. start: {
  19633. line: 1,
  19634. column: 39
  19635. },
  19636. end: {
  19637. line: 1,
  19638. column: 41
  19639. }
  19640. }
  19641. },
  19642. loc: {
  19643. start: {
  19644. line: 1,
  19645. column: 33
  19646. },
  19647. end: {
  19648. line: 1,
  19649. column: 41
  19650. }
  19651. }
  19652. },
  19653. loc: {
  19654. start: {
  19655. line: 1,
  19656. column: 26
  19657. },
  19658. end: {
  19659. line: 1,
  19660. column: 41
  19661. }
  19662. }
  19663. }
  19664. ],
  19665. loc: {
  19666. start: {
  19667. line: 1,
  19668. column: 24
  19669. },
  19670. end: {
  19671. line: 1,
  19672. column: 43
  19673. }
  19674. }
  19675. },
  19676. loc: {
  19677. start: {
  19678. line: 1,
  19679. column: 13
  19680. },
  19681. end: {
  19682. line: 1,
  19683. column: 43
  19684. }
  19685. }
  19686. },
  19687. loc: {
  19688. start: {
  19689. line: 1,
  19690. column: 9
  19691. },
  19692. end: {
  19693. line: 1,
  19694. column: 43
  19695. }
  19696. }
  19697. }
  19698. ],
  19699. kind: "var",
  19700. loc: {
  19701. start: {
  19702. line: 1,
  19703. column: 5
  19704. },
  19705. end: {
  19706. line: 1,
  19707. column: 43
  19708. }
  19709. }
  19710. },
  19711. right: {
  19712. type: "Identifier",
  19713. name: "list",
  19714. loc: {
  19715. start: {
  19716. line: 1,
  19717. column: 47
  19718. },
  19719. end: {
  19720. line: 1,
  19721. column: 51
  19722. }
  19723. }
  19724. },
  19725. body: {
  19726. type: "ExpressionStatement",
  19727. expression: {
  19728. type: "CallExpression",
  19729. callee: {
  19730. type: "Identifier",
  19731. name: "process",
  19732. loc: {
  19733. start: {
  19734. line: 1,
  19735. column: 53
  19736. },
  19737. end: {
  19738. line: 1,
  19739. column: 60
  19740. }
  19741. }
  19742. },
  19743. arguments: [
  19744. {
  19745. type: "Identifier",
  19746. name: "x",
  19747. loc: {
  19748. start: {
  19749. line: 1,
  19750. column: 61
  19751. },
  19752. end: {
  19753. line: 1,
  19754. column: 62
  19755. }
  19756. }
  19757. }
  19758. ],
  19759. loc: {
  19760. start: {
  19761. line: 1,
  19762. column: 53
  19763. },
  19764. end: {
  19765. line: 1,
  19766. column: 63
  19767. }
  19768. }
  19769. },
  19770. loc: {
  19771. start: {
  19772. line: 1,
  19773. column: 53
  19774. },
  19775. end: {
  19776. line: 1,
  19777. column: 64
  19778. }
  19779. }
  19780. },
  19781. loc: {
  19782. start: {
  19783. line: 1,
  19784. column: 0
  19785. },
  19786. end: {
  19787. line: 1,
  19788. column: 64
  19789. }
  19790. }
  19791. }
  19792. ],
  19793. loc: {
  19794. start: {
  19795. line: 1,
  19796. column: 0
  19797. },
  19798. end: {
  19799. line: 1,
  19800. column: 64
  19801. }
  19802. }
  19803. });
  19804. test("while (true) { continue; }", {
  19805. type: "Program",
  19806. body: [
  19807. {
  19808. type: "WhileStatement",
  19809. test: {
  19810. type: "Literal",
  19811. value: true,
  19812. loc: {
  19813. start: {
  19814. line: 1,
  19815. column: 7
  19816. },
  19817. end: {
  19818. line: 1,
  19819. column: 11
  19820. }
  19821. }
  19822. },
  19823. body: {
  19824. type: "BlockStatement",
  19825. body: [
  19826. {
  19827. type: "ContinueStatement",
  19828. label: null,
  19829. loc: {
  19830. start: {
  19831. line: 1,
  19832. column: 15
  19833. },
  19834. end: {
  19835. line: 1,
  19836. column: 24
  19837. }
  19838. }
  19839. }
  19840. ],
  19841. loc: {
  19842. start: {
  19843. line: 1,
  19844. column: 13
  19845. },
  19846. end: {
  19847. line: 1,
  19848. column: 26
  19849. }
  19850. }
  19851. },
  19852. loc: {
  19853. start: {
  19854. line: 1,
  19855. column: 0
  19856. },
  19857. end: {
  19858. line: 1,
  19859. column: 26
  19860. }
  19861. }
  19862. }
  19863. ],
  19864. loc: {
  19865. start: {
  19866. line: 1,
  19867. column: 0
  19868. },
  19869. end: {
  19870. line: 1,
  19871. column: 26
  19872. }
  19873. }
  19874. });
  19875. test("while (true) { continue }", {
  19876. type: "Program",
  19877. body: [
  19878. {
  19879. type: "WhileStatement",
  19880. test: {
  19881. type: "Literal",
  19882. value: true,
  19883. loc: {
  19884. start: {
  19885. line: 1,
  19886. column: 7
  19887. },
  19888. end: {
  19889. line: 1,
  19890. column: 11
  19891. }
  19892. }
  19893. },
  19894. body: {
  19895. type: "BlockStatement",
  19896. body: [
  19897. {
  19898. type: "ContinueStatement",
  19899. label: null,
  19900. loc: {
  19901. start: {
  19902. line: 1,
  19903. column: 15
  19904. },
  19905. end: {
  19906. line: 1,
  19907. column: 23
  19908. }
  19909. }
  19910. }
  19911. ],
  19912. loc: {
  19913. start: {
  19914. line: 1,
  19915. column: 13
  19916. },
  19917. end: {
  19918. line: 1,
  19919. column: 25
  19920. }
  19921. }
  19922. },
  19923. loc: {
  19924. start: {
  19925. line: 1,
  19926. column: 0
  19927. },
  19928. end: {
  19929. line: 1,
  19930. column: 25
  19931. }
  19932. }
  19933. }
  19934. ],
  19935. loc: {
  19936. start: {
  19937. line: 1,
  19938. column: 0
  19939. },
  19940. end: {
  19941. line: 1,
  19942. column: 25
  19943. }
  19944. }
  19945. });
  19946. test("done: while (true) { continue done }", {
  19947. type: "Program",
  19948. body: [
  19949. {
  19950. type: "LabeledStatement",
  19951. body: {
  19952. type: "WhileStatement",
  19953. test: {
  19954. type: "Literal",
  19955. value: true,
  19956. loc: {
  19957. start: {
  19958. line: 1,
  19959. column: 13
  19960. },
  19961. end: {
  19962. line: 1,
  19963. column: 17
  19964. }
  19965. }
  19966. },
  19967. body: {
  19968. type: "BlockStatement",
  19969. body: [
  19970. {
  19971. type: "ContinueStatement",
  19972. label: {
  19973. type: "Identifier",
  19974. name: "done",
  19975. loc: {
  19976. start: {
  19977. line: 1,
  19978. column: 30
  19979. },
  19980. end: {
  19981. line: 1,
  19982. column: 34
  19983. }
  19984. }
  19985. },
  19986. loc: {
  19987. start: {
  19988. line: 1,
  19989. column: 21
  19990. },
  19991. end: {
  19992. line: 1,
  19993. column: 34
  19994. }
  19995. }
  19996. }
  19997. ],
  19998. loc: {
  19999. start: {
  20000. line: 1,
  20001. column: 19
  20002. },
  20003. end: {
  20004. line: 1,
  20005. column: 36
  20006. }
  20007. }
  20008. },
  20009. loc: {
  20010. start: {
  20011. line: 1,
  20012. column: 6
  20013. },
  20014. end: {
  20015. line: 1,
  20016. column: 36
  20017. }
  20018. }
  20019. },
  20020. label: {
  20021. type: "Identifier",
  20022. name: "done",
  20023. loc: {
  20024. start: {
  20025. line: 1,
  20026. column: 0
  20027. },
  20028. end: {
  20029. line: 1,
  20030. column: 4
  20031. }
  20032. }
  20033. },
  20034. loc: {
  20035. start: {
  20036. line: 1,
  20037. column: 0
  20038. },
  20039. end: {
  20040. line: 1,
  20041. column: 36
  20042. }
  20043. }
  20044. }
  20045. ],
  20046. loc: {
  20047. start: {
  20048. line: 1,
  20049. column: 0
  20050. },
  20051. end: {
  20052. line: 1,
  20053. column: 36
  20054. }
  20055. }
  20056. });
  20057. test("done: while (true) { continue done; }", {
  20058. type: "Program",
  20059. body: [
  20060. {
  20061. type: "LabeledStatement",
  20062. body: {
  20063. type: "WhileStatement",
  20064. test: {
  20065. type: "Literal",
  20066. value: true,
  20067. loc: {
  20068. start: {
  20069. line: 1,
  20070. column: 13
  20071. },
  20072. end: {
  20073. line: 1,
  20074. column: 17
  20075. }
  20076. }
  20077. },
  20078. body: {
  20079. type: "BlockStatement",
  20080. body: [
  20081. {
  20082. type: "ContinueStatement",
  20083. label: {
  20084. type: "Identifier",
  20085. name: "done",
  20086. loc: {
  20087. start: {
  20088. line: 1,
  20089. column: 30
  20090. },
  20091. end: {
  20092. line: 1,
  20093. column: 34
  20094. }
  20095. }
  20096. },
  20097. loc: {
  20098. start: {
  20099. line: 1,
  20100. column: 21
  20101. },
  20102. end: {
  20103. line: 1,
  20104. column: 35
  20105. }
  20106. }
  20107. }
  20108. ],
  20109. loc: {
  20110. start: {
  20111. line: 1,
  20112. column: 19
  20113. },
  20114. end: {
  20115. line: 1,
  20116. column: 37
  20117. }
  20118. }
  20119. },
  20120. loc: {
  20121. start: {
  20122. line: 1,
  20123. column: 6
  20124. },
  20125. end: {
  20126. line: 1,
  20127. column: 37
  20128. }
  20129. }
  20130. },
  20131. label: {
  20132. type: "Identifier",
  20133. name: "done",
  20134. loc: {
  20135. start: {
  20136. line: 1,
  20137. column: 0
  20138. },
  20139. end: {
  20140. line: 1,
  20141. column: 4
  20142. }
  20143. }
  20144. },
  20145. loc: {
  20146. start: {
  20147. line: 1,
  20148. column: 0
  20149. },
  20150. end: {
  20151. line: 1,
  20152. column: 37
  20153. }
  20154. }
  20155. }
  20156. ],
  20157. loc: {
  20158. start: {
  20159. line: 1,
  20160. column: 0
  20161. },
  20162. end: {
  20163. line: 1,
  20164. column: 37
  20165. }
  20166. }
  20167. });
  20168. test("while (true) { break }", {
  20169. type: "Program",
  20170. body: [
  20171. {
  20172. type: "WhileStatement",
  20173. test: {
  20174. type: "Literal",
  20175. value: true,
  20176. loc: {
  20177. start: {
  20178. line: 1,
  20179. column: 7
  20180. },
  20181. end: {
  20182. line: 1,
  20183. column: 11
  20184. }
  20185. }
  20186. },
  20187. body: {
  20188. type: "BlockStatement",
  20189. body: [
  20190. {
  20191. type: "BreakStatement",
  20192. label: null,
  20193. loc: {
  20194. start: {
  20195. line: 1,
  20196. column: 15
  20197. },
  20198. end: {
  20199. line: 1,
  20200. column: 20
  20201. }
  20202. }
  20203. }
  20204. ],
  20205. loc: {
  20206. start: {
  20207. line: 1,
  20208. column: 13
  20209. },
  20210. end: {
  20211. line: 1,
  20212. column: 22
  20213. }
  20214. }
  20215. },
  20216. loc: {
  20217. start: {
  20218. line: 1,
  20219. column: 0
  20220. },
  20221. end: {
  20222. line: 1,
  20223. column: 22
  20224. }
  20225. }
  20226. }
  20227. ],
  20228. loc: {
  20229. start: {
  20230. line: 1,
  20231. column: 0
  20232. },
  20233. end: {
  20234. line: 1,
  20235. column: 22
  20236. }
  20237. }
  20238. });
  20239. test("done: while (true) { break done }", {
  20240. type: "Program",
  20241. body: [
  20242. {
  20243. type: "LabeledStatement",
  20244. body: {
  20245. type: "WhileStatement",
  20246. test: {
  20247. type: "Literal",
  20248. value: true,
  20249. loc: {
  20250. start: {
  20251. line: 1,
  20252. column: 13
  20253. },
  20254. end: {
  20255. line: 1,
  20256. column: 17
  20257. }
  20258. }
  20259. },
  20260. body: {
  20261. type: "BlockStatement",
  20262. body: [
  20263. {
  20264. type: "BreakStatement",
  20265. label: {
  20266. type: "Identifier",
  20267. name: "done",
  20268. loc: {
  20269. start: {
  20270. line: 1,
  20271. column: 27
  20272. },
  20273. end: {
  20274. line: 1,
  20275. column: 31
  20276. }
  20277. }
  20278. },
  20279. loc: {
  20280. start: {
  20281. line: 1,
  20282. column: 21
  20283. },
  20284. end: {
  20285. line: 1,
  20286. column: 31
  20287. }
  20288. }
  20289. }
  20290. ],
  20291. loc: {
  20292. start: {
  20293. line: 1,
  20294. column: 19
  20295. },
  20296. end: {
  20297. line: 1,
  20298. column: 33
  20299. }
  20300. }
  20301. },
  20302. loc: {
  20303. start: {
  20304. line: 1,
  20305. column: 6
  20306. },
  20307. end: {
  20308. line: 1,
  20309. column: 33
  20310. }
  20311. }
  20312. },
  20313. label: {
  20314. type: "Identifier",
  20315. name: "done",
  20316. loc: {
  20317. start: {
  20318. line: 1,
  20319. column: 0
  20320. },
  20321. end: {
  20322. line: 1,
  20323. column: 4
  20324. }
  20325. }
  20326. },
  20327. loc: {
  20328. start: {
  20329. line: 1,
  20330. column: 0
  20331. },
  20332. end: {
  20333. line: 1,
  20334. column: 33
  20335. }
  20336. }
  20337. }
  20338. ],
  20339. loc: {
  20340. start: {
  20341. line: 1,
  20342. column: 0
  20343. },
  20344. end: {
  20345. line: 1,
  20346. column: 33
  20347. }
  20348. }
  20349. });
  20350. test("done: while (true) { break done; }", {
  20351. type: "Program",
  20352. body: [
  20353. {
  20354. type: "LabeledStatement",
  20355. body: {
  20356. type: "WhileStatement",
  20357. test: {
  20358. type: "Literal",
  20359. value: true,
  20360. loc: {
  20361. start: {
  20362. line: 1,
  20363. column: 13
  20364. },
  20365. end: {
  20366. line: 1,
  20367. column: 17
  20368. }
  20369. }
  20370. },
  20371. body: {
  20372. type: "BlockStatement",
  20373. body: [
  20374. {
  20375. type: "BreakStatement",
  20376. label: {
  20377. type: "Identifier",
  20378. name: "done",
  20379. loc: {
  20380. start: {
  20381. line: 1,
  20382. column: 27
  20383. },
  20384. end: {
  20385. line: 1,
  20386. column: 31
  20387. }
  20388. }
  20389. },
  20390. loc: {
  20391. start: {
  20392. line: 1,
  20393. column: 21
  20394. },
  20395. end: {
  20396. line: 1,
  20397. column: 32
  20398. }
  20399. }
  20400. }
  20401. ],
  20402. loc: {
  20403. start: {
  20404. line: 1,
  20405. column: 19
  20406. },
  20407. end: {
  20408. line: 1,
  20409. column: 34
  20410. }
  20411. }
  20412. },
  20413. loc: {
  20414. start: {
  20415. line: 1,
  20416. column: 6
  20417. },
  20418. end: {
  20419. line: 1,
  20420. column: 34
  20421. }
  20422. }
  20423. },
  20424. label: {
  20425. type: "Identifier",
  20426. name: "done",
  20427. loc: {
  20428. start: {
  20429. line: 1,
  20430. column: 0
  20431. },
  20432. end: {
  20433. line: 1,
  20434. column: 4
  20435. }
  20436. }
  20437. },
  20438. loc: {
  20439. start: {
  20440. line: 1,
  20441. column: 0
  20442. },
  20443. end: {
  20444. line: 1,
  20445. column: 34
  20446. }
  20447. }
  20448. }
  20449. ],
  20450. loc: {
  20451. start: {
  20452. line: 1,
  20453. column: 0
  20454. },
  20455. end: {
  20456. line: 1,
  20457. column: 34
  20458. }
  20459. }
  20460. });
  20461. test("target1: target2: while (true) { continue target1; }", {});
  20462. test("target1: target2: target3: while (true) { continue target1; }", {});
  20463. test("(function(){ return })", {
  20464. type: "Program",
  20465. body: [
  20466. {
  20467. type: "ExpressionStatement",
  20468. expression: {
  20469. type: "FunctionExpression",
  20470. id: null,
  20471. params: [],
  20472. body: {
  20473. type: "BlockStatement",
  20474. body: [
  20475. {
  20476. type: "ReturnStatement",
  20477. argument: null,
  20478. loc: {
  20479. start: {
  20480. line: 1,
  20481. column: 13
  20482. },
  20483. end: {
  20484. line: 1,
  20485. column: 19
  20486. }
  20487. }
  20488. }
  20489. ],
  20490. loc: {
  20491. start: {
  20492. line: 1,
  20493. column: 11
  20494. },
  20495. end: {
  20496. line: 1,
  20497. column: 21
  20498. }
  20499. }
  20500. },
  20501. loc: {
  20502. start: {
  20503. line: 1,
  20504. column: 1
  20505. },
  20506. end: {
  20507. line: 1,
  20508. column: 21
  20509. }
  20510. }
  20511. },
  20512. loc: {
  20513. start: {
  20514. line: 1,
  20515. column: 0
  20516. },
  20517. end: {
  20518. line: 1,
  20519. column: 22
  20520. }
  20521. }
  20522. }
  20523. ],
  20524. loc: {
  20525. start: {
  20526. line: 1,
  20527. column: 0
  20528. },
  20529. end: {
  20530. line: 1,
  20531. column: 22
  20532. }
  20533. }
  20534. });
  20535. test("(function(){ return; })", {
  20536. type: "Program",
  20537. body: [
  20538. {
  20539. type: "ExpressionStatement",
  20540. expression: {
  20541. type: "FunctionExpression",
  20542. id: null,
  20543. params: [],
  20544. body: {
  20545. type: "BlockStatement",
  20546. body: [
  20547. {
  20548. type: "ReturnStatement",
  20549. argument: null,
  20550. loc: {
  20551. start: {
  20552. line: 1,
  20553. column: 13
  20554. },
  20555. end: {
  20556. line: 1,
  20557. column: 20
  20558. }
  20559. }
  20560. }
  20561. ],
  20562. loc: {
  20563. start: {
  20564. line: 1,
  20565. column: 11
  20566. },
  20567. end: {
  20568. line: 1,
  20569. column: 22
  20570. }
  20571. }
  20572. },
  20573. loc: {
  20574. start: {
  20575. line: 1,
  20576. column: 1
  20577. },
  20578. end: {
  20579. line: 1,
  20580. column: 22
  20581. }
  20582. }
  20583. },
  20584. loc: {
  20585. start: {
  20586. line: 1,
  20587. column: 0
  20588. },
  20589. end: {
  20590. line: 1,
  20591. column: 23
  20592. }
  20593. }
  20594. }
  20595. ],
  20596. loc: {
  20597. start: {
  20598. line: 1,
  20599. column: 0
  20600. },
  20601. end: {
  20602. line: 1,
  20603. column: 23
  20604. }
  20605. }
  20606. });
  20607. test("(function(){ return x; })", {
  20608. type: "Program",
  20609. body: [
  20610. {
  20611. type: "ExpressionStatement",
  20612. expression: {
  20613. type: "FunctionExpression",
  20614. id: null,
  20615. params: [],
  20616. body: {
  20617. type: "BlockStatement",
  20618. body: [
  20619. {
  20620. type: "ReturnStatement",
  20621. argument: {
  20622. type: "Identifier",
  20623. name: "x",
  20624. loc: {
  20625. start: {
  20626. line: 1,
  20627. column: 20
  20628. },
  20629. end: {
  20630. line: 1,
  20631. column: 21
  20632. }
  20633. }
  20634. },
  20635. loc: {
  20636. start: {
  20637. line: 1,
  20638. column: 13
  20639. },
  20640. end: {
  20641. line: 1,
  20642. column: 22
  20643. }
  20644. }
  20645. }
  20646. ],
  20647. loc: {
  20648. start: {
  20649. line: 1,
  20650. column: 11
  20651. },
  20652. end: {
  20653. line: 1,
  20654. column: 24
  20655. }
  20656. }
  20657. },
  20658. loc: {
  20659. start: {
  20660. line: 1,
  20661. column: 1
  20662. },
  20663. end: {
  20664. line: 1,
  20665. column: 24
  20666. }
  20667. }
  20668. },
  20669. loc: {
  20670. start: {
  20671. line: 1,
  20672. column: 0
  20673. },
  20674. end: {
  20675. line: 1,
  20676. column: 25
  20677. }
  20678. }
  20679. }
  20680. ],
  20681. loc: {
  20682. start: {
  20683. line: 1,
  20684. column: 0
  20685. },
  20686. end: {
  20687. line: 1,
  20688. column: 25
  20689. }
  20690. }
  20691. });
  20692. test("(function(){ return x * y })", {
  20693. type: "Program",
  20694. body: [
  20695. {
  20696. type: "ExpressionStatement",
  20697. expression: {
  20698. type: "FunctionExpression",
  20699. id: null,
  20700. params: [],
  20701. body: {
  20702. type: "BlockStatement",
  20703. body: [
  20704. {
  20705. type: "ReturnStatement",
  20706. argument: {
  20707. type: "BinaryExpression",
  20708. left: {
  20709. type: "Identifier",
  20710. name: "x",
  20711. loc: {
  20712. start: {
  20713. line: 1,
  20714. column: 20
  20715. },
  20716. end: {
  20717. line: 1,
  20718. column: 21
  20719. }
  20720. }
  20721. },
  20722. operator: "*",
  20723. right: {
  20724. type: "Identifier",
  20725. name: "y",
  20726. loc: {
  20727. start: {
  20728. line: 1,
  20729. column: 24
  20730. },
  20731. end: {
  20732. line: 1,
  20733. column: 25
  20734. }
  20735. }
  20736. },
  20737. loc: {
  20738. start: {
  20739. line: 1,
  20740. column: 20
  20741. },
  20742. end: {
  20743. line: 1,
  20744. column: 25
  20745. }
  20746. }
  20747. },
  20748. loc: {
  20749. start: {
  20750. line: 1,
  20751. column: 13
  20752. },
  20753. end: {
  20754. line: 1,
  20755. column: 25
  20756. }
  20757. }
  20758. }
  20759. ],
  20760. loc: {
  20761. start: {
  20762. line: 1,
  20763. column: 11
  20764. },
  20765. end: {
  20766. line: 1,
  20767. column: 27
  20768. }
  20769. }
  20770. },
  20771. loc: {
  20772. start: {
  20773. line: 1,
  20774. column: 1
  20775. },
  20776. end: {
  20777. line: 1,
  20778. column: 27
  20779. }
  20780. }
  20781. },
  20782. loc: {
  20783. start: {
  20784. line: 1,
  20785. column: 0
  20786. },
  20787. end: {
  20788. line: 1,
  20789. column: 28
  20790. }
  20791. }
  20792. }
  20793. ],
  20794. loc: {
  20795. start: {
  20796. line: 1,
  20797. column: 0
  20798. },
  20799. end: {
  20800. line: 1,
  20801. column: 28
  20802. }
  20803. }
  20804. });
  20805. test("with (x) foo = bar", {
  20806. type: "Program",
  20807. body: [
  20808. {
  20809. type: "WithStatement",
  20810. object: {
  20811. type: "Identifier",
  20812. name: "x",
  20813. loc: {
  20814. start: {
  20815. line: 1,
  20816. column: 6
  20817. },
  20818. end: {
  20819. line: 1,
  20820. column: 7
  20821. }
  20822. }
  20823. },
  20824. body: {
  20825. type: "ExpressionStatement",
  20826. expression: {
  20827. type: "AssignmentExpression",
  20828. operator: "=",
  20829. left: {
  20830. type: "Identifier",
  20831. name: "foo",
  20832. loc: {
  20833. start: {
  20834. line: 1,
  20835. column: 9
  20836. },
  20837. end: {
  20838. line: 1,
  20839. column: 12
  20840. }
  20841. }
  20842. },
  20843. right: {
  20844. type: "Identifier",
  20845. name: "bar",
  20846. loc: {
  20847. start: {
  20848. line: 1,
  20849. column: 15
  20850. },
  20851. end: {
  20852. line: 1,
  20853. column: 18
  20854. }
  20855. }
  20856. },
  20857. loc: {
  20858. start: {
  20859. line: 1,
  20860. column: 9
  20861. },
  20862. end: {
  20863. line: 1,
  20864. column: 18
  20865. }
  20866. }
  20867. },
  20868. loc: {
  20869. start: {
  20870. line: 1,
  20871. column: 9
  20872. },
  20873. end: {
  20874. line: 1,
  20875. column: 18
  20876. }
  20877. }
  20878. },
  20879. loc: {
  20880. start: {
  20881. line: 1,
  20882. column: 0
  20883. },
  20884. end: {
  20885. line: 1,
  20886. column: 18
  20887. }
  20888. }
  20889. }
  20890. ],
  20891. loc: {
  20892. start: {
  20893. line: 1,
  20894. column: 0
  20895. },
  20896. end: {
  20897. line: 1,
  20898. column: 18
  20899. }
  20900. }
  20901. });
  20902. test("with (x) foo = bar;", {
  20903. type: "Program",
  20904. body: [
  20905. {
  20906. type: "WithStatement",
  20907. object: {
  20908. type: "Identifier",
  20909. name: "x",
  20910. loc: {
  20911. start: {
  20912. line: 1,
  20913. column: 6
  20914. },
  20915. end: {
  20916. line: 1,
  20917. column: 7
  20918. }
  20919. }
  20920. },
  20921. body: {
  20922. type: "ExpressionStatement",
  20923. expression: {
  20924. type: "AssignmentExpression",
  20925. operator: "=",
  20926. left: {
  20927. type: "Identifier",
  20928. name: "foo",
  20929. loc: {
  20930. start: {
  20931. line: 1,
  20932. column: 9
  20933. },
  20934. end: {
  20935. line: 1,
  20936. column: 12
  20937. }
  20938. }
  20939. },
  20940. right: {
  20941. type: "Identifier",
  20942. name: "bar",
  20943. loc: {
  20944. start: {
  20945. line: 1,
  20946. column: 15
  20947. },
  20948. end: {
  20949. line: 1,
  20950. column: 18
  20951. }
  20952. }
  20953. },
  20954. loc: {
  20955. start: {
  20956. line: 1,
  20957. column: 9
  20958. },
  20959. end: {
  20960. line: 1,
  20961. column: 18
  20962. }
  20963. }
  20964. },
  20965. loc: {
  20966. start: {
  20967. line: 1,
  20968. column: 9
  20969. },
  20970. end: {
  20971. line: 1,
  20972. column: 19
  20973. }
  20974. }
  20975. },
  20976. loc: {
  20977. start: {
  20978. line: 1,
  20979. column: 0
  20980. },
  20981. end: {
  20982. line: 1,
  20983. column: 19
  20984. }
  20985. }
  20986. }
  20987. ],
  20988. loc: {
  20989. start: {
  20990. line: 1,
  20991. column: 0
  20992. },
  20993. end: {
  20994. line: 1,
  20995. column: 19
  20996. }
  20997. }
  20998. });
  20999. // Test that innocuous string that evaluates to `use strict` is not promoted to
  21000. // Use Strict directive.
  21001. test("'use\\x20strict'; with (x) foo = bar;", {});
  21002. // Test that innocuous string that evaluates to `use strict` is not promoted to
  21003. // Use Strict directive.
  21004. test('"use\\x20strict"; with (x) foo = bar;', {});
  21005. test("with (x) { foo = bar }", {
  21006. type: "Program",
  21007. body: [
  21008. {
  21009. type: "WithStatement",
  21010. object: {
  21011. type: "Identifier",
  21012. name: "x",
  21013. loc: {
  21014. start: {
  21015. line: 1,
  21016. column: 6
  21017. },
  21018. end: {
  21019. line: 1,
  21020. column: 7
  21021. }
  21022. }
  21023. },
  21024. body: {
  21025. type: "BlockStatement",
  21026. body: [
  21027. {
  21028. type: "ExpressionStatement",
  21029. expression: {
  21030. type: "AssignmentExpression",
  21031. operator: "=",
  21032. left: {
  21033. type: "Identifier",
  21034. name: "foo",
  21035. loc: {
  21036. start: {
  21037. line: 1,
  21038. column: 11
  21039. },
  21040. end: {
  21041. line: 1,
  21042. column: 14
  21043. }
  21044. }
  21045. },
  21046. right: {
  21047. type: "Identifier",
  21048. name: "bar",
  21049. loc: {
  21050. start: {
  21051. line: 1,
  21052. column: 17
  21053. },
  21054. end: {
  21055. line: 1,
  21056. column: 20
  21057. }
  21058. }
  21059. },
  21060. loc: {
  21061. start: {
  21062. line: 1,
  21063. column: 11
  21064. },
  21065. end: {
  21066. line: 1,
  21067. column: 20
  21068. }
  21069. }
  21070. },
  21071. loc: {
  21072. start: {
  21073. line: 1,
  21074. column: 11
  21075. },
  21076. end: {
  21077. line: 1,
  21078. column: 20
  21079. }
  21080. }
  21081. }
  21082. ],
  21083. loc: {
  21084. start: {
  21085. line: 1,
  21086. column: 9
  21087. },
  21088. end: {
  21089. line: 1,
  21090. column: 22
  21091. }
  21092. }
  21093. },
  21094. loc: {
  21095. start: {
  21096. line: 1,
  21097. column: 0
  21098. },
  21099. end: {
  21100. line: 1,
  21101. column: 22
  21102. }
  21103. }
  21104. }
  21105. ],
  21106. loc: {
  21107. start: {
  21108. line: 1,
  21109. column: 0
  21110. },
  21111. end: {
  21112. line: 1,
  21113. column: 22
  21114. }
  21115. }
  21116. });
  21117. test("switch (x) {}", {
  21118. type: "Program",
  21119. body: [
  21120. {
  21121. type: "SwitchStatement",
  21122. discriminant: {
  21123. type: "Identifier",
  21124. name: "x",
  21125. loc: {
  21126. start: {
  21127. line: 1,
  21128. column: 8
  21129. },
  21130. end: {
  21131. line: 1,
  21132. column: 9
  21133. }
  21134. }
  21135. },
  21136. cases: [],
  21137. loc: {
  21138. start: {
  21139. line: 1,
  21140. column: 0
  21141. },
  21142. end: {
  21143. line: 1,
  21144. column: 13
  21145. }
  21146. }
  21147. }
  21148. ],
  21149. loc: {
  21150. start: {
  21151. line: 1,
  21152. column: 0
  21153. },
  21154. end: {
  21155. line: 1,
  21156. column: 13
  21157. }
  21158. }
  21159. });
  21160. test("switch (answer) { case 42: hi(); break; }", {
  21161. type: "Program",
  21162. body: [
  21163. {
  21164. type: "SwitchStatement",
  21165. discriminant: {
  21166. type: "Identifier",
  21167. name: "answer",
  21168. loc: {
  21169. start: {
  21170. line: 1,
  21171. column: 8
  21172. },
  21173. end: {
  21174. line: 1,
  21175. column: 14
  21176. }
  21177. }
  21178. },
  21179. cases: [
  21180. {
  21181. type: "SwitchCase",
  21182. consequent: [
  21183. {
  21184. type: "ExpressionStatement",
  21185. expression: {
  21186. type: "CallExpression",
  21187. callee: {
  21188. type: "Identifier",
  21189. name: "hi",
  21190. loc: {
  21191. start: {
  21192. line: 1,
  21193. column: 27
  21194. },
  21195. end: {
  21196. line: 1,
  21197. column: 29
  21198. }
  21199. }
  21200. },
  21201. arguments: [],
  21202. loc: {
  21203. start: {
  21204. line: 1,
  21205. column: 27
  21206. },
  21207. end: {
  21208. line: 1,
  21209. column: 31
  21210. }
  21211. }
  21212. },
  21213. loc: {
  21214. start: {
  21215. line: 1,
  21216. column: 27
  21217. },
  21218. end: {
  21219. line: 1,
  21220. column: 32
  21221. }
  21222. }
  21223. },
  21224. {
  21225. type: "BreakStatement",
  21226. label: null,
  21227. loc: {
  21228. start: {
  21229. line: 1,
  21230. column: 33
  21231. },
  21232. end: {
  21233. line: 1,
  21234. column: 39
  21235. }
  21236. }
  21237. }
  21238. ],
  21239. test: {
  21240. type: "Literal",
  21241. value: 42,
  21242. loc: {
  21243. start: {
  21244. line: 1,
  21245. column: 23
  21246. },
  21247. end: {
  21248. line: 1,
  21249. column: 25
  21250. }
  21251. }
  21252. },
  21253. loc: {
  21254. start: {
  21255. line: 1,
  21256. column: 18
  21257. },
  21258. end: {
  21259. line: 1,
  21260. column: 39
  21261. }
  21262. }
  21263. }
  21264. ],
  21265. loc: {
  21266. start: {
  21267. line: 1,
  21268. column: 0
  21269. },
  21270. end: {
  21271. line: 1,
  21272. column: 41
  21273. }
  21274. }
  21275. }
  21276. ],
  21277. loc: {
  21278. start: {
  21279. line: 1,
  21280. column: 0
  21281. },
  21282. end: {
  21283. line: 1,
  21284. column: 41
  21285. }
  21286. }
  21287. });
  21288. test("switch (answer) { case 42: hi(); break; default: break }", {
  21289. type: "Program",
  21290. body: [
  21291. {
  21292. type: "SwitchStatement",
  21293. discriminant: {
  21294. type: "Identifier",
  21295. name: "answer",
  21296. loc: {
  21297. start: {
  21298. line: 1,
  21299. column: 8
  21300. },
  21301. end: {
  21302. line: 1,
  21303. column: 14
  21304. }
  21305. }
  21306. },
  21307. cases: [
  21308. {
  21309. type: "SwitchCase",
  21310. consequent: [
  21311. {
  21312. type: "ExpressionStatement",
  21313. expression: {
  21314. type: "CallExpression",
  21315. callee: {
  21316. type: "Identifier",
  21317. name: "hi",
  21318. loc: {
  21319. start: {
  21320. line: 1,
  21321. column: 27
  21322. },
  21323. end: {
  21324. line: 1,
  21325. column: 29
  21326. }
  21327. }
  21328. },
  21329. arguments: [],
  21330. loc: {
  21331. start: {
  21332. line: 1,
  21333. column: 27
  21334. },
  21335. end: {
  21336. line: 1,
  21337. column: 31
  21338. }
  21339. }
  21340. },
  21341. loc: {
  21342. start: {
  21343. line: 1,
  21344. column: 27
  21345. },
  21346. end: {
  21347. line: 1,
  21348. column: 32
  21349. }
  21350. }
  21351. },
  21352. {
  21353. type: "BreakStatement",
  21354. label: null,
  21355. loc: {
  21356. start: {
  21357. line: 1,
  21358. column: 33
  21359. },
  21360. end: {
  21361. line: 1,
  21362. column: 39
  21363. }
  21364. }
  21365. }
  21366. ],
  21367. test: {
  21368. type: "Literal",
  21369. value: 42,
  21370. loc: {
  21371. start: {
  21372. line: 1,
  21373. column: 23
  21374. },
  21375. end: {
  21376. line: 1,
  21377. column: 25
  21378. }
  21379. }
  21380. },
  21381. loc: {
  21382. start: {
  21383. line: 1,
  21384. column: 18
  21385. },
  21386. end: {
  21387. line: 1,
  21388. column: 39
  21389. }
  21390. }
  21391. },
  21392. {
  21393. type: "SwitchCase",
  21394. consequent: [
  21395. {
  21396. type: "BreakStatement",
  21397. label: null,
  21398. loc: {
  21399. start: {
  21400. line: 1,
  21401. column: 49
  21402. },
  21403. end: {
  21404. line: 1,
  21405. column: 54
  21406. }
  21407. }
  21408. }
  21409. ],
  21410. test: null,
  21411. loc: {
  21412. start: {
  21413. line: 1,
  21414. column: 40
  21415. },
  21416. end: {
  21417. line: 1,
  21418. column: 54
  21419. }
  21420. }
  21421. }
  21422. ],
  21423. loc: {
  21424. start: {
  21425. line: 1,
  21426. column: 0
  21427. },
  21428. end: {
  21429. line: 1,
  21430. column: 56
  21431. }
  21432. }
  21433. }
  21434. ],
  21435. loc: {
  21436. start: {
  21437. line: 1,
  21438. column: 0
  21439. },
  21440. end: {
  21441. line: 1,
  21442. column: 56
  21443. }
  21444. }
  21445. });
  21446. test("start: for (;;) break start", {
  21447. type: "Program",
  21448. body: [
  21449. {
  21450. type: "LabeledStatement",
  21451. body: {
  21452. type: "ForStatement",
  21453. init: null,
  21454. test: null,
  21455. update: null,
  21456. body: {
  21457. type: "BreakStatement",
  21458. label: {
  21459. type: "Identifier",
  21460. name: "start",
  21461. loc: {
  21462. start: {
  21463. line: 1,
  21464. column: 22
  21465. },
  21466. end: {
  21467. line: 1,
  21468. column: 27
  21469. }
  21470. }
  21471. },
  21472. loc: {
  21473. start: {
  21474. line: 1,
  21475. column: 16
  21476. },
  21477. end: {
  21478. line: 1,
  21479. column: 27
  21480. }
  21481. }
  21482. },
  21483. loc: {
  21484. start: {
  21485. line: 1,
  21486. column: 7
  21487. },
  21488. end: {
  21489. line: 1,
  21490. column: 27
  21491. }
  21492. }
  21493. },
  21494. label: {
  21495. type: "Identifier",
  21496. name: "start",
  21497. loc: {
  21498. start: {
  21499. line: 1,
  21500. column: 0
  21501. },
  21502. end: {
  21503. line: 1,
  21504. column: 5
  21505. }
  21506. }
  21507. },
  21508. loc: {
  21509. start: {
  21510. line: 1,
  21511. column: 0
  21512. },
  21513. end: {
  21514. line: 1,
  21515. column: 27
  21516. }
  21517. }
  21518. }
  21519. ],
  21520. loc: {
  21521. start: {
  21522. line: 1,
  21523. column: 0
  21524. },
  21525. end: {
  21526. line: 1,
  21527. column: 27
  21528. }
  21529. }
  21530. });
  21531. test("start: while (true) break start", {
  21532. type: "Program",
  21533. body: [
  21534. {
  21535. type: "LabeledStatement",
  21536. body: {
  21537. type: "WhileStatement",
  21538. test: {
  21539. type: "Literal",
  21540. value: true,
  21541. loc: {
  21542. start: {
  21543. line: 1,
  21544. column: 14
  21545. },
  21546. end: {
  21547. line: 1,
  21548. column: 18
  21549. }
  21550. }
  21551. },
  21552. body: {
  21553. type: "BreakStatement",
  21554. label: {
  21555. type: "Identifier",
  21556. name: "start",
  21557. loc: {
  21558. start: {
  21559. line: 1,
  21560. column: 26
  21561. },
  21562. end: {
  21563. line: 1,
  21564. column: 31
  21565. }
  21566. }
  21567. },
  21568. loc: {
  21569. start: {
  21570. line: 1,
  21571. column: 20
  21572. },
  21573. end: {
  21574. line: 1,
  21575. column: 31
  21576. }
  21577. }
  21578. },
  21579. loc: {
  21580. start: {
  21581. line: 1,
  21582. column: 7
  21583. },
  21584. end: {
  21585. line: 1,
  21586. column: 31
  21587. }
  21588. }
  21589. },
  21590. label: {
  21591. type: "Identifier",
  21592. name: "start",
  21593. loc: {
  21594. start: {
  21595. line: 1,
  21596. column: 0
  21597. },
  21598. end: {
  21599. line: 1,
  21600. column: 5
  21601. }
  21602. }
  21603. },
  21604. loc: {
  21605. start: {
  21606. line: 1,
  21607. column: 0
  21608. },
  21609. end: {
  21610. line: 1,
  21611. column: 31
  21612. }
  21613. }
  21614. }
  21615. ],
  21616. loc: {
  21617. start: {
  21618. line: 1,
  21619. column: 0
  21620. },
  21621. end: {
  21622. line: 1,
  21623. column: 31
  21624. }
  21625. }
  21626. });
  21627. test("throw x;", {
  21628. type: "Program",
  21629. body: [
  21630. {
  21631. type: "ThrowStatement",
  21632. argument: {
  21633. type: "Identifier",
  21634. name: "x",
  21635. loc: {
  21636. start: {
  21637. line: 1,
  21638. column: 6
  21639. },
  21640. end: {
  21641. line: 1,
  21642. column: 7
  21643. }
  21644. }
  21645. },
  21646. loc: {
  21647. start: {
  21648. line: 1,
  21649. column: 0
  21650. },
  21651. end: {
  21652. line: 1,
  21653. column: 8
  21654. }
  21655. }
  21656. }
  21657. ],
  21658. loc: {
  21659. start: {
  21660. line: 1,
  21661. column: 0
  21662. },
  21663. end: {
  21664. line: 1,
  21665. column: 8
  21666. }
  21667. }
  21668. });
  21669. test("throw x * y", {
  21670. type: "Program",
  21671. body: [
  21672. {
  21673. type: "ThrowStatement",
  21674. argument: {
  21675. type: "BinaryExpression",
  21676. left: {
  21677. type: "Identifier",
  21678. name: "x",
  21679. loc: {
  21680. start: {
  21681. line: 1,
  21682. column: 6
  21683. },
  21684. end: {
  21685. line: 1,
  21686. column: 7
  21687. }
  21688. }
  21689. },
  21690. operator: "*",
  21691. right: {
  21692. type: "Identifier",
  21693. name: "y",
  21694. loc: {
  21695. start: {
  21696. line: 1,
  21697. column: 10
  21698. },
  21699. end: {
  21700. line: 1,
  21701. column: 11
  21702. }
  21703. }
  21704. },
  21705. loc: {
  21706. start: {
  21707. line: 1,
  21708. column: 6
  21709. },
  21710. end: {
  21711. line: 1,
  21712. column: 11
  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. loc: {
  21729. start: {
  21730. line: 1,
  21731. column: 0
  21732. },
  21733. end: {
  21734. line: 1,
  21735. column: 11
  21736. }
  21737. }
  21738. });
  21739. test("throw { message: \"Error\" }", {
  21740. type: "Program",
  21741. body: [
  21742. {
  21743. type: "ThrowStatement",
  21744. argument: {
  21745. type: "ObjectExpression",
  21746. properties: [
  21747. {
  21748. type: "Property",
  21749. key: {
  21750. type: "Identifier",
  21751. name: "message",
  21752. loc: {
  21753. start: {
  21754. line: 1,
  21755. column: 8
  21756. },
  21757. end: {
  21758. line: 1,
  21759. column: 15
  21760. }
  21761. }
  21762. },
  21763. value: {
  21764. type: "Literal",
  21765. value: "Error",
  21766. loc: {
  21767. start: {
  21768. line: 1,
  21769. column: 17
  21770. },
  21771. end: {
  21772. line: 1,
  21773. column: 24
  21774. }
  21775. }
  21776. },
  21777. kind: "init"
  21778. }
  21779. ],
  21780. loc: {
  21781. start: {
  21782. line: 1,
  21783. column: 6
  21784. },
  21785. end: {
  21786. line: 1,
  21787. column: 26
  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. loc: {
  21804. start: {
  21805. line: 1,
  21806. column: 0
  21807. },
  21808. end: {
  21809. line: 1,
  21810. column: 26
  21811. }
  21812. }
  21813. });
  21814. test("try { } catch (e) { }", {
  21815. type: "Program",
  21816. body: [
  21817. {
  21818. type: "TryStatement",
  21819. block: {
  21820. type: "BlockStatement",
  21821. body: [],
  21822. loc: {
  21823. start: {
  21824. line: 1,
  21825. column: 4
  21826. },
  21827. end: {
  21828. line: 1,
  21829. column: 7
  21830. }
  21831. }
  21832. },
  21833. handler: {
  21834. type: "CatchClause",
  21835. param: {
  21836. type: "Identifier",
  21837. name: "e",
  21838. loc: {
  21839. start: {
  21840. line: 1,
  21841. column: 15
  21842. },
  21843. end: {
  21844. line: 1,
  21845. column: 16
  21846. }
  21847. }
  21848. },
  21849. body: {
  21850. type: "BlockStatement",
  21851. body: [],
  21852. loc: {
  21853. start: {
  21854. line: 1,
  21855. column: 18
  21856. },
  21857. end: {
  21858. line: 1,
  21859. column: 21
  21860. }
  21861. }
  21862. },
  21863. loc: {
  21864. start: {
  21865. line: 1,
  21866. column: 8
  21867. },
  21868. end: {
  21869. line: 1,
  21870. column: 21
  21871. }
  21872. }
  21873. }
  21874. ,
  21875. finalizer: null,
  21876. loc: {
  21877. start: {
  21878. line: 1,
  21879. column: 0
  21880. },
  21881. end: {
  21882. line: 1,
  21883. column: 21
  21884. }
  21885. }
  21886. }
  21887. ],
  21888. loc: {
  21889. start: {
  21890. line: 1,
  21891. column: 0
  21892. },
  21893. end: {
  21894. line: 1,
  21895. column: 21
  21896. }
  21897. }
  21898. });
  21899. test("try { } catch (eval) { }", {
  21900. type: "Program",
  21901. body: [
  21902. {
  21903. type: "TryStatement",
  21904. block: {
  21905. type: "BlockStatement",
  21906. body: [],
  21907. loc: {
  21908. start: {
  21909. line: 1,
  21910. column: 4
  21911. },
  21912. end: {
  21913. line: 1,
  21914. column: 7
  21915. }
  21916. }
  21917. },
  21918. handler:
  21919. {
  21920. type: "CatchClause",
  21921. param: {
  21922. type: "Identifier",
  21923. name: "eval",
  21924. loc: {
  21925. start: {
  21926. line: 1,
  21927. column: 15
  21928. },
  21929. end: {
  21930. line: 1,
  21931. column: 19
  21932. }
  21933. }
  21934. },
  21935. body: {
  21936. type: "BlockStatement",
  21937. body: [],
  21938. loc: {
  21939. start: {
  21940. line: 1,
  21941. column: 21
  21942. },
  21943. end: {
  21944. line: 1,
  21945. column: 24
  21946. }
  21947. }
  21948. },
  21949. loc: {
  21950. start: {
  21951. line: 1,
  21952. column: 8
  21953. },
  21954. end: {
  21955. line: 1,
  21956. column: 24
  21957. }
  21958. }
  21959. }
  21960. ,
  21961. finalizer: null,
  21962. loc: {
  21963. start: {
  21964. line: 1,
  21965. column: 0
  21966. },
  21967. end: {
  21968. line: 1,
  21969. column: 24
  21970. }
  21971. }
  21972. }
  21973. ],
  21974. loc: {
  21975. start: {
  21976. line: 1,
  21977. column: 0
  21978. },
  21979. end: {
  21980. line: 1,
  21981. column: 24
  21982. }
  21983. }
  21984. });
  21985. test("try { } catch (arguments) { }", {
  21986. type: "Program",
  21987. body: [
  21988. {
  21989. type: "TryStatement",
  21990. block: {
  21991. type: "BlockStatement",
  21992. body: [],
  21993. loc: {
  21994. start: {
  21995. line: 1,
  21996. column: 4
  21997. },
  21998. end: {
  21999. line: 1,
  22000. column: 7
  22001. }
  22002. }
  22003. },
  22004. handler:
  22005. {
  22006. type: "CatchClause",
  22007. param: {
  22008. type: "Identifier",
  22009. name: "arguments",
  22010. loc: {
  22011. start: {
  22012. line: 1,
  22013. column: 15
  22014. },
  22015. end: {
  22016. line: 1,
  22017. column: 24
  22018. }
  22019. }
  22020. },
  22021. body: {
  22022. type: "BlockStatement",
  22023. body: [],
  22024. loc: {
  22025. start: {
  22026. line: 1,
  22027. column: 26
  22028. },
  22029. end: {
  22030. line: 1,
  22031. column: 29
  22032. }
  22033. }
  22034. },
  22035. loc: {
  22036. start: {
  22037. line: 1,
  22038. column: 8
  22039. },
  22040. end: {
  22041. line: 1,
  22042. column: 29
  22043. }
  22044. }
  22045. }
  22046. ,
  22047. finalizer: null,
  22048. loc: {
  22049. start: {
  22050. line: 1,
  22051. column: 0
  22052. },
  22053. end: {
  22054. line: 1,
  22055. column: 29
  22056. }
  22057. }
  22058. }
  22059. ],
  22060. loc: {
  22061. start: {
  22062. line: 1,
  22063. column: 0
  22064. },
  22065. end: {
  22066. line: 1,
  22067. column: 29
  22068. }
  22069. }
  22070. });
  22071. test("try { } catch (e) { say(e) }", {
  22072. type: "Program",
  22073. body: [
  22074. {
  22075. type: "TryStatement",
  22076. block: {
  22077. type: "BlockStatement",
  22078. body: [],
  22079. loc: {
  22080. start: {
  22081. line: 1,
  22082. column: 4
  22083. },
  22084. end: {
  22085. line: 1,
  22086. column: 7
  22087. }
  22088. }
  22089. },
  22090. handler:
  22091. {
  22092. type: "CatchClause",
  22093. param: {
  22094. type: "Identifier",
  22095. name: "e",
  22096. loc: {
  22097. start: {
  22098. line: 1,
  22099. column: 15
  22100. },
  22101. end: {
  22102. line: 1,
  22103. column: 16
  22104. }
  22105. }
  22106. },
  22107. body: {
  22108. type: "BlockStatement",
  22109. body: [
  22110. {
  22111. type: "ExpressionStatement",
  22112. expression: {
  22113. type: "CallExpression",
  22114. callee: {
  22115. type: "Identifier",
  22116. name: "say",
  22117. loc: {
  22118. start: {
  22119. line: 1,
  22120. column: 20
  22121. },
  22122. end: {
  22123. line: 1,
  22124. column: 23
  22125. }
  22126. }
  22127. },
  22128. arguments: [
  22129. {
  22130. type: "Identifier",
  22131. name: "e",
  22132. loc: {
  22133. start: {
  22134. line: 1,
  22135. column: 24
  22136. },
  22137. end: {
  22138. line: 1,
  22139. column: 25
  22140. }
  22141. }
  22142. }
  22143. ],
  22144. loc: {
  22145. start: {
  22146. line: 1,
  22147. column: 20
  22148. },
  22149. end: {
  22150. line: 1,
  22151. column: 26
  22152. }
  22153. }
  22154. },
  22155. loc: {
  22156. start: {
  22157. line: 1,
  22158. column: 20
  22159. },
  22160. end: {
  22161. line: 1,
  22162. column: 26
  22163. }
  22164. }
  22165. }
  22166. ],
  22167. loc: {
  22168. start: {
  22169. line: 1,
  22170. column: 18
  22171. },
  22172. end: {
  22173. line: 1,
  22174. column: 28
  22175. }
  22176. }
  22177. },
  22178. loc: {
  22179. start: {
  22180. line: 1,
  22181. column: 8
  22182. },
  22183. end: {
  22184. line: 1,
  22185. column: 28
  22186. }
  22187. }
  22188. }
  22189. ,
  22190. finalizer: null,
  22191. loc: {
  22192. start: {
  22193. line: 1,
  22194. column: 0
  22195. },
  22196. end: {
  22197. line: 1,
  22198. column: 28
  22199. }
  22200. }
  22201. }
  22202. ],
  22203. loc: {
  22204. start: {
  22205. line: 1,
  22206. column: 0
  22207. },
  22208. end: {
  22209. line: 1,
  22210. column: 28
  22211. }
  22212. }
  22213. });
  22214. test("try { } finally { cleanup(stuff) }", {
  22215. type: "Program",
  22216. body: [
  22217. {
  22218. type: "TryStatement",
  22219. block: {
  22220. type: "BlockStatement",
  22221. body: [],
  22222. loc: {
  22223. start: {
  22224. line: 1,
  22225. column: 4
  22226. },
  22227. end: {
  22228. line: 1,
  22229. column: 7
  22230. }
  22231. }
  22232. },
  22233. handler: null,
  22234. finalizer: {
  22235. type: "BlockStatement",
  22236. body: [
  22237. {
  22238. type: "ExpressionStatement",
  22239. expression: {
  22240. type: "CallExpression",
  22241. callee: {
  22242. type: "Identifier",
  22243. name: "cleanup",
  22244. loc: {
  22245. start: {
  22246. line: 1,
  22247. column: 18
  22248. },
  22249. end: {
  22250. line: 1,
  22251. column: 25
  22252. }
  22253. }
  22254. },
  22255. arguments: [
  22256. {
  22257. type: "Identifier",
  22258. name: "stuff",
  22259. loc: {
  22260. start: {
  22261. line: 1,
  22262. column: 26
  22263. },
  22264. end: {
  22265. line: 1,
  22266. column: 31
  22267. }
  22268. }
  22269. }
  22270. ],
  22271. loc: {
  22272. start: {
  22273. line: 1,
  22274. column: 18
  22275. },
  22276. end: {
  22277. line: 1,
  22278. column: 32
  22279. }
  22280. }
  22281. },
  22282. loc: {
  22283. start: {
  22284. line: 1,
  22285. column: 18
  22286. },
  22287. end: {
  22288. line: 1,
  22289. column: 32
  22290. }
  22291. }
  22292. }
  22293. ],
  22294. loc: {
  22295. start: {
  22296. line: 1,
  22297. column: 16
  22298. },
  22299. end: {
  22300. line: 1,
  22301. column: 34
  22302. }
  22303. }
  22304. },
  22305. loc: {
  22306. start: {
  22307. line: 1,
  22308. column: 0
  22309. },
  22310. end: {
  22311. line: 1,
  22312. column: 34
  22313. }
  22314. }
  22315. }
  22316. ],
  22317. loc: {
  22318. start: {
  22319. line: 1,
  22320. column: 0
  22321. },
  22322. end: {
  22323. line: 1,
  22324. column: 34
  22325. }
  22326. }
  22327. });
  22328. test("try { doThat(); } catch (e) { say(e) }", {
  22329. type: "Program",
  22330. body: [
  22331. {
  22332. type: "TryStatement",
  22333. block: {
  22334. type: "BlockStatement",
  22335. body: [
  22336. {
  22337. type: "ExpressionStatement",
  22338. expression: {
  22339. type: "CallExpression",
  22340. callee: {
  22341. type: "Identifier",
  22342. name: "doThat",
  22343. loc: {
  22344. start: {
  22345. line: 1,
  22346. column: 6
  22347. },
  22348. end: {
  22349. line: 1,
  22350. column: 12
  22351. }
  22352. }
  22353. },
  22354. arguments: [],
  22355. loc: {
  22356. start: {
  22357. line: 1,
  22358. column: 6
  22359. },
  22360. end: {
  22361. line: 1,
  22362. column: 14
  22363. }
  22364. }
  22365. },
  22366. loc: {
  22367. start: {
  22368. line: 1,
  22369. column: 6
  22370. },
  22371. end: {
  22372. line: 1,
  22373. column: 15
  22374. }
  22375. }
  22376. }
  22377. ],
  22378. loc: {
  22379. start: {
  22380. line: 1,
  22381. column: 4
  22382. },
  22383. end: {
  22384. line: 1,
  22385. column: 17
  22386. }
  22387. }
  22388. },
  22389. handler:
  22390. {
  22391. type: "CatchClause",
  22392. param: {
  22393. type: "Identifier",
  22394. name: "e",
  22395. loc: {
  22396. start: {
  22397. line: 1,
  22398. column: 25
  22399. },
  22400. end: {
  22401. line: 1,
  22402. column: 26
  22403. }
  22404. }
  22405. },
  22406. body: {
  22407. type: "BlockStatement",
  22408. body: [
  22409. {
  22410. type: "ExpressionStatement",
  22411. expression: {
  22412. type: "CallExpression",
  22413. callee: {
  22414. type: "Identifier",
  22415. name: "say",
  22416. loc: {
  22417. start: {
  22418. line: 1,
  22419. column: 30
  22420. },
  22421. end: {
  22422. line: 1,
  22423. column: 33
  22424. }
  22425. }
  22426. },
  22427. arguments: [
  22428. {
  22429. type: "Identifier",
  22430. name: "e",
  22431. loc: {
  22432. start: {
  22433. line: 1,
  22434. column: 34
  22435. },
  22436. end: {
  22437. line: 1,
  22438. column: 35
  22439. }
  22440. }
  22441. }
  22442. ],
  22443. loc: {
  22444. start: {
  22445. line: 1,
  22446. column: 30
  22447. },
  22448. end: {
  22449. line: 1,
  22450. column: 36
  22451. }
  22452. }
  22453. },
  22454. loc: {
  22455. start: {
  22456. line: 1,
  22457. column: 30
  22458. },
  22459. end: {
  22460. line: 1,
  22461. column: 36
  22462. }
  22463. }
  22464. }
  22465. ],
  22466. loc: {
  22467. start: {
  22468. line: 1,
  22469. column: 28
  22470. },
  22471. end: {
  22472. line: 1,
  22473. column: 38
  22474. }
  22475. }
  22476. },
  22477. loc: {
  22478. start: {
  22479. line: 1,
  22480. column: 18
  22481. },
  22482. end: {
  22483. line: 1,
  22484. column: 38
  22485. }
  22486. }
  22487. }
  22488. ,
  22489. finalizer: null,
  22490. loc: {
  22491. start: {
  22492. line: 1,
  22493. column: 0
  22494. },
  22495. end: {
  22496. line: 1,
  22497. column: 38
  22498. }
  22499. }
  22500. }
  22501. ],
  22502. loc: {
  22503. start: {
  22504. line: 1,
  22505. column: 0
  22506. },
  22507. end: {
  22508. line: 1,
  22509. column: 38
  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. body: {
  22592. type: "BlockStatement",
  22593. body: [
  22594. {
  22595. type: "ExpressionStatement",
  22596. expression: {
  22597. type: "CallExpression",
  22598. callee: {
  22599. type: "Identifier",
  22600. name: "say",
  22601. loc: {
  22602. start: {
  22603. line: 1,
  22604. column: 30
  22605. },
  22606. end: {
  22607. line: 1,
  22608. column: 33
  22609. }
  22610. }
  22611. },
  22612. arguments: [
  22613. {
  22614. type: "Identifier",
  22615. name: "e",
  22616. loc: {
  22617. start: {
  22618. line: 1,
  22619. column: 34
  22620. },
  22621. end: {
  22622. line: 1,
  22623. column: 35
  22624. }
  22625. }
  22626. }
  22627. ],
  22628. loc: {
  22629. start: {
  22630. line: 1,
  22631. column: 30
  22632. },
  22633. end: {
  22634. line: 1,
  22635. column: 36
  22636. }
  22637. }
  22638. },
  22639. loc: {
  22640. start: {
  22641. line: 1,
  22642. column: 30
  22643. },
  22644. end: {
  22645. line: 1,
  22646. column: 36
  22647. }
  22648. }
  22649. }
  22650. ],
  22651. loc: {
  22652. start: {
  22653. line: 1,
  22654. column: 28
  22655. },
  22656. end: {
  22657. line: 1,
  22658. column: 38
  22659. }
  22660. }
  22661. },
  22662. loc: {
  22663. start: {
  22664. line: 1,
  22665. column: 18
  22666. },
  22667. end: {
  22668. line: 1,
  22669. column: 38
  22670. }
  22671. }
  22672. }
  22673. ,
  22674. finalizer: {
  22675. type: "BlockStatement",
  22676. body: [
  22677. {
  22678. type: "ExpressionStatement",
  22679. expression: {
  22680. type: "CallExpression",
  22681. callee: {
  22682. type: "Identifier",
  22683. name: "cleanup",
  22684. loc: {
  22685. start: {
  22686. line: 1,
  22687. column: 49
  22688. },
  22689. end: {
  22690. line: 1,
  22691. column: 56
  22692. }
  22693. }
  22694. },
  22695. arguments: [
  22696. {
  22697. type: "Identifier",
  22698. name: "stuff",
  22699. loc: {
  22700. start: {
  22701. line: 1,
  22702. column: 57
  22703. },
  22704. end: {
  22705. line: 1,
  22706. column: 62
  22707. }
  22708. }
  22709. }
  22710. ],
  22711. loc: {
  22712. start: {
  22713. line: 1,
  22714. column: 49
  22715. },
  22716. end: {
  22717. line: 1,
  22718. column: 63
  22719. }
  22720. }
  22721. },
  22722. loc: {
  22723. start: {
  22724. line: 1,
  22725. column: 49
  22726. },
  22727. end: {
  22728. line: 1,
  22729. column: 63
  22730. }
  22731. }
  22732. }
  22733. ],
  22734. loc: {
  22735. start: {
  22736. line: 1,
  22737. column: 47
  22738. },
  22739. end: {
  22740. line: 1,
  22741. column: 65
  22742. }
  22743. }
  22744. },
  22745. loc: {
  22746. start: {
  22747. line: 1,
  22748. column: 0
  22749. },
  22750. end: {
  22751. line: 1,
  22752. column: 65
  22753. }
  22754. }
  22755. }
  22756. ],
  22757. loc: {
  22758. start: {
  22759. line: 1,
  22760. column: 0
  22761. },
  22762. end: {
  22763. line: 1,
  22764. column: 65
  22765. }
  22766. }
  22767. });
  22768. test("debugger;", {
  22769. type: "Program",
  22770. body: [
  22771. {
  22772. type: "DebuggerStatement",
  22773. loc: {
  22774. start: {
  22775. line: 1,
  22776. column: 0
  22777. },
  22778. end: {
  22779. line: 1,
  22780. column: 9
  22781. }
  22782. }
  22783. }
  22784. ],
  22785. loc: {
  22786. start: {
  22787. line: 1,
  22788. column: 0
  22789. },
  22790. end: {
  22791. line: 1,
  22792. column: 9
  22793. }
  22794. }
  22795. });
  22796. test("function hello() { sayHi(); }", {
  22797. type: "Program",
  22798. body: [
  22799. {
  22800. type: "FunctionDeclaration",
  22801. id: {
  22802. type: "Identifier",
  22803. name: "hello",
  22804. loc: {
  22805. start: {
  22806. line: 1,
  22807. column: 9
  22808. },
  22809. end: {
  22810. line: 1,
  22811. column: 14
  22812. }
  22813. }
  22814. },
  22815. params: [],
  22816. body: {
  22817. type: "BlockStatement",
  22818. body: [
  22819. {
  22820. type: "ExpressionStatement",
  22821. expression: {
  22822. type: "CallExpression",
  22823. callee: {
  22824. type: "Identifier",
  22825. name: "sayHi",
  22826. loc: {
  22827. start: {
  22828. line: 1,
  22829. column: 19
  22830. },
  22831. end: {
  22832. line: 1,
  22833. column: 24
  22834. }
  22835. }
  22836. },
  22837. arguments: [],
  22838. loc: {
  22839. start: {
  22840. line: 1,
  22841. column: 19
  22842. },
  22843. end: {
  22844. line: 1,
  22845. column: 26
  22846. }
  22847. }
  22848. },
  22849. loc: {
  22850. start: {
  22851. line: 1,
  22852. column: 19
  22853. },
  22854. end: {
  22855. line: 1,
  22856. column: 27
  22857. }
  22858. }
  22859. }
  22860. ],
  22861. loc: {
  22862. start: {
  22863. line: 1,
  22864. column: 17
  22865. },
  22866. end: {
  22867. line: 1,
  22868. column: 29
  22869. }
  22870. }
  22871. },
  22872. loc: {
  22873. start: {
  22874. line: 1,
  22875. column: 0
  22876. },
  22877. end: {
  22878. line: 1,
  22879. column: 29
  22880. }
  22881. }
  22882. }
  22883. ],
  22884. loc: {
  22885. start: {
  22886. line: 1,
  22887. column: 0
  22888. },
  22889. end: {
  22890. line: 1,
  22891. column: 29
  22892. }
  22893. }
  22894. });
  22895. test("function eval() { }", {
  22896. type: "Program",
  22897. body: [
  22898. {
  22899. type: "FunctionDeclaration",
  22900. id: {
  22901. type: "Identifier",
  22902. name: "eval",
  22903. loc: {
  22904. start: {
  22905. line: 1,
  22906. column: 9
  22907. },
  22908. end: {
  22909. line: 1,
  22910. column: 13
  22911. }
  22912. }
  22913. },
  22914. params: [],
  22915. body: {
  22916. type: "BlockStatement",
  22917. body: [],
  22918. loc: {
  22919. start: {
  22920. line: 1,
  22921. column: 16
  22922. },
  22923. end: {
  22924. line: 1,
  22925. column: 19
  22926. }
  22927. }
  22928. },
  22929. loc: {
  22930. start: {
  22931. line: 1,
  22932. column: 0
  22933. },
  22934. end: {
  22935. line: 1,
  22936. column: 19
  22937. }
  22938. }
  22939. }
  22940. ],
  22941. loc: {
  22942. start: {
  22943. line: 1,
  22944. column: 0
  22945. },
  22946. end: {
  22947. line: 1,
  22948. column: 19
  22949. }
  22950. }
  22951. });
  22952. test("function arguments() { }", {
  22953. type: "Program",
  22954. body: [
  22955. {
  22956. type: "FunctionDeclaration",
  22957. id: {
  22958. type: "Identifier",
  22959. name: "arguments",
  22960. loc: {
  22961. start: {
  22962. line: 1,
  22963. column: 9
  22964. },
  22965. end: {
  22966. line: 1,
  22967. column: 18
  22968. }
  22969. }
  22970. },
  22971. params: [],
  22972. body: {
  22973. type: "BlockStatement",
  22974. body: [],
  22975. loc: {
  22976. start: {
  22977. line: 1,
  22978. column: 21
  22979. },
  22980. end: {
  22981. line: 1,
  22982. column: 24
  22983. }
  22984. }
  22985. },
  22986. loc: {
  22987. start: {
  22988. line: 1,
  22989. column: 0
  22990. },
  22991. end: {
  22992. line: 1,
  22993. column: 24
  22994. }
  22995. }
  22996. }
  22997. ],
  22998. loc: {
  22999. start: {
  23000. line: 1,
  23001. column: 0
  23002. },
  23003. end: {
  23004. line: 1,
  23005. column: 24
  23006. }
  23007. }
  23008. });
  23009. test("function test(t, t) { }", {
  23010. type: "Program",
  23011. body: [
  23012. {
  23013. type: "FunctionDeclaration",
  23014. id: {
  23015. type: "Identifier",
  23016. name: "test",
  23017. loc: {
  23018. start: {
  23019. line: 1,
  23020. column: 9
  23021. },
  23022. end: {
  23023. line: 1,
  23024. column: 13
  23025. }
  23026. }
  23027. },
  23028. params: [
  23029. {
  23030. type: "Identifier",
  23031. name: "t",
  23032. loc: {
  23033. start: {
  23034. line: 1,
  23035. column: 14
  23036. },
  23037. end: {
  23038. line: 1,
  23039. column: 15
  23040. }
  23041. }
  23042. },
  23043. {
  23044. type: "Identifier",
  23045. name: "t",
  23046. loc: {
  23047. start: {
  23048. line: 1,
  23049. column: 17
  23050. },
  23051. end: {
  23052. line: 1,
  23053. column: 18
  23054. }
  23055. }
  23056. }
  23057. ],
  23058. body: {
  23059. type: "BlockStatement",
  23060. body: [],
  23061. loc: {
  23062. start: {
  23063. line: 1,
  23064. column: 20
  23065. },
  23066. end: {
  23067. line: 1,
  23068. column: 23
  23069. }
  23070. }
  23071. },
  23072. loc: {
  23073. start: {
  23074. line: 1,
  23075. column: 0
  23076. },
  23077. end: {
  23078. line: 1,
  23079. column: 23
  23080. }
  23081. }
  23082. }
  23083. ],
  23084. loc: {
  23085. start: {
  23086. line: 1,
  23087. column: 0
  23088. },
  23089. end: {
  23090. line: 1,
  23091. column: 23
  23092. }
  23093. }
  23094. });
  23095. test("(function test(t, t) { })", {
  23096. type: "Program",
  23097. body: [
  23098. {
  23099. type: "ExpressionStatement",
  23100. expression: {
  23101. type: "FunctionExpression",
  23102. id: {
  23103. type: "Identifier",
  23104. name: "test",
  23105. loc: {
  23106. start: {
  23107. line: 1,
  23108. column: 10
  23109. },
  23110. end: {
  23111. line: 1,
  23112. column: 14
  23113. }
  23114. }
  23115. },
  23116. params: [
  23117. {
  23118. type: "Identifier",
  23119. name: "t",
  23120. loc: {
  23121. start: {
  23122. line: 1,
  23123. column: 15
  23124. },
  23125. end: {
  23126. line: 1,
  23127. column: 16
  23128. }
  23129. }
  23130. },
  23131. {
  23132. type: "Identifier",
  23133. name: "t",
  23134. loc: {
  23135. start: {
  23136. line: 1,
  23137. column: 18
  23138. },
  23139. end: {
  23140. line: 1,
  23141. column: 19
  23142. }
  23143. }
  23144. }
  23145. ],
  23146. body: {
  23147. type: "BlockStatement",
  23148. body: [],
  23149. loc: {
  23150. start: {
  23151. line: 1,
  23152. column: 21
  23153. },
  23154. end: {
  23155. line: 1,
  23156. column: 24
  23157. }
  23158. }
  23159. },
  23160. loc: {
  23161. start: {
  23162. line: 1,
  23163. column: 1
  23164. },
  23165. end: {
  23166. line: 1,
  23167. column: 24
  23168. }
  23169. }
  23170. },
  23171. loc: {
  23172. start: {
  23173. line: 1,
  23174. column: 0
  23175. },
  23176. end: {
  23177. line: 1,
  23178. column: 25
  23179. }
  23180. }
  23181. }
  23182. ],
  23183. loc: {
  23184. start: {
  23185. line: 1,
  23186. column: 0
  23187. },
  23188. end: {
  23189. line: 1,
  23190. column: 25
  23191. }
  23192. }
  23193. });
  23194. test("function eval() { function inner() { \"use strict\" } }", {
  23195. type: "Program",
  23196. body: [
  23197. {
  23198. type: "FunctionDeclaration",
  23199. id: {
  23200. type: "Identifier",
  23201. name: "eval",
  23202. loc: {
  23203. start: {
  23204. line: 1,
  23205. column: 9
  23206. },
  23207. end: {
  23208. line: 1,
  23209. column: 13
  23210. }
  23211. }
  23212. },
  23213. params: [],
  23214. body: {
  23215. type: "BlockStatement",
  23216. body: [
  23217. {
  23218. type: "FunctionDeclaration",
  23219. id: {
  23220. type: "Identifier",
  23221. name: "inner",
  23222. loc: {
  23223. start: {
  23224. line: 1,
  23225. column: 27
  23226. },
  23227. end: {
  23228. line: 1,
  23229. column: 32
  23230. }
  23231. }
  23232. },
  23233. params: [],
  23234. body: {
  23235. type: "BlockStatement",
  23236. body: [
  23237. {
  23238. type: "ExpressionStatement",
  23239. expression: {
  23240. type: "Literal",
  23241. value: "use strict",
  23242. loc: {
  23243. start: {
  23244. line: 1,
  23245. column: 37
  23246. },
  23247. end: {
  23248. line: 1,
  23249. column: 49
  23250. }
  23251. }
  23252. },
  23253. loc: {
  23254. start: {
  23255. line: 1,
  23256. column: 37
  23257. },
  23258. end: {
  23259. line: 1,
  23260. column: 49
  23261. }
  23262. }
  23263. }
  23264. ],
  23265. loc: {
  23266. start: {
  23267. line: 1,
  23268. column: 35
  23269. },
  23270. end: {
  23271. line: 1,
  23272. column: 51
  23273. }
  23274. }
  23275. },
  23276. loc: {
  23277. start: {
  23278. line: 1,
  23279. column: 18
  23280. },
  23281. end: {
  23282. line: 1,
  23283. column: 51
  23284. }
  23285. }
  23286. }
  23287. ],
  23288. loc: {
  23289. start: {
  23290. line: 1,
  23291. column: 16
  23292. },
  23293. end: {
  23294. line: 1,
  23295. column: 53
  23296. }
  23297. }
  23298. },
  23299. loc: {
  23300. start: {
  23301. line: 1,
  23302. column: 0
  23303. },
  23304. end: {
  23305. line: 1,
  23306. column: 53
  23307. }
  23308. }
  23309. }
  23310. ],
  23311. loc: {
  23312. start: {
  23313. line: 1,
  23314. column: 0
  23315. },
  23316. end: {
  23317. line: 1,
  23318. column: 53
  23319. }
  23320. }
  23321. });
  23322. test("function hello(a) { sayHi(); }", {
  23323. type: "Program",
  23324. body: [
  23325. {
  23326. type: "FunctionDeclaration",
  23327. id: {
  23328. type: "Identifier",
  23329. name: "hello",
  23330. loc: {
  23331. start: {
  23332. line: 1,
  23333. column: 9
  23334. },
  23335. end: {
  23336. line: 1,
  23337. column: 14
  23338. }
  23339. }
  23340. },
  23341. params: [
  23342. {
  23343. type: "Identifier",
  23344. name: "a",
  23345. loc: {
  23346. start: {
  23347. line: 1,
  23348. column: 15
  23349. },
  23350. end: {
  23351. line: 1,
  23352. column: 16
  23353. }
  23354. }
  23355. }
  23356. ],
  23357. body: {
  23358. type: "BlockStatement",
  23359. body: [
  23360. {
  23361. type: "ExpressionStatement",
  23362. expression: {
  23363. type: "CallExpression",
  23364. callee: {
  23365. type: "Identifier",
  23366. name: "sayHi",
  23367. loc: {
  23368. start: {
  23369. line: 1,
  23370. column: 20
  23371. },
  23372. end: {
  23373. line: 1,
  23374. column: 25
  23375. }
  23376. }
  23377. },
  23378. arguments: [],
  23379. loc: {
  23380. start: {
  23381. line: 1,
  23382. column: 20
  23383. },
  23384. end: {
  23385. line: 1,
  23386. column: 27
  23387. }
  23388. }
  23389. },
  23390. loc: {
  23391. start: {
  23392. line: 1,
  23393. column: 20
  23394. },
  23395. end: {
  23396. line: 1,
  23397. column: 28
  23398. }
  23399. }
  23400. }
  23401. ],
  23402. loc: {
  23403. start: {
  23404. line: 1,
  23405. column: 18
  23406. },
  23407. end: {
  23408. line: 1,
  23409. column: 30
  23410. }
  23411. }
  23412. },
  23413. loc: {
  23414. start: {
  23415. line: 1,
  23416. column: 0
  23417. },
  23418. end: {
  23419. line: 1,
  23420. column: 30
  23421. }
  23422. }
  23423. }
  23424. ],
  23425. loc: {
  23426. start: {
  23427. line: 1,
  23428. column: 0
  23429. },
  23430. end: {
  23431. line: 1,
  23432. column: 30
  23433. }
  23434. }
  23435. });
  23436. test("function hello(a, b) { sayHi(); }", {
  23437. type: "Program",
  23438. body: [
  23439. {
  23440. type: "FunctionDeclaration",
  23441. id: {
  23442. type: "Identifier",
  23443. name: "hello",
  23444. loc: {
  23445. start: {
  23446. line: 1,
  23447. column: 9
  23448. },
  23449. end: {
  23450. line: 1,
  23451. column: 14
  23452. }
  23453. }
  23454. },
  23455. params: [
  23456. {
  23457. type: "Identifier",
  23458. name: "a",
  23459. loc: {
  23460. start: {
  23461. line: 1,
  23462. column: 15
  23463. },
  23464. end: {
  23465. line: 1,
  23466. column: 16
  23467. }
  23468. }
  23469. },
  23470. {
  23471. type: "Identifier",
  23472. name: "b",
  23473. loc: {
  23474. start: {
  23475. line: 1,
  23476. column: 18
  23477. },
  23478. end: {
  23479. line: 1,
  23480. column: 19
  23481. }
  23482. }
  23483. }
  23484. ],
  23485. body: {
  23486. type: "BlockStatement",
  23487. body: [
  23488. {
  23489. type: "ExpressionStatement",
  23490. expression: {
  23491. type: "CallExpression",
  23492. callee: {
  23493. type: "Identifier",
  23494. name: "sayHi",
  23495. loc: {
  23496. start: {
  23497. line: 1,
  23498. column: 23
  23499. },
  23500. end: {
  23501. line: 1,
  23502. column: 28
  23503. }
  23504. }
  23505. },
  23506. arguments: [],
  23507. loc: {
  23508. start: {
  23509. line: 1,
  23510. column: 23
  23511. },
  23512. end: {
  23513. line: 1,
  23514. column: 30
  23515. }
  23516. }
  23517. },
  23518. loc: {
  23519. start: {
  23520. line: 1,
  23521. column: 23
  23522. },
  23523. end: {
  23524. line: 1,
  23525. column: 31
  23526. }
  23527. }
  23528. }
  23529. ],
  23530. loc: {
  23531. start: {
  23532. line: 1,
  23533. column: 21
  23534. },
  23535. end: {
  23536. line: 1,
  23537. column: 33
  23538. }
  23539. }
  23540. },
  23541. loc: {
  23542. start: {
  23543. line: 1,
  23544. column: 0
  23545. },
  23546. end: {
  23547. line: 1,
  23548. column: 33
  23549. }
  23550. }
  23551. }
  23552. ],
  23553. loc: {
  23554. start: {
  23555. line: 1,
  23556. column: 0
  23557. },
  23558. end: {
  23559. line: 1,
  23560. column: 33
  23561. }
  23562. }
  23563. });
  23564. test("function hello(...rest) { }", {
  23565. type: "Program",
  23566. body: [
  23567. {
  23568. type: "FunctionDeclaration",
  23569. id: {
  23570. type: "Identifier",
  23571. name: "hello",
  23572. loc: {
  23573. start: {
  23574. line: 1,
  23575. column: 9
  23576. },
  23577. end: {
  23578. line: 1,
  23579. column: 14
  23580. }
  23581. }
  23582. },
  23583. params: [{
  23584. type: "RestElement",
  23585. argument: {
  23586. type: "Identifier",
  23587. name: "rest",
  23588. loc: {
  23589. start: {
  23590. line: 1,
  23591. column: 18
  23592. },
  23593. end: {
  23594. line: 1,
  23595. column: 22
  23596. }
  23597. }
  23598. }
  23599. }],
  23600. body: {
  23601. type: "BlockStatement",
  23602. body: [],
  23603. loc: {
  23604. start: {
  23605. line: 1,
  23606. column: 24
  23607. },
  23608. end: {
  23609. line: 1,
  23610. column: 27
  23611. }
  23612. }
  23613. },
  23614. loc: {
  23615. start: {
  23616. line: 1,
  23617. column: 0
  23618. },
  23619. end: {
  23620. line: 1,
  23621. column: 27
  23622. }
  23623. }
  23624. }
  23625. ],
  23626. loc: {
  23627. start: {
  23628. line: 1,
  23629. column: 0
  23630. },
  23631. end: {
  23632. line: 1,
  23633. column: 27
  23634. }
  23635. }
  23636. }, {
  23637. ecmaVersion: 6,
  23638. locations: true
  23639. });
  23640. test("function hello(a, ...rest) { }", {
  23641. type: "Program",
  23642. body: [
  23643. {
  23644. type: "FunctionDeclaration",
  23645. id: {
  23646. type: "Identifier",
  23647. name: "hello",
  23648. loc: {
  23649. start: {
  23650. line: 1,
  23651. column: 9
  23652. },
  23653. end: {
  23654. line: 1,
  23655. column: 14
  23656. }
  23657. }
  23658. },
  23659. params: [
  23660. {
  23661. type: "Identifier",
  23662. name: "a",
  23663. loc: {
  23664. start: {
  23665. line: 1,
  23666. column: 15
  23667. },
  23668. end: {
  23669. line: 1,
  23670. column: 16
  23671. }
  23672. }
  23673. },
  23674. {
  23675. type: "RestElement",
  23676. argument: {
  23677. type: "Identifier",
  23678. name: "rest",
  23679. loc: {
  23680. start: {
  23681. line: 1,
  23682. column: 21
  23683. },
  23684. end: {
  23685. line: 1,
  23686. column: 25
  23687. }
  23688. }
  23689. }
  23690. }
  23691. ],
  23692. body: {
  23693. type: "BlockStatement",
  23694. body: [],
  23695. loc: {
  23696. start: {
  23697. line: 1,
  23698. column: 27
  23699. },
  23700. end: {
  23701. line: 1,
  23702. column: 30
  23703. }
  23704. }
  23705. },
  23706. loc: {
  23707. start: {
  23708. line: 1,
  23709. column: 0
  23710. },
  23711. end: {
  23712. line: 1,
  23713. column: 30
  23714. }
  23715. }
  23716. }
  23717. ],
  23718. loc: {
  23719. start: {
  23720. line: 1,
  23721. column: 0
  23722. },
  23723. end: {
  23724. line: 1,
  23725. column: 30
  23726. }
  23727. }
  23728. }, {
  23729. ecmaVersion: 6,
  23730. locations: true
  23731. });
  23732. test("var hi = function() { sayHi() };", {
  23733. type: "Program",
  23734. body: [
  23735. {
  23736. type: "VariableDeclaration",
  23737. declarations: [
  23738. {
  23739. type: "VariableDeclarator",
  23740. id: {
  23741. type: "Identifier",
  23742. name: "hi",
  23743. loc: {
  23744. start: {
  23745. line: 1,
  23746. column: 4
  23747. },
  23748. end: {
  23749. line: 1,
  23750. column: 6
  23751. }
  23752. }
  23753. },
  23754. init: {
  23755. type: "FunctionExpression",
  23756. id: null,
  23757. params: [],
  23758. body: {
  23759. type: "BlockStatement",
  23760. body: [
  23761. {
  23762. type: "ExpressionStatement",
  23763. expression: {
  23764. type: "CallExpression",
  23765. callee: {
  23766. type: "Identifier",
  23767. name: "sayHi",
  23768. loc: {
  23769. start: {
  23770. line: 1,
  23771. column: 22
  23772. },
  23773. end: {
  23774. line: 1,
  23775. column: 27
  23776. }
  23777. }
  23778. },
  23779. arguments: [],
  23780. loc: {
  23781. start: {
  23782. line: 1,
  23783. column: 22
  23784. },
  23785. end: {
  23786. line: 1,
  23787. column: 29
  23788. }
  23789. }
  23790. },
  23791. loc: {
  23792. start: {
  23793. line: 1,
  23794. column: 22
  23795. },
  23796. end: {
  23797. line: 1,
  23798. column: 29
  23799. }
  23800. }
  23801. }
  23802. ],
  23803. loc: {
  23804. start: {
  23805. line: 1,
  23806. column: 20
  23807. },
  23808. end: {
  23809. line: 1,
  23810. column: 31
  23811. }
  23812. }
  23813. },
  23814. loc: {
  23815. start: {
  23816. line: 1,
  23817. column: 9
  23818. },
  23819. end: {
  23820. line: 1,
  23821. column: 31
  23822. }
  23823. }
  23824. },
  23825. loc: {
  23826. start: {
  23827. line: 1,
  23828. column: 4
  23829. },
  23830. end: {
  23831. line: 1,
  23832. column: 31
  23833. }
  23834. }
  23835. }
  23836. ],
  23837. kind: "var",
  23838. loc: {
  23839. start: {
  23840. line: 1,
  23841. column: 0
  23842. },
  23843. end: {
  23844. line: 1,
  23845. column: 32
  23846. }
  23847. }
  23848. }
  23849. ],
  23850. loc: {
  23851. start: {
  23852. line: 1,
  23853. column: 0
  23854. },
  23855. end: {
  23856. line: 1,
  23857. column: 32
  23858. }
  23859. }
  23860. });
  23861. test("var hi = function (...r) { sayHi() };", {
  23862. type: "Program",
  23863. body: [
  23864. {
  23865. type: "VariableDeclaration",
  23866. declarations: [
  23867. {
  23868. type: "VariableDeclarator",
  23869. id: {
  23870. type: "Identifier",
  23871. name: "hi",
  23872. loc: {
  23873. start: {
  23874. line: 1,
  23875. column: 4
  23876. },
  23877. end: {
  23878. line: 1,
  23879. column: 6
  23880. }
  23881. }
  23882. },
  23883. init: {
  23884. type: "FunctionExpression",
  23885. id: null,
  23886. params: [{
  23887. type: "RestElement",
  23888. argument: {
  23889. type: "Identifier",
  23890. name: "r",
  23891. loc: {
  23892. start: {
  23893. line: 1,
  23894. column: 22
  23895. },
  23896. end: {
  23897. line: 1,
  23898. column: 23
  23899. }
  23900. }
  23901. }
  23902. }],
  23903. body: {
  23904. type: "BlockStatement",
  23905. body: [
  23906. {
  23907. type: "ExpressionStatement",
  23908. expression: {
  23909. type: "CallExpression",
  23910. callee: {
  23911. type: "Identifier",
  23912. name: "sayHi",
  23913. loc: {
  23914. start: {
  23915. line: 1,
  23916. column: 27
  23917. },
  23918. end: {
  23919. line: 1,
  23920. column: 32
  23921. }
  23922. }
  23923. },
  23924. arguments: [],
  23925. loc: {
  23926. start: {
  23927. line: 1,
  23928. column: 27
  23929. },
  23930. end: {
  23931. line: 1,
  23932. column: 34
  23933. }
  23934. }
  23935. },
  23936. loc: {
  23937. start: {
  23938. line: 1,
  23939. column: 27
  23940. },
  23941. end: {
  23942. line: 1,
  23943. column: 34
  23944. }
  23945. }
  23946. }
  23947. ],
  23948. loc: {
  23949. start: {
  23950. line: 1,
  23951. column: 25
  23952. },
  23953. end: {
  23954. line: 1,
  23955. column: 36
  23956. }
  23957. }
  23958. },
  23959. loc: {
  23960. start: {
  23961. line: 1,
  23962. column: 9
  23963. },
  23964. end: {
  23965. line: 1,
  23966. column: 36
  23967. }
  23968. }
  23969. },
  23970. loc: {
  23971. start: {
  23972. line: 1,
  23973. column: 4
  23974. },
  23975. end: {
  23976. line: 1,
  23977. column: 36
  23978. }
  23979. }
  23980. }
  23981. ],
  23982. kind: "var",
  23983. loc: {
  23984. start: {
  23985. line: 1,
  23986. column: 0
  23987. },
  23988. end: {
  23989. line: 1,
  23990. column: 37
  23991. }
  23992. }
  23993. }
  23994. ],
  23995. loc: {
  23996. start: {
  23997. line: 1,
  23998. column: 0
  23999. },
  24000. end: {
  24001. line: 1,
  24002. column: 37
  24003. }
  24004. }
  24005. }, {
  24006. ecmaVersion: 6,
  24007. locations: true
  24008. });
  24009. test("var hi = function eval() { };", {
  24010. type: "Program",
  24011. body: [
  24012. {
  24013. type: "VariableDeclaration",
  24014. declarations: [
  24015. {
  24016. type: "VariableDeclarator",
  24017. id: {
  24018. type: "Identifier",
  24019. name: "hi",
  24020. loc: {
  24021. start: {
  24022. line: 1,
  24023. column: 4
  24024. },
  24025. end: {
  24026. line: 1,
  24027. column: 6
  24028. }
  24029. }
  24030. },
  24031. init: {
  24032. type: "FunctionExpression",
  24033. id: {
  24034. type: "Identifier",
  24035. name: "eval",
  24036. loc: {
  24037. start: {
  24038. line: 1,
  24039. column: 18
  24040. },
  24041. end: {
  24042. line: 1,
  24043. column: 22
  24044. }
  24045. }
  24046. },
  24047. params: [],
  24048. body: {
  24049. type: "BlockStatement",
  24050. body: [],
  24051. loc: {
  24052. start: {
  24053. line: 1,
  24054. column: 25
  24055. },
  24056. end: {
  24057. line: 1,
  24058. column: 28
  24059. }
  24060. }
  24061. },
  24062. loc: {
  24063. start: {
  24064. line: 1,
  24065. column: 9
  24066. },
  24067. end: {
  24068. line: 1,
  24069. column: 28
  24070. }
  24071. }
  24072. },
  24073. loc: {
  24074. start: {
  24075. line: 1,
  24076. column: 4
  24077. },
  24078. end: {
  24079. line: 1,
  24080. column: 28
  24081. }
  24082. }
  24083. }
  24084. ],
  24085. kind: "var",
  24086. loc: {
  24087. start: {
  24088. line: 1,
  24089. column: 0
  24090. },
  24091. end: {
  24092. line: 1,
  24093. column: 29
  24094. }
  24095. }
  24096. }
  24097. ],
  24098. loc: {
  24099. start: {
  24100. line: 1,
  24101. column: 0
  24102. },
  24103. end: {
  24104. line: 1,
  24105. column: 29
  24106. }
  24107. }
  24108. });
  24109. test("var hi = function arguments() { };", {
  24110. type: "Program",
  24111. body: [
  24112. {
  24113. type: "VariableDeclaration",
  24114. declarations: [
  24115. {
  24116. type: "VariableDeclarator",
  24117. id: {
  24118. type: "Identifier",
  24119. name: "hi",
  24120. loc: {
  24121. start: {
  24122. line: 1,
  24123. column: 4
  24124. },
  24125. end: {
  24126. line: 1,
  24127. column: 6
  24128. }
  24129. }
  24130. },
  24131. init: {
  24132. type: "FunctionExpression",
  24133. id: {
  24134. type: "Identifier",
  24135. name: "arguments",
  24136. loc: {
  24137. start: {
  24138. line: 1,
  24139. column: 18
  24140. },
  24141. end: {
  24142. line: 1,
  24143. column: 27
  24144. }
  24145. }
  24146. },
  24147. params: [],
  24148. body: {
  24149. type: "BlockStatement",
  24150. body: [],
  24151. loc: {
  24152. start: {
  24153. line: 1,
  24154. column: 30
  24155. },
  24156. end: {
  24157. line: 1,
  24158. column: 33
  24159. }
  24160. }
  24161. },
  24162. loc: {
  24163. start: {
  24164. line: 1,
  24165. column: 9
  24166. },
  24167. end: {
  24168. line: 1,
  24169. column: 33
  24170. }
  24171. }
  24172. },
  24173. loc: {
  24174. start: {
  24175. line: 1,
  24176. column: 4
  24177. },
  24178. end: {
  24179. line: 1,
  24180. column: 33
  24181. }
  24182. }
  24183. }
  24184. ],
  24185. kind: "var",
  24186. loc: {
  24187. start: {
  24188. line: 1,
  24189. column: 0
  24190. },
  24191. end: {
  24192. line: 1,
  24193. column: 34
  24194. }
  24195. }
  24196. }
  24197. ],
  24198. loc: {
  24199. start: {
  24200. line: 1,
  24201. column: 0
  24202. },
  24203. end: {
  24204. line: 1,
  24205. column: 34
  24206. }
  24207. }
  24208. });
  24209. test("var hello = function hi() { sayHi() };", {
  24210. type: "Program",
  24211. body: [
  24212. {
  24213. type: "VariableDeclaration",
  24214. declarations: [
  24215. {
  24216. type: "VariableDeclarator",
  24217. id: {
  24218. type: "Identifier",
  24219. name: "hello",
  24220. loc: {
  24221. start: {
  24222. line: 1,
  24223. column: 4
  24224. },
  24225. end: {
  24226. line: 1,
  24227. column: 9
  24228. }
  24229. }
  24230. },
  24231. init: {
  24232. type: "FunctionExpression",
  24233. id: {
  24234. type: "Identifier",
  24235. name: "hi",
  24236. loc: {
  24237. start: {
  24238. line: 1,
  24239. column: 21
  24240. },
  24241. end: {
  24242. line: 1,
  24243. column: 23
  24244. }
  24245. }
  24246. },
  24247. params: [],
  24248. body: {
  24249. type: "BlockStatement",
  24250. body: [
  24251. {
  24252. type: "ExpressionStatement",
  24253. expression: {
  24254. type: "CallExpression",
  24255. callee: {
  24256. type: "Identifier",
  24257. name: "sayHi",
  24258. loc: {
  24259. start: {
  24260. line: 1,
  24261. column: 28
  24262. },
  24263. end: {
  24264. line: 1,
  24265. column: 33
  24266. }
  24267. }
  24268. },
  24269. arguments: [],
  24270. loc: {
  24271. start: {
  24272. line: 1,
  24273. column: 28
  24274. },
  24275. end: {
  24276. line: 1,
  24277. column: 35
  24278. }
  24279. }
  24280. },
  24281. loc: {
  24282. start: {
  24283. line: 1,
  24284. column: 28
  24285. },
  24286. end: {
  24287. line: 1,
  24288. column: 35
  24289. }
  24290. }
  24291. }
  24292. ],
  24293. loc: {
  24294. start: {
  24295. line: 1,
  24296. column: 26
  24297. },
  24298. end: {
  24299. line: 1,
  24300. column: 37
  24301. }
  24302. }
  24303. },
  24304. loc: {
  24305. start: {
  24306. line: 1,
  24307. column: 12
  24308. },
  24309. end: {
  24310. line: 1,
  24311. column: 37
  24312. }
  24313. }
  24314. },
  24315. loc: {
  24316. start: {
  24317. line: 1,
  24318. column: 4
  24319. },
  24320. end: {
  24321. line: 1,
  24322. column: 37
  24323. }
  24324. }
  24325. }
  24326. ],
  24327. kind: "var",
  24328. loc: {
  24329. start: {
  24330. line: 1,
  24331. column: 0
  24332. },
  24333. end: {
  24334. line: 1,
  24335. column: 38
  24336. }
  24337. }
  24338. }
  24339. ],
  24340. loc: {
  24341. start: {
  24342. line: 1,
  24343. column: 0
  24344. },
  24345. end: {
  24346. line: 1,
  24347. column: 38
  24348. }
  24349. }
  24350. });
  24351. test("(function(){})", {
  24352. type: "Program",
  24353. body: [
  24354. {
  24355. type: "ExpressionStatement",
  24356. expression: {
  24357. type: "FunctionExpression",
  24358. id: null,
  24359. params: [],
  24360. body: {
  24361. type: "BlockStatement",
  24362. body: [],
  24363. loc: {
  24364. start: {
  24365. line: 1,
  24366. column: 11
  24367. },
  24368. end: {
  24369. line: 1,
  24370. column: 13
  24371. }
  24372. }
  24373. },
  24374. loc: {
  24375. start: {
  24376. line: 1,
  24377. column: 1
  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. ],
  24397. loc: {
  24398. start: {
  24399. line: 1,
  24400. column: 0
  24401. },
  24402. end: {
  24403. line: 1,
  24404. column: 14
  24405. }
  24406. }
  24407. });
  24408. test("{ x\n++y }", {
  24409. type: "Program",
  24410. body: [
  24411. {
  24412. type: "BlockStatement",
  24413. body: [
  24414. {
  24415. type: "ExpressionStatement",
  24416. expression: {
  24417. type: "Identifier",
  24418. name: "x",
  24419. loc: {
  24420. start: {
  24421. line: 1,
  24422. column: 2
  24423. },
  24424. end: {
  24425. line: 1,
  24426. column: 3
  24427. }
  24428. }
  24429. },
  24430. loc: {
  24431. start: {
  24432. line: 1,
  24433. column: 2
  24434. },
  24435. end: {
  24436. line: 1,
  24437. column: 3
  24438. }
  24439. }
  24440. },
  24441. {
  24442. type: "ExpressionStatement",
  24443. expression: {
  24444. type: "UpdateExpression",
  24445. operator: "++",
  24446. prefix: true,
  24447. argument: {
  24448. type: "Identifier",
  24449. name: "y",
  24450. loc: {
  24451. start: {
  24452. line: 2,
  24453. column: 2
  24454. },
  24455. end: {
  24456. line: 2,
  24457. column: 3
  24458. }
  24459. }
  24460. },
  24461. loc: {
  24462. start: {
  24463. line: 2,
  24464. column: 0
  24465. },
  24466. end: {
  24467. line: 2,
  24468. column: 3
  24469. }
  24470. }
  24471. },
  24472. loc: {
  24473. start: {
  24474. line: 2,
  24475. column: 0
  24476. },
  24477. end: {
  24478. line: 2,
  24479. column: 3
  24480. }
  24481. }
  24482. }
  24483. ],
  24484. loc: {
  24485. start: {
  24486. line: 1,
  24487. column: 0
  24488. },
  24489. end: {
  24490. line: 2,
  24491. column: 5
  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. test("{ x\n--y }", {
  24508. type: "Program",
  24509. body: [
  24510. {
  24511. type: "BlockStatement",
  24512. body: [
  24513. {
  24514. type: "ExpressionStatement",
  24515. expression: {
  24516. type: "Identifier",
  24517. name: "x",
  24518. loc: {
  24519. start: {
  24520. line: 1,
  24521. column: 2
  24522. },
  24523. end: {
  24524. line: 1,
  24525. column: 3
  24526. }
  24527. }
  24528. },
  24529. loc: {
  24530. start: {
  24531. line: 1,
  24532. column: 2
  24533. },
  24534. end: {
  24535. line: 1,
  24536. column: 3
  24537. }
  24538. }
  24539. },
  24540. {
  24541. type: "ExpressionStatement",
  24542. expression: {
  24543. type: "UpdateExpression",
  24544. operator: "--",
  24545. prefix: true,
  24546. argument: {
  24547. type: "Identifier",
  24548. name: "y",
  24549. loc: {
  24550. start: {
  24551. line: 2,
  24552. column: 2
  24553. },
  24554. end: {
  24555. line: 2,
  24556. column: 3
  24557. }
  24558. }
  24559. },
  24560. loc: {
  24561. start: {
  24562. line: 2,
  24563. column: 0
  24564. },
  24565. end: {
  24566. line: 2,
  24567. column: 3
  24568. }
  24569. }
  24570. },
  24571. loc: {
  24572. start: {
  24573. line: 2,
  24574. column: 0
  24575. },
  24576. end: {
  24577. line: 2,
  24578. column: 3
  24579. }
  24580. }
  24581. }
  24582. ],
  24583. loc: {
  24584. start: {
  24585. line: 1,
  24586. column: 0
  24587. },
  24588. end: {
  24589. line: 2,
  24590. column: 5
  24591. }
  24592. }
  24593. }
  24594. ],
  24595. loc: {
  24596. start: {
  24597. line: 1,
  24598. column: 0
  24599. },
  24600. end: {
  24601. line: 2,
  24602. column: 5
  24603. }
  24604. }
  24605. });
  24606. test("var x /* comment */;", {
  24607. type: "Program",
  24608. body: [
  24609. {
  24610. type: "VariableDeclaration",
  24611. declarations: [
  24612. {
  24613. type: "VariableDeclarator",
  24614. id: {
  24615. type: "Identifier",
  24616. name: "x",
  24617. loc: {
  24618. start: {
  24619. line: 1,
  24620. column: 4
  24621. },
  24622. end: {
  24623. line: 1,
  24624. column: 5
  24625. }
  24626. }
  24627. },
  24628. init: null,
  24629. loc: {
  24630. start: {
  24631. line: 1,
  24632. column: 4
  24633. },
  24634. end: {
  24635. line: 1,
  24636. column: 5
  24637. }
  24638. }
  24639. }
  24640. ],
  24641. kind: "var",
  24642. loc: {
  24643. start: {
  24644. line: 1,
  24645. column: 0
  24646. },
  24647. end: {
  24648. line: 1,
  24649. column: 20
  24650. }
  24651. }
  24652. }
  24653. ],
  24654. loc: {
  24655. start: {
  24656. line: 1,
  24657. column: 0
  24658. },
  24659. end: {
  24660. line: 1,
  24661. column: 20
  24662. }
  24663. }
  24664. });
  24665. test("{ var x = 14, y = 3\nz; }", {
  24666. type: "Program",
  24667. body: [
  24668. {
  24669. type: "BlockStatement",
  24670. body: [
  24671. {
  24672. type: "VariableDeclaration",
  24673. declarations: [
  24674. {
  24675. type: "VariableDeclarator",
  24676. id: {
  24677. type: "Identifier",
  24678. name: "x",
  24679. loc: {
  24680. start: {
  24681. line: 1,
  24682. column: 6
  24683. },
  24684. end: {
  24685. line: 1,
  24686. column: 7
  24687. }
  24688. }
  24689. },
  24690. init: {
  24691. type: "Literal",
  24692. value: 14,
  24693. loc: {
  24694. start: {
  24695. line: 1,
  24696. column: 10
  24697. },
  24698. end: {
  24699. line: 1,
  24700. column: 12
  24701. }
  24702. }
  24703. },
  24704. loc: {
  24705. start: {
  24706. line: 1,
  24707. column: 6
  24708. },
  24709. end: {
  24710. line: 1,
  24711. column: 12
  24712. }
  24713. }
  24714. },
  24715. {
  24716. type: "VariableDeclarator",
  24717. id: {
  24718. type: "Identifier",
  24719. name: "y",
  24720. loc: {
  24721. start: {
  24722. line: 1,
  24723. column: 14
  24724. },
  24725. end: {
  24726. line: 1,
  24727. column: 15
  24728. }
  24729. }
  24730. },
  24731. init: {
  24732. type: "Literal",
  24733. value: 3,
  24734. loc: {
  24735. start: {
  24736. line: 1,
  24737. column: 18
  24738. },
  24739. end: {
  24740. line: 1,
  24741. column: 19
  24742. }
  24743. }
  24744. },
  24745. loc: {
  24746. start: {
  24747. line: 1,
  24748. column: 14
  24749. },
  24750. end: {
  24751. line: 1,
  24752. column: 19
  24753. }
  24754. }
  24755. }
  24756. ],
  24757. kind: "var",
  24758. loc: {
  24759. start: {
  24760. line: 1,
  24761. column: 2
  24762. },
  24763. end: {
  24764. line: 1,
  24765. column: 19
  24766. }
  24767. }
  24768. },
  24769. {
  24770. type: "ExpressionStatement",
  24771. expression: {
  24772. type: "Identifier",
  24773. name: "z",
  24774. loc: {
  24775. start: {
  24776. line: 2,
  24777. column: 0
  24778. },
  24779. end: {
  24780. line: 2,
  24781. column: 1
  24782. }
  24783. }
  24784. },
  24785. loc: {
  24786. start: {
  24787. line: 2,
  24788. column: 0
  24789. },
  24790. end: {
  24791. line: 2,
  24792. column: 2
  24793. }
  24794. }
  24795. }
  24796. ],
  24797. loc: {
  24798. start: {
  24799. line: 1,
  24800. column: 0
  24801. },
  24802. end: {
  24803. line: 2,
  24804. column: 4
  24805. }
  24806. }
  24807. }
  24808. ],
  24809. loc: {
  24810. start: {
  24811. line: 1,
  24812. column: 0
  24813. },
  24814. end: {
  24815. line: 2,
  24816. column: 4
  24817. }
  24818. }
  24819. });
  24820. test("while (true) { continue\nthere; }", {
  24821. type: "Program",
  24822. body: [
  24823. {
  24824. type: "WhileStatement",
  24825. test: {
  24826. type: "Literal",
  24827. value: true,
  24828. loc: {
  24829. start: {
  24830. line: 1,
  24831. column: 7
  24832. },
  24833. end: {
  24834. line: 1,
  24835. column: 11
  24836. }
  24837. }
  24838. },
  24839. body: {
  24840. type: "BlockStatement",
  24841. body: [
  24842. {
  24843. type: "ContinueStatement",
  24844. label: null,
  24845. loc: {
  24846. start: {
  24847. line: 1,
  24848. column: 15
  24849. },
  24850. end: {
  24851. line: 1,
  24852. column: 23
  24853. }
  24854. }
  24855. },
  24856. {
  24857. type: "ExpressionStatement",
  24858. expression: {
  24859. type: "Identifier",
  24860. name: "there",
  24861. loc: {
  24862. start: {
  24863. line: 2,
  24864. column: 0
  24865. },
  24866. end: {
  24867. line: 2,
  24868. column: 5
  24869. }
  24870. }
  24871. },
  24872. loc: {
  24873. start: {
  24874. line: 2,
  24875. column: 0
  24876. },
  24877. end: {
  24878. line: 2,
  24879. column: 6
  24880. }
  24881. }
  24882. }
  24883. ],
  24884. loc: {
  24885. start: {
  24886. line: 1,
  24887. column: 13
  24888. },
  24889. end: {
  24890. line: 2,
  24891. column: 8
  24892. }
  24893. }
  24894. },
  24895. loc: {
  24896. start: {
  24897. line: 1,
  24898. column: 0
  24899. },
  24900. end: {
  24901. line: 2,
  24902. column: 8
  24903. }
  24904. }
  24905. }
  24906. ],
  24907. loc: {
  24908. start: {
  24909. line: 1,
  24910. column: 0
  24911. },
  24912. end: {
  24913. line: 2,
  24914. column: 8
  24915. }
  24916. }
  24917. });
  24918. test("while (true) { continue // Comment\nthere; }", {
  24919. type: "Program",
  24920. body: [
  24921. {
  24922. type: "WhileStatement",
  24923. test: {
  24924. type: "Literal",
  24925. value: true,
  24926. loc: {
  24927. start: {
  24928. line: 1,
  24929. column: 7
  24930. },
  24931. end: {
  24932. line: 1,
  24933. column: 11
  24934. }
  24935. }
  24936. },
  24937. body: {
  24938. type: "BlockStatement",
  24939. body: [
  24940. {
  24941. type: "ContinueStatement",
  24942. label: null,
  24943. loc: {
  24944. start: {
  24945. line: 1,
  24946. column: 15
  24947. },
  24948. end: {
  24949. line: 1,
  24950. column: 23
  24951. }
  24952. }
  24953. },
  24954. {
  24955. type: "ExpressionStatement",
  24956. expression: {
  24957. type: "Identifier",
  24958. name: "there",
  24959. loc: {
  24960. start: {
  24961. line: 2,
  24962. column: 0
  24963. },
  24964. end: {
  24965. line: 2,
  24966. column: 5
  24967. }
  24968. }
  24969. },
  24970. loc: {
  24971. start: {
  24972. line: 2,
  24973. column: 0
  24974. },
  24975. end: {
  24976. line: 2,
  24977. column: 6
  24978. }
  24979. }
  24980. }
  24981. ],
  24982. loc: {
  24983. start: {
  24984. line: 1,
  24985. column: 13
  24986. },
  24987. end: {
  24988. line: 2,
  24989. column: 8
  24990. }
  24991. }
  24992. },
  24993. loc: {
  24994. start: {
  24995. line: 1,
  24996. column: 0
  24997. },
  24998. end: {
  24999. line: 2,
  25000. column: 8
  25001. }
  25002. }
  25003. }
  25004. ],
  25005. loc: {
  25006. start: {
  25007. line: 1,
  25008. column: 0
  25009. },
  25010. end: {
  25011. line: 2,
  25012. column: 8
  25013. }
  25014. }
  25015. });
  25016. test("while (true) { continue /* Multiline\nComment */there; }", {
  25017. type: "Program",
  25018. body: [
  25019. {
  25020. type: "WhileStatement",
  25021. test: {
  25022. type: "Literal",
  25023. value: true,
  25024. loc: {
  25025. start: {
  25026. line: 1,
  25027. column: 7
  25028. },
  25029. end: {
  25030. line: 1,
  25031. column: 11
  25032. }
  25033. }
  25034. },
  25035. body: {
  25036. type: "BlockStatement",
  25037. body: [
  25038. {
  25039. type: "ContinueStatement",
  25040. label: null,
  25041. loc: {
  25042. start: {
  25043. line: 1,
  25044. column: 15
  25045. },
  25046. end: {
  25047. line: 1,
  25048. column: 23
  25049. }
  25050. }
  25051. },
  25052. {
  25053. type: "ExpressionStatement",
  25054. expression: {
  25055. type: "Identifier",
  25056. name: "there",
  25057. loc: {
  25058. start: {
  25059. line: 2,
  25060. column: 10
  25061. },
  25062. end: {
  25063. line: 2,
  25064. column: 15
  25065. }
  25066. }
  25067. },
  25068. loc: {
  25069. start: {
  25070. line: 2,
  25071. column: 10
  25072. },
  25073. end: {
  25074. line: 2,
  25075. column: 16
  25076. }
  25077. }
  25078. }
  25079. ],
  25080. loc: {
  25081. start: {
  25082. line: 1,
  25083. column: 13
  25084. },
  25085. end: {
  25086. line: 2,
  25087. column: 18
  25088. }
  25089. }
  25090. },
  25091. loc: {
  25092. start: {
  25093. line: 1,
  25094. column: 0
  25095. },
  25096. end: {
  25097. line: 2,
  25098. column: 18
  25099. }
  25100. }
  25101. }
  25102. ],
  25103. loc: {
  25104. start: {
  25105. line: 1,
  25106. column: 0
  25107. },
  25108. end: {
  25109. line: 2,
  25110. column: 18
  25111. }
  25112. }
  25113. });
  25114. test("while (true) { break\nthere; }", {
  25115. type: "Program",
  25116. body: [
  25117. {
  25118. type: "WhileStatement",
  25119. test: {
  25120. type: "Literal",
  25121. value: true,
  25122. loc: {
  25123. start: {
  25124. line: 1,
  25125. column: 7
  25126. },
  25127. end: {
  25128. line: 1,
  25129. column: 11
  25130. }
  25131. }
  25132. },
  25133. body: {
  25134. type: "BlockStatement",
  25135. body: [
  25136. {
  25137. type: "BreakStatement",
  25138. label: null,
  25139. loc: {
  25140. start: {
  25141. line: 1,
  25142. column: 15
  25143. },
  25144. end: {
  25145. line: 1,
  25146. column: 20
  25147. }
  25148. }
  25149. },
  25150. {
  25151. type: "ExpressionStatement",
  25152. expression: {
  25153. type: "Identifier",
  25154. name: "there",
  25155. loc: {
  25156. start: {
  25157. line: 2,
  25158. column: 0
  25159. },
  25160. end: {
  25161. line: 2,
  25162. column: 5
  25163. }
  25164. }
  25165. },
  25166. loc: {
  25167. start: {
  25168. line: 2,
  25169. column: 0
  25170. },
  25171. end: {
  25172. line: 2,
  25173. column: 6
  25174. }
  25175. }
  25176. }
  25177. ],
  25178. loc: {
  25179. start: {
  25180. line: 1,
  25181. column: 13
  25182. },
  25183. end: {
  25184. line: 2,
  25185. column: 8
  25186. }
  25187. }
  25188. },
  25189. loc: {
  25190. start: {
  25191. line: 1,
  25192. column: 0
  25193. },
  25194. end: {
  25195. line: 2,
  25196. column: 8
  25197. }
  25198. }
  25199. }
  25200. ],
  25201. loc: {
  25202. start: {
  25203. line: 1,
  25204. column: 0
  25205. },
  25206. end: {
  25207. line: 2,
  25208. column: 8
  25209. }
  25210. }
  25211. });
  25212. test("while (true) { break // Comment\nthere; }", {
  25213. type: "Program",
  25214. body: [
  25215. {
  25216. type: "WhileStatement",
  25217. test: {
  25218. type: "Literal",
  25219. value: true,
  25220. loc: {
  25221. start: {
  25222. line: 1,
  25223. column: 7
  25224. },
  25225. end: {
  25226. line: 1,
  25227. column: 11
  25228. }
  25229. }
  25230. },
  25231. body: {
  25232. type: "BlockStatement",
  25233. body: [
  25234. {
  25235. type: "BreakStatement",
  25236. label: null,
  25237. loc: {
  25238. start: {
  25239. line: 1,
  25240. column: 15
  25241. },
  25242. end: {
  25243. line: 1,
  25244. column: 20
  25245. }
  25246. }
  25247. },
  25248. {
  25249. type: "ExpressionStatement",
  25250. expression: {
  25251. type: "Identifier",
  25252. name: "there",
  25253. loc: {
  25254. start: {
  25255. line: 2,
  25256. column: 0
  25257. },
  25258. end: {
  25259. line: 2,
  25260. column: 5
  25261. }
  25262. }
  25263. },
  25264. loc: {
  25265. start: {
  25266. line: 2,
  25267. column: 0
  25268. },
  25269. end: {
  25270. line: 2,
  25271. column: 6
  25272. }
  25273. }
  25274. }
  25275. ],
  25276. loc: {
  25277. start: {
  25278. line: 1,
  25279. column: 13
  25280. },
  25281. end: {
  25282. line: 2,
  25283. column: 8
  25284. }
  25285. }
  25286. },
  25287. loc: {
  25288. start: {
  25289. line: 1,
  25290. column: 0
  25291. },
  25292. end: {
  25293. line: 2,
  25294. column: 8
  25295. }
  25296. }
  25297. }
  25298. ],
  25299. loc: {
  25300. start: {
  25301. line: 1,
  25302. column: 0
  25303. },
  25304. end: {
  25305. line: 2,
  25306. column: 8
  25307. }
  25308. }
  25309. });
  25310. test("while (true) { break /* Multiline\nComment */there; }", {
  25311. type: "Program",
  25312. body: [
  25313. {
  25314. type: "WhileStatement",
  25315. test: {
  25316. type: "Literal",
  25317. value: true,
  25318. loc: {
  25319. start: {
  25320. line: 1,
  25321. column: 7
  25322. },
  25323. end: {
  25324. line: 1,
  25325. column: 11
  25326. }
  25327. }
  25328. },
  25329. body: {
  25330. type: "BlockStatement",
  25331. body: [
  25332. {
  25333. type: "BreakStatement",
  25334. label: null,
  25335. loc: {
  25336. start: {
  25337. line: 1,
  25338. column: 15
  25339. },
  25340. end: {
  25341. line: 1,
  25342. column: 20
  25343. }
  25344. }
  25345. },
  25346. {
  25347. type: "ExpressionStatement",
  25348. expression: {
  25349. type: "Identifier",
  25350. name: "there",
  25351. loc: {
  25352. start: {
  25353. line: 2,
  25354. column: 10
  25355. },
  25356. end: {
  25357. line: 2,
  25358. column: 15
  25359. }
  25360. }
  25361. },
  25362. loc: {
  25363. start: {
  25364. line: 2,
  25365. column: 10
  25366. },
  25367. end: {
  25368. line: 2,
  25369. column: 16
  25370. }
  25371. }
  25372. }
  25373. ],
  25374. loc: {
  25375. start: {
  25376. line: 1,
  25377. column: 13
  25378. },
  25379. end: {
  25380. line: 2,
  25381. column: 18
  25382. }
  25383. }
  25384. },
  25385. loc: {
  25386. start: {
  25387. line: 1,
  25388. column: 0
  25389. },
  25390. end: {
  25391. line: 2,
  25392. column: 18
  25393. }
  25394. }
  25395. }
  25396. ],
  25397. loc: {
  25398. start: {
  25399. line: 1,
  25400. column: 0
  25401. },
  25402. end: {
  25403. line: 2,
  25404. column: 18
  25405. }
  25406. }
  25407. });
  25408. test("(function(){ return\nx; })", {
  25409. type: "Program",
  25410. body: [
  25411. {
  25412. type: "ExpressionStatement",
  25413. expression: {
  25414. type: "FunctionExpression",
  25415. id: null,
  25416. params: [],
  25417. body: {
  25418. type: "BlockStatement",
  25419. body: [
  25420. {
  25421. type: "ReturnStatement",
  25422. argument: null,
  25423. loc: {
  25424. start: {
  25425. line: 1,
  25426. column: 13
  25427. },
  25428. end: {
  25429. line: 1,
  25430. column: 19
  25431. }
  25432. }
  25433. },
  25434. {
  25435. type: "ExpressionStatement",
  25436. expression: {
  25437. type: "Identifier",
  25438. name: "x",
  25439. loc: {
  25440. start: {
  25441. line: 2,
  25442. column: 0
  25443. },
  25444. end: {
  25445. line: 2,
  25446. column: 1
  25447. }
  25448. }
  25449. },
  25450. loc: {
  25451. start: {
  25452. line: 2,
  25453. column: 0
  25454. },
  25455. end: {
  25456. line: 2,
  25457. column: 2
  25458. }
  25459. }
  25460. }
  25461. ],
  25462. loc: {
  25463. start: {
  25464. line: 1,
  25465. column: 11
  25466. },
  25467. end: {
  25468. line: 2,
  25469. column: 4
  25470. }
  25471. }
  25472. },
  25473. loc: {
  25474. start: {
  25475. line: 1,
  25476. column: 1
  25477. },
  25478. end: {
  25479. line: 2,
  25480. column: 4
  25481. }
  25482. }
  25483. },
  25484. loc: {
  25485. start: {
  25486. line: 1,
  25487. column: 0
  25488. },
  25489. end: {
  25490. line: 2,
  25491. column: 5
  25492. }
  25493. }
  25494. }
  25495. ],
  25496. loc: {
  25497. start: {
  25498. line: 1,
  25499. column: 0
  25500. },
  25501. end: {
  25502. line: 2,
  25503. column: 5
  25504. }
  25505. }
  25506. });
  25507. test("(function(){ return // Comment\nx; })", {
  25508. type: "Program",
  25509. body: [
  25510. {
  25511. type: "ExpressionStatement",
  25512. expression: {
  25513. type: "FunctionExpression",
  25514. id: null,
  25515. params: [],
  25516. body: {
  25517. type: "BlockStatement",
  25518. body: [
  25519. {
  25520. type: "ReturnStatement",
  25521. argument: null,
  25522. loc: {
  25523. start: {
  25524. line: 1,
  25525. column: 13
  25526. },
  25527. end: {
  25528. line: 1,
  25529. column: 19
  25530. }
  25531. }
  25532. },
  25533. {
  25534. type: "ExpressionStatement",
  25535. expression: {
  25536. type: "Identifier",
  25537. name: "x",
  25538. loc: {
  25539. start: {
  25540. line: 2,
  25541. column: 0
  25542. },
  25543. end: {
  25544. line: 2,
  25545. column: 1
  25546. }
  25547. }
  25548. },
  25549. loc: {
  25550. start: {
  25551. line: 2,
  25552. column: 0
  25553. },
  25554. end: {
  25555. line: 2,
  25556. column: 2
  25557. }
  25558. }
  25559. }
  25560. ],
  25561. loc: {
  25562. start: {
  25563. line: 1,
  25564. column: 11
  25565. },
  25566. end: {
  25567. line: 2,
  25568. column: 4
  25569. }
  25570. }
  25571. },
  25572. loc: {
  25573. start: {
  25574. line: 1,
  25575. column: 1
  25576. },
  25577. end: {
  25578. line: 2,
  25579. column: 4
  25580. }
  25581. }
  25582. },
  25583. loc: {
  25584. start: {
  25585. line: 1,
  25586. column: 0
  25587. },
  25588. end: {
  25589. line: 2,
  25590. column: 5
  25591. }
  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. test("(function(){ return/* Multiline\nComment */x; })", {
  25607. type: "Program",
  25608. body: [
  25609. {
  25610. type: "ExpressionStatement",
  25611. expression: {
  25612. type: "FunctionExpression",
  25613. id: null,
  25614. params: [],
  25615. body: {
  25616. type: "BlockStatement",
  25617. body: [
  25618. {
  25619. type: "ReturnStatement",
  25620. argument: null,
  25621. loc: {
  25622. start: {
  25623. line: 1,
  25624. column: 13
  25625. },
  25626. end: {
  25627. line: 1,
  25628. column: 19
  25629. }
  25630. }
  25631. },
  25632. {
  25633. type: "ExpressionStatement",
  25634. expression: {
  25635. type: "Identifier",
  25636. name: "x",
  25637. loc: {
  25638. start: {
  25639. line: 2,
  25640. column: 10
  25641. },
  25642. end: {
  25643. line: 2,
  25644. column: 11
  25645. }
  25646. }
  25647. },
  25648. loc: {
  25649. start: {
  25650. line: 2,
  25651. column: 10
  25652. },
  25653. end: {
  25654. line: 2,
  25655. column: 12
  25656. }
  25657. }
  25658. }
  25659. ],
  25660. loc: {
  25661. start: {
  25662. line: 1,
  25663. column: 11
  25664. },
  25665. end: {
  25666. line: 2,
  25667. column: 14
  25668. }
  25669. }
  25670. },
  25671. loc: {
  25672. start: {
  25673. line: 1,
  25674. column: 1
  25675. },
  25676. end: {
  25677. line: 2,
  25678. column: 14
  25679. }
  25680. }
  25681. },
  25682. loc: {
  25683. start: {
  25684. line: 1,
  25685. column: 0
  25686. },
  25687. end: {
  25688. line: 2,
  25689. column: 15
  25690. }
  25691. }
  25692. }
  25693. ],
  25694. loc: {
  25695. start: {
  25696. line: 1,
  25697. column: 0
  25698. },
  25699. end: {
  25700. line: 2,
  25701. column: 15
  25702. }
  25703. }
  25704. });
  25705. test("{ throw error\nerror; }", {
  25706. type: "Program",
  25707. body: [
  25708. {
  25709. type: "BlockStatement",
  25710. body: [
  25711. {
  25712. type: "ThrowStatement",
  25713. argument: {
  25714. type: "Identifier",
  25715. name: "error",
  25716. loc: {
  25717. start: {
  25718. line: 1,
  25719. column: 8
  25720. },
  25721. end: {
  25722. line: 1,
  25723. column: 13
  25724. }
  25725. }
  25726. },
  25727. loc: {
  25728. start: {
  25729. line: 1,
  25730. column: 2
  25731. },
  25732. end: {
  25733. line: 1,
  25734. column: 13
  25735. }
  25736. }
  25737. },
  25738. {
  25739. type: "ExpressionStatement",
  25740. expression: {
  25741. type: "Identifier",
  25742. name: "error",
  25743. loc: {
  25744. start: {
  25745. line: 2,
  25746. column: 0
  25747. },
  25748. end: {
  25749. line: 2,
  25750. column: 5
  25751. }
  25752. }
  25753. },
  25754. loc: {
  25755. start: {
  25756. line: 2,
  25757. column: 0
  25758. },
  25759. end: {
  25760. line: 2,
  25761. column: 6
  25762. }
  25763. }
  25764. }
  25765. ],
  25766. loc: {
  25767. start: {
  25768. line: 1,
  25769. column: 0
  25770. },
  25771. end: {
  25772. line: 2,
  25773. column: 8
  25774. }
  25775. }
  25776. }
  25777. ],
  25778. loc: {
  25779. start: {
  25780. line: 1,
  25781. column: 0
  25782. },
  25783. end: {
  25784. line: 2,
  25785. column: 8
  25786. }
  25787. }
  25788. });
  25789. test("{ throw error// Comment\nerror; }", {
  25790. type: "Program",
  25791. body: [
  25792. {
  25793. type: "BlockStatement",
  25794. body: [
  25795. {
  25796. type: "ThrowStatement",
  25797. argument: {
  25798. type: "Identifier",
  25799. name: "error",
  25800. loc: {
  25801. start: {
  25802. line: 1,
  25803. column: 8
  25804. },
  25805. end: {
  25806. line: 1,
  25807. column: 13
  25808. }
  25809. }
  25810. },
  25811. loc: {
  25812. start: {
  25813. line: 1,
  25814. column: 2
  25815. },
  25816. end: {
  25817. line: 1,
  25818. column: 13
  25819. }
  25820. }
  25821. },
  25822. {
  25823. type: "ExpressionStatement",
  25824. expression: {
  25825. type: "Identifier",
  25826. name: "error",
  25827. loc: {
  25828. start: {
  25829. line: 2,
  25830. column: 0
  25831. },
  25832. end: {
  25833. line: 2,
  25834. column: 5
  25835. }
  25836. }
  25837. },
  25838. loc: {
  25839. start: {
  25840. line: 2,
  25841. column: 0
  25842. },
  25843. end: {
  25844. line: 2,
  25845. column: 6
  25846. }
  25847. }
  25848. }
  25849. ],
  25850. loc: {
  25851. start: {
  25852. line: 1,
  25853. column: 0
  25854. },
  25855. end: {
  25856. line: 2,
  25857. column: 8
  25858. }
  25859. }
  25860. }
  25861. ],
  25862. loc: {
  25863. start: {
  25864. line: 1,
  25865. column: 0
  25866. },
  25867. end: {
  25868. line: 2,
  25869. column: 8
  25870. }
  25871. }
  25872. });
  25873. test("{ throw error/* Multiline\nComment */error; }", {
  25874. type: "Program",
  25875. body: [
  25876. {
  25877. type: "BlockStatement",
  25878. body: [
  25879. {
  25880. type: "ThrowStatement",
  25881. argument: {
  25882. type: "Identifier",
  25883. name: "error",
  25884. loc: {
  25885. start: {
  25886. line: 1,
  25887. column: 8
  25888. },
  25889. end: {
  25890. line: 1,
  25891. column: 13
  25892. }
  25893. }
  25894. },
  25895. loc: {
  25896. start: {
  25897. line: 1,
  25898. column: 2
  25899. },
  25900. end: {
  25901. line: 1,
  25902. column: 13
  25903. }
  25904. }
  25905. },
  25906. {
  25907. type: "ExpressionStatement",
  25908. expression: {
  25909. type: "Identifier",
  25910. name: "error",
  25911. loc: {
  25912. start: {
  25913. line: 2,
  25914. column: 10
  25915. },
  25916. end: {
  25917. line: 2,
  25918. column: 15
  25919. }
  25920. }
  25921. },
  25922. loc: {
  25923. start: {
  25924. line: 2,
  25925. column: 10
  25926. },
  25927. end: {
  25928. line: 2,
  25929. column: 16
  25930. }
  25931. }
  25932. }
  25933. ],
  25934. loc: {
  25935. start: {
  25936. line: 1,
  25937. column: 0
  25938. },
  25939. end: {
  25940. line: 2,
  25941. column: 18
  25942. }
  25943. }
  25944. }
  25945. ],
  25946. loc: {
  25947. start: {
  25948. line: 1,
  25949. column: 0
  25950. },
  25951. end: {
  25952. line: 2,
  25953. column: 18
  25954. }
  25955. }
  25956. });
  25957. test("", {
  25958. type: "Program",
  25959. body: [],
  25960. loc: {
  25961. start: {
  25962. line: 1,
  25963. column: 0
  25964. },
  25965. end: {
  25966. line: 1,
  25967. column: 0
  25968. }
  25969. }
  25970. });
  25971. test("foo: if (true) break foo;", {
  25972. type: "Program",
  25973. loc: {
  25974. start: {
  25975. line: 1,
  25976. column: 0
  25977. },
  25978. end: {
  25979. line: 1,
  25980. column: 25
  25981. }
  25982. },
  25983. body: [
  25984. {
  25985. type: "LabeledStatement",
  25986. loc: {
  25987. start: {
  25988. line: 1,
  25989. column: 0
  25990. },
  25991. end: {
  25992. line: 1,
  25993. column: 25
  25994. }
  25995. },
  25996. body: {
  25997. type: "IfStatement",
  25998. loc: {
  25999. start: {
  26000. line: 1,
  26001. column: 5
  26002. },
  26003. end: {
  26004. line: 1,
  26005. column: 25
  26006. }
  26007. },
  26008. test: {
  26009. type: "Literal",
  26010. loc: {
  26011. start: {
  26012. line: 1,
  26013. column: 9
  26014. },
  26015. end: {
  26016. line: 1,
  26017. column: 13
  26018. }
  26019. },
  26020. value: true
  26021. },
  26022. consequent: {
  26023. type: "BreakStatement",
  26024. loc: {
  26025. start: {
  26026. line: 1,
  26027. column: 15
  26028. },
  26029. end: {
  26030. line: 1,
  26031. column: 25
  26032. }
  26033. },
  26034. label: {
  26035. type: "Identifier",
  26036. loc: {
  26037. start: {
  26038. line: 1,
  26039. column: 21
  26040. },
  26041. end: {
  26042. line: 1,
  26043. column: 24
  26044. }
  26045. },
  26046. name: "foo"
  26047. }
  26048. },
  26049. alternate: null
  26050. },
  26051. label: {
  26052. type: "Identifier",
  26053. loc: {
  26054. start: {
  26055. line: 1,
  26056. column: 0
  26057. },
  26058. end: {
  26059. line: 1,
  26060. column: 3
  26061. }
  26062. },
  26063. name: "foo"
  26064. }
  26065. }
  26066. ]
  26067. });
  26068. test("(function () {\n 'use strict';\n '\0';\n}())", {
  26069. type: "Program",
  26070. loc: {
  26071. start: {
  26072. line: 1,
  26073. column: 0
  26074. },
  26075. end: {
  26076. line: 4,
  26077. column: 4
  26078. }
  26079. },
  26080. body: [
  26081. {
  26082. type: "ExpressionStatement",
  26083. loc: {
  26084. start: {
  26085. line: 1,
  26086. column: 0
  26087. },
  26088. end: {
  26089. line: 4,
  26090. column: 4
  26091. }
  26092. },
  26093. expression: {
  26094. type: "CallExpression",
  26095. loc: {
  26096. start: {
  26097. line: 1,
  26098. column: 1
  26099. },
  26100. end: {
  26101. line: 4,
  26102. column: 3
  26103. }
  26104. },
  26105. callee: {
  26106. type: "FunctionExpression",
  26107. loc: {
  26108. start: {
  26109. line: 1,
  26110. column: 1
  26111. },
  26112. end: {
  26113. line: 4,
  26114. column: 1
  26115. }
  26116. },
  26117. id: null,
  26118. params: [],
  26119. body: {
  26120. type: "BlockStatement",
  26121. loc: {
  26122. start: {
  26123. line: 1,
  26124. column: 13
  26125. },
  26126. end: {
  26127. line: 4,
  26128. column: 1
  26129. }
  26130. },
  26131. body: [
  26132. {
  26133. type: "ExpressionStatement",
  26134. loc: {
  26135. start: {
  26136. line: 2,
  26137. column: 1
  26138. },
  26139. end: {
  26140. line: 2,
  26141. column: 14
  26142. }
  26143. },
  26144. expression: {
  26145. type: "Literal",
  26146. loc: {
  26147. start: {
  26148. line: 2,
  26149. column: 1
  26150. },
  26151. end: {
  26152. line: 2,
  26153. column: 13
  26154. }
  26155. },
  26156. value: "use strict"
  26157. }
  26158. },
  26159. {
  26160. type: "ExpressionStatement",
  26161. loc: {
  26162. start: {
  26163. line: 3,
  26164. column: 1
  26165. },
  26166. end: {
  26167. line: 3,
  26168. column: 5
  26169. }
  26170. },
  26171. expression: {
  26172. type: "Literal",
  26173. loc: {
  26174. start: {
  26175. line: 3,
  26176. column: 1
  26177. },
  26178. end: {
  26179. line: 3,
  26180. column: 4
  26181. }
  26182. },
  26183. value: "\u0000"
  26184. }
  26185. }
  26186. ]
  26187. }
  26188. },
  26189. arguments: [],
  26190. }
  26191. }
  26192. ]
  26193. });
  26194. test("123..toString(10)", {
  26195. type: "Program",
  26196. body: [
  26197. {
  26198. type: "ExpressionStatement",
  26199. expression: {
  26200. type: "CallExpression",
  26201. callee: {
  26202. type: "MemberExpression",
  26203. object: {
  26204. type: "Literal",
  26205. value: 123
  26206. },
  26207. property: {
  26208. type: "Identifier",
  26209. name: "toString"
  26210. },
  26211. computed: false,
  26212. },
  26213. arguments: [
  26214. {
  26215. type: "Literal",
  26216. value: 10
  26217. }
  26218. ],
  26219. }
  26220. }
  26221. ]
  26222. });
  26223. test("123.+2", {
  26224. type: "Program",
  26225. body: [
  26226. {
  26227. type: "ExpressionStatement",
  26228. expression: {
  26229. type: "BinaryExpression",
  26230. left: {
  26231. type: "Literal",
  26232. value: 123
  26233. },
  26234. operator: "+",
  26235. right: {
  26236. type: "Literal",
  26237. value: 2
  26238. },
  26239. }
  26240. }
  26241. ]
  26242. });
  26243. test("a\u2028b", {
  26244. type: "Program",
  26245. body: [
  26246. {
  26247. type: "ExpressionStatement",
  26248. expression: {
  26249. type: "Identifier",
  26250. name: "a"
  26251. }
  26252. },
  26253. {
  26254. type: "ExpressionStatement",
  26255. expression: {
  26256. type: "Identifier",
  26257. name: "b"
  26258. }
  26259. }
  26260. ]
  26261. });
  26262. test("'a\\u0026b'", {
  26263. type: "Program",
  26264. body: [
  26265. {
  26266. type: "ExpressionStatement",
  26267. expression: {
  26268. type: "Literal",
  26269. value: "a\u0026b"
  26270. }
  26271. }
  26272. ]
  26273. });
  26274. test("foo: 10; foo: 20;", {
  26275. type: "Program",
  26276. body: [
  26277. {
  26278. type: "LabeledStatement",
  26279. body: {
  26280. type: "ExpressionStatement",
  26281. expression: {
  26282. type: "Literal",
  26283. value: 10,
  26284. raw: "10"
  26285. }
  26286. },
  26287. label: {
  26288. type: "Identifier",
  26289. name: "foo"
  26290. }
  26291. },
  26292. {
  26293. type: "LabeledStatement",
  26294. body: {
  26295. type: "ExpressionStatement",
  26296. expression: {
  26297. type: "Literal",
  26298. value: 20,
  26299. raw: "20"
  26300. }
  26301. },
  26302. label: {
  26303. type: "Identifier",
  26304. name: "foo"
  26305. }
  26306. }
  26307. ]
  26308. });
  26309. test("if(1)/ foo/", {
  26310. type: "Program",
  26311. body: [
  26312. {
  26313. type: "IfStatement",
  26314. test: {
  26315. type: "Literal",
  26316. value: 1,
  26317. raw: "1"
  26318. },
  26319. consequent: {
  26320. type: "ExpressionStatement",
  26321. expression: {
  26322. type: "Literal",
  26323. raw: "/ foo/"
  26324. }
  26325. },
  26326. alternate: null
  26327. }
  26328. ]
  26329. });
  26330. test("price_9̶9̶_89", {
  26331. type: "Program",
  26332. body: [
  26333. {
  26334. type: "ExpressionStatement",
  26335. expression: {
  26336. type: "Identifier",
  26337. name: "price_9̶9̶_89",
  26338. }
  26339. }
  26340. ]
  26341. });
  26342. // `\0` is valid even in strict mode
  26343. test("function hello() { 'use strict'; \"\\0\"; }", {});
  26344. // option tests
  26345. test("var a = 1;", {
  26346. type: "Program",
  26347. loc: {
  26348. start: {
  26349. line: 1,
  26350. column: 0
  26351. },
  26352. end: {
  26353. line: 1,
  26354. column: 10
  26355. },
  26356. source: "test.js"
  26357. },
  26358. body: [
  26359. {
  26360. type: "VariableDeclaration",
  26361. loc: {
  26362. start: {
  26363. line: 1,
  26364. column: 0
  26365. },
  26366. end: {
  26367. line: 1,
  26368. column: 10
  26369. },
  26370. source: "test.js"
  26371. },
  26372. declarations: [
  26373. {
  26374. type: "VariableDeclarator",
  26375. loc: {
  26376. start: {
  26377. line: 1,
  26378. column: 4
  26379. },
  26380. end: {
  26381. line: 1,
  26382. column: 9
  26383. },
  26384. source: "test.js"
  26385. },
  26386. id: {
  26387. type: "Identifier",
  26388. loc: {
  26389. start: {
  26390. line: 1,
  26391. column: 4
  26392. },
  26393. end: {
  26394. line: 1,
  26395. column: 5
  26396. },
  26397. source: "test.js"
  26398. },
  26399. name: "a"
  26400. },
  26401. init: {
  26402. type: "Literal",
  26403. loc: {
  26404. start: {
  26405. line: 1,
  26406. column: 8
  26407. },
  26408. end: {
  26409. line: 1,
  26410. column: 9
  26411. },
  26412. source: "test.js"
  26413. },
  26414. value: 1,
  26415. raw: "1"
  26416. }
  26417. }
  26418. ],
  26419. kind: "var"
  26420. }
  26421. ]
  26422. }, {
  26423. locations: true,
  26424. sourceFile: "test.js"
  26425. });
  26426. test("a.in / b", {
  26427. type: "Program",
  26428. body: [
  26429. {
  26430. type: "ExpressionStatement",
  26431. expression: {
  26432. type: "BinaryExpression",
  26433. left: {
  26434. type: "MemberExpression",
  26435. object: {
  26436. type: "Identifier",
  26437. name: "a"
  26438. },
  26439. property: {
  26440. type: "Identifier",
  26441. name: "in"
  26442. },
  26443. computed: false
  26444. },
  26445. operator: "/",
  26446. right: {
  26447. type: "Identifier",
  26448. name: "b"
  26449. }
  26450. }
  26451. }
  26452. ]
  26453. });
  26454. // A number of slash-disambiguation corner cases
  26455. test("return {} / 2", {}, {allowReturnOutsideFunction: true});
  26456. test("return\n{}\n/foo/", {}, {allowReturnOutsideFunction: true});
  26457. test("+{} / 2", {});
  26458. test("{}\n/foo/", {});
  26459. test("x++\n{}\n/foo/", {});
  26460. test("{{}\n/foo/}", {});
  26461. test("while (1) /foo/", {});
  26462. test("while (1) {} /foo/", {});
  26463. test("(1) / 2", {});
  26464. test("({a: [1]}+[]) / 2", {});
  26465. test("{[1]}\n/foo/", {});
  26466. test("switch(a) { case 1: {}\n/foo/ }", {});
  26467. test("({1: {} / 2})", {});
  26468. test("+x++ / 2", {});
  26469. test("foo.in\n{}\n/foo/", {});
  26470. test("var x = function f() {} / 3;", {});
  26471. test("+function f() {} / 3;", {});
  26472. test("foo: function x() {} /regexp/", {});
  26473. test("x = {foo: function x() {} / divide}", {});
  26474. test("foo; function f() {} /regexp/", {});
  26475. test("{}/=/", {
  26476. type: "Program",
  26477. body: [
  26478. {
  26479. type: "BlockStatement",
  26480. body: []
  26481. },
  26482. {
  26483. type: "ExpressionStatement",
  26484. expression: {
  26485. type: "Literal",
  26486. raw: "/=/"
  26487. }
  26488. }
  26489. ]
  26490. });
  26491. test("foo <!--bar\n+baz", {
  26492. type: "Program",
  26493. body: [
  26494. {
  26495. type: "ExpressionStatement",
  26496. expression: {
  26497. type: "BinaryExpression",
  26498. left: {
  26499. type: "Identifier",
  26500. name: "foo"
  26501. },
  26502. operator: "+",
  26503. right: {
  26504. type: "Identifier",
  26505. name: "baz"
  26506. }
  26507. }
  26508. }
  26509. ]
  26510. });
  26511. test("x = y-->10;\n --> nothing", {
  26512. type: "Program",
  26513. body: [
  26514. {
  26515. type: "ExpressionStatement",
  26516. expression: {
  26517. type: "AssignmentExpression",
  26518. operator: "=",
  26519. left: {
  26520. type: "Identifier",
  26521. name: "x"
  26522. },
  26523. right: {
  26524. type: "BinaryExpression",
  26525. left: {
  26526. type: "UpdateExpression",
  26527. operator: "--",
  26528. prefix: false,
  26529. argument: {
  26530. type: "Identifier",
  26531. name: "y"
  26532. }
  26533. },
  26534. operator: ">",
  26535. right: {
  26536. type: "Literal",
  26537. value: 10
  26538. }
  26539. }
  26540. }
  26541. }
  26542. ]
  26543. });
  26544. test("'use strict';\nobject.static();", {
  26545. type: "Program",
  26546. body: [
  26547. {
  26548. type: "ExpressionStatement",
  26549. expression: {
  26550. type: "Literal",
  26551. value: "use strict",
  26552. raw: "'use strict'"
  26553. }
  26554. },
  26555. {
  26556. type: "ExpressionStatement",
  26557. expression: {
  26558. type: "CallExpression",
  26559. callee: {
  26560. type: "MemberExpression",
  26561. object: {
  26562. type: "Identifier",
  26563. name: "object"
  26564. },
  26565. property: {
  26566. type: "Identifier",
  26567. name: "static"
  26568. },
  26569. computed: false
  26570. },
  26571. arguments: []
  26572. }
  26573. }
  26574. ]
  26575. });
  26576. // Failure tests
  26577. testFail("{",
  26578. "Unexpected token (1:1)");
  26579. testFail("}",
  26580. "Unexpected token (1:0)");
  26581. testFail("3ea",
  26582. "Invalid number (1:0)");
  26583. testFail("3in []",
  26584. "Identifier directly after number (1:1)");
  26585. testFail("3e",
  26586. "Invalid number (1:0)");
  26587. testFail("3e+",
  26588. "Invalid number (1:0)");
  26589. testFail("3e-",
  26590. "Invalid number (1:0)");
  26591. testFail("3x",
  26592. "Identifier directly after number (1:1)");
  26593. testFail("3x0",
  26594. "Identifier directly after number (1:1)");
  26595. testFail("0x",
  26596. "Expected number in radix 16 (1:2)");
  26597. testFail("09",
  26598. "Invalid number (1:0)");
  26599. testFail("018",
  26600. "Invalid number (1:0)");
  26601. testFail("01a",
  26602. "Identifier directly after number (1:2)");
  26603. testFail("3in[]",
  26604. "Identifier directly after number (1:1)");
  26605. testFail("0x3in[]",
  26606. "Identifier directly after number (1:3)");
  26607. testFail("\"Hello\nWorld\"",
  26608. "Unterminated string constant (1:0)");
  26609. testFail("x\\",
  26610. "Expecting Unicode escape sequence \\uXXXX (1:2)");
  26611. testFail("x\\u005c",
  26612. "Invalid Unicode escape (1:1)");
  26613. testFail("x\\u002a",
  26614. "Invalid Unicode escape (1:1)");
  26615. testFail("/",
  26616. "Unterminated regular expression (1:1)");
  26617. testFail("/test",
  26618. "Unterminated regular expression (1:1)");
  26619. testFail("var x = /[a-z]/\\ux",
  26620. "Bad character escape sequence (1:17)");
  26621. testFail("3 = 4",
  26622. "Assigning to rvalue (1:0)");
  26623. testFail("func() = 4",
  26624. "Assigning to rvalue (1:0)");
  26625. testFail("(1 + 1) = 10",
  26626. "Assigning to rvalue (1:1)");
  26627. testFail("1++",
  26628. "Assigning to rvalue (1:0)");
  26629. testFail("1--",
  26630. "Assigning to rvalue (1:0)");
  26631. testFail("++1",
  26632. "Assigning to rvalue (1:2)");
  26633. testFail("--1",
  26634. "Assigning to rvalue (1:2)");
  26635. testFail("for((1 + 1) in list) process(x);",
  26636. "Assigning to rvalue (1:5)");
  26637. testFail("[",
  26638. "Unexpected token (1:1)");
  26639. testFail("[,",
  26640. "Unexpected token (1:2)");
  26641. testFail("1 + {",
  26642. "Unexpected token (1:5)");
  26643. testFail("1 + { t:t ",
  26644. "Unexpected token (1:10)");
  26645. testFail("1 + { t:t,",
  26646. "Unexpected token (1:10)");
  26647. testFail("var x = /\n/",
  26648. "Unterminated regular expression (1:9)");
  26649. testFail("var x = \"\n",
  26650. "Unterminated string constant (1:8)");
  26651. testFail("var if = 42",
  26652. "Unexpected token (1:4)");
  26653. testFail("i + 2 = 42",
  26654. "Assigning to rvalue (1:0)");
  26655. testFail("+i = 42",
  26656. "Assigning to rvalue (1:0)");
  26657. testFail("1 + (",
  26658. "Unexpected token (1:5)");
  26659. testFail("\n\n\n{",
  26660. "Unexpected token (4:1)");
  26661. testFail("\n/* Some multiline\ncomment */\n)",
  26662. "Unexpected token (4:0)");
  26663. testFail("{ set 1 }",
  26664. "Unexpected token (1:6)");
  26665. testFail("{ get 2 }",
  26666. "Unexpected token (1:6)");
  26667. testFail("({ set: s(if) { } })",
  26668. "Unexpected token (1:10)");
  26669. testFail("({ set s(.) { } })",
  26670. "Unexpected token (1:9)");
  26671. testFail("({ set: s() { } })",
  26672. "Unexpected token (1:12)");
  26673. testFail("({ set: s(a, b) { } })",
  26674. "Unexpected token (1:16)");
  26675. testFail("({ get: g(d) { } })",
  26676. "Unexpected token (1:13)");
  26677. testFail("({ get i() { }, i: 42 })",
  26678. "Redefinition of property (1:16)");
  26679. testFail("({ i: 42, get i() { } })",
  26680. "Redefinition of property (1:14)");
  26681. testFail("({ set i(x) { }, i: 42 })",
  26682. "Redefinition of property (1:17)");
  26683. testFail("({ i: 42, set i(x) { } })",
  26684. "Redefinition of property (1:14)");
  26685. testFail("({ get i() { }, get i() { } })",
  26686. "Redefinition of property (1:20)");
  26687. testFail("({ set i(x) { }, set i(x) { } })",
  26688. "Redefinition of property (1:21)");
  26689. testFail("'use strict'; ({ __proto__: 1, __proto__: 2 })",
  26690. "Redefinition of property (1:31)");
  26691. testFail("function t(...) { }",
  26692. "Unexpected token (1:11)");
  26693. testFail("function t(...) { }",
  26694. "Unexpected token (1:14)",
  26695. { ecmaVersion: 6 });
  26696. testFail("function t(...rest, b) { }",
  26697. "Comma is not permitted after the rest element (1:18)",
  26698. { ecmaVersion: 6 });
  26699. testFail("function t(if) { }",
  26700. "Unexpected token (1:11)");
  26701. testFail("function t(true) { }",
  26702. "Unexpected token (1:11)");
  26703. testFail("function t(false) { }",
  26704. "Unexpected token (1:11)");
  26705. testFail("function t(null) { }",
  26706. "Unexpected token (1:11)");
  26707. testFail("function null() { }",
  26708. "Unexpected token (1:9)");
  26709. testFail("function true() { }",
  26710. "Unexpected token (1:9)");
  26711. testFail("function false() { }",
  26712. "Unexpected token (1:9)");
  26713. testFail("function if() { }",
  26714. "Unexpected token (1:9)");
  26715. testFail("a b;",
  26716. "Unexpected token (1:2)");
  26717. testFail("if.a;",
  26718. "Unexpected token (1:2)");
  26719. testFail("a if;",
  26720. "Unexpected token (1:2)");
  26721. testFail("a class;",
  26722. "Unexpected token (1:2)");
  26723. testFail("break\n",
  26724. "Unsyntactic break (1:0)");
  26725. testFail("break 1;",
  26726. "Unexpected token (1:6)");
  26727. testFail("continue\n",
  26728. "Unsyntactic continue (1:0)");
  26729. testFail("continue 2;",
  26730. "Unexpected token (1:9)");
  26731. testFail("throw",
  26732. "Unexpected token (1:5)");
  26733. testFail("throw;",
  26734. "Unexpected token (1:5)");
  26735. testFail("for (var i, i2 in {});",
  26736. "Unexpected token (1:15)");
  26737. testFail("for ((i in {}));",
  26738. "Unexpected token (1:14)");
  26739. testFail("for (i + 1 in {});",
  26740. "Assigning to rvalue (1:5)");
  26741. testFail("for (+i in {});",
  26742. "Assigning to rvalue (1:5)");
  26743. testFail("if(false)",
  26744. "Unexpected token (1:9)");
  26745. testFail("if(false) doThis(); else",
  26746. "Unexpected token (1:24)");
  26747. testFail("do",
  26748. "Unexpected token (1:2)");
  26749. testFail("while(false)",
  26750. "Unexpected token (1:12)");
  26751. testFail("for(;;)",
  26752. "Unexpected token (1:7)");
  26753. testFail("with(x)",
  26754. "Unexpected token (1:7)");
  26755. testFail("try { }",
  26756. "Missing catch or finally clause (1:0)");
  26757. testFail("‿ = 10",
  26758. "Unexpected character '‿' (1:0)");
  26759. testFail("if(true) let a = 1;",
  26760. "Unexpected token (1:13)");
  26761. testFail("switch (c) { default: default: }",
  26762. "Multiple default clauses (1:22)");
  26763. testFail("new X().\"s\"",
  26764. "Unexpected token (1:8)");
  26765. testFail("/*",
  26766. "Unterminated comment (1:0)");
  26767. testFail("/*\n\n\n",
  26768. "Unterminated comment (1:0)");
  26769. testFail("/**",
  26770. "Unterminated comment (1:0)");
  26771. testFail("/*\n\n*",
  26772. "Unterminated comment (1:0)");
  26773. testFail("/*hello",
  26774. "Unterminated comment (1:0)");
  26775. testFail("/*hello *",
  26776. "Unterminated comment (1:0)");
  26777. testFail("\n]",
  26778. "Unexpected token (2:0)");
  26779. testFail("\r]",
  26780. "Unexpected token (2:0)");
  26781. testFail("\r\n]",
  26782. "Unexpected token (2:0)");
  26783. testFail("\n\r]",
  26784. "Unexpected token (3:0)");
  26785. testFail("//\r\n]",
  26786. "Unexpected token (2:0)");
  26787. testFail("//\n\r]",
  26788. "Unexpected token (3:0)");
  26789. testFail("/a\\\n/",
  26790. "Unterminated regular expression (1:1)");
  26791. testFail("//\r \n]",
  26792. "Unexpected token (3:0)");
  26793. testFail("/*\r\n*/]",
  26794. "Unexpected token (2:2)");
  26795. testFail("/*\n\r*/]",
  26796. "Unexpected token (3:2)");
  26797. testFail("/*\r \n*/]",
  26798. "Unexpected token (3:2)");
  26799. testFail("\\\\",
  26800. "Expecting Unicode escape sequence \\uXXXX (1:1)");
  26801. testFail("\\u005c",
  26802. "Invalid Unicode escape (1:0)");
  26803. testFail("\\x",
  26804. "Expecting Unicode escape sequence \\uXXXX (1:1)");
  26805. testFail("\\u0000",
  26806. "Invalid Unicode escape (1:0)");
  26807. testFail("‌ = []",
  26808. "Unexpected character '‌' (1:0)");
  26809. testFail("‍ = []",
  26810. "Unexpected character '‍' (1:0)");
  26811. testFail("\"\\",
  26812. "Unterminated string constant (1:0)");
  26813. testFail("\"\\u",
  26814. "Bad character escape sequence (1:3)");
  26815. testFail("return",
  26816. "'return' outside of function (1:0)");
  26817. testFail("break",
  26818. "Unsyntactic break (1:0)");
  26819. testFail("continue",
  26820. "Unsyntactic continue (1:0)");
  26821. testFail("switch (x) { default: continue; }",
  26822. "Unsyntactic continue (1:22)");
  26823. testFail("do { x } *",
  26824. "Unexpected token (1:9)");
  26825. testFail("while (true) { break x; }",
  26826. "Unsyntactic break (1:15)");
  26827. testFail("while (true) { continue x; }",
  26828. "Unsyntactic continue (1:15)");
  26829. testFail("x: while (true) { (function () { break x; }); }",
  26830. "Unsyntactic break (1:33)");
  26831. testFail("x: while (true) { (function () { continue x; }); }",
  26832. "Unsyntactic continue (1:33)");
  26833. testFail("x: while (true) { (function () { break; }); }",
  26834. "Unsyntactic break (1:33)");
  26835. testFail("x: while (true) { (function () { continue; }); }",
  26836. "Unsyntactic continue (1:33)");
  26837. testFail("x: while (true) { x: while (true) { } }",
  26838. "Label 'x' is already declared (1:18)");
  26839. testFail("(function () { 'use strict'; delete i; }())",
  26840. "Deleting local variable in strict mode (1:29)");
  26841. testFail("(function () { 'use strict'; with (i); }())",
  26842. "'with' in strict mode (1:29)");
  26843. testFail("function hello() {'use strict'; ({ i: 42, i: 42 }) }",
  26844. "Redefinition of property (1:42)");
  26845. testFail("function hello() {'use strict'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }",
  26846. "Redefinition of property (1:55)");
  26847. testFail("function hello() {'use strict'; var eval = 10; }",
  26848. "Binding eval in strict mode (1:36)");
  26849. testFail("function hello() {'use strict'; var arguments = 10; }",
  26850. "Binding arguments in strict mode (1:36)");
  26851. testFail("function hello() {'use strict'; try { } catch (eval) { } }",
  26852. "Binding eval in strict mode (1:47)");
  26853. testFail("function hello() {'use strict'; try { } catch (arguments) { } }",
  26854. "Binding arguments in strict mode (1:47)");
  26855. testFail("function hello() {'use strict'; eval = 10; }",
  26856. "Assigning to eval in strict mode (1:32)");
  26857. testFail("function hello() {'use strict'; arguments = 10; }",
  26858. "Assigning to arguments in strict mode (1:32)");
  26859. testFail("function hello() {'use strict'; ++eval; }",
  26860. "Assigning to eval in strict mode (1:34)");
  26861. testFail("function hello() {'use strict'; --eval; }",
  26862. "Assigning to eval in strict mode (1:34)");
  26863. testFail("function hello() {'use strict'; ++arguments; }",
  26864. "Assigning to arguments in strict mode (1:34)");
  26865. testFail("function hello() {'use strict'; --arguments; }",
  26866. "Assigning to arguments in strict mode (1:34)");
  26867. testFail("function hello() {'use strict'; eval++; }",
  26868. "Assigning to eval in strict mode (1:32)");
  26869. testFail("function hello() {'use strict'; eval--; }",
  26870. "Assigning to eval in strict mode (1:32)");
  26871. testFail("function hello() {'use strict'; arguments++; }",
  26872. "Assigning to arguments in strict mode (1:32)");
  26873. testFail("function hello() {'use strict'; arguments--; }",
  26874. "Assigning to arguments in strict mode (1:32)");
  26875. testFail("function hello() {'use strict'; function eval() { } }",
  26876. "Binding eval in strict mode (1:41)");
  26877. testFail("function hello() {'use strict'; function arguments() { } }",
  26878. "Binding arguments in strict mode (1:41)");
  26879. testFail("function eval() {'use strict'; }",
  26880. "Binding eval in strict mode (1:9)");
  26881. testFail("function arguments() {'use strict'; }",
  26882. "Binding arguments in strict mode (1:9)");
  26883. testFail("function hello() {'use strict'; (function eval() { }()) }",
  26884. "Binding eval in strict mode (1:42)");
  26885. testFail("function hello() {'use strict'; (function arguments() { }()) }",
  26886. "Binding arguments in strict mode (1:42)");
  26887. testFail("(function eval() {'use strict'; })()",
  26888. "Binding eval in strict mode (1:10)");
  26889. testFail("(function arguments() {'use strict'; })()",
  26890. "Binding arguments in strict mode (1:10)");
  26891. testFail("function hello() {'use strict'; ({ s: function eval() { } }); }",
  26892. "Binding eval in strict mode (1:47)");
  26893. testFail("(function package() {'use strict'; })()",
  26894. "Binding package in strict mode (1:10)");
  26895. testFail("function hello() {'use strict'; ({ i: 10, set s(eval) { } }); }",
  26896. "Binding eval in strict mode (1:48)");
  26897. testFail("function hello() {'use strict'; ({ set s(eval) { } }); }",
  26898. "Binding eval in strict mode (1:41)");
  26899. testFail("function hello() {'use strict'; ({ s: function s(eval) { } }); }",
  26900. "Binding eval in strict mode (1:49)");
  26901. testFail("function hello(eval) {'use strict';}",
  26902. "Binding eval in strict mode (1:15)");
  26903. testFail("function hello(arguments) {'use strict';}",
  26904. "Binding arguments in strict mode (1:15)");
  26905. testFail("function hello() { 'use strict'; function inner(eval) {} }",
  26906. "Binding eval in strict mode (1:48)");
  26907. testFail("function hello() { 'use strict'; function inner(arguments) {} }",
  26908. "Binding arguments in strict mode (1:48)");
  26909. testFail("function hello() { 'use strict'; \"\\1\"; }",
  26910. "Octal literal in strict mode (1:34)");
  26911. testFail("function hello() { 'use strict'; \"\\00\"; }",
  26912. "Octal literal in strict mode (1:34)");
  26913. testFail("function hello() { 'use strict'; \"\\000\"; }",
  26914. "Octal literal in strict mode (1:34)");
  26915. testFail("function hello() { 'use strict'; 021; }",
  26916. "Invalid number (1:33)");
  26917. testFail("function hello() { 'use strict'; ({ \"\\1\": 42 }); }",
  26918. "Octal literal in strict mode (1:37)");
  26919. testFail("function hello() { 'use strict'; ({ 021: 42 }); }",
  26920. "Invalid number (1:36)");
  26921. testFail("function hello() { \"use strict\"; function inner() { \"octal directive\\1\"; } }",
  26922. "Octal literal in strict mode (1:68)");
  26923. testFail("function hello() { \"use strict\"; var implements; }",
  26924. "The keyword 'implements' is reserved (1:37)");
  26925. testFail("function hello() { \"use strict\"; var interface; }",
  26926. "The keyword 'interface' is reserved (1:37)");
  26927. testFail("function hello() { \"use strict\"; var package; }",
  26928. "The keyword 'package' is reserved (1:37)");
  26929. testFail("function hello() { \"use strict\"; var private; }",
  26930. "The keyword 'private' is reserved (1:37)");
  26931. testFail("function hello() { \"use strict\"; var protected; }",
  26932. "The keyword 'protected' is reserved (1:37)");
  26933. testFail("function hello() { \"use strict\"; var public; }",
  26934. "The keyword 'public' is reserved (1:37)");
  26935. testFail("function hello() { \"use strict\"; var static; }",
  26936. "The keyword 'static' is reserved (1:37)");
  26937. testFail("function hello(static) { \"use strict\"; }",
  26938. "Binding static in strict mode (1:15)");
  26939. testFail("function static() { \"use strict\"; }",
  26940. "Binding static in strict mode (1:9)");
  26941. testFail("\"use strict\"; function static() { }",
  26942. "The keyword 'static' is reserved (1:23)");
  26943. testFail("function a(t, t) { \"use strict\"; }",
  26944. "Argument name clash (1:14)");
  26945. testFail("function a(eval) { \"use strict\"; }",
  26946. "Binding eval in strict mode (1:11)");
  26947. testFail("function a(package) { \"use strict\"; }",
  26948. "Binding package in strict mode (1:11)");
  26949. testFail("function a() { \"use strict\"; function b(t, t) { }; }",
  26950. "Argument name clash (1:43)");
  26951. testFail("(function a(t, t) { \"use strict\"; })",
  26952. "Argument name clash (1:15)");
  26953. testFail("function a() { \"use strict\"; (function b(t, t) { }); }",
  26954. "Argument name clash (1:44)");
  26955. testFail("(function a(eval) { \"use strict\"; })",
  26956. "Binding eval in strict mode (1:12)");
  26957. testFail("(function a(package) { \"use strict\"; })",
  26958. "Binding package in strict mode (1:12)");
  26959. testFail("\"use strict\";function foo(){\"use strict\";}function bar(){var v = 015}",
  26960. "Invalid number (1:65)");
  26961. testFail("var this = 10;", "Unexpected token (1:4)");
  26962. testFail("throw\n10;", "Illegal newline after throw (1:5)");
  26963. // ECMA < 6 mode should work as before
  26964. testFail("const a;", "The keyword 'const' is reserved (1:0)");
  26965. testFail("let x;", "Unexpected token (1:4)");
  26966. testFail("const a = 1;", "The keyword 'const' is reserved (1:0)");
  26967. testFail("let a = 1;", "Unexpected token (1:4)");
  26968. testFail("for(const x = 0;;);", "The keyword 'const' is reserved (1:4)");
  26969. testFail("for(let x = 0;;);", "Unexpected token (1:8)");
  26970. testFail("function a(b = c) {}", "Unexpected token (1:13)")
  26971. test("let++", {
  26972. type: "Program",
  26973. loc: {
  26974. start: {
  26975. line: 1,
  26976. column: 0
  26977. },
  26978. end: {
  26979. line: 1,
  26980. column: 5
  26981. }
  26982. },
  26983. body: [
  26984. {
  26985. type: "ExpressionStatement",
  26986. loc: {
  26987. start: {
  26988. line: 1,
  26989. column: 0
  26990. },
  26991. end: {
  26992. line: 1,
  26993. column: 5
  26994. }
  26995. },
  26996. expression: {
  26997. type: "UpdateExpression",
  26998. loc: {
  26999. start: {
  27000. line: 1,
  27001. column: 0
  27002. },
  27003. end: {
  27004. line: 1,
  27005. column: 5
  27006. }
  27007. },
  27008. operator: "++",
  27009. prefix: false,
  27010. argument: {
  27011. type: "Identifier",
  27012. loc: {
  27013. start: {
  27014. line: 1,
  27015. column: 0
  27016. },
  27017. end: {
  27018. line: 1,
  27019. column: 3
  27020. }
  27021. },
  27022. name: "let"
  27023. }
  27024. }
  27025. }
  27026. ]
  27027. });
  27028. // ECMA 6 support
  27029. test("let x", {
  27030. type: "Program",
  27031. body: [
  27032. {
  27033. type: "VariableDeclaration",
  27034. declarations: [
  27035. {
  27036. type: "VariableDeclarator",
  27037. id: {
  27038. type: "Identifier",
  27039. name: "x",
  27040. loc: {
  27041. start: {
  27042. line: 1,
  27043. column: 4
  27044. },
  27045. end: {
  27046. line: 1,
  27047. column: 5
  27048. }
  27049. }
  27050. },
  27051. init: null,
  27052. loc: {
  27053. start: {
  27054. line: 1,
  27055. column: 4
  27056. },
  27057. end: {
  27058. line: 1,
  27059. column: 5
  27060. }
  27061. }
  27062. }
  27063. ],
  27064. kind: "let",
  27065. loc: {
  27066. start: {
  27067. line: 1,
  27068. column: 0
  27069. },
  27070. end: {
  27071. line: 1,
  27072. column: 5
  27073. }
  27074. }
  27075. }
  27076. ],
  27077. loc: {
  27078. start: {
  27079. line: 1,
  27080. column: 0
  27081. },
  27082. end: {
  27083. line: 1,
  27084. column: 5
  27085. }
  27086. }
  27087. }, {ecmaVersion: 6, locations: true});
  27088. test("let x, y;", {
  27089. type: "Program",
  27090. body: [
  27091. {
  27092. type: "VariableDeclaration",
  27093. declarations: [
  27094. {
  27095. type: "VariableDeclarator",
  27096. id: {
  27097. type: "Identifier",
  27098. name: "x",
  27099. loc: {
  27100. start: {
  27101. line: 1,
  27102. column: 4
  27103. },
  27104. end: {
  27105. line: 1,
  27106. column: 5
  27107. }
  27108. }
  27109. },
  27110. init: null,
  27111. loc: {
  27112. start: {
  27113. line: 1,
  27114. column: 4
  27115. },
  27116. end: {
  27117. line: 1,
  27118. column: 5
  27119. }
  27120. }
  27121. },
  27122. {
  27123. type: "VariableDeclarator",
  27124. id: {
  27125. type: "Identifier",
  27126. name: "y",
  27127. loc: {
  27128. start: {
  27129. line: 1,
  27130. column: 7
  27131. },
  27132. end: {
  27133. line: 1,
  27134. column: 8
  27135. }
  27136. }
  27137. },
  27138. init: null,
  27139. loc: {
  27140. start: {
  27141. line: 1,
  27142. column: 7
  27143. },
  27144. end: {
  27145. line: 1,
  27146. column: 8
  27147. }
  27148. }
  27149. }
  27150. ],
  27151. kind: "let",
  27152. loc: {
  27153. start: {
  27154. line: 1,
  27155. column: 0
  27156. },
  27157. end: {
  27158. line: 1,
  27159. column: 9
  27160. }
  27161. }
  27162. }
  27163. ],
  27164. loc: {
  27165. start: {
  27166. line: 1,
  27167. column: 0
  27168. },
  27169. end: {
  27170. line: 1,
  27171. column: 9
  27172. }
  27173. }
  27174. }, {ecmaVersion: 6, locations: true});
  27175. test("let x = 42", {
  27176. type: "Program",
  27177. body: [
  27178. {
  27179. type: "VariableDeclaration",
  27180. declarations: [
  27181. {
  27182. type: "VariableDeclarator",
  27183. id: {
  27184. type: "Identifier",
  27185. name: "x",
  27186. loc: {
  27187. start: {
  27188. line: 1,
  27189. column: 4
  27190. },
  27191. end: {
  27192. line: 1,
  27193. column: 5
  27194. }
  27195. }
  27196. },
  27197. init: {
  27198. type: "Literal",
  27199. value: 42,
  27200. loc: {
  27201. start: {
  27202. line: 1,
  27203. column: 8
  27204. },
  27205. end: {
  27206. line: 1,
  27207. column: 10
  27208. }
  27209. }
  27210. },
  27211. loc: {
  27212. start: {
  27213. line: 1,
  27214. column: 4
  27215. },
  27216. end: {
  27217. line: 1,
  27218. column: 10
  27219. }
  27220. }
  27221. }
  27222. ],
  27223. kind: "let",
  27224. loc: {
  27225. start: {
  27226. line: 1,
  27227. column: 0
  27228. },
  27229. end: {
  27230. line: 1,
  27231. column: 10
  27232. }
  27233. }
  27234. }
  27235. ],
  27236. loc: {
  27237. start: {
  27238. line: 1,
  27239. column: 0
  27240. },
  27241. end: {
  27242. line: 1,
  27243. column: 10
  27244. }
  27245. }
  27246. }, {ecmaVersion: 6, locations: true});
  27247. test("let eval = 42, arguments = 42", {
  27248. type: "Program",
  27249. body: [
  27250. {
  27251. type: "VariableDeclaration",
  27252. declarations: [
  27253. {
  27254. type: "VariableDeclarator",
  27255. id: {
  27256. type: "Identifier",
  27257. name: "eval",
  27258. loc: {
  27259. start: {
  27260. line: 1,
  27261. column: 4
  27262. },
  27263. end: {
  27264. line: 1,
  27265. column: 8
  27266. }
  27267. }
  27268. },
  27269. init: {
  27270. type: "Literal",
  27271. value: 42,
  27272. loc: {
  27273. start: {
  27274. line: 1,
  27275. column: 11
  27276. },
  27277. end: {
  27278. line: 1,
  27279. column: 13
  27280. }
  27281. }
  27282. },
  27283. loc: {
  27284. start: {
  27285. line: 1,
  27286. column: 4
  27287. },
  27288. end: {
  27289. line: 1,
  27290. column: 13
  27291. }
  27292. }
  27293. },
  27294. {
  27295. type: "VariableDeclarator",
  27296. id: {
  27297. type: "Identifier",
  27298. name: "arguments",
  27299. loc: {
  27300. start: {
  27301. line: 1,
  27302. column: 15
  27303. },
  27304. end: {
  27305. line: 1,
  27306. column: 24
  27307. }
  27308. }
  27309. },
  27310. init: {
  27311. type: "Literal",
  27312. value: 42,
  27313. loc: {
  27314. start: {
  27315. line: 1,
  27316. column: 27
  27317. },
  27318. end: {
  27319. line: 1,
  27320. column: 29
  27321. }
  27322. }
  27323. },
  27324. loc: {
  27325. start: {
  27326. line: 1,
  27327. column: 15
  27328. },
  27329. end: {
  27330. line: 1,
  27331. column: 29
  27332. }
  27333. }
  27334. }
  27335. ],
  27336. kind: "let",
  27337. loc: {
  27338. start: {
  27339. line: 1,
  27340. column: 0
  27341. },
  27342. end: {
  27343. line: 1,
  27344. column: 29
  27345. }
  27346. }
  27347. }
  27348. ],
  27349. loc: {
  27350. start: {
  27351. line: 1,
  27352. column: 0
  27353. },
  27354. end: {
  27355. line: 1,
  27356. column: 29
  27357. }
  27358. }
  27359. }, {ecmaVersion: 6, locations: true});
  27360. test("let x = 14, y = 3, z = 1977", {
  27361. type: "Program",
  27362. body: [
  27363. {
  27364. type: "VariableDeclaration",
  27365. declarations: [
  27366. {
  27367. type: "VariableDeclarator",
  27368. id: {
  27369. type: "Identifier",
  27370. name: "x",
  27371. loc: {
  27372. start: {
  27373. line: 1,
  27374. column: 4
  27375. },
  27376. end: {
  27377. line: 1,
  27378. column: 5
  27379. }
  27380. }
  27381. },
  27382. init: {
  27383. type: "Literal",
  27384. value: 14,
  27385. loc: {
  27386. start: {
  27387. line: 1,
  27388. column: 8
  27389. },
  27390. end: {
  27391. line: 1,
  27392. column: 10
  27393. }
  27394. }
  27395. },
  27396. loc: {
  27397. start: {
  27398. line: 1,
  27399. column: 4
  27400. },
  27401. end: {
  27402. line: 1,
  27403. column: 10
  27404. }
  27405. }
  27406. },
  27407. {
  27408. type: "VariableDeclarator",
  27409. id: {
  27410. type: "Identifier",
  27411. name: "y",
  27412. loc: {
  27413. start: {
  27414. line: 1,
  27415. column: 12
  27416. },
  27417. end: {
  27418. line: 1,
  27419. column: 13
  27420. }
  27421. }
  27422. },
  27423. init: {
  27424. type: "Literal",
  27425. value: 3,
  27426. loc: {
  27427. start: {
  27428. line: 1,
  27429. column: 16
  27430. },
  27431. end: {
  27432. line: 1,
  27433. column: 17
  27434. }
  27435. }
  27436. },
  27437. loc: {
  27438. start: {
  27439. line: 1,
  27440. column: 12
  27441. },
  27442. end: {
  27443. line: 1,
  27444. column: 17
  27445. }
  27446. }
  27447. },
  27448. {
  27449. type: "VariableDeclarator",
  27450. id: {
  27451. type: "Identifier",
  27452. name: "z",
  27453. loc: {
  27454. start: {
  27455. line: 1,
  27456. column: 19
  27457. },
  27458. end: {
  27459. line: 1,
  27460. column: 20
  27461. }
  27462. }
  27463. },
  27464. init: {
  27465. type: "Literal",
  27466. value: 1977,
  27467. loc: {
  27468. start: {
  27469. line: 1,
  27470. column: 23
  27471. },
  27472. end: {
  27473. line: 1,
  27474. column: 27
  27475. }
  27476. }
  27477. },
  27478. loc: {
  27479. start: {
  27480. line: 1,
  27481. column: 19
  27482. },
  27483. end: {
  27484. line: 1,
  27485. column: 27
  27486. }
  27487. }
  27488. }
  27489. ],
  27490. kind: "let",
  27491. loc: {
  27492. start: {
  27493. line: 1,
  27494. column: 0
  27495. },
  27496. end: {
  27497. line: 1,
  27498. column: 27
  27499. }
  27500. }
  27501. }
  27502. ],
  27503. loc: {
  27504. start: {
  27505. line: 1,
  27506. column: 0
  27507. },
  27508. end: {
  27509. line: 1,
  27510. column: 27
  27511. }
  27512. }
  27513. }, {ecmaVersion: 6, locations: true});
  27514. test("for(let x = 0;;);", {
  27515. type: "Program",
  27516. body: [
  27517. {
  27518. type: "ForStatement",
  27519. init: {
  27520. type: "VariableDeclaration",
  27521. declarations: [
  27522. {
  27523. type: "VariableDeclarator",
  27524. id: {
  27525. type: "Identifier",
  27526. name: "x",
  27527. loc: {
  27528. start: {
  27529. line: 1,
  27530. column: 8
  27531. },
  27532. end: {
  27533. line: 1,
  27534. column: 9
  27535. }
  27536. }
  27537. },
  27538. init: {
  27539. type: "Literal",
  27540. value: 0,
  27541. loc: {
  27542. start: {
  27543. line: 1,
  27544. column: 12
  27545. },
  27546. end: {
  27547. line: 1,
  27548. column: 13
  27549. }
  27550. }
  27551. },
  27552. loc: {
  27553. start: {
  27554. line: 1,
  27555. column: 8
  27556. },
  27557. end: {
  27558. line: 1,
  27559. column: 13
  27560. }
  27561. }
  27562. }
  27563. ],
  27564. kind: "let",
  27565. loc: {
  27566. start: {
  27567. line: 1,
  27568. column: 4
  27569. },
  27570. end: {
  27571. line: 1,
  27572. column: 13
  27573. }
  27574. }
  27575. },
  27576. test: null,
  27577. update: null,
  27578. body: {
  27579. type: "EmptyStatement",
  27580. loc: {
  27581. start: {
  27582. line: 1,
  27583. column: 16
  27584. },
  27585. end: {
  27586. line: 1,
  27587. column: 17
  27588. }
  27589. }
  27590. },
  27591. loc: {
  27592. start: {
  27593. line: 1,
  27594. column: 0
  27595. },
  27596. end: {
  27597. line: 1,
  27598. column: 17
  27599. }
  27600. }
  27601. }
  27602. ],
  27603. loc: {
  27604. start: {
  27605. line: 1,
  27606. column: 0
  27607. },
  27608. end: {
  27609. line: 1,
  27610. column: 17
  27611. }
  27612. }
  27613. }, {ecmaVersion: 6, locations: true});
  27614. test("for(let x = 0, y = 1;;);", {
  27615. type: "Program",
  27616. body: [
  27617. {
  27618. type: "ForStatement",
  27619. init: {
  27620. type: "VariableDeclaration",
  27621. declarations: [
  27622. {
  27623. type: "VariableDeclarator",
  27624. id: {
  27625. type: "Identifier",
  27626. name: "x",
  27627. loc: {
  27628. start: {
  27629. line: 1,
  27630. column: 8
  27631. },
  27632. end: {
  27633. line: 1,
  27634. column: 9
  27635. }
  27636. }
  27637. },
  27638. init: {
  27639. type: "Literal",
  27640. value: 0,
  27641. loc: {
  27642. start: {
  27643. line: 1,
  27644. column: 12
  27645. },
  27646. end: {
  27647. line: 1,
  27648. column: 13
  27649. }
  27650. }
  27651. },
  27652. loc: {
  27653. start: {
  27654. line: 1,
  27655. column: 8
  27656. },
  27657. end: {
  27658. line: 1,
  27659. column: 13
  27660. }
  27661. }
  27662. },
  27663. {
  27664. type: "VariableDeclarator",
  27665. id: {
  27666. type: "Identifier",
  27667. name: "y",
  27668. loc: {
  27669. start: {
  27670. line: 1,
  27671. column: 15
  27672. },
  27673. end: {
  27674. line: 1,
  27675. column: 16
  27676. }
  27677. }
  27678. },
  27679. init: {
  27680. type: "Literal",
  27681. value: 1,
  27682. loc: {
  27683. start: {
  27684. line: 1,
  27685. column: 19
  27686. },
  27687. end: {
  27688. line: 1,
  27689. column: 20
  27690. }
  27691. }
  27692. },
  27693. loc: {
  27694. start: {
  27695. line: 1,
  27696. column: 15
  27697. },
  27698. end: {
  27699. line: 1,
  27700. column: 20
  27701. }
  27702. }
  27703. }
  27704. ],
  27705. kind: "let",
  27706. loc: {
  27707. start: {
  27708. line: 1,
  27709. column: 4
  27710. },
  27711. end: {
  27712. line: 1,
  27713. column: 20
  27714. }
  27715. }
  27716. },
  27717. test: null,
  27718. update: null,
  27719. body: {
  27720. type: "EmptyStatement",
  27721. loc: {
  27722. start: {
  27723. line: 1,
  27724. column: 23
  27725. },
  27726. end: {
  27727. line: 1,
  27728. column: 24
  27729. }
  27730. }
  27731. },
  27732. loc: {
  27733. start: {
  27734. line: 1,
  27735. column: 0
  27736. },
  27737. end: {
  27738. line: 1,
  27739. column: 24
  27740. }
  27741. }
  27742. }
  27743. ],
  27744. loc: {
  27745. start: {
  27746. line: 1,
  27747. column: 0
  27748. },
  27749. end: {
  27750. line: 1,
  27751. column: 24
  27752. }
  27753. }
  27754. }, {ecmaVersion: 6, locations: true});
  27755. test("for (let x in list) process(x);", {
  27756. type: "Program",
  27757. body: [
  27758. {
  27759. type: "ForInStatement",
  27760. left: {
  27761. type: "VariableDeclaration",
  27762. declarations: [
  27763. {
  27764. type: "VariableDeclarator",
  27765. id: {
  27766. type: "Identifier",
  27767. name: "x",
  27768. loc: {
  27769. start: {
  27770. line: 1,
  27771. column: 9
  27772. },
  27773. end: {
  27774. line: 1,
  27775. column: 10
  27776. }
  27777. }
  27778. },
  27779. init: null,
  27780. loc: {
  27781. start: {
  27782. line: 1,
  27783. column: 9
  27784. },
  27785. end: {
  27786. line: 1,
  27787. column: 10
  27788. }
  27789. }
  27790. }
  27791. ],
  27792. kind: "let",
  27793. loc: {
  27794. start: {
  27795. line: 1,
  27796. column: 5
  27797. },
  27798. end: {
  27799. line: 1,
  27800. column: 10
  27801. }
  27802. }
  27803. },
  27804. right: {
  27805. type: "Identifier",
  27806. name: "list",
  27807. loc: {
  27808. start: {
  27809. line: 1,
  27810. column: 14
  27811. },
  27812. end: {
  27813. line: 1,
  27814. column: 18
  27815. }
  27816. }
  27817. },
  27818. body: {
  27819. type: "ExpressionStatement",
  27820. expression: {
  27821. type: "CallExpression",
  27822. callee: {
  27823. type: "Identifier",
  27824. name: "process",
  27825. loc: {
  27826. start: {
  27827. line: 1,
  27828. column: 20
  27829. },
  27830. end: {
  27831. line: 1,
  27832. column: 27
  27833. }
  27834. }
  27835. },
  27836. arguments: [
  27837. {
  27838. type: "Identifier",
  27839. name: "x",
  27840. loc: {
  27841. start: {
  27842. line: 1,
  27843. column: 28
  27844. },
  27845. end: {
  27846. line: 1,
  27847. column: 29
  27848. }
  27849. }
  27850. }
  27851. ],
  27852. loc: {
  27853. start: {
  27854. line: 1,
  27855. column: 20
  27856. },
  27857. end: {
  27858. line: 1,
  27859. column: 30
  27860. }
  27861. }
  27862. },
  27863. loc: {
  27864. start: {
  27865. line: 1,
  27866. column: 20
  27867. },
  27868. end: {
  27869. line: 1,
  27870. column: 31
  27871. }
  27872. }
  27873. },
  27874. loc: {
  27875. start: {
  27876. line: 1,
  27877. column: 0
  27878. },
  27879. end: {
  27880. line: 1,
  27881. column: 31
  27882. }
  27883. }
  27884. }
  27885. ],
  27886. loc: {
  27887. start: {
  27888. line: 1,
  27889. column: 0
  27890. },
  27891. end: {
  27892. line: 1,
  27893. column: 31
  27894. }
  27895. }
  27896. }, {ecmaVersion: 6, locations: true});
  27897. test("const x = 42", {
  27898. type: "Program",
  27899. body: [
  27900. {
  27901. type: "VariableDeclaration",
  27902. declarations: [
  27903. {
  27904. type: "VariableDeclarator",
  27905. id: {
  27906. type: "Identifier",
  27907. name: "x",
  27908. loc: {
  27909. start: {
  27910. line: 1,
  27911. column: 6
  27912. },
  27913. end: {
  27914. line: 1,
  27915. column: 7
  27916. }
  27917. }
  27918. },
  27919. init: {
  27920. type: "Literal",
  27921. value: 42,
  27922. loc: {
  27923. start: {
  27924. line: 1,
  27925. column: 10
  27926. },
  27927. end: {
  27928. line: 1,
  27929. column: 12
  27930. }
  27931. }
  27932. },
  27933. loc: {
  27934. start: {
  27935. line: 1,
  27936. column: 6
  27937. },
  27938. end: {
  27939. line: 1,
  27940. column: 12
  27941. }
  27942. }
  27943. }
  27944. ],
  27945. kind: "const",
  27946. loc: {
  27947. start: {
  27948. line: 1,
  27949. column: 0
  27950. },
  27951. end: {
  27952. line: 1,
  27953. column: 12
  27954. }
  27955. }
  27956. }
  27957. ],
  27958. loc: {
  27959. start: {
  27960. line: 1,
  27961. column: 0
  27962. },
  27963. end: {
  27964. line: 1,
  27965. column: 12
  27966. }
  27967. }
  27968. }, {ecmaVersion: 6, locations: true});
  27969. test("const eval = 42, arguments = 42", {
  27970. type: "Program",
  27971. body: [
  27972. {
  27973. type: "VariableDeclaration",
  27974. declarations: [
  27975. {
  27976. type: "VariableDeclarator",
  27977. id: {
  27978. type: "Identifier",
  27979. name: "eval",
  27980. loc: {
  27981. start: {
  27982. line: 1,
  27983. column: 6
  27984. },
  27985. end: {
  27986. line: 1,
  27987. column: 10
  27988. }
  27989. }
  27990. },
  27991. init: {
  27992. type: "Literal",
  27993. value: 42,
  27994. loc: {
  27995. start: {
  27996. line: 1,
  27997. column: 13
  27998. },
  27999. end: {
  28000. line: 1,
  28001. column: 15
  28002. }
  28003. }
  28004. },
  28005. loc: {
  28006. start: {
  28007. line: 1,
  28008. column: 6
  28009. },
  28010. end: {
  28011. line: 1,
  28012. column: 15
  28013. }
  28014. }
  28015. },
  28016. {
  28017. type: "VariableDeclarator",
  28018. id: {
  28019. type: "Identifier",
  28020. name: "arguments",
  28021. loc: {
  28022. start: {
  28023. line: 1,
  28024. column: 17
  28025. },
  28026. end: {
  28027. line: 1,
  28028. column: 26
  28029. }
  28030. }
  28031. },
  28032. init: {
  28033. type: "Literal",
  28034. value: 42,
  28035. loc: {
  28036. start: {
  28037. line: 1,
  28038. column: 29
  28039. },
  28040. end: {
  28041. line: 1,
  28042. column: 31
  28043. }
  28044. }
  28045. },
  28046. loc: {
  28047. start: {
  28048. line: 1,
  28049. column: 17
  28050. },
  28051. end: {
  28052. line: 1,
  28053. column: 31
  28054. }
  28055. }
  28056. }
  28057. ],
  28058. kind: "const",
  28059. loc: {
  28060. start: {
  28061. line: 1,
  28062. column: 0
  28063. },
  28064. end: {
  28065. line: 1,
  28066. column: 31
  28067. }
  28068. }
  28069. }
  28070. ],
  28071. loc: {
  28072. start: {
  28073. line: 1,
  28074. column: 0
  28075. },
  28076. end: {
  28077. line: 1,
  28078. column: 31
  28079. }
  28080. }
  28081. }, {ecmaVersion: 6, locations: true});
  28082. test("const x = 14, y = 3, z = 1977", {
  28083. type: "Program",
  28084. body: [
  28085. {
  28086. type: "VariableDeclaration",
  28087. declarations: [
  28088. {
  28089. type: "VariableDeclarator",
  28090. id: {
  28091. type: "Identifier",
  28092. name: "x",
  28093. loc: {
  28094. start: {
  28095. line: 1,
  28096. column: 6
  28097. },
  28098. end: {
  28099. line: 1,
  28100. column: 7
  28101. }
  28102. }
  28103. },
  28104. init: {
  28105. type: "Literal",
  28106. value: 14,
  28107. loc: {
  28108. start: {
  28109. line: 1,
  28110. column: 10
  28111. },
  28112. end: {
  28113. line: 1,
  28114. column: 12
  28115. }
  28116. }
  28117. },
  28118. loc: {
  28119. start: {
  28120. line: 1,
  28121. column: 6
  28122. },
  28123. end: {
  28124. line: 1,
  28125. column: 12
  28126. }
  28127. }
  28128. },
  28129. {
  28130. type: "VariableDeclarator",
  28131. id: {
  28132. type: "Identifier",
  28133. name: "y",
  28134. loc: {
  28135. start: {
  28136. line: 1,
  28137. column: 14
  28138. },
  28139. end: {
  28140. line: 1,
  28141. column: 15
  28142. }
  28143. }
  28144. },
  28145. init: {
  28146. type: "Literal",
  28147. value: 3,
  28148. loc: {
  28149. start: {
  28150. line: 1,
  28151. column: 18
  28152. },
  28153. end: {
  28154. line: 1,
  28155. column: 19
  28156. }
  28157. }
  28158. },
  28159. loc: {
  28160. start: {
  28161. line: 1,
  28162. column: 14
  28163. },
  28164. end: {
  28165. line: 1,
  28166. column: 19
  28167. }
  28168. }
  28169. },
  28170. {
  28171. type: "VariableDeclarator",
  28172. id: {
  28173. type: "Identifier",
  28174. name: "z",
  28175. loc: {
  28176. start: {
  28177. line: 1,
  28178. column: 21
  28179. },
  28180. end: {
  28181. line: 1,
  28182. column: 22
  28183. }
  28184. }
  28185. },
  28186. init: {
  28187. type: "Literal",
  28188. value: 1977,
  28189. loc: {
  28190. start: {
  28191. line: 1,
  28192. column: 25
  28193. },
  28194. end: {
  28195. line: 1,
  28196. column: 29
  28197. }
  28198. }
  28199. },
  28200. loc: {
  28201. start: {
  28202. line: 1,
  28203. column: 21
  28204. },
  28205. end: {
  28206. line: 1,
  28207. column: 29
  28208. }
  28209. }
  28210. }
  28211. ],
  28212. kind: "const",
  28213. loc: {
  28214. start: {
  28215. line: 1,
  28216. column: 0
  28217. },
  28218. end: {
  28219. line: 1,
  28220. column: 29
  28221. }
  28222. }
  28223. }
  28224. ],
  28225. loc: {
  28226. start: {
  28227. line: 1,
  28228. column: 0
  28229. },
  28230. end: {
  28231. line: 1,
  28232. column: 29
  28233. }
  28234. }
  28235. }, {ecmaVersion: 6, locations: true});
  28236. testFail("const a;", "Unexpected token (1:7)", {ecmaVersion: 6});
  28237. test("for(const x = 0;;);", {
  28238. type: "Program",
  28239. body: [{
  28240. type: "ForStatement",
  28241. init: {
  28242. type: "VariableDeclaration",
  28243. declarations: [{
  28244. type: "VariableDeclarator",
  28245. id: {
  28246. type: "Identifier",
  28247. name: "x",
  28248. range: [10, 11]
  28249. },
  28250. init: {
  28251. type: "Literal",
  28252. value: 0,
  28253. range: [14, 15]
  28254. },
  28255. range: [10, 15]
  28256. }],
  28257. kind: "const",
  28258. range: [4, 15]
  28259. },
  28260. test: null,
  28261. update: null,
  28262. body: {
  28263. type: "EmptyStatement",
  28264. range: [18, 19]
  28265. },
  28266. range: [0, 19]
  28267. }],
  28268. range: [0, 19]
  28269. }, {ecmaVersion: 6, ranges: true});
  28270. testFail("for(x of a);", "Unexpected token (1:6)");
  28271. testFail("for(var x of a);", "Unexpected token (1:10)");
  28272. // Assertion Tests
  28273. test(function TestComments() {
  28274. // Bear class
  28275. function Bear(x,y,z) {
  28276. this.position = [x||0,y||0,z||0]
  28277. }
  28278. Bear.prototype.roar = function(message) {
  28279. return 'RAWWW: ' + message; // Whatever
  28280. };
  28281. function Cat() {
  28282. /* 1
  28283. 2
  28284. 3*/
  28285. }
  28286. Cat.prototype.roar = function(message) {
  28287. return 'MEOOWW: ' + /*stuff*/ message;
  28288. };
  28289. }.toString().replace(/\r\n/g, '\n'), {}, {
  28290. onComment: [
  28291. {type: "Line", value: " Bear class"},
  28292. {type: "Line", value: " Whatever"},
  28293. {type: "Block", value: [
  28294. " 1",
  28295. " 2",
  28296. " 3"
  28297. ].join('\n')},
  28298. {type: "Block", value: "stuff"}
  28299. ]
  28300. });
  28301. test("<!--\n;", {
  28302. type: "Program",
  28303. body: [{
  28304. type: "EmptyStatement"
  28305. }]
  28306. });
  28307. test("\nfunction plop() {\n'use strict';\n/* Comment */\n}", {}, {
  28308. locations: true,
  28309. onComment: [{
  28310. type: "Block",
  28311. value: " Comment ",
  28312. loc: {
  28313. start: { line: 4, column: 0 },
  28314. end: { line: 4, column: 13 }
  28315. }
  28316. }]
  28317. });
  28318. test("// line comment", {}, {
  28319. locations: true,
  28320. onComment: [{
  28321. type: "Line",
  28322. value: " line comment",
  28323. loc: {
  28324. start: { line: 1, column: 0 },
  28325. end: { line: 1, column: 15 }
  28326. }
  28327. }]
  28328. });
  28329. test("<!-- HTML comment", {}, {
  28330. locations: true,
  28331. onComment: [{
  28332. type: "Line",
  28333. value: " HTML comment",
  28334. loc: {
  28335. start: { line: 1, column: 0 },
  28336. end: { line: 1, column: 17 }
  28337. }
  28338. }]
  28339. });
  28340. test(";\n--> HTML comment", {}, {
  28341. locations: true,
  28342. onComment: [{
  28343. type: "Line",
  28344. value: " HTML comment",
  28345. loc: {
  28346. start: { line: 2, column: 0 },
  28347. end: { line: 2, column: 16 }
  28348. }
  28349. }]
  28350. });
  28351. var tokTypes = acorn.tokTypes;
  28352. test('var x = (1 + 2)', {}, {
  28353. locations: true,
  28354. loose: false,
  28355. onToken: [
  28356. {
  28357. type: tokTypes._var,
  28358. value: "var",
  28359. loc: {
  28360. start: {line: 1, column: 0},
  28361. end: {line: 1, column: 3}
  28362. }
  28363. },
  28364. {
  28365. type: tokTypes.name,
  28366. value: "x",
  28367. loc: {
  28368. start: {line: 1, column: 4},
  28369. end: {line: 1, column: 5}
  28370. }
  28371. },
  28372. {
  28373. type: tokTypes.eq,
  28374. value: "=",
  28375. loc: {
  28376. start: {line: 1, column: 6},
  28377. end: {line: 1, column: 7}
  28378. }
  28379. },
  28380. {
  28381. type: tokTypes.parenL,
  28382. value: undefined,
  28383. loc: {
  28384. start: {line: 1, column: 8},
  28385. end: {line: 1, column: 9}
  28386. }
  28387. },
  28388. {
  28389. type: tokTypes.num,
  28390. value: 1,
  28391. loc: {
  28392. start: {line: 1, column: 9},
  28393. end: {line: 1, column: 10}
  28394. }
  28395. },
  28396. {
  28397. type: {binop: 9, prefix: true, beforeExpr: true},
  28398. value: "+",
  28399. loc: {
  28400. start: {line: 1, column: 11},
  28401. end: {line: 1, column: 12}
  28402. }
  28403. },
  28404. {
  28405. type: tokTypes.num,
  28406. value: 2,
  28407. loc: {
  28408. start: {line: 1, column: 13},
  28409. end: {line: 1, column: 14}
  28410. }
  28411. },
  28412. {
  28413. type: tokTypes.parenR,
  28414. value: undefined,
  28415. loc: {
  28416. start: {line: 1, column: 14},
  28417. end: {line: 1, column: 15}
  28418. }
  28419. },
  28420. {
  28421. type: tokTypes.eof,
  28422. value: undefined,
  28423. loc: {
  28424. start: {line: 1, column: 15},
  28425. end: {line: 1, column: 15}
  28426. }
  28427. }
  28428. ]
  28429. });
  28430. test("function f(f) { 'use strict'; }", {});
  28431. // https://github.com/ternjs/acorn/issues/180
  28432. test("#!/usr/bin/node\n;", {}, {
  28433. allowHashBang: true,
  28434. onComment: [{
  28435. type: "Line",
  28436. value: "/usr/bin/node",
  28437. start: 0,
  28438. end: 15
  28439. }]
  28440. });
  28441. // https://github.com/ternjs/acorn/issues/204
  28442. test("(function () {} / 1)", {
  28443. type: "Program",
  28444. body: [{
  28445. type: "ExpressionStatement",
  28446. expression: {
  28447. type: "BinaryExpression",
  28448. left: {
  28449. type: "FunctionExpression",
  28450. id: null,
  28451. params: [],
  28452. body: {
  28453. type: "BlockStatement",
  28454. body: []
  28455. }
  28456. },
  28457. operator: "/",
  28458. right: {type: "Literal", value: 1}
  28459. }
  28460. }]
  28461. });
  28462. test("function f() {} / 1 /", {
  28463. type: "Program",
  28464. body: [
  28465. {
  28466. type: "FunctionDeclaration",
  28467. id: {type: "Identifier", name: "f"},
  28468. params: [],
  28469. body: {
  28470. type: "BlockStatement",
  28471. body: []
  28472. }
  28473. },
  28474. {
  28475. type: "ExpressionStatement",
  28476. expression: {
  28477. type: "Literal",
  28478. regex: {pattern: " 1 ", flags: ""},
  28479. value: / 1 /
  28480. }
  28481. }
  28482. ]
  28483. });
  28484. // https://github.com/ternjs/acorn/issues/320
  28485. test("do /x/; while (false);", {
  28486. type: "Program",
  28487. body: [
  28488. {
  28489. type: "DoWhileStatement",
  28490. body: {
  28491. type: "ExpressionStatement",
  28492. expression: {
  28493. type: "Literal",
  28494. value: /x/,
  28495. raw: "/x/",
  28496. regex: { pattern: "x", flags: "" }
  28497. }
  28498. },
  28499. test: {
  28500. type: "Literal",
  28501. value: false,
  28502. raw: "false"
  28503. }
  28504. }
  28505. ]
  28506. });
  28507. var semicolons = []
  28508. testAssert("var x\nreturn\n10", function() {
  28509. var result = semicolons.join(" ");
  28510. semicolons.length = 0;
  28511. if (result != "5 12 15")
  28512. return "Unexpected result for onInsertedSemicolon: " + result;
  28513. }, {onInsertedSemicolon: function(pos) { semicolons.push(pos); },
  28514. allowReturnOutsideFunction: true,
  28515. loose: false})
  28516. var trailingCommas = []
  28517. testAssert("[1,2,] + {foo: 1,}", function() {
  28518. var result = trailingCommas.join(" ");
  28519. trailingCommas.length = 0;
  28520. if (result != "4 16")
  28521. return "Unexpected result for onTrailingComma: " + result;
  28522. }, {onTrailingComma: function(pos) { trailingCommas.push(pos); },
  28523. loose: false})
  28524. // https://github.com/ternjs/acorn/issues/275
  28525. testFail("({ get prop(x) {} })", "getter should have no params (1:11)");
  28526. testFail("({ set prop() {} })", "setter should have exactly one param (1:11)");
  28527. testFail("({ set prop(x, y) {} })", "setter should have exactly one param (1:11)");
  28528. // https://github.com/ternjs/acorn/issues/363
  28529. test("/[a-z]/gim", {
  28530. type: "Program",
  28531. body: [
  28532. {
  28533. type: "ExpressionStatement",
  28534. expression: {
  28535. type: "Literal",
  28536. value: /[a-z]/gim,
  28537. regex: {
  28538. pattern: "[a-z]",
  28539. flags: "gim"
  28540. }
  28541. }
  28542. }
  28543. ]
  28544. });
  28545. testFail("/[a-z]/u", "Invalid regular expression flag (1:1)");
  28546. testFail("/[a-z]/y", "Invalid regular expression flag (1:1)");
  28547. testFail("/[a-z]/s", "Invalid regular expression flag (1:1)");