ast-types 0.14.1 → 0.15.2

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.
Files changed (52) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/README.md +1 -1
  3. package/def/babel-core.js +48 -28
  4. package/def/babel.js +15 -2
  5. package/def/core.js +8 -26
  6. package/def/es-proposals.js +32 -4
  7. package/def/es2016.js +6 -12
  8. package/def/es2017.js +3 -3
  9. package/def/es2018.js +3 -3
  10. package/def/es2019.js +3 -3
  11. package/def/es2020.js +23 -12
  12. package/def/{es7.d.ts → es2021.d.ts} +0 -0
  13. package/def/es2021.js +13 -0
  14. package/def/es2022.d.ts +2 -0
  15. package/def/es2022.js +16 -0
  16. package/def/es6.js +3 -3
  17. package/def/esprima.js +4 -4
  18. package/def/flow.js +15 -4
  19. package/def/jsx.js +4 -4
  20. package/def/operators/core.d.ts +5 -0
  21. package/def/operators/core.js +25 -0
  22. package/def/operators/es2016.d.ts +5 -0
  23. package/def/operators/es2016.js +19 -0
  24. package/def/operators/es2020.d.ts +5 -0
  25. package/def/operators/es2020.js +15 -0
  26. package/def/operators/es2021.d.ts +5 -0
  27. package/def/operators/es2021.js +18 -0
  28. package/def/type-annotations.js +2 -2
  29. package/def/typescript.js +11 -4
  30. package/fork.d.ts +3 -2
  31. package/fork.js +7 -7
  32. package/gen/builders.d.ts +200 -100
  33. package/gen/kinds.d.ts +28 -15
  34. package/gen/namedTypes.d.ts +143 -49
  35. package/gen/visitor.d.ts +18 -5
  36. package/lib/equiv.js +1 -1
  37. package/lib/node-path.js +3 -3
  38. package/lib/path-visitor.js +2 -2
  39. package/lib/path.d.ts +3 -3
  40. package/lib/path.js +1 -1
  41. package/lib/scope.d.ts +3 -2
  42. package/lib/scope.js +63 -26
  43. package/lib/shared.js +1 -1
  44. package/lib/types.d.ts +1 -0
  45. package/lib/types.js +10 -6
  46. package/main.d.ts +1 -0
  47. package/main.js +9 -25
  48. package/package.json +15 -15
  49. package/types.d.ts +0 -1
  50. package/def/core-operators.d.ts +0 -3
  51. package/def/core-operators.js +0 -20
  52. package/def/es7.js +0 -34
package/lib/scope.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";;
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var types_1 = tslib_1.__importDefault(require("./types"));
4
+ var types_1 = (0, tslib_1.__importDefault)(require("./types"));
5
5
  var hasOwn = Object.prototype.hasOwnProperty;
