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