|
1 | | -import * as types from "babel-types"; |
| 1 | +import * as t from "babel-types"; |
2 | 2 | import { Path } from "./path"; |
3 | 3 |
|
4 | 4 | export type ScopeType = "function" | "loop" | "switch" | "block" | "class"; |
5 | 5 |
|
6 | 6 | export type Kind = "const" | "var" | "let"; |
7 | 7 |
|
8 | 8 | export interface INodeTypeMap { |
9 | | - File: types.File; |
10 | | - Program: types.Program; |
11 | | - Identifier: types.Identifier; |
12 | | - NullLiteral: types.NullLiteral; |
13 | | - StringLiteral: types.StringLiteral; |
14 | | - NumericLiteral: types.NumericLiteral; |
15 | | - BooleanLiteral: types.BooleanLiteral; |
16 | | - RegExpLiteral: types.RegExpLiteral; |
17 | | - FunctionDeclaration: types.FunctionDeclaration; |
18 | | - FunctionExpression: types.FunctionExpression; |
19 | | - ArrowFunctionExpression: types.ArrowFunctionExpression; |
20 | | - SwitchCase: types.SwitchCase; |
21 | | - CatchClause: types.CatchClause; |
22 | | - VariableDeclarator: types.VariableDeclarator; |
23 | | - ExpressionStatement: types.ExpressionStatement; |
24 | | - BlockStatement: types.BlockStatement; |
25 | | - EmptyStatement: types.EmptyStatement; |
26 | | - DebuggerStatement: types.DebuggerStatement; |
27 | | - WithStatement: types.WithStatement; |
28 | | - ReturnStatement: types.ReturnStatement; |
29 | | - LabeledStatement: types.LabeledStatement; |
30 | | - BreakStatement: types.BreakStatement; |
31 | | - ContinueStatement: types.ContinueStatement; |
32 | | - IfStatement: types.IfStatement; |
33 | | - SwitchStatement: types.SwitchStatement; |
34 | | - ThrowStatement: types.ThrowStatement; |
35 | | - TryStatement: types.TryStatement; |
36 | | - WhileStatement: types.WhileStatement; |
37 | | - DoWhileStatement: types.DoWhileStatement; |
38 | | - ForStatement: types.ForStatement; |
39 | | - ForInStatement: types.ForInStatement; |
40 | | - ForOfStatement: types.ForOfStatement; |
41 | | - VariableDeclaration: types.VariableDeclaration; |
42 | | - ClassDeclaration: types.ClassDeclaration; |
43 | | - ThisExpression: types.ThisExpression; |
44 | | - ArrayExpression: types.ArrayExpression; |
45 | | - ObjectExpression: types.ObjectExpression; |
46 | | - ObjectProperty: types.ObjectProperty; |
47 | | - ObjectMethod: types.ObjectMethod; |
48 | | - YieldExpression: types.YieldExpression; |
49 | | - UnaryExpression: types.UnaryExpression; |
50 | | - UpdateExpression: types.UpdateExpression; |
51 | | - BinaryExpression: types.BinaryExpression; |
52 | | - AssignmentExpression: types.AssignmentExpression; |
53 | | - LogicalExpression: types.LogicalExpression; |
54 | | - MemberExpression: types.MemberExpression; |
55 | | - ConditionalExpression: types.ConditionalExpression; |
56 | | - CallExpression: types.CallExpression; |
57 | | - NewExpression: types.NewExpression; |
58 | | - SequenceExpression: types.SequenceExpression; |
59 | | - TemplateLiteral: types.TemplateLiteral; |
60 | | - TaggedTemplateExpression: types.TaggedTemplateExpression; |
61 | | - ClassExpression: types.ClassExpression; |
62 | | - ClassMethod: types.ClassMethod; |
63 | | - MetaProperty: types.MetaProperty; |
64 | | - AwaitExpression: types.AwaitExpression; |
65 | | - Super: types.Super; |
66 | | - TemplateElement: types.TemplateElement; |
67 | | - SpreadElement: types.SpreadElement; |
68 | | - // ObjectPattern: types.ObjectPattern; |
69 | | - // ArrayPattern: types.ArrayPattern; |
70 | | - RestElement: types.RestElement; |
71 | | - AssignmentPattern: types.AssignmentPattern; |
72 | | - ClassBody: types.ClassBody; |
73 | | - ImportDeclaration: types.ImportDeclaration; |
74 | | - ExportNamedDeclaration: types.ExportNamedDeclaration; |
75 | | - ExportDefaultDeclaration: types.ExportDefaultDeclaration; |
76 | | - // ExportAllDeclaration: types.ExportAllDeclaration; |
77 | | - ImportSpecifier: types.ImportSpecifier; |
78 | | - ImportDefaultSpecifier: types.ImportDefaultSpecifier; |
79 | | - // ImportNamespaceSpecifier: types.ImportNamespaceSpecifier; |
80 | | - ExportSpecifier: types.ExportSpecifier; |
81 | | - SpreadProperty: types.SpreadProperty; |
82 | | - DoExpression: types.DoExpression; |
| 9 | + File: t.File; |
| 10 | + Program: t.Program; |
| 11 | + Identifier: t.Identifier; |
| 12 | + NullLiteral: t.NullLiteral; |
| 13 | + StringLiteral: t.StringLiteral; |
| 14 | + NumericLiteral: t.NumericLiteral; |
| 15 | + BooleanLiteral: t.BooleanLiteral; |
| 16 | + RegExpLiteral: t.RegExpLiteral; |
| 17 | + FunctionDeclaration: t.FunctionDeclaration; |
| 18 | + FunctionExpression: t.FunctionExpression; |
| 19 | + ArrowFunctionExpression: t.ArrowFunctionExpression; |
| 20 | + SwitchCase: t.SwitchCase; |
| 21 | + CatchClause: t.CatchClause; |
| 22 | + VariableDeclarator: t.VariableDeclarator; |
| 23 | + ExpressionStatement: t.ExpressionStatement; |
| 24 | + BlockStatement: t.BlockStatement; |
| 25 | + EmptyStatement: t.EmptyStatement; |
| 26 | + DebuggerStatement: t.DebuggerStatement; |
| 27 | + WithStatement: t.WithStatement; |
| 28 | + ReturnStatement: t.ReturnStatement; |
| 29 | + LabeledStatement: t.LabeledStatement; |
| 30 | + BreakStatement: t.BreakStatement; |
| 31 | + ContinueStatement: t.ContinueStatement; |
| 32 | + IfStatement: t.IfStatement; |
| 33 | + SwitchStatement: t.SwitchStatement; |
| 34 | + ThrowStatement: t.ThrowStatement; |
| 35 | + TryStatement: t.TryStatement; |
| 36 | + WhileStatement: t.WhileStatement; |
| 37 | + DoWhileStatement: t.DoWhileStatement; |
| 38 | + ForStatement: t.ForStatement; |
| 39 | + ForInStatement: t.ForInStatement; |
| 40 | + ForOfStatement: t.ForOfStatement; |
| 41 | + VariableDeclaration: t.VariableDeclaration; |
| 42 | + ClassDeclaration: t.ClassDeclaration; |
| 43 | + ThisExpression: t.ThisExpression; |
| 44 | + ArrayExpression: t.ArrayExpression; |
| 45 | + ObjectExpression: t.ObjectExpression; |
| 46 | + ObjectProperty: t.ObjectProperty; |
| 47 | + ObjectMethod: t.ObjectMethod; |
| 48 | + YieldExpression: t.YieldExpression; |
| 49 | + UnaryExpression: t.UnaryExpression; |
| 50 | + UpdateExpression: t.UpdateExpression; |
| 51 | + BinaryExpression: t.BinaryExpression; |
| 52 | + AssignmentExpression: t.AssignmentExpression; |
| 53 | + LogicalExpression: t.LogicalExpression; |
| 54 | + MemberExpression: t.MemberExpression; |
| 55 | + ConditionalExpression: t.ConditionalExpression; |
| 56 | + CallExpression: t.CallExpression; |
| 57 | + NewExpression: t.NewExpression; |
| 58 | + SequenceExpression: t.SequenceExpression; |
| 59 | + TemplateLiteral: t.TemplateLiteral; |
| 60 | + TaggedTemplateExpression: t.TaggedTemplateExpression; |
| 61 | + ClassExpression: t.ClassExpression; |
| 62 | + ClassMethod: t.ClassMethod; |
| 63 | + MetaProperty: t.MetaProperty; |
| 64 | + AwaitExpression: t.AwaitExpression; |
| 65 | + Super: t.Super; |
| 66 | + TemplateElement: t.TemplateElement; |
| 67 | + SpreadElement: t.SpreadElement; |
| 68 | + // ObjectPattern: t.ObjectPattern; |
| 69 | + // ArrayPattern: t.ArrayPattern; |
| 70 | + RestElement: t.RestElement; |
| 71 | + AssignmentPattern: t.AssignmentPattern; |
| 72 | + ClassBody: t.ClassBody; |
| 73 | + ImportDeclaration: t.ImportDeclaration; |
| 74 | + ExportNamedDeclaration: t.ExportNamedDeclaration; |
| 75 | + ExportDefaultDeclaration: t.ExportDefaultDeclaration; |
| 76 | + // ExportAllDeclaration: t.ExportAllDeclaration; |
| 77 | + ImportSpecifier: t.ImportSpecifier; |
| 78 | + ImportDefaultSpecifier: t.ImportDefaultSpecifier; |
| 79 | + // ImportNamespaceSpecifier: t.ImportNamespaceSpecifier; |
| 80 | + ExportSpecifier: t.ExportSpecifier; |
| 81 | + SpreadProperty: t.SpreadProperty; |
| 82 | + DoExpression: t.DoExpression; |
83 | 83 | } |
84 | 84 |
|
85 | 85 | export type EvaluateMap = { |
86 | 86 | [key in keyof INodeTypeMap]: (path: Path<INodeTypeMap[key]>) => any |
87 | 87 | }; |
88 | 88 |
|
89 | | -export type EvaluateFunc = (path: Path<types.Node>) => any; |
| 89 | +export type EvaluateFunc = (path: Path<t.Node>) => any; |
0 commit comments