UNPKG

2.55 kBJavaScriptView Raw
1require("./es7");
2
3var types = require("../lib/types");
4var defaults = require("../lib/shared").defaults;
5var def = types.Type.def;
6var or = types.Type.or;
7
8def("Noop")
9 .bases("Node")
10 .build();
11
12def("DoExpression")
13 .bases("Expression")
14 .build("body")
15 .field("body", [def("Statement")]);
16
17def("Super")
18 .bases("Expression")
19 .build();
20
21def("BindExpression")
22 .bases("Expression")
23 .build("object", "callee")
24 .field("object", or(def("Expression"), null))
25 .field("callee", def("Expression"));
26
27def("Decorator")
28 .bases("Node")
29 .build("expression")
30 .field("expression", def("Expression"));
31
32def("Property")
33 .field("decorators",
34 or([def("Decorator")], null),
35 defaults["null"]);
36
37def("MethodDefinition")
38 .field("decorators",
39 or([def("Decorator")], null),
40 defaults["null"]);
41
42def("MetaProperty")
43 .bases("Expression")
44 .build("meta", "property")
45 .field("meta", def("Identifier"))
46 .field("property", def("Identifier"));
47
48def("ParenthesizedExpression")
49 .bases("Expression")
50 .build("expression")
51 .field("expression", def("Expression"));
52
53def("ImportSpecifier")
54 .bases("ModuleSpecifier")
55 .build("imported", "local")
56 .field("imported", def("Identifier"));
57
58def("ImportDefaultSpecifier")
59 .bases("ModuleSpecifier")
60 .build("local");
61
62def("ImportNamespaceSpecifier")
63 .bases("ModuleSpecifier")
64 .build("local");
65
66def("ExportDefaultDeclaration")
67 .bases("Declaration")
68 .build("declaration")
69 .field("declaration", or(def("Declaration"), def("Expression")));
70
71def("ExportNamedDeclaration")
72 .bases("Declaration")
73 .build("declaration", "specifiers", "source")
74 .field("declaration", or(def("Declaration"), null))
75 .field("specifiers", [def("ExportSpecifier")], defaults.emptyArray)
76 .field("source", or(def("Literal"), null), defaults["null"]);
77
78def("ExportSpecifier")
79 .bases("ModuleSpecifier")
80 .build("local", "exported")
81 .field("exported", def("Identifier"));
82
83def("ExportNamespaceSpecifier")
84 .bases("Specifier")
85 .build("exported")
86 .field("exported", def("Identifier"));
87
88def("ExportDefaultSpecifier")
89 .bases("Specifier")
90 .build("exported")
91 .field("exported", def("Identifier"));
92
93def("ExportAllDeclaration")
94 .bases("Declaration")
95 .build("exported", "source")
96 .field("exported", or(def("Identifier"), null))
97 .field("source", def("Literal"));
98
99def("CommentBlock")
100 .bases("Comment")
101 .build("value", /*optional:*/ "leading", "trailing");
102
103def("CommentLine")
104 .bases("Comment")
105 .build("value", /*optional:*/ "leading", "trailing");