allClasses.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. define(["esprima"], function (esprima) {
  2. // return esprima.parse("function a(){ [a] = () => 0; new.target; `test`; `hello,${name}`; }");
  3. return {
  4. "type": "Program",
  5. "body": [
  6. {
  7. "type": "FunctionDeclaration",
  8. "id": {
  9. "type": "Identifier",
  10. "name": "a"
  11. },
  12. "params": [],
  13. "defaults": [],
  14. "body": {
  15. "type": "BlockStatement",
  16. "body": [
  17. {
  18. "type": "ExpressionStatement",
  19. "expression": {
  20. "type": "AssignmentExpression",
  21. "operator": "=",
  22. "left": {
  23. "type": "ArrayPattern",
  24. "elements": [
  25. {
  26. "type": "Identifier",
  27. "name": "a"
  28. }
  29. ]
  30. },
  31. "right": {
  32. "type": "ArrowFunctionExpression",
  33. "params": [],
  34. "defaults": [],
  35. "rest": null,
  36. "body": {
  37. "type": "Literal",
  38. "value": 0,
  39. "raw": "0"
  40. },
  41. "generator": false,
  42. "expression": false
  43. }
  44. }
  45. },
  46. {
  47. "type": "ExpressionStatement",
  48. "expression": {
  49. "type": "MetaProperty",
  50. "meta": {
  51. "type": "Identifier",
  52. "name": "new",
  53. },
  54. "property": {
  55. "type": "Identifier",
  56. "name": "target",
  57. },
  58. },
  59. },
  60. {
  61. "type": "ExpressionStatement",
  62. "expression": {
  63. "type": "TemplateLiteral",
  64. "quasis": [
  65. {
  66. "type": "TemplateElement",
  67. "value": {
  68. "raw": "test",
  69. "cooked": "test"
  70. },
  71. "tail": true,
  72. }
  73. ],
  74. "expressions": [],
  75. },
  76. },
  77. {
  78. "type": "ExpressionStatement",
  79. "expression": {
  80. "type": "TemplateLiteral",
  81. "quasis": [
  82. {
  83. "type": "TemplateElement",
  84. "value": {
  85. "raw": "hello,",
  86. "cooked": "hello,"
  87. },
  88. "tail": false,
  89. },
  90. {
  91. "type": "TemplateElement",
  92. "value": {
  93. "raw": "",
  94. "cooked": ""
  95. },
  96. "tail": true,
  97. }
  98. ],
  99. "expressions": [
  100. {
  101. "type": "Identifier",
  102. "name": "name",
  103. }
  104. ],
  105. },
  106. }
  107. ]
  108. },
  109. "rest": null,
  110. "generator": false,
  111. "expression": false
  112. }
  113. ]
  114. };
  115. });