6
6
  function scopePlugin(fork) {
7
7
  var types = fork.use(types_1.default);
@@ -15,7 +15,9 @@ function scopePlugin(fork) {
15
15
  if (!(this instanceof Scope)) {
16
16
  throw new Error("Scope constructor cannot be invoked without 'new'");
17
17
  }
18
- ScopeType.assert(path.value);
18
+ if (!TypeParameterScopeType.check(path.value)) {
19
+ ScopeType.assert(path.value);
20
+ }
19
21
  var depth;
20
22
  if (parentScope) {
21
23
  if (!(parentScope instanceof Scope)) {
@@ -37,19 +39,21 @@ function scopePlugin(fork) {
37
39
  types: { value: {} },
38
40
  });
39
41
  };
40
- var scopeTypes = [
41
- // Program nodes introduce global scopes.
42
- namedTypes.Program,
43
- // Function is the supertype of FunctionExpression,
44
- // FunctionDeclaration, ArrowExpression, etc.
45
- namedTypes.Function,
46
- // In case you didn't know, the caught parameter shadows any variable
47
- // of the same name in an outer scope.
48
- namedTypes.CatchClause
49
- ];
50
- var ScopeType = Type.or.apply(Type, scopeTypes);
42
+ var ScopeType = Type.or(
43
+ // Program nodes introduce global scopes.
44
+ namedTypes.Program,
45
+ // Function is the supertype of FunctionExpression,
46
+ // FunctionDeclaration, ArrowExpression, etc.
47
+ namedTypes.Function,
48
+ // In case you didn't know, the caught parameter shadows any variable
49
+ // of the same name in an outer scope.
50
+ namedTypes.CatchClause);
51
+ // These types introduce scopes that are restricted to type parameters in
52
+ // Flow (this doesn't apply to ECMAScript).
53
+ var TypeParameterScopeType = Type.or(namedTypes.Function, namedTypes.ClassDeclaration, namedTypes.ClassExpression, namedTypes.InterfaceDeclaration, namedTypes.TSInterfaceDeclaration, namedTypes.TypeAlias, namedTypes.TSTypeAliasDeclaration);
54
+ var FlowOrTSTypeParameterType = Type.or(namedTypes.TypeParameter, namedTypes.TSTypeParameter);
51
55
  Scope.isEstablishedBy = function (node) {
52
- return ScopeType.check(node);
56
+ return ScopeType.check(node) || TypeParameterScopeType.check(node);
53
57
  };
54
58
  var Sp = Scope.prototype;
55
59
  // Will be overridden after an instance lazily calls scanScope.
@@ -97,6 +101,10 @@ function scopePlugin(fork) {
97
101
  // Empty out this.bindings, just in cases.
98
102
  delete this.bindings[name];
99
103
  }
104
+ for (var name in this.types) {
105
+ // Empty out this.types, just in cases.
106
+ delete this.types[name];
107
+ }
100
108
  scanScope(this.path, this.bindings, this.types);
101
109
  this.didScan = true;
102
110
  }
@@ -111,18 +119,24 @@ function scopePlugin(fork) {
111
119
  };
112
120
  function scanScope(path, bindings, scopeTypes) {
113
121
  var node = path.value;
114
- ScopeType.assert(node);
115
- if (namedTypes.CatchClause.check(node)) {
116
- // A catch clause establishes a new scope but the only variable
117
- // bound in that scope is the catch parameter. Any other
118
- // declarations create bindings in the outer scope.
119
- var param = path.get("param");
120
- if (param.value) {
121
- addPattern(param, bindings);
122
+ if (TypeParameterScopeType.check(node)) {
123
+ var params = path.get('typeParameters', 'params');
124
+ if (isArray.check(params.value)) {
125
+ params.each(function (childPath) {
126
+ addTypeParameter(childPath, scopeTypes);
127
+ });
122
128
  }
123
129
  }
124
- else {
125
- recursiveScanScope(path, bindings, scopeTypes);
130
+ if (ScopeType.check(node)) {
131
+ if (namedTypes.CatchClause.check(node)) {
132
+ // A catch clause establishes a new scope but the only variable
133
+ // bound in that scope is the catch parameter. Any other
134
+ // declarations create bindings in the outer scope.
135
+ addPattern(path.get("param"), bindings);
136
+ }
137
+ else {
138
+ recursiveScanScope(path, bindings, scopeTypes);
139
+ }
126
140
  }
127
141
  }
128
142
  function recursiveScanScope(path, bindings, scopeTypes) {
@@ -145,6 +159,7 @@ function scopePlugin(fork) {
145
159
  addPattern(paramPath, bindings);
146
160
  });
147
161
  recursiveScanChild(path.get("body"), bindings, scopeTypes);
162
+ recursiveScanScope(path.get("typeParameters"), bindings, scopeTypes);
148
163
  }
149
164
  else if ((namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) ||
150
165
  (namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node)) ||
@@ -201,8 +216,16 @@ function scopePlugin(fork) {
201
216
  addPattern(path.get("id"), bindings);
202
217
  }
203
218
  else if (namedTypes.ClassDeclaration &&
204
- namedTypes.ClassDeclaration.check(node)) {
219
+ namedTypes.ClassDeclaration.check(node) &&
220
+ node.id !== null) {
205
221
  addPattern(path.get("id"), bindings);
222
+ recursiveScanScope(path.get("typeParameters"), bindings, scopeTypes);
223
+ }
224
+ else if ((namedTypes.InterfaceDeclaration &&
225
+ namedTypes.InterfaceDeclaration.check(node)) ||
226
+ (namedTypes.TSInterfaceDeclaration &&
227
+ namedTypes.TSInterfaceDeclaration.check(node))) {
228
+ addTypePattern(path.get("id"), scopeTypes);
206
229
  }
207
230
  else if (ScopeType.check(node)) {
208
231
  if (namedTypes.CatchClause.check(node) &&
@@ -249,7 +272,9 @@ function scopePlugin(fork) {
249
272
  if (namedTypes.Pattern.check(property)) {
250
273
  addPattern(propertyPath, bindings);
251
274
  }
252
- else if (namedTypes.Property.check(property)) {
275
+ else if (namedTypes.Property.check(property) ||
276
+ (namedTypes.ObjectProperty &&
277
+ namedTypes.ObjectProperty.check(property))) {
253
278
  addPattern(propertyPath.get('value'), bindings);
254
279
  }
255
280
  else if (namedTypes.SpreadProperty &&
@@ -277,6 +302,8 @@ function scopePlugin(fork) {
277
302
  }
278
303
  else if ((namedTypes.SpreadElementPattern &&
279
304
  namedTypes.SpreadElementPattern.check(pattern)) ||
305
+ (namedTypes.RestElement &&
306
+ namedTypes.RestElement.check(pattern)) ||
280
307
  (namedTypes.SpreadPropertyPattern &&
281
308
  namedTypes.SpreadPropertyPattern.check(pattern))) {
282
309
  addPattern(patternPath.get('argument'), bindings);
@@ -294,6 +321,16 @@ function scopePlugin(fork) {
294
321
  }
295
322
  }
296
323
  }
324
+ function addTypeParameter(parameterPath, types) {
325
+ var parameter = parameterPath.value;
326
+ FlowOrTSTypeParameterType.assert(parameter);
327
+ if (hasOwn.call(types, parameter.name)) {
328
+ types[parameter.name].push(parameterPath);
329
+ }
330
+ else {
331
+ types[parameter.name] = [parameterPath];
332
+ }
333
+ }
297
334
  Sp.lookup = function (name) {
298
335
  for (var scope = this; scope; scope = scope.parent)
299
336
  if (scope.declares(name))
package/lib/shared.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";;
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var types_1 = tslib_1.__importDefault(require("./types"));
4
+ var types_1 = (0, tslib_1.__importDefault)(require("./types"));
5
5
  function default_1(fork) {
6
6
  var types = fork.use(types_1.default);
7
7
  var Type = types.Type;
package/lib/types.d.ts CHANGED
@@ -118,6 +118,7 @@ export default function typesPlugin(_fork: Fork): {
118
118
  boolean: Type<boolean>;
119
119
  null: Type<null>;
120
120
  undefined: Type<undefined>;
121
+ BigInt: Type<BigInt>;
121
122
  };
122
123
  getSupertypeNames: (typeName: string) => string[];
123
124
  computeSupertypeLookupTable: (candidates: any) => {
package/lib/types.js CHANGED
@@ -22,7 +22,7 @@ var BaseType = /** @class */ (function () {
22
22
  return BaseType;
23
23
  }());
24
24
  var ArrayType = /** @class */ (function (_super) {
25
- tslib_1.__extends(ArrayType, _super);
25
+ (0, tslib_1.__extends)(ArrayType, _super);
26
26
  function ArrayType(elemType) {
27
27
  var _this = _super.call(this) || this;
28
28
  _this.elemType = elemType;
@@ -39,7 +39,7 @@ var ArrayType = /** @class */ (function (_super) {
39
39
  return ArrayType;
40
40
  }(BaseType));
41
41
  var IdentityType = /** @class */ (function (_super) {
42
- tslib_1.__extends(IdentityType, _super);
42
+ (0, tslib_1.__extends)(IdentityType, _super);
43
43
  function IdentityType(value) {
44
44
  var _this = _super.call(this) || this;
45
45
  _this.value = value;
@@ -59,7 +59,7 @@ var IdentityType = /** @class */ (function (_super) {
59
59
  return IdentityType;
60
60
  }(BaseType));
61
61
  var ObjectType = /** @class */ (function (_super) {
62
- tslib_1.__extends(ObjectType, _super);
62
+ (0, tslib_1.__extends)(ObjectType, _super);
63
63
  function ObjectType(fields) {
64
64
  var _this = _super.call(this) || this;
65
65
  _this.fields = fields;
@@ -78,7 +78,7 @@ var ObjectType = /** @class */ (function (_super) {
78
78
  return ObjectType;
79
79
  }(BaseType));
80
80
  var OrType = /** @class */ (function (_super) {
81
- tslib_1.__extends(OrType, _super);
81
+ (0, tslib_1.__extends)(OrType, _super);
82
82
  function OrType(types) {
83
83
  var _this = _super.call(this) || this;
84
84
  _this.types = types;
@@ -96,7 +96,7 @@ var OrType = /** @class */ (function (_super) {
96
96
  return OrType;
97
97
  }(BaseType));
98
98
  var PredicateType = /** @class */ (function (_super) {
99
- tslib_1.__extends(PredicateType, _super);
99
+ (0, tslib_1.__extends)(PredicateType, _super);
100
100
  function PredicateType(name, predicate) {
101
101
  var _this = _super.call(this) || this;
102
102
  _this.name = name;
@@ -316,6 +316,9 @@ function typesPlugin(_fork) {
316
316
  var isBoolean = defBuiltInType("boolean", true);
317
317
  var isNull = defBuiltInType("null", null);
318
318
  var isUndefined = defBuiltInType("undefined", undefined);
319
+ var isBigInt = typeof BigInt === "function"
320
+ ? defBuiltInType("BigInt", BigInt(1234))
321
+ : new PredicateType("BigInt", function () { return false; });
319
322
  var builtInTypes = {
320
323
  string: isString,
321
324
  function: isFunction,
@@ -327,6 +330,7 @@ function typesPlugin(_fork) {
327
330
  boolean: isBoolean,
328
331
  null: isNull,
329
332
  undefined: isUndefined,
333
+ BigInt: isBigInt,
330
334
  };
331
335
  // In order to return the same Def instance every time Type.def is called
332
336
  // with a particular name, those instances need to be stored in a cache.
@@ -345,7 +349,7 @@ function typesPlugin(_fork) {
345
349
  return null;
346
350
  }
347
351
  var DefImpl = /** @class */ (function (_super) {
348
- tslib_1.__extends(DefImpl, _super);
352
+ (0, tslib_1.__extends)(DefImpl, _super);
349
353
  function DefImpl(typeName) {
350
354
  var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this;
351
355
  return _this;
package/main.d.ts CHANGED
@@ -19,6 +19,7 @@ declare const astNodesAreEquivalent: {
19
19
  boolean: Type<boolean>;
20
20
  null: Type<null>;
21
21
  undefined: Type<undefined>;
22
+ BigInt: Type<BigInt>;
22
23
  }, defineMethod: (name: any, func?: Function | undefined) => Function, eachField: (object: any, callback: (name: any, value: any) => any, context?: any) => void, finalize: () => void, getBuilderName: (typeName: any) => any, getFieldNames: (object: any) => string[], getFieldValue: (object: any, fieldName: any) => any, getSupertypeNames: (typeName: string) => string[], NodePath: import("./lib/node-path").NodePathConstructor, Path: import("./lib/path").PathConstructor, PathVisitor: import("./lib/path-visitor").PathVisitorConstructor, someField: (object: any, callback: (name: any, value: any) => any, context?: any) => boolean, Type: {
23
24
  or(...types: any[]): Type<any>;
24
25
  from<T>(value: any, name?: string | undefined): Type<T>;
package/main.js CHANGED
@@ -2,40 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.visit = exports.use = exports.Type = exports.someField = exports.PathVisitor = exports.Path = exports.NodePath = exports.namedTypes = exports.getSupertypeNames = exports.getFieldValue = exports.getFieldNames = exports.getBuilderName = exports.finalize = exports.eachField = exports.defineMethod = exports.builtInTypes = exports.builders = exports.astNodesAreEquivalent = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var fork_1 = tslib_1.__importDefault(require("./fork"));
6
- var core_1 = tslib_1.__importDefault(require("./def/core"));
7
- var es6_1 = tslib_1.__importDefault(require("./def/es6"));
8
- var es2016_1 = tslib_1.__importDefault(require("./def/es2016"));
9
- var es2017_1 = tslib_1.__importDefault(require("./def/es2017"));
10
- var es2018_1 = tslib_1.__importDefault(require("./def/es2018"));
11
- var es2019_1 = tslib_1.__importDefault(require("./def/es2019"));
12
- var es2020_1 = tslib_1.__importDefault(require("./def/es2020"));
13
- var jsx_1 = tslib_1.__importDefault(require("./def/jsx"));
14
- var flow_1 = tslib_1.__importDefault(require("./def/flow"));
15
- var esprima_1 = tslib_1.__importDefault(require("./def/esprima"));
16
- var babel_1 = tslib_1.__importDefault(require("./def/babel"));
17
- var typescript_1 = tslib_1.__importDefault(require("./def/typescript"));
18
- var es_proposals_1 = tslib_1.__importDefault(require("./def/es-proposals"));
5
+ var fork_1 = (0, tslib_1.__importDefault)(require("./fork"));
6
+ var es_proposals_1 = (0, tslib_1.__importDefault)(require("./def/es-proposals"));
7
+ var jsx_1 = (0, tslib_1.__importDefault)(require("./def/jsx"));
8
+ var flow_1 = (0, tslib_1.__importDefault)(require("./def/flow"));
9
+ var esprima_1 = (0, tslib_1.__importDefault)(require("./def/esprima"));
10
+ var babel_1 = (0, tslib_1.__importDefault)(require("./def/babel"));
11
+ var typescript_1 = (0, tslib_1.__importDefault)(require("./def/typescript"));
19
12
  var namedTypes_1 = require("./gen/namedTypes");
20
13
  Object.defineProperty(exports, "namedTypes", { enumerable: true, get: function () { return namedTypes_1.namedTypes; } });
21
- var _a = fork_1.default([
22
- // This core module of AST types captures ES5 as it is parsed today by
23
- // git://github.com/ariya/esprima.git#master.
24
- core_1.default,
14
+ var _a = (0, fork_1.default)([
25
15
  // Feel free to add to or remove from this list of extension modules to
26
16
  // configure the precise type hierarchy that you need.
27
- es6_1.default,
28
- es2016_1.default,
29
- es2017_1.default,
30
- es2018_1.default,
31
- es2019_1.default,
32
- es2020_1.default,
17
+ es_proposals_1.default,
33
18
  jsx_1.default,
34
19
  flow_1.default,
35
20
  esprima_1.default,
36
21
  babel_1.default,
37
22
  typescript_1.default,
38
- es_proposals_1.default,
39
23
  ]), astNodesAreEquivalent = _a.astNodesAreEquivalent, builders = _a.builders, builtInTypes = _a.builtInTypes, defineMethod = _a.defineMethod, eachField = _a.eachField, finalize = _a.finalize, getBuilderName = _a.getBuilderName, getFieldNames = _a.getFieldNames, getFieldValue = _a.getFieldValue, getSupertypeNames = _a.getSupertypeNames, n = _a.namedTypes, NodePath = _a.NodePath, Path = _a.Path, PathVisitor = _a.PathVisitor, someField = _a.someField, Type = _a.Type, use = _a.use, visit = _a.visit;
40
24
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
41
25
  exports.builders = builders;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Ben Newman <bn@cs.stanford.edu>",
3
3
  "name": "ast-types",
4
- "version": "0.14.1",
4
+ "version": "0.15.2",
5
5
  "description": "Esprima-compatible implementation of the Mozilla JS Parser API",
6
6
  "keywords": [
7
7
  "ast",
@@ -33,31 +33,31 @@
33
33
  "test": "npm run gen && npm run build && npm run mocha",
34
34
  "clean": "ts-emit-clean",
35
35
  "build": "tsc && ts-add-module-exports",
36
- "prepack": "npm run clean && npm run gen && npm run build",
36
+ "prepare": "npm run clean && npm run gen && npm run build",
37
37
  "postpack": "npm run clean"
38
38
  },
39
39
  "dependencies": {
40
40
  "tslib": "^2.0.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/parser": "7.11.4",
44
- "@babel/types": "7.4.4",
45
- "@types/esprima": "4.0.2",
46
- "@types/glob": "7.1.3",
47
- "@types/mocha": "8.0.3",
48
- "@types/node": "12.0.0",
49
- "espree": "7.3.0",
43
+ "@babel/parser": "7.16.4",
44
+ "@babel/types": "7.16.0",
45
+ "@types/esprima": "4.0.3",
46
+ "@types/glob": "7.2.0",
47
+ "@types/mocha": "9.0.0",
48
+ "@types/node": "16.11.10",
49
+ "espree": "9.1.0",
50
50
  "esprima": "4.0.1",
51
51
  "esprima-fb": "15001.1001.0-dev-harmony-fb",
52
- "flow-parser": "0.132.0",
53
- "glob": "7.1.6",
54
- "mocha": "^8.1.1",
55
- "recast": "0.20.1",
52
+ "flow-parser": "0.166.0",
53
+ "glob": "7.2.0",
54
+ "mocha": "^9.1.3",
55
+ "recast": "0.20.5",
56
56
  "reify": "0.20.12",
57
57
  "ts-add-module-exports": "1.0.0",
58
58
  "ts-emit-clean": "1.0.0",
59
- "ts-node": "7.0.1",
60
- "typescript": "3.9.7"
59
+ "ts-node": "10.4.0",
60
+ "typescript": "4.5.2"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=4"
package/types.d.ts CHANGED
@@ -2,5 +2,4 @@ export declare type Fork = {
2
2
  use<T>(plugin: Plugin<T>): T;
3
3
  };
4
4
  export declare type Plugin<T> = (fork: Fork) => T;
5
- export declare type Def = Plugin<void>;
6
5
  export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
@@ -1,3 +0,0 @@
1
- export declare const BinaryOperators: string[];
2
- export declare const AssignmentOperators: string[];
3
- export declare const LogicalOperators: string[];
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogicalOperators = exports.AssignmentOperators = exports.BinaryOperators = void 0;
4
- exports.BinaryOperators = [
5
- "==", "!=", "===", "!==",
6
- "<", "<=", ">", ">=",
7
- "<<", ">>", ">>>",
8
- "+", "-", "*", "/", "%",
9
- "&",
10
- "|", "^", "in",
11
- "instanceof",
12
- ];
13
- exports.AssignmentOperators = [
14
- "=", "+=", "-=", "*=", "/=", "%=",
15
- "<<=", ">>=", ">>>=",
16
- "|=", "^=", "&=",
17
- ];
18
- exports.LogicalOperators = [
19
- "||", "&&",
20
- ];
package/def/es7.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";;
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
4
- var es6_1 = tslib_1.__importDefault(require("./es6"));
5
- var types_1 = tslib_1.__importDefault(require("../lib/types"));
6
- var shared_1 = tslib_1.__importDefault(require("../lib/shared"));
7
- function default_1(fork) {
8
- fork.use(es6_1.default);
9
- var types = fork.use(types_1.default);
10
- var def = types.Type.def;
11
- var or = types.Type.or;
12
- var defaults = fork.use(shared_1.default).defaults;
13
- def("Function")
14
- .field("async", Boolean, defaults["false"]);
15
- def("SpreadProperty")
16
- .bases("Node")
17
- .build("argument")
18
- .field("argument", def("Expression"));
19
- def("ObjectExpression")
20
- .field("properties", [or(def("Property"), def("SpreadProperty"), def("SpreadElement"))]);
21
- def("SpreadPropertyPattern")
22
- .bases("Pattern")
23
- .build("argument")
24
- .field("argument", def("Pattern"));
25
- def("ObjectPattern")
26
- .field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"))]);
27
- def("AwaitExpression")
28
- .bases("Expression")
29
- .build("argument", "all")
30
- .field("argument", or(def("Expression"), null))
31
- .field("all", Boolean, defaults["false"]);
32
- }
33
- exports.default = default_1;
34
- module.exports = exports["default"];