forked from benjamn/ast-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
es7.ts
46 lines (38 loc) · 1.09 KB
/
es7.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { Fork } from "../types";
import es6Def from "./es6";
import typesPlugin from "../lib/types";
import sharedPlugin from "../lib/shared";
export default function (fork: Fork) {
fork.use(es6Def);
var types = fork.use(typesPlugin);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(sharedPlugin).defaults;
def("Function")
.field("async", Boolean, defaults["false"]);
def("SpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ObjectExpression")
.field("properties", [or(
def("Property"),
def("SpreadProperty"),
def("SpreadElement")
)]);
def("SpreadPropertyPattern")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"));
def("ObjectPattern")
.field("properties", [or(
def("Property"),
def("PropertyPattern"),
def("SpreadPropertyPattern")
)]);
def("AwaitExpression")
.bases("Expression")
.build("argument", "all")
.field("argument", or(def("Expression"), null))
.field("all", Boolean, defaults["false"]);
};