1 | function AstNodeTypes() {
|
2 |
|
3 | }
|
4 |
|
5 | AstNodeTypes.LogicalExpression = "LogicalExpression";
|
6 | AstNodeTypes.BlockStatement = "BlockStatement";
|
7 | AstNodeTypes.SwitchStatement = "SwitchStatement";
|
8 | AstNodeTypes.IfStatement = "IfStatement";
|
9 | AstNodeTypes.ConditionalExpression = "ConditionalExpression";
|
10 | AstNodeTypes.StringLiteral = "StringLiteral";
|
11 | AstNodeTypes.Identifier = "Identifier";
|
12 | AstNodeTypes.AssignmentPattern = "AssignmentPattern";
|
13 | AstNodeTypes.DefaultArgument = "DefaultArgument";
|
14 | AstNodeTypes.FunctionExpression = "FunctionExpression";
|
15 | AstNodeTypes.FunctionDeclaration = "FunctionDeclaration";
|
16 |
|
17 | AstNodeTypes.isMethodNode = function (node) {
|
18 | if (!node && !node.type)
|
19 | return false;
|
20 |
|
21 | return methodNodeTypes[node.type];
|
22 | }
|
23 |
|
24 | AstNodeTypes.isBranchNode = function (node) {
|
25 | if (!node && !node.type)
|
26 | return false;
|
27 |
|
28 | return branchNodeTypes[node.type];
|
29 | }
|
30 |
|
31 | var branchNodeTypes = {
|
32 | "IfStatement": true,
|
33 | "SwitchStatement": true,
|
34 | "ConditionalExpression": true,
|
35 | "LogicalExpression": true
|
36 | };
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | var methodNodeTypes = {
|
47 | "FunctionDeclaration": true,
|
48 | "FunctionExpression": true,
|
49 | "ArrowFunctionExpression": true,
|
50 | "ObjectMethod": true,
|
51 | "ClassMethod": true
|
52 | }
|
53 |
|
54 | module.exports = AstNodeTypes; |
\ | No newline at end of file |