Skip to content
Permalink
Browse files

Add parsing support for internal slot properties in object types

Summary:
It's useful to describe capabilities in object types, interfaces, and declared
classes which do not necessarily correspond to runtime properties.

Call properties are one example, which we support through a special syntax.
Unfortunately, this syntax is not unambiguous with methods when used in a
declare class -- `declare class C { static (): void }` can be reasonably parsed
as a static "callable" property or as an instance method named `static`.

Another example is "newable" objects, like constructors. It is useful to
describe the set of values which can be constructed with given arguments,
returning a value of some shape. We might support this with a syntax like
`{ [[new]](x: A, y: B): C }`.

Yet another example is `__proto__` property, which we currently support on
object types, but also potentially overlaps with a named property. We could
swap the syntax to the non-overlapping `[[proto]]` instead.

This diff simply adds parsing support for internal slot properties, and
provides no specific support. An internal slot property is currently always a
semantic error, realized during AST traversal. Follow-up diffs will add
support for specific properties.

Reviewed By: avikchaudhuri

Differential Revision: D7731906

fbshipit-source-id: 5051bc64c8c9317dff3196facff91c5a297539c3
  • Loading branch information...
samwgoldman authored and facebook-github-bot committed May 1, 2018
1 parent 5b9fa2b commit 732eae55e102cdb7dfa7b6a85f0147d48c3afed7
Showing with 879 additions and 175 deletions.
  1. +9 −1 packages/flow-parser/test/custom_ast_types.js
  2. +1 −0 packages/flow-parser/test/esprima_test_runner.js
  3. +10 −0 src/parser/ast.ml
  4. +19 −6 src/parser/estree_translator.ml
  5. +2 −1 src/parser/test/flow/ES6/modules/migrated_0007.tree.json
  6. +2 −1 src/parser/test/flow/call_properties/migrated_0000.tree.json
  7. +2 −1 src/parser/test/flow/call_properties/migrated_0001.tree.json
  8. +2 −1 src/parser/test/flow/call_properties/migrated_0002.tree.json
  9. +2 −1 src/parser/test/flow/call_properties/migrated_0003.tree.json
  10. +2 −1 src/parser/test/flow/call_properties/migrated_0004.tree.json
  11. +2 −1 src/parser/test/flow/call_properties_invalid/migrated_0000.tree.json
  12. +2 −1 src/parser/test/flow/decorators_invalid/migrated_0003.tree.json
  13. +2 −1 src/parser/test/flow/decorators_invalid/migrated_0007.tree.json
  14. +2 −1 src/parser/test/flow/decorators_invalid/migrated_0008.tree.json
  15. +1 −0 src/parser/test/flow/internal_slot/declare_class.js
  16. +51 −0 src/parser/test/flow/internal_slot/declare_class.tree.json
  17. +1 −0 src/parser/test/flow/internal_slot/declare_class_static.js
  18. +51 −0 src/parser/test/flow/internal_slot/declare_class_static.tree.json
  19. +1 −0 src/parser/test/flow/internal_slot/interface.js
  20. +49 −0 src/parser/test/flow/internal_slot/interface.tree.json
  21. +1 −0 src/parser/test/flow/internal_slot/interface_method.js
  22. +49 −0 src/parser/test/flow/internal_slot/interface_method.tree.json
  23. +1 −0 src/parser/test/flow/internal_slot/interface_variance.js
  24. +55 −0 src/parser/test/flow/internal_slot/interface_variance.tree.json
  25. +1 −0 src/parser/test/flow/internal_slot/object.js
  26. +48 −0 src/parser/test/flow/internal_slot/object.tree.json
  27. +1 −0 src/parser/test/flow/internal_slot/object_method.js
  28. +48 −0 src/parser/test/flow/internal_slot/object_method.tree.json
  29. +1 −0 src/parser/test/flow/internal_slot/object_variance.js
  30. +54 −0 src/parser/test/flow/internal_slot/object_variance.tree.json
  31. +2 −1 src/parser/test/flow/private_class_properties/nested.tree.json
  32. +2 −1 src/parser/test/flow/private_class_properties/object_type.tree.json
  33. +2 −1 src/parser/test/flow/types/annotations/migrated_0013.tree.json
  34. +2 −1 src/parser/test/flow/types/annotations/migrated_0021.tree.json
  35. +2 −1 src/parser/test/flow/types/annotations/migrated_0022.tree.json
  36. +2 −1 src/parser/test/flow/types/annotations/migrated_0023.tree.json
  37. +2 −1 src/parser/test/flow/types/annotations/migrated_0024.tree.json
  38. +4 −2 src/parser/test/flow/types/annotations/migrated_0025.tree.json
  39. +2 −1 src/parser/test/flow/types/annotations/migrated_0026.tree.json
  40. +2 −1 src/parser/test/flow/types/annotations/migrated_0027.tree.json
  41. +2 −1 src/parser/test/flow/types/annotations/migrated_0030.tree.json
  42. +2 −1 src/parser/test/flow/types/annotations/migrated_0031.tree.json
  43. +2 −1 src/parser/test/flow/types/annotations/migrated_0032.tree.json
  44. +2 −1 src/parser/test/flow/types/annotations/migrated_0033.tree.json
  45. +2 −1 src/parser/test/flow/types/annotations/migrated_0034.tree.json
  46. +2 −1 src/parser/test/flow/types/annotations/migrated_0035.tree.json
  47. +2 −1 src/parser/test/flow/types/annotations/migrated_0036.tree.json
  48. +2 −1 src/parser/test/flow/types/annotations/migrated_0037.tree.json
  49. +2 −1 src/parser/test/flow/types/annotations/migrated_0038.tree.json
  50. +2 −1 src/parser/test/flow/types/annotations/migrated_0058.tree.json
  51. +2 −1 src/parser/test/flow/types/annotations/migrated_0060.tree.json
  52. +2 −1 src/parser/test/flow/types/annotations/migrated_0063.tree.json
  53. +2 −1 src/parser/test/flow/types/annotations/migrated_0068.tree.json
  54. +2 −1 src/parser/test/flow/types/annotations/migrated_0073.tree.json
  55. +2 −1 src/parser/test/flow/types/annotations/migrated_0076.tree.json
  56. +2 −1 src/parser/test/flow/types/annotations/migrated_0079.tree.json
  57. +2 −1 src/parser/test/flow/types/annotations/unfinished_colon_method.tree.json
  58. +2 −1 src/parser/test/flow/types/annotations/unfinished_colon_return.tree.json
  59. +2 −1 src/parser/test/flow/types/annotations/unfinished_function_body.tree.json
  60. +2 −1 src/parser/test/flow/types/annotations_in_comments/migrated_0012.tree.json
  61. +2 −1 src/parser/test/flow/types/annotations_in_comments/migrated_0013.tree.json
  62. +2 −1 src/parser/test/flow/types/declare_class/basic.tree.json
  63. +2 −1 src/parser/test/flow/types/declare_class/field_named_static.tree.json
  64. +2 −1 src/parser/test/flow/types/declare_class/implements.tree.json
  65. +2 −1 src/parser/test/flow/types/declare_class/implements_and_mixins.tree.json
  66. +2 −1 src/parser/test/flow/types/declare_class/implements_multiple.tree.json
  67. +2 −1 src/parser/test/flow/types/declare_class/invalid_quoted_static_modifier.tree.json
  68. +2 −1 src/parser/test/flow/types/declare_class/method_with_this_return.tree.json
  69. +2 −1 src/parser/test/flow/types/declare_class/mixins.tree.json
  70. +2 −1 src/parser/test/flow/types/declare_class/mixins_multiple.tree.json
  71. +2 −1 src/parser/test/flow/types/declare_class/multiple_extends.tree.json
  72. +6 −3 src/parser/test/flow/types/declare_class/proto.tree.json
  73. +2 −1 src/parser/test/flow/types/declare_class/proto_indexer.tree.json
  74. +2 −1 src/parser/test/flow/types/declare_class/proto_method.tree.json
  75. +2 −1 src/parser/test/flow/types/declare_class/static_indexer.tree.json
  76. +2 −1 src/parser/test/flow/types/declare_class/static_method.tree.json
  77. +2 −1 src/parser/test/flow/types/declare_class/static_proto.tree.json
  78. +2 −1 src/parser/test/flow/types/declare_class/truncated0.tree.json
  79. +2 −1 src/parser/test/flow/types/declare_class/truncated1.tree.json
  80. +2 −1 src/parser/test/flow/types/declare_class/truncated2.tree.json
  81. +2 −1 src/parser/test/flow/types/declare_export/class/migrated_0017.tree.json
  82. +2 −1 src/parser/test/flow/types/declare_export/class/migrated_0018.tree.json
  83. +2 −1 src/parser/test/flow/types/declare_export/class/migrated_0019.tree.json
  84. +2 −1 src/parser/test/flow/types/declare_export/class/migrated_0020.tree.json
  85. +2 −1 src/parser/test/flow/types/declare_export/class/migrated_0021.tree.json
  86. +2 −1 src/parser/test/flow/types/declare_export/declare_export_class_prop_named_static.tree.json
  87. +2 −1 src/parser/test/flow/types/declare_export/default/migrated_0028.tree.json
  88. +2 −1 src/parser/test/flow/types/declare_export/default/migrated_0029.tree.json
  89. +2 −1 src/parser/test/flow/types/declare_export/default/migrated_0030.tree.json
  90. +2 −1 src/parser/test/flow/types/declare_export/default/migrated_0031.tree.json
  91. +2 −1 src/parser/test/flow/types/declare_export/default/migrated_0032.tree.json
  92. +2 −1 src/parser/test/flow/types/declare_export_invalid/migrated_0014.tree.json
  93. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0000.tree.json
  94. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0001.tree.json
  95. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0002.tree.json
  96. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0003.tree.json
  97. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0004.tree.json
  98. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0005.tree.json
  99. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0010.tree.json
  100. +2 −1 src/parser/test/flow/types/declare_interface/migrated_0011.tree.json
  101. +2 −1 src/parser/test/flow/types/declare_module_with_exports/migrated_0005.tree.json
  102. +2 −1 src/parser/test/flow/types/declare_module_with_exports/migrated_0009.tree.json
  103. +2 −1 src/parser/test/flow/types/declare_module_with_exports/migrated_0010.tree.json
  104. +2 −1 src/parser/test/flow/types/declare_module_with_exports/migrated_0011.tree.json
  105. +2 −1 src/parser/test/flow/types/declare_statements/declare_class_prop_named_static.tree.json
  106. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0006.tree.json
  107. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0007.tree.json
  108. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0008.tree.json
  109. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0009.tree.json
  110. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0010.tree.json
  111. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0011.tree.json
  112. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0012.tree.json
  113. +2 −1 src/parser/test/flow/types/declare_statements/migrated_0013.tree.json
  114. +2 −1 src/parser/test/flow/types/declare_statements_invalid/migrated_0002.tree.json
  115. +2 −1 src/parser/test/flow/types/exact_objects/migrated_0000.tree.json
  116. +2 −1 src/parser/test/flow/types/exact_objects/migrated_0001.tree.json
  117. +2 −1 src/parser/test/flow/types/grouping/method.tree.json
  118. +2 −1 src/parser/test/flow/types/grouping/object_type_call_property.tree.json
  119. +2 −1 src/parser/test/flow/types/grouping/object_type_indexer.tree.json
  120. +2 −1 src/parser/test/flow/types/grouping/object_type_property.tree.json
  121. +2 −1 src/parser/test/flow/types/grouping/object_type_spread_property.tree.json
  122. +2 −1 src/parser/test/flow/types/instance_spread_invalid/migrated_0000.tree.json
  123. +2 −1 src/parser/test/flow/types/instance_spread_invalid/migrated_0001.tree.json
  124. +2 −1 src/parser/test/flow/types/interfaces/migrated_0000.tree.json
  125. +2 −1 src/parser/test/flow/types/interfaces/migrated_0001.tree.json
  126. +2 −1 src/parser/test/flow/types/interfaces/migrated_0002.tree.json
  127. +2 −1 src/parser/test/flow/types/interfaces/migrated_0003.tree.json
  128. +2 −1 src/parser/test/flow/types/interfaces/migrated_0004.tree.json
  129. +2 −1 src/parser/test/flow/types/interfaces/migrated_0005.tree.json
  130. +2 −1 src/parser/test/flow/types/interfaces/migrated_0010.tree.json
  131. +2 −1 src/parser/test/flow/types/interfaces/migrated_0011.tree.json
  132. +8 −4 src/parser/test/flow/types/interfaces/prop_named_static.tree.json
  133. +2 −1 src/parser/test/flow/types/interfaces/reserved_type.tree.json
  134. +2 −1 src/parser/test/flow/types/interfaces/reserved_value.tree.json
  135. +2 −1 src/parser/test/flow/types/object/indexers/reserved_type_indexer_name.tree.json
  136. +2 −1 src/parser/test/flow/types/object/indexers/reserved_word_indexer_name.tree.json
  137. +2 −1 src/parser/test/flow/types/object/methods/generic_method.tree.json
  138. +2 −1 src/parser/test/flow/types/object/methods/method.tree.json
  139. +6 −3 src/parser/test/flow/types/object/unexpected_proto.tree.json
  140. +18 −9 src/parser/test/flow/types/object/unexpected_static.tree.json
  141. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0000.tree.json
  142. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0001.tree.json
  143. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0002.tree.json
  144. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0003.tree.json
  145. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0004.tree.json
  146. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0005.tree.json
  147. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0006.tree.json
  148. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0007.tree.json
  149. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0008.tree.json
  150. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0009.tree.json
  151. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0010.tree.json
  152. +2 −1 src/parser/test/flow/types/object_type_property_variance/migrated_0011.tree.json
  153. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0000.tree.json
  154. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0001.tree.json
  155. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0002.tree.json
  156. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0003.tree.json
  157. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0004.tree.json
  158. +2 −1 src/parser/test/flow/types/object_type_spread/migrated_0005.tree.json
  159. +2 −1 src/parser/test/flow/types/optional_indexer_name/migrated_0000.tree.json
  160. +2 −1 src/parser/test/flow/types/optional_indexer_name/migrated_0001.tree.json
  161. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0012.tree.json
  162. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0013.tree.json
  163. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0014.tree.json
  164. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0015.tree.json
  165. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0016.tree.json
  166. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0017.tree.json
  167. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0018.tree.json
  168. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0019.tree.json
  169. +2 −1 src/parser/test/flow/types/parameter_defaults/migrated_0031.tree.json
  170. +2 −1 src/parser/test/flow/types/typecasts/migrated_0001.tree.json
  171. +38 −2 src/parser/type_parser.ml
  172. +8 −0 src/parser_utils/output/js_layout_generator.ml
  173. +8 −0 src/typing/class_sig.ml
  174. +5 −0 src/typing/flow_error.ml
  175. +7 −0 src/typing/type_annotation.ml
  176. 0 tests/internal_slot/.flowconfig
  177. +1 −0 tests/internal_slot/declare_class_unsupported.js
  178. +1 −0 tests/internal_slot/interface_unsupported.js
  179. +26 −0 tests/internal_slot/internal_slot.exp
  180. +1 −0 tests/internal_slot/object_unsupported.js
