Implement parsing for optional shape fields
Summary:
Introduces parsing for optional `shape` fields. An optional shape field is a field whose name is annotated as nullable:
type ShapeWithOptionalField = shape(
?'a' => int
);
As discussed with dlreeves, we want the entire field, and //not// just the name, to be considered optional in this case. As a result, the type for `shape_field` has been changed as follows:
```lang=diff
shape_field =
- shape_field_name * hint
+ {
+ sf_optional : bool;
+ sf_name : shape_field_name;
+ sf_hint : hint;
+ }
```
See comments for discussion on why this design was chosen.
Note that this diff does not update the changes needed for naming, which will prevent optional shape fields from being valid Hack, until we're ready to roll this feature to a wider audience. The main change that will be needed for this to work is in `naming.ml`. `astConstructor.ml` will also need to be updated, although I'm less sure about what this is used for.
Reviewed By: dlreeves
Differential Revision:
D4534386
fbshipit-source-id:
501323601b2c1ce840bfdc2f781e07889e42671d