George Zahariev ec3345bb57 Flow enums parsing (#10344)
* Flow enums parsing

* Parse exporting enums

* Enums parsing remove lookahead, other improvements

* Enums: add EnumBody and EnumMember aliases, change boolean members to use BooleaLiteral value

* Fix enum member init flow type, now that boolean members have a BooleanLiteral value

* Flow enums: use contextual utils, change members length checks to use logic operators, remove reserved word logic modification

* Flow enums: remove unnecessary code in generator, fix error message
2019-10-29 22:55:12 +01:00

166 lines
3.3 KiB
JSON

{
"type": "File",
"start": 0,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 24
}
},
"program": {
"type": "Program",
"start": 0,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 24
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExportNamedDeclaration",
"start": 0,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 16
}
},
"specifiers": [],
"source": null,
"exportKind": "value",
"declaration": {
"type": "EnumDeclaration",
"start": 7,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 16
}
},
"id": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "A"
},
"name": "A"
},
"body": {
"type": "EnumStringBody",
"start": 15,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 15
}
},
"explicitType": false,
"members": []
}
}
},
{
"type": "ExportDefaultDeclaration",
"start": 18,
"end": 42,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 24
}
},
"declaration": {
"type": "EnumDeclaration",
"start": 33,
"end": 42,
"loc": {
"start": {
"line": 3,
"column": 15
},
"end": {
"line": 3,
"column": 24
}
},
"id": {
"type": "Identifier",
"start": 38,
"end": 39,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 3,
"column": 21
},
"identifierName": "B"
},
"name": "B"
},
"body": {
"type": "EnumStringBody",
"start": 41,
"end": 41,
"loc": {
"start": {
"line": 3,
"column": 23
},
"end": {
"line": 3,
"column": 23
}
},
"explicitType": false,
"members": []
}
}
}
],
"directives": []
}
}