@@ -175,7 +175,8 @@ def("ObjectTypeAnnotation")
.field("exact", Boolean)
.field("properties", [or(
def("ObjectTypeProperty"),
def("ObjectTypeSpreadProperty"))]);
def("ObjectTypeSpreadProperty"))])
.field("internalSlots", [def("ObjectTypeInternalSlot")]);

def("MetaProperty")
.bases("Expression")
@@ -217,6 +218,13 @@ def("ObjectTypeSpreadProperty")
.build("argument")
.field("argument", def("GenericTypeAnnotation"));

def("ObjectTypeInternalSlot")
.bases("Node")
.build("id", "static", "method")
.field("id", def("Identifier"))
.field("static", Boolean)
.field("method", Boolean);

// https://github.com/benjamn/ast-types/issues/186
def("ForAwaitStatement")
.bases("Statement")
@@ -199,6 +199,7 @@ function handleSpecialObjectCompare(esprima, flow, env) {
break;
case 'ObjectTypeAnnotation':
esprima.exact = esprima.exact || false;
esprima.internalSlots = esprima.internalSlots || [];
break;
case 'ObjectTypeProperty':
esprima.kind = "init"; // esprima-fb doesn't support getters/setters
@@ -145,11 +145,21 @@ and Type : sig
static: bool;
}
end
module InternalSlot: sig
type 'M t = 'M * 'M t'
and 'M t' = {
id: 'M Identifier.t;
value: 'M Type.t;
_method: bool;
static: bool;
}
end
type 'M property =
| Property of 'M Property.t
| SpreadProperty of 'M SpreadProperty.t
| Indexer of 'M Indexer.t
| CallProperty of 'M CallProperty.t
| InternalSlot of 'M InternalSlot.t
type 'M t = {
exact: bool;
properties: 'M property list;
@@ -1090,25 +1090,30 @@ end with type t = Impl.t) = struct
function_type_param argument

