Internal slot properties (#7947)
* Support internalSlots to babel-types and babel-generator * Parsing support for internal slot properties * Print internal slots in babel-generator * Add whitespace before first internal slot property
This commit is contained in:
@@ -248,15 +248,22 @@ defineType("NumberTypeAnnotation", {
|
||||
});
|
||||
|
||||
defineType("ObjectTypeAnnotation", {
|
||||
visitor: ["properties", "indexers", "callProperties"],
|
||||
visitor: ["properties", "indexers", "callProperties", "internalSlots"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
builder: ["properties", "indexers", "callProperties", "exact"],
|
||||
builder: [
|
||||
"properties",
|
||||
"indexers",
|
||||
"callProperties",
|
||||
"internalSlots",
|
||||
"exact",
|
||||
],
|
||||
fields: {
|
||||
properties: validate(
|
||||
arrayOfType(["ObjectTypeProperty", "ObjectTypeSpreadProperty"]),
|
||||
),
|
||||
indexers: validateOptional(arrayOfType("ObjectTypeIndexer")),
|
||||
callProperties: validateOptional(arrayOfType("ObjectTypeCallProperty")),
|
||||
internalSlots: validateOptional(arrayOfType("ObjectTypeInternalSlot")),
|
||||
exact: {
|
||||
validate: assertValueType("boolean"),
|
||||
default: false,
|
||||
@@ -264,6 +271,17 @@ defineType("ObjectTypeAnnotation", {
|
||||
},
|
||||
});
|
||||
|
||||
defineType("ObjectTypeInternalSlot", {
|
||||
visitor: ["id", "value", "static", "method"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
id: validateType("Identifier"),
|
||||
value: validateType("FlowType"),
|
||||
static: validate(assertValueType("boolean")),
|
||||
method: validate(assertValueType("boolean")),
|
||||
},
|
||||
});
|
||||
|
||||
defineType("ObjectTypeCallProperty", {
|
||||
visitor: ["value"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
|
||||
Reference in New Issue
Block a user