ff5846c8385ab3115ebeea1cc0401bbba97da6c1877e7df8a85a1c77be0e7e5f8629d1daf5a13734cacf8d9fe29e65b71560c61468b02a34a882d192d58bc5 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. "use strict";
  2. var _index = require("./index");
  3. var _index2 = _interopRequireDefault(_index);
  4. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5. (0, _index2.default)("AssignmentPattern", {
  6. visitor: ["left", "right"],
  7. aliases: ["Pattern", "LVal"],
  8. fields: {
  9. left: {
  10. validate: (0, _index.assertNodeType)("Identifier")
  11. },
  12. right: {
  13. validate: (0, _index.assertNodeType)("Expression")
  14. },
  15. decorators: {
  16. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  17. }
  18. }
  19. });
  20. (0, _index2.default)("ArrayPattern", {
  21. visitor: ["elements", "typeAnnotation"],
  22. aliases: ["Pattern", "LVal"],
  23. fields: {
  24. elements: {
  25. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Identifier", "Pattern", "RestElement")))
  26. },
  27. decorators: {
  28. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  29. }
  30. }
  31. });
  32. (0, _index2.default)("ArrowFunctionExpression", {
  33. builder: ["params", "body", "async"],
  34. visitor: ["params", "body", "returnType", "typeParameters"],
  35. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
  36. fields: {
  37. params: {
  38. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  39. },
  40. body: {
  41. validate: (0, _index.assertNodeType)("BlockStatement", "Expression")
  42. },
  43. async: {
  44. validate: (0, _index.assertValueType)("boolean"),
  45. default: false
  46. }
  47. }
  48. });
  49. (0, _index2.default)("ClassBody", {
  50. visitor: ["body"],
  51. fields: {
  52. body: {
  53. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty")))
  54. }
  55. }
  56. });
  57. (0, _index2.default)("ClassDeclaration", {
  58. builder: ["id", "superClass", "body", "decorators"],
  59. visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
  60. aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
  61. fields: {
  62. id: {
  63. validate: (0, _index.assertNodeType)("Identifier")
  64. },
  65. body: {
  66. validate: (0, _index.assertNodeType)("ClassBody")
  67. },
  68. superClass: {
  69. optional: true,
  70. validate: (0, _index.assertNodeType)("Expression")
  71. },
  72. decorators: {
  73. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  74. }
  75. }
  76. });
  77. (0, _index2.default)("ClassExpression", {
  78. inherits: "ClassDeclaration",
  79. aliases: ["Scopable", "Class", "Expression", "Pureish"],
  80. fields: {
  81. id: {
  82. optional: true,
  83. validate: (0, _index.assertNodeType)("Identifier")
  84. },
  85. body: {
  86. validate: (0, _index.assertNodeType)("ClassBody")
  87. },
  88. superClass: {
  89. optional: true,
  90. validate: (0, _index.assertNodeType)("Expression")
  91. },
  92. decorators: {
  93. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  94. }
  95. }
  96. });
  97. (0, _index2.default)("ExportAllDeclaration", {
  98. visitor: ["source"],
  99. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  100. fields: {
  101. source: {
  102. validate: (0, _index.assertNodeType)("StringLiteral")
  103. }
  104. }
  105. });
  106. (0, _index2.default)("ExportDefaultDeclaration", {
  107. visitor: ["declaration"],
  108. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  109. fields: {
  110. declaration: {
  111. validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression")
  112. }
  113. }
  114. });
  115. (0, _index2.default)("ExportNamedDeclaration", {
  116. visitor: ["declaration", "specifiers", "source"],
  117. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  118. fields: {
  119. declaration: {
  120. validate: (0, _index.assertNodeType)("Declaration"),
  121. optional: true
  122. },
  123. specifiers: {
  124. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier")))
  125. },
  126. source: {
  127. validate: (0, _index.assertNodeType)("StringLiteral"),
  128. optional: true
  129. }
  130. }
  131. });
  132. (0, _index2.default)("ExportSpecifier", {
  133. visitor: ["local", "exported"],
  134. aliases: ["ModuleSpecifier"],
  135. fields: {
  136. local: {
  137. validate: (0, _index.assertNodeType)("Identifier")
  138. },
  139. exported: {
  140. validate: (0, _index.assertNodeType)("Identifier")
  141. }
  142. }
  143. });
  144. (0, _index2.default)("ForOfStatement", {
  145. visitor: ["left", "right", "body"],
  146. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  147. fields: {
  148. left: {
  149. validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal")
  150. },
  151. right: {
  152. validate: (0, _index.assertNodeType)("Expression")
  153. },
  154. body: {
  155. validate: (0, _index.assertNodeType)("Statement")
  156. }
  157. }
  158. });
  159. (0, _index2.default)("ImportDeclaration", {
  160. visitor: ["specifiers", "source"],
  161. aliases: ["Statement", "Declaration", "ModuleDeclaration"],
  162. fields: {
  163. specifiers: {
  164. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
  165. },
  166. source: {
  167. validate: (0, _index.assertNodeType)("StringLiteral")
  168. }
  169. }
  170. });
  171. (0, _index2.default)("ImportDefaultSpecifier", {
  172. visitor: ["local"],
  173. aliases: ["ModuleSpecifier"],
  174. fields: {
  175. local: {
  176. validate: (0, _index.assertNodeType)("Identifier")
  177. }
  178. }
  179. });
  180. (0, _index2.default)("ImportNamespaceSpecifier", {
  181. visitor: ["local"],
  182. aliases: ["ModuleSpecifier"],
  183. fields: {
  184. local: {
  185. validate: (0, _index.assertNodeType)("Identifier")
  186. }
  187. }
  188. });
  189. (0, _index2.default)("ImportSpecifier", {
  190. visitor: ["local", "imported"],
  191. aliases: ["ModuleSpecifier"],
  192. fields: {
  193. local: {
  194. validate: (0, _index.assertNodeType)("Identifier")
  195. },
  196. imported: {
  197. validate: (0, _index.assertNodeType)("Identifier")
  198. },
  199. importKind: {
  200. validate: (0, _index.assertOneOf)(null, "type", "typeof")
  201. }
  202. }
  203. });
  204. (0, _index2.default)("MetaProperty", {
  205. visitor: ["meta", "property"],
  206. aliases: ["Expression"],
  207. fields: {
  208. meta: {
  209. validate: (0, _index.assertValueType)("string")
  210. },
  211. property: {
  212. validate: (0, _index.assertValueType)("string")
  213. }
  214. }
  215. });
  216. (0, _index2.default)("ClassMethod", {
  217. aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
  218. builder: ["kind", "key", "params", "body", "computed", "static"],
  219. visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
  220. fields: {
  221. kind: {
  222. validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")),
  223. default: "method"
  224. },
  225. computed: {
  226. default: false,
  227. validate: (0, _index.assertValueType)("boolean")
  228. },
  229. static: {
  230. default: false,
  231. validate: (0, _index.assertValueType)("boolean")
  232. },
  233. key: {
  234. validate: function validate(node, key, val) {
  235. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  236. _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  237. }
  238. },
  239. params: {
  240. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  241. },
  242. body: {
  243. validate: (0, _index.assertNodeType)("BlockStatement")
  244. },
  245. generator: {
  246. default: false,
  247. validate: (0, _index.assertValueType)("boolean")
  248. },
  249. async: {
  250. default: false,
  251. validate: (0, _index.assertValueType)("boolean")
  252. }
  253. }
  254. });
  255. (0, _index2.default)("ObjectPattern", {
  256. visitor: ["properties", "typeAnnotation"],
  257. aliases: ["Pattern", "LVal"],
  258. fields: {
  259. properties: {
  260. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property")))
  261. },
  262. decorators: {
  263. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  264. }
  265. }
  266. });
  267. (0, _index2.default)("SpreadElement", {
  268. visitor: ["argument"],
  269. aliases: ["UnaryLike"],
  270. fields: {
  271. argument: {
  272. validate: (0, _index.assertNodeType)("Expression")
  273. }
  274. }
  275. });
  276. (0, _index2.default)("Super", {
  277. aliases: ["Expression"]
  278. });
  279. (0, _index2.default)("TaggedTemplateExpression", {
  280. visitor: ["tag", "quasi"],
  281. aliases: ["Expression"],
  282. fields: {
  283. tag: {
  284. validate: (0, _index.assertNodeType)("Expression")
  285. },
  286. quasi: {
  287. validate: (0, _index.assertNodeType)("TemplateLiteral")
  288. }
  289. }
  290. });
  291. (0, _index2.default)("TemplateElement", {
  292. builder: ["value", "tail"],
  293. fields: {
  294. value: {},
  295. tail: {
  296. validate: (0, _index.assertValueType)("boolean"),
  297. default: false
  298. }
  299. }
  300. });
  301. (0, _index2.default)("TemplateLiteral", {
  302. visitor: ["quasis", "expressions"],
  303. aliases: ["Expression", "Literal"],
  304. fields: {
  305. quasis: {
  306. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement")))
  307. },
  308. expressions: {
  309. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression")))
  310. }
  311. }
  312. });
  313. (0, _index2.default)("YieldExpression", {
  314. builder: ["argument", "delegate"],
  315. visitor: ["argument"],
  316. aliases: ["Expression", "Terminatorless"],
  317. fields: {
  318. delegate: {
  319. validate: (0, _index.assertValueType)("boolean"),
  320. default: false
  321. },
  322. argument: {
  323. optional: true,
  324. validate: (0, _index.assertNodeType)("Expression")
  325. }
  326. }
  327. });