and object_type (loc, o) = Type.Object.(
let props, ixs, calls = List.fold_left (fun (props, ixs, calls) -> function
let props, ixs, calls, slots = List.fold_left (fun (props, ixs, calls, slots) ->
function
| Property p ->
let prop = object_type_property p in
prop::props, ixs, calls
prop::props, ixs, calls, slots
| SpreadProperty p ->
let prop = object_type_spread_property p in
prop::props, ixs, calls
prop::props, ixs, calls, slots
| Indexer i ->
let ix = object_type_indexer i in
props, ix::ixs, calls
props, ix::ixs, calls, slots
| CallProperty c ->
let call = object_type_call_property c in
props, ixs, call::calls
) ([], [], []) o.properties in
props, ixs, call::calls, slots
| InternalSlot s ->
let slot = object_type_internal_slot s in
props, ixs, calls, slot::slots
) ([], [], [], []) o.properties in
node "ObjectTypeAnnotation" loc [
"exact", bool o.exact;
"properties", array (List.rev props);
"indexers", array (List.rev ixs);
"callProperties", array (List.rev calls);
"internalSlots", array (List.rev slots);
]
)

@@ -1162,6 +1167,14 @@ end with type t = Impl.t) = struct
]
)

and object_type_internal_slot (loc, slot) = Type.Object.InternalSlot.(
node "ObjectTypeInternalSlot" loc [
"id", identifier slot.id;
"static", bool slot.static;
"method", bool slot._method;
]
)

