ast-types 0.11.1 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/def/es-proposals.js +33 -0
- package/def/flow.js +63 -48
- package/def/typescript.js +14 -0
- package/lib/types.js +99 -61
- package/main.js +2 -1
- package/package.json +4 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module.exports = function (fork) {
|
|
2
|
+
fork.use(require('./core'));
|
|
3
|
+
|
|
4
|
+
var types = fork.use(require("../lib/types"));
|
|
5
|
+
var Type = types.Type;
|
|
6
|
+
var def = types.Type.def;
|
|
7
|
+
var or = Type.or;
|
|
8
|
+
|
|
9
|
+
var shared = fork.use(require("../lib/shared"));
|
|
10
|
+
var defaults = shared.defaults;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// https://github.com/tc39/proposal-optional-chaining
|
|
14
|
+
// `a?.b` as per https://github.com/estree/estree/issues/146
|
|
15
|
+
def("OptionalMemberExpression")
|
|
16
|
+
.bases("MemberExpression")
|
|
17
|
+
.build("object", "property", "computed", "optional")
|
|
18
|
+
.field("optional", Boolean, defaults["true"])
|
|
19
|
+
|
|
20
|
+
// a?.b()
|
|
21
|
+
def("OptionalCallExpression")
|
|
22
|
+
.bases("CallExpression")
|
|
23
|
+
.build("callee", "arguments", "optional")
|
|
24
|
+
.field("optional", Boolean, defaults["true"])
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// https://github.com/tc39/proposal-nullish-coalescing
|
|
28
|
+
// `a ?? b` as per https://github.com/babel/babylon/pull/761/files
|
|
29
|
+
var LogicalOperator = or("||", "&&", "??");
|
|
30
|
+
|
|
31
|
+
def("LogicalExpression")
|
|
32
|
+
.field("operator", LogicalOperator)
|
|
33
|
+
};
|
package/def/flow.js
CHANGED
|
@@ -6,31 +6,35 @@ module.exports = function (fork) {
|
|
|
6
6
|
var or = types.Type.or;
|
|
7
7
|
var defaults = fork.use(require("../lib/shared")).defaults;
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
9
|
+
// Base types
|
|
10
|
+
|
|
11
|
+
def("Flow").bases("Node");
|
|
12
|
+
def("FlowType").bases("Flow");
|
|
13
|
+
|
|
14
|
+
// Type annotations
|
|
11
15
|
|
|
12
16
|
def("AnyTypeAnnotation")
|
|
13
|
-
.bases("
|
|
17
|
+
.bases("FlowType")
|
|
14
18
|
.build();
|
|
15
19
|
|
|
16
20
|
def("EmptyTypeAnnotation")
|
|
17
|
-
.bases("
|
|
21
|
+
.bases("FlowType")
|
|
18
22
|
.build();
|
|
19
23
|
|
|
20
24
|
def("MixedTypeAnnotation")
|
|
21
|
-
.bases("
|
|
25
|
+
.bases("FlowType")
|
|
22
26
|
.build();
|
|
23
27
|
|
|
24
28
|
def("VoidTypeAnnotation")
|
|
25
|
-
.bases("
|
|
29
|
+
.bases("FlowType")
|
|
26
30
|
.build();
|
|
27
31
|
|
|
28
32
|
def("NumberTypeAnnotation")
|
|
29
|
-
.bases("
|
|
33
|
+
.bases("FlowType")
|
|
30
34
|
.build();
|
|
31
35
|
|
|
32
36
|
def("NumberLiteralTypeAnnotation")
|
|
33
|
-
.bases("
|
|
37
|
+
.bases("FlowType")
|
|
34
38
|
.build("value", "raw")
|
|
35
39
|
.field("value", Number)
|
|
36
40
|
.field("raw", String);
|
|
@@ -38,27 +42,27 @@ module.exports = function (fork) {
|
|
|
38
42
|
// Babylon 6 differs in AST from Flow
|
|
39
43
|
// same as NumberLiteralTypeAnnotation
|
|
40
44
|
def("NumericLiteralTypeAnnotation")
|
|
41
|
-
.bases("
|
|
45
|
+
.bases("FlowType")
|
|
42
46
|
.build("value", "raw")
|
|
43
47
|
.field("value", Number)
|
|
44
48
|
.field("raw", String);
|
|
45
49
|
|
|
46
50
|
def("StringTypeAnnotation")
|
|
47
|
-
.bases("
|
|
51
|
+
.bases("FlowType")
|
|
48
52
|
.build();
|
|
49
53
|
|
|
50
54
|
def("StringLiteralTypeAnnotation")
|
|
51
|
-
.bases("
|
|
55
|
+
.bases("FlowType")
|
|
52
56
|
.build("value", "raw")
|
|
53
57
|
.field("value", String)
|
|
54
58
|
.field("raw", String);
|
|
55
59
|
|
|
56
60
|
def("BooleanTypeAnnotation")
|
|
57
|
-
.bases("
|
|
61
|
+
.bases("FlowType")
|
|
58
62
|
.build();
|
|
59
63
|
|
|
60
64
|
def("BooleanLiteralTypeAnnotation")
|
|
61
|
-
.bases("
|
|
65
|
+
.bases("FlowType")
|
|
62
66
|
.build("value", "raw")
|
|
63
67
|
.field("value", Boolean)
|
|
64
68
|
.field("raw", String);
|
|
@@ -66,38 +70,38 @@ module.exports = function (fork) {
|
|
|
66
70
|
def("TypeAnnotation")
|
|
67
71
|
.bases("Node")
|
|
68
72
|
.build("typeAnnotation")
|
|
69
|
-
.field("typeAnnotation", def("
|
|
73
|
+
.field("typeAnnotation", def("FlowType"));
|
|
70
74
|
|
|
71
75
|
def("NullableTypeAnnotation")
|
|
72
|
-
.bases("
|
|
76
|
+
.bases("FlowType")
|
|
73
77
|
.build("typeAnnotation")
|
|
74
|
-
.field("typeAnnotation", def("
|
|
78
|
+
.field("typeAnnotation", def("FlowType"));
|
|
75
79
|
|
|
76
80
|
def("NullLiteralTypeAnnotation")
|
|
77
|
-
.bases("
|
|
81
|
+
.bases("FlowType")
|
|
78
82
|
.build();
|
|
79
83
|
|
|
80
84
|
def("NullTypeAnnotation")
|
|
81
|
-
.bases("
|
|
85
|
+
.bases("FlowType")
|
|
82
86
|
.build();
|
|
83
87
|
|
|
84
88
|
def("ThisTypeAnnotation")
|
|
85
|
-
.bases("
|
|
89
|
+
.bases("FlowType")
|
|
86
90
|
.build();
|
|
87
91
|
|
|
88
92
|
def("ExistsTypeAnnotation")
|
|
89
|
-
.bases("
|
|
93
|
+
.bases("FlowType")
|
|
90
94
|
.build();
|
|
91
95
|
|
|
92
96
|
def("ExistentialTypeParam")
|
|
93
|
-
.bases("
|
|
97
|
+
.bases("FlowType")
|
|
94
98
|
.build();
|
|
95
99
|
|
|
96
100
|
def("FunctionTypeAnnotation")
|
|
97
|
-
.bases("
|
|
101
|
+
.bases("FlowType")
|
|
98
102
|
.build("params", "returnType", "rest", "typeParameters")
|
|
99
103
|
.field("params", [def("FunctionTypeParam")])
|
|
100
|
-
.field("returnType", def("
|
|
104
|
+
.field("returnType", def("FlowType"))
|
|
101
105
|
.field("rest", or(def("FunctionTypeParam"), null))
|
|
102
106
|
.field("typeParameters", or(def("TypeParameterDeclaration"), null));
|
|
103
107
|
|
|
@@ -105,16 +109,16 @@ module.exports = function (fork) {
|
|
|
105
109
|
.bases("Node")
|
|
106
110
|
.build("name", "typeAnnotation", "optional")
|
|
107
111
|
.field("name", def("Identifier"))
|
|
108
|
-
.field("typeAnnotation", def("
|
|
112
|
+
.field("typeAnnotation", def("FlowType"))
|
|
109
113
|
.field("optional", Boolean);
|
|
110
114
|
|
|
111
115
|
def("ArrayTypeAnnotation")
|
|
112
|
-
.bases("
|
|
116
|
+
.bases("FlowType")
|
|
113
117
|
.build("elementType")
|
|
114
|
-
.field("elementType", def("
|
|
118
|
+
.field("elementType", def("FlowType"));
|
|
115
119
|
|
|
116
120
|
def("ObjectTypeAnnotation")
|
|
117
|
-
.bases("
|
|
121
|
+
.bases("FlowType")
|
|
118
122
|
.build("properties", "indexers", "callProperties")
|
|
119
123
|
.field("properties", [
|
|
120
124
|
or(def("ObjectTypeProperty"),
|
|
@@ -142,7 +146,7 @@ module.exports = function (fork) {
|
|
|
142
146
|
.bases("Node")
|
|
143
147
|
.build("key", "value", "optional")
|
|
144
148
|
.field("key", or(def("Literal"), def("Identifier")))
|
|
145
|
-
.field("value", def("
|
|
149
|
+
.field("value", def("FlowType"))
|
|
146
150
|
.field("optional", Boolean)
|
|
147
151
|
.field("variance", LegacyVariance, defaults["null"]);
|
|
148
152
|
|
|
@@ -150,8 +154,8 @@ module.exports = function (fork) {
|
|
|
150
154
|
.bases("Node")
|
|
151
155
|
.build("id", "key", "value")
|
|
152
156
|
.field("id", def("Identifier"))
|
|
153
|
-
.field("key", def("
|
|
154
|
-
.field("value", def("
|
|
157
|
+
.field("key", def("FlowType"))
|
|
158
|
+
.field("value", def("FlowType"))
|
|
155
159
|
.field("variance", LegacyVariance, defaults["null"]);
|
|
156
160
|
|
|
157
161
|
def("ObjectTypeCallProperty")
|
|
@@ -169,13 +173,13 @@ module.exports = function (fork) {
|
|
|
169
173
|
.field("id", def("Identifier"));
|
|
170
174
|
|
|
171
175
|
def("GenericTypeAnnotation")
|
|
172
|
-
.bases("
|
|
176
|
+
.bases("FlowType")
|
|
173
177
|
.build("id", "typeParameters")
|
|
174
178
|
.field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
|
|
175
179
|
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
|
|
176
180
|
|
|
177
181
|
def("MemberTypeAnnotation")
|
|
178
|
-
.bases("
|
|
182
|
+
.bases("FlowType")
|
|
179
183
|
.build("object", "property")
|
|
180
184
|
.field("object", def("Identifier"))
|
|
181
185
|
.field("property",
|
|
@@ -183,24 +187,24 @@ module.exports = function (fork) {
|
|
|
183
187
|
def("GenericTypeAnnotation")));
|
|
184
188
|
|
|
185
189
|
def("UnionTypeAnnotation")
|
|
186
|
-
.bases("
|
|
190
|
+
.bases("FlowType")
|
|
187
191
|
.build("types")
|
|
188
|
-
.field("types", [def("
|
|
192
|
+
.field("types", [def("FlowType")]);
|
|
189
193
|
|
|
190
194
|
def("IntersectionTypeAnnotation")
|
|
191
|
-
.bases("
|
|
195
|
+
.bases("FlowType")
|
|
192
196
|
.build("types")
|
|
193
|
-
.field("types", [def("
|
|
197
|
+
.field("types", [def("FlowType")]);
|
|
194
198
|
|
|
195
199
|
def("TypeofTypeAnnotation")
|
|
196
|
-
.bases("
|
|
200
|
+
.bases("FlowType")
|
|
197
201
|
.build("argument")
|
|
198
|
-
.field("argument", def("
|
|
202
|
+
.field("argument", def("FlowType"));
|
|
199
203
|
|
|
200
204
|
def("ObjectTypeSpreadProperty")
|
|
201
205
|
.bases("Node")
|
|
202
206
|
.build("argument")
|
|
203
|
-
.field("argument", def("
|
|
207
|
+
.field("argument", def("FlowType"));
|
|
204
208
|
|
|
205
209
|
def("Identifier")
|
|
206
210
|
.field("typeAnnotation", or(def("TypeAnnotation"), null), defaults["null"]);
|
|
@@ -216,10 +220,10 @@ module.exports = function (fork) {
|
|
|
216
220
|
def("TypeParameterInstantiation")
|
|
217
221
|
.bases("Node")
|
|
218
222
|
.build("params")
|
|
219
|
-
.field("params", [def("
|
|
223
|
+
.field("params", [def("FlowType")]);
|
|
220
224
|
|
|
221
225
|
def("TypeParameter")
|
|
222
|
-
.bases("
|
|
226
|
+
.bases("FlowType")
|
|
223
227
|
.build("name", "variance", "bound")
|
|
224
228
|
.field("name", String)
|
|
225
229
|
.field("variance", LegacyVariance, defaults["null"])
|
|
@@ -295,15 +299,15 @@ module.exports = function (fork) {
|
|
|
295
299
|
.build("id", "typeParameters", "right")
|
|
296
300
|
.field("id", def("Identifier"))
|
|
297
301
|
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
298
|
-
.field("right", def("
|
|
302
|
+
.field("right", def("FlowType"));
|
|
299
303
|
|
|
300
304
|
def("OpaqueType")
|
|
301
305
|
.bases("Declaration")
|
|
302
306
|
.build("id", "typeParameters", "impltype", "supertype")
|
|
303
307
|
.field("id", def("Identifier"))
|
|
304
308
|
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
305
|
-
.field("implType", def("
|
|
306
|
-
.field("superType", def("
|
|
309
|
+
.field("implType", def("FlowType"))
|
|
310
|
+
.field("superType", def("FlowType"));
|
|
307
311
|
|
|
308
312
|
def("DeclareTypeAlias")
|
|
309
313
|
.bases("TypeAlias")
|
|
@@ -320,9 +324,9 @@ module.exports = function (fork) {
|
|
|
320
324
|
.field("typeAnnotation", def("TypeAnnotation"));
|
|
321
325
|
|
|
322
326
|
def("TupleTypeAnnotation")
|
|
323
|
-
.bases("
|
|
327
|
+
.bases("FlowType")
|
|
324
328
|
.build("types")
|
|
325
|
-
.field("types", [def("
|
|
329
|
+
.field("types", [def("FlowType")]);
|
|
326
330
|
|
|
327
331
|
def("DeclareVariable")
|
|
328
332
|
.bases("Statement")
|
|
@@ -347,7 +351,7 @@ module.exports = function (fork) {
|
|
|
347
351
|
def("DeclareModuleExports")
|
|
348
352
|
.bases("Statement")
|
|
349
353
|
.build("typeAnnotation")
|
|
350
|
-
.field("typeAnnotation", def("
|
|
354
|
+
.field("typeAnnotation", def("TypeAnnotation"));
|
|
351
355
|
|
|
352
356
|
def("DeclareExportDeclaration")
|
|
353
357
|
.bases("Declaration")
|
|
@@ -357,7 +361,7 @@ module.exports = function (fork) {
|
|
|
357
361
|
def("DeclareVariable"),
|
|
358
362
|
def("DeclareFunction"),
|
|
359
363
|
def("DeclareClass"),
|
|
360
|
-
def("
|
|
364
|
+
def("FlowType"), // Implies default.
|
|
361
365
|
null
|
|
362
366
|
))
|
|
363
367
|
.field("specifiers", [or(
|
|
@@ -376,4 +380,15 @@ module.exports = function (fork) {
|
|
|
376
380
|
def("Literal"),
|
|
377
381
|
null
|
|
378
382
|
), defaults["null"]);
|
|
383
|
+
|
|
384
|
+
def("FlowPredicate").bases("Flow");
|
|
385
|
+
|
|
386
|
+
def("InferredPredicate")
|
|
387
|
+
.bases("FlowPredicate")
|
|
388
|
+
.build();
|
|
389
|
+
|
|
390
|
+
def("DeclaredPredicate")
|
|
391
|
+
.bases("FlowPredicate")
|
|
392
|
+
.build("value")
|
|
393
|
+
.field("value", def("Expression"));
|
|
379
394
|
};
|
package/def/typescript.js
CHANGED
|
@@ -31,6 +31,7 @@ module.exports = function (fork) {
|
|
|
31
31
|
|
|
32
32
|
def("TSTypeReference")
|
|
33
33
|
.bases("TSType")
|
|
34
|
+
.build("typeName", "typeParameters")
|
|
34
35
|
.field("typeName", IdOrQualifiedName)
|
|
35
36
|
.field("typeParameters",
|
|
36
37
|
or(def("TSTypeParameterInstantiation"), null),
|
|
@@ -110,6 +111,19 @@ module.exports = function (fork) {
|
|
|
110
111
|
.field("types", [def("TSType")]);
|
|
111
112
|
});
|
|
112
113
|
|
|
114
|
+
def("TSConditionalType")
|
|
115
|
+
.bases("TSType")
|
|
116
|
+
.build("checkType", "extendsType", "trueType", "falseType")
|
|
117
|
+
.field("checkType", def("TSType"))
|
|
118
|
+
.field("extendsType", def("TSType"))
|
|
119
|
+
.field("trueType", def("TSType"))
|
|
120
|
+
.field("falseType", def("TSType"));
|
|
121
|
+
|
|
122
|
+
def("TSInferType")
|
|
123
|
+
.bases("TSType")
|
|
124
|
+
.build("typeParameter")
|
|
125
|
+
.field("typeParameter", def("TSTypeParameter"));
|
|
126
|
+
|
|
113
127
|
def("TSParenthesizedType")
|
|
114
128
|
.bases("TSType")
|
|
115
129
|
.build("typeAnnotation")
|
package/lib/types.js
CHANGED
|
@@ -533,77 +533,115 @@ module.exports = function () {
|
|
|
533
533
|
// Override Dp.buildable for this Def instance.
|
|
534
534
|
Object.defineProperty(self, "buildable", {value: true});
|
|
535
535
|
|
|
536
|
-
|
|
537
|
-
|
|
536
|
+
function addParam(built, param, arg, isArgAvailable) {
|
|
537
|
+
if (hasOwn.call(built, param))
|
|
538
|
+
return;
|
|
538
539
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
var all = self.allFields;
|
|
541
|
+
if (!hasOwn.call(all, param)) {
|
|
542
|
+
throw new Error("" + param);
|
|
543
|
+
}
|
|
543
544
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
545
|
+
var field = all[param];
|
|
546
|
+
var type = field.type;
|
|
547
|
+
var value;
|
|
548
|
+
|
|
549
|
+
if (isArgAvailable) {
|
|
550
|
+
value = arg;
|
|
551
|
+
} else if (field.defaultFn) {
|
|
552
|
+
// Expose the partially-built object to the default
|
|
553
|
+
// function as its `this` object.
|
|
554
|
+
value = field.defaultFn.call(built);
|
|
555
|
+
} else {
|
|
556
|
+
var message = "no value or default function given for field " +
|
|
557
|
+
JSON.stringify(param) + " of " + self.typeName + "(" +
|
|
558
|
+
self.buildParams.map(function (name) {
|
|
559
|
+
return all[name];
|
|
560
|
+
}).join(", ") + ")";
|
|
561
|
+
throw new Error(message);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (!type.check(value)) {
|
|
565
|
+
throw new Error(
|
|
566
|
+
shallowStringify(value) +
|
|
567
|
+
" does not match field " + field +
|
|
568
|
+
" of type " + self.typeName
|
|
569
|
+
);
|
|
570
|
+
}
|
|
550
571
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
throw new Error(message);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (!type.check(value)) {
|
|
580
|
-
throw new Error(
|
|
581
|
-
shallowStringify(value) +
|
|
582
|
-
" does not match field " + field +
|
|
583
|
-
" of type " + self.typeName
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
// TODO Could attach getters and setters here to enforce
|
|
588
|
-
// dynamic type safety.
|
|
589
|
-
built[param] = value;
|
|
572
|
+
built[param] = value;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// Calling the builder function will construct an instance of the Def,
|
|
576
|
+
// with positional arguments mapped to the fields original passed to .build.
|
|
577
|
+
// If not enough arguments are provided, the default value for the remaining fields
|
|
578
|
+
// will be used.
|
|
579
|
+
function builder() {
|
|
580
|
+
var args = arguments;
|
|
581
|
+
var argc = args.length;
|
|
582
|
+
|
|
583
|
+
if (!self.finalized) {
|
|
584
|
+
throw new Error(
|
|
585
|
+
"attempting to instantiate unfinalized type " +
|
|
586
|
+
self.typeName
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
var built = Object.create(nodePrototype);
|
|
591
|
+
|
|
592
|
+
self.buildParams.forEach(function (param, i) {
|
|
593
|
+
if (i < argc) {
|
|
594
|
+
addParam(built, param, args[i], true)
|
|
595
|
+
} else {
|
|
596
|
+
addParam(built, param, null, false);
|
|
590
597
|
}
|
|
598
|
+
});
|
|
591
599
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
600
|
+
Object.keys(self.allFields).forEach(function (param) {
|
|
601
|
+
// Use the default value.
|
|
602
|
+
addParam(built, param, null, false);
|
|
603
|
+
});
|
|
595
604
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
605
|
+
// Make sure that the "type" field was filled automatically.
|
|
606
|
+
if (built.type !== self.typeName) {
|
|
607
|
+
throw new Error("");
|
|
608
|
+
}
|
|
599
609
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
610
|
+
return built;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// Calling .from on the builder function will construct an instance of the Def,
|
|
614
|
+
// using field values from the passed object. For fields missing from the passed object,
|
|
615
|
+
// their default value will be used.
|
|
616
|
+
builder.from = function (obj) {
|
|
617
|
+
if (!self.finalized) {
|
|
618
|
+
throw new Error(
|
|
619
|
+
"attempting to instantiate unfinalized type " +
|
|
620
|
+
self.typeName
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
var built = Object.create(nodePrototype);
|
|
625
|
+
|
|
626
|
+
Object.keys(self.allFields).forEach(function (param) {
|
|
627
|
+
if (hasOwn.call(obj, param)) {
|
|
628
|
+
addParam(built, param, obj[param], true);
|
|
629
|
+
} else {
|
|
630
|
+
addParam(built, param, null, false);
|
|
603
631
|
}
|
|
632
|
+
});
|
|
604
633
|
|
|
605
|
-
|
|
634
|
+
// Make sure that the "type" field was filled automatically.
|
|
635
|
+
if (built.type !== self.typeName) {
|
|
636
|
+
throw new Error("");
|
|
606
637
|
}
|
|
638
|
+
|
|
639
|
+
return built;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
Object.defineProperty(builders, getBuilderName(self.typeName), {
|
|
643
|
+
enumerable: true,
|
|
644
|
+
value: builder
|
|
607
645
|
});
|
|
608
646
|
|
|
609
647
|
return self; // For chaining.
|
package/main.js
CHANGED
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"transformation",
|
|
19
19
|
"syntax"
|
|
20
20
|
],
|
|
21
|
-
"version": "0.11.
|
|
21
|
+
"version": "0.11.5",
|
|
22
22
|
"homepage": "http://github.com/benjamn/ast-types",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"espree": "^3.1.7",
|
|
37
37
|
"esprima": "~4.0.0",
|
|
38
38
|
"esprima-fb": "~14001.1.0-dev-harmony-fb",
|
|
39
|
-
"flow-parser": "^0.
|
|
39
|
+
"flow-parser": "^0.73.0",
|
|
40
40
|
"glob": "^7.1.2",
|
|
41
41
|
"mocha": "^5.0.0",
|
|
42
|
-
"reify": "^0.
|
|
42
|
+
"reify": "^0.16.1"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
45
|
+
"node": ">=4"
|
|
46
46
|
}
|
|
47
47
|
}
|