UNPKG

4.78 kBJavaScriptView Raw
1/**
2 * @fileoverview The visitor keys for the node types Espree supports
3 * @author Nicholas C. Zakas
4 *
5 * This file contains code from estraverse-fb.
6 *
7 * The MIT license. Copyright (c) 2014 Ingvar Stepanyan
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in all
17 * copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28"use strict";
29
30//------------------------------------------------------------------------------
31// Requirements
32//------------------------------------------------------------------------------
33
34// None!
35
36//------------------------------------------------------------------------------
37// Public
38//------------------------------------------------------------------------------
39
40module.exports = {
41
42 // ECMAScript
43 AssignmentExpression: ["left", "right"],
44 AssignmentPattern: ["left", "right"],
45 ArrayExpression: ["elements"],
46 ArrayPattern: ["elements"],
47 ArrowFunctionExpression: ["params", "body"],
48 BlockStatement: ["body"],
49 BinaryExpression: ["left", "right"],
50 BreakStatement: ["label"],
51 CallExpression: ["callee", "arguments"],
52 CatchClause: ["param", "body"],
53 ClassBody: ["body"],
54 ClassDeclaration: ["id", "superClass", "body"],
55 ClassExpression: ["id", "superClass", "body"],
56 ConditionalExpression: ["test", "consequent", "alternate"],
57 ContinueStatement: ["label"],
58 DebuggerStatement: [],
59 DirectiveStatement: [],
60 DoWhileStatement: ["body", "test"],
61 EmptyStatement: [],
62 ExportAllDeclaration: ["source"],
63 ExportDefaultDeclaration: ["declaration"],
64 ExportNamedDeclaration: ["declaration", "specifiers", "source"],
65 ExportSpecifier: ["exported", "local"],
66 ExpressionStatement: ["expression"],
67 ForStatement: ["init", "test", "update", "body"],
68 ForInStatement: ["left", "right", "body"],
69 ForOfStatement: ["left", "right", "body"],
70 FunctionDeclaration: ["id", "params", "body"],
71 FunctionExpression: ["id", "params", "body"],
72 Identifier: [],
73 IfStatement: ["test", "consequent", "alternate"],
74 ImportDeclaration: ["specifiers", "source"],
75 ImportDefaultSpecifier: ["local"],
76 ImportNamespaceSpecifier: ["local"],
77 ImportSpecifier: ["imported", "local"],
78 Literal: [],
79 LabeledStatement: ["label", "body"],
80 LogicalExpression: ["left", "right"],
81 MemberExpression: ["object", "property"],
82 MetaProperty: ["meta", "property"],
83 MethodDefinition: ["key", "value"],
84 ModuleSpecifier: [],
85 NewExpression: ["callee", "arguments"],
86 ObjectExpression: ["properties"],
87 ObjectPattern: ["properties"],
88 Program: ["body"],
89 Property: ["key", "value"],
90 RestElement: ["argument"],
91 ReturnStatement: ["argument"],
92 SequenceExpression: ["expressions"],
93 SpreadElement: ["argument"],
94 Super: [],
95 SwitchStatement: ["discriminant", "cases"],
96 SwitchCase: ["test", "consequent"],
97 TaggedTemplateExpression: ["tag", "quasi"],
98 TemplateElement: [],
99 TemplateLiteral: ["quasis", "expressions"],
100 ThisExpression: [],
101 ThrowStatement: ["argument"],
102 TryStatement: ["block", "handler", "finalizer"],
103 UnaryExpression: ["argument"],
104 UpdateExpression: ["argument"],
105 VariableDeclaration: ["declarations"],
106 VariableDeclarator: ["id", "init"],
107 WhileStatement: ["test", "body"],
108 WithStatement: ["object", "body"],
109 YieldExpression: ["argument"],
110
111 // JSX
112 JSXIdentifier: [],
113 JSXNamespacedName: ["namespace", "name"],
114 JSXMemberExpression: ["object", "property"],
115 JSXEmptyExpression: [],
116 JSXExpressionContainer: ["expression"],
117 JSXElement: ["openingElement", "closingElement", "children"],
118 JSXClosingElement: ["name"],
119 JSXOpeningElement: ["name", "attributes"],
120 JSXAttribute: ["name", "value"],
121 JSXText: null,
122 JSXSpreadAttribute: ["argument"]
123};