and array_type loc t =
node "ArrayTypeAnnotation" loc [
"elementType", (_type t);
@@ -52,7 +52,8 @@
}
],
"indexers":[],
"callProperties":[]
"callProperties":[],
"internalSlots":[]
},
"extends":[]
},
@@ -48,7 +48,8 @@
},
"static":false
}
]
],
"internalSlots":[]
}
},
"optional":false
@@ -48,7 +48,8 @@
},
"static":false
}
]
],
"internalSlots":[]
}
},
"optional":false
@@ -112,7 +112,8 @@
},
"static":false
}
]
],
"internalSlots":[]
}
},
"optional":false
@@ -92,7 +92,8 @@
},
"static":false
}
]
],
"internalSlots":[]
}
},
"optional":false
@@ -43,7 +43,8 @@
},
"static":false
}
]
],
"internalSlots":[]
},
"extends":[]
}
@@ -58,7 +58,8 @@
},
"static":false
}
]
],
"internalSlots":[]
}
},
"optional":false
@@ -34,7 +34,8 @@
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[]
"callProperties":[],
"internalSlots":[]
},
"extends":[],
"implements":[],
@@ -29,7 +29,8 @@
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[]
"callProperties":[],
"internalSlots":[]
},
"extends":[]
}
@@ -29,7 +29,8 @@
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[]
"callProperties":[],
"internalSlots":[]
},
"extends":[],
"implements":[],
@@ -0,0 +1 @@
declare class C { [[foo]]: T }
@@ -0,0 +1,51 @@
{
"type":"Program",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
"range":[0,30],
"body":[
{
"type":"DeclareClass",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
"range":[0,30],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
"range":[14,15],
"name":"C",
"typeAnnotation":null,
"optional":false
},
"typeParameters":null,
"body":{
"type":"ObjectTypeAnnotation",
"loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":30}},
"range":[16,30],
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[],
"internalSlots":[
{
"type":"ObjectTypeInternalSlot",
"loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":28}},
"range":[18,28],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":20},"end":{"line":1,"column":23}},
"range":[20,23],
"name":"foo",
"typeAnnotation":null,
"optional":false
},
"static":false,
"method":false
}
]
},
"extends":[],
"implements":[],
"mixins":[]
}
],
"comments":[]
}
@@ -0,0 +1 @@
declare class C { static [[foo]]: T }
@@ -0,0 +1,51 @@
{
"type":"Program",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
"range":[0,37],
"body":[
{
"type":"DeclareClass",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":37}},
"range":[0,37],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
"range":[14,15],
"name":"C",
"typeAnnotation":null,
"optional":false
},
"typeParameters":null,
"body":{
"type":"ObjectTypeAnnotation",
"loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":37}},
"range":[16,37],
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[],
"internalSlots":[
{
"type":"ObjectTypeInternalSlot",
"loc":{"source":null,"start":{"line":1,"column":18},"end":{"line":1,"column":35}},
"range":[18,35],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":27},"end":{"line":1,"column":30}},
"range":[27,30],
"name":"foo",
"typeAnnotation":null,
"optional":false
},
"static":true,
"method":false
}
]
},
"extends":[],
"implements":[],
"mixins":[]
}
],
"comments":[]
}
@@ -0,0 +1 @@
interface T { [[foo]]: X }
@@ -0,0 +1,49 @@
{
"type":"Program",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"range":[0,26],
"body":[
{
"type":"InterfaceDeclaration",
"loc":{"source":null,"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"range":[0,26],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":10},"end":{"line":1,"column":11}},
"range":[10,11],
"name":"T",
"typeAnnotation":null,
"optional":false
},
"typeParameters":null,
"body":{
"type":"ObjectTypeAnnotation",
"loc":{"source":null,"start":{"line":1,"column":12},"end":{"line":1,"column":26}},
"range":[12,26],
"exact":false,
"properties":[],
"indexers":[],
"callProperties":[],
"internalSlots":[
{
"type":"ObjectTypeInternalSlot",
"loc":{"source":null,"start":{"line":1,"column":14},"end":{"line":1,"column":24}},
"range":[14,24],
"id":{
"type":"Identifier",
"loc":{"source":null,"start":{"line":1,"column":16},"end":{"line":1,"column":19}},
"range":[16,19],
"name":"foo",
"typeAnnotation":null,
"optional":false
},
"static":false,
"method":false
}
]
},
"extends":[]
}
],
"comments":[]
}
@@ -0,0 +1 @@
interface T { [[foo]](): X }

0 comments on commit 732eae5

Please sign in to comment.
You can’t perform that action at this time.