main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
5.2 KB
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * @type {VisitorKeys}
|
---|
| 7 | */
|
---|
| 8 | const KEYS = {
|
---|
| 9 | ArrayExpression: [
|
---|
| 10 | "elements"
|
---|
| 11 | ],
|
---|
| 12 | ArrayPattern: [
|
---|
| 13 | "elements"
|
---|
| 14 | ],
|
---|
| 15 | ArrowFunctionExpression: [
|
---|
| 16 | "params",
|
---|
| 17 | "body"
|
---|
| 18 | ],
|
---|
| 19 | AssignmentExpression: [
|
---|
| 20 | "left",
|
---|
| 21 | "right"
|
---|
| 22 | ],
|
---|
| 23 | AssignmentPattern: [
|
---|
| 24 | "left",
|
---|
| 25 | "right"
|
---|
| 26 | ],
|
---|
| 27 | AwaitExpression: [
|
---|
| 28 | "argument"
|
---|
| 29 | ],
|
---|
| 30 | BinaryExpression: [
|
---|
| 31 | "left",
|
---|
| 32 | "right"
|
---|
| 33 | ],
|
---|
| 34 | BlockStatement: [
|
---|
| 35 | "body"
|
---|
| 36 | ],
|
---|
| 37 | BreakStatement: [
|
---|
| 38 | "label"
|
---|
| 39 | ],
|
---|
| 40 | CallExpression: [
|
---|
| 41 | "callee",
|
---|
| 42 | "arguments"
|
---|
| 43 | ],
|
---|
| 44 | CatchClause: [
|
---|
| 45 | "param",
|
---|
| 46 | "body"
|
---|
| 47 | ],
|
---|
| 48 | ChainExpression: [
|
---|
| 49 | "expression"
|
---|
| 50 | ],
|
---|
| 51 | ClassBody: [
|
---|
| 52 | "body"
|
---|
| 53 | ],
|
---|
| 54 | ClassDeclaration: [
|
---|
| 55 | "id",
|
---|
| 56 | "superClass",
|
---|
| 57 | "body"
|
---|
| 58 | ],
|
---|
| 59 | ClassExpression: [
|
---|
| 60 | "id",
|
---|
| 61 | "superClass",
|
---|
| 62 | "body"
|
---|
| 63 | ],
|
---|
| 64 | ConditionalExpression: [
|
---|
| 65 | "test",
|
---|
| 66 | "consequent",
|
---|
| 67 | "alternate"
|
---|
| 68 | ],
|
---|
| 69 | ContinueStatement: [
|
---|
| 70 | "label"
|
---|
| 71 | ],
|
---|
| 72 | DebuggerStatement: [],
|
---|
| 73 | DoWhileStatement: [
|
---|
| 74 | "body",
|
---|
| 75 | "test"
|
---|
| 76 | ],
|
---|
| 77 | EmptyStatement: [],
|
---|
| 78 | ExperimentalRestProperty: [
|
---|
| 79 | "argument"
|
---|
| 80 | ],
|
---|
| 81 | ExperimentalSpreadProperty: [
|
---|
| 82 | "argument"
|
---|
| 83 | ],
|
---|
| 84 | ExportAllDeclaration: [
|
---|
| 85 | "exported",
|
---|
| 86 | "source"
|
---|
| 87 | ],
|
---|
| 88 | ExportDefaultDeclaration: [
|
---|
| 89 | "declaration"
|
---|
| 90 | ],
|
---|
| 91 | ExportNamedDeclaration: [
|
---|
| 92 | "declaration",
|
---|
| 93 | "specifiers",
|
---|
| 94 | "source"
|
---|
| 95 | ],
|
---|
| 96 | ExportSpecifier: [
|
---|
| 97 | "exported",
|
---|
| 98 | "local"
|
---|
| 99 | ],
|
---|
| 100 | ExpressionStatement: [
|
---|
| 101 | "expression"
|
---|
| 102 | ],
|
---|
| 103 | ForInStatement: [
|
---|
| 104 | "left",
|
---|
| 105 | "right",
|
---|
| 106 | "body"
|
---|
| 107 | ],
|
---|
| 108 | ForOfStatement: [
|
---|
| 109 | "left",
|
---|
| 110 | "right",
|
---|
| 111 | "body"
|
---|
| 112 | ],
|
---|
| 113 | ForStatement: [
|
---|
| 114 | "init",
|
---|
| 115 | "test",
|
---|
| 116 | "update",
|
---|
| 117 | "body"
|
---|
| 118 | ],
|
---|
| 119 | FunctionDeclaration: [
|
---|
| 120 | "id",
|
---|
| 121 | "params",
|
---|
| 122 | "body"
|
---|
| 123 | ],
|
---|
| 124 | FunctionExpression: [
|
---|
| 125 | "id",
|
---|
| 126 | "params",
|
---|
| 127 | "body"
|
---|
| 128 | ],
|
---|
| 129 | Identifier: [],
|
---|
| 130 | IfStatement: [
|
---|
| 131 | "test",
|
---|
| 132 | "consequent",
|
---|
| 133 | "alternate"
|
---|
| 134 | ],
|
---|
| 135 | ImportDeclaration: [
|
---|
| 136 | "specifiers",
|
---|
| 137 | "source"
|
---|
| 138 | ],
|
---|
| 139 | ImportDefaultSpecifier: [
|
---|
| 140 | "local"
|
---|
| 141 | ],
|
---|
| 142 | ImportExpression: [
|
---|
| 143 | "source"
|
---|
| 144 | ],
|
---|
| 145 | ImportNamespaceSpecifier: [
|
---|
| 146 | "local"
|
---|
| 147 | ],
|
---|
| 148 | ImportSpecifier: [
|
---|
| 149 | "imported",
|
---|
| 150 | "local"
|
---|
| 151 | ],
|
---|
| 152 | JSXAttribute: [
|
---|
| 153 | "name",
|
---|
| 154 | "value"
|
---|
| 155 | ],
|
---|
| 156 | JSXClosingElement: [
|
---|
| 157 | "name"
|
---|
| 158 | ],
|
---|
| 159 | JSXClosingFragment: [],
|
---|
| 160 | JSXElement: [
|
---|
| 161 | "openingElement",
|
---|
| 162 | "children",
|
---|
| 163 | "closingElement"
|
---|
| 164 | ],
|
---|
| 165 | JSXEmptyExpression: [],
|
---|
| 166 | JSXExpressionContainer: [
|
---|
| 167 | "expression"
|
---|
| 168 | ],
|
---|
| 169 | JSXFragment: [
|
---|
| 170 | "openingFragment",
|
---|
| 171 | "children",
|
---|
| 172 | "closingFragment"
|
---|
| 173 | ],
|
---|
| 174 | JSXIdentifier: [],
|
---|
| 175 | JSXMemberExpression: [
|
---|
| 176 | "object",
|
---|
| 177 | "property"
|
---|
| 178 | ],
|
---|
| 179 | JSXNamespacedName: [
|
---|
| 180 | "namespace",
|
---|
| 181 | "name"
|
---|
| 182 | ],
|
---|
| 183 | JSXOpeningElement: [
|
---|
| 184 | "name",
|
---|
| 185 | "attributes"
|
---|
| 186 | ],
|
---|
| 187 | JSXOpeningFragment: [],
|
---|
| 188 | JSXSpreadAttribute: [
|
---|
| 189 | "argument"
|
---|
| 190 | ],
|
---|
| 191 | JSXSpreadChild: [
|
---|
| 192 | "expression"
|
---|
| 193 | ],
|
---|
| 194 | JSXText: [],
|
---|
| 195 | LabeledStatement: [
|
---|
| 196 | "label",
|
---|
| 197 | "body"
|
---|
| 198 | ],
|
---|
| 199 | Literal: [],
|
---|
| 200 | LogicalExpression: [
|
---|
| 201 | "left",
|
---|
| 202 | "right"
|
---|
| 203 | ],
|
---|
| 204 | MemberExpression: [
|
---|
| 205 | "object",
|
---|
| 206 | "property"
|
---|
| 207 | ],
|
---|
| 208 | MetaProperty: [
|
---|
| 209 | "meta",
|
---|
| 210 | "property"
|
---|
| 211 | ],
|
---|
| 212 | MethodDefinition: [
|
---|
| 213 | "key",
|
---|
| 214 | "value"
|
---|
| 215 | ],
|
---|
| 216 | NewExpression: [
|
---|
| 217 | "callee",
|
---|
| 218 | "arguments"
|
---|
| 219 | ],
|
---|
| 220 | ObjectExpression: [
|
---|
| 221 | "properties"
|
---|
| 222 | ],
|
---|
| 223 | ObjectPattern: [
|
---|
| 224 | "properties"
|
---|
| 225 | ],
|
---|
| 226 | PrivateIdentifier: [],
|
---|
| 227 | Program: [
|
---|
| 228 | "body"
|
---|
| 229 | ],
|
---|
| 230 | Property: [
|
---|
| 231 | "key",
|
---|
| 232 | "value"
|
---|
| 233 | ],
|
---|
| 234 | PropertyDefinition: [
|
---|
| 235 | "key",
|
---|
| 236 | "value"
|
---|
| 237 | ],
|
---|
| 238 | RestElement: [
|
---|
| 239 | "argument"
|
---|
| 240 | ],
|
---|
| 241 | ReturnStatement: [
|
---|
| 242 | "argument"
|
---|
| 243 | ],
|
---|
| 244 | SequenceExpression: [
|
---|
| 245 | "expressions"
|
---|
| 246 | ],
|
---|
| 247 | SpreadElement: [
|
---|
| 248 | "argument"
|
---|
| 249 | ],
|
---|
| 250 | StaticBlock: [
|
---|
| 251 | "body"
|
---|
| 252 | ],
|
---|
| 253 | Super: [],
|
---|
| 254 | SwitchCase: [
|
---|
| 255 | "test",
|
---|
| 256 | "consequent"
|
---|
| 257 | ],
|
---|
| 258 | SwitchStatement: [
|
---|
| 259 | "discriminant",
|
---|
| 260 | "cases"
|
---|
| 261 | ],
|
---|
| 262 | TaggedTemplateExpression: [
|
---|
| 263 | "tag",
|
---|
| 264 | "quasi"
|
---|
| 265 | ],
|
---|
| 266 | TemplateElement: [],
|
---|
| 267 | TemplateLiteral: [
|
---|
| 268 | "quasis",
|
---|
| 269 | "expressions"
|
---|
| 270 | ],
|
---|
| 271 | ThisExpression: [],
|
---|
| 272 | ThrowStatement: [
|
---|
| 273 | "argument"
|
---|
| 274 | ],
|
---|
| 275 | TryStatement: [
|
---|
| 276 | "block",
|
---|
| 277 | "handler",
|
---|
| 278 | "finalizer"
|
---|
| 279 | ],
|
---|
| 280 | UnaryExpression: [
|
---|
| 281 | "argument"
|
---|
| 282 | ],
|
---|
| 283 | UpdateExpression: [
|
---|
| 284 | "argument"
|
---|
| 285 | ],
|
---|
| 286 | VariableDeclaration: [
|
---|
| 287 | "declarations"
|
---|
| 288 | ],
|
---|
| 289 | VariableDeclarator: [
|
---|
| 290 | "id",
|
---|
| 291 | "init"
|
---|
| 292 | ],
|
---|
| 293 | WhileStatement: [
|
---|
| 294 | "test",
|
---|
| 295 | "body"
|
---|
| 296 | ],
|
---|
| 297 | WithStatement: [
|
---|
| 298 | "object",
|
---|
| 299 | "body"
|
---|
| 300 | ],
|
---|
| 301 | YieldExpression: [
|
---|
| 302 | "argument"
|
---|
| 303 | ]
|
---|
| 304 | };
|
---|
| 305 |
|
---|
| 306 | // Types.
|
---|
| 307 | const NODE_TYPES = Object.keys(KEYS);
|
---|
| 308 |
|
---|
| 309 | // Freeze the keys.
|
---|
| 310 | for (const type of NODE_TYPES) {
|
---|
| 311 | Object.freeze(KEYS[type]);
|
---|
| 312 | }
|
---|
| 313 | Object.freeze(KEYS);
|
---|
| 314 |
|
---|
| 315 | export default KEYS;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.