* 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
189 lines
4.2 KiB
JSON
189 lines
4.2 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 28,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 28,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"sourceType": "script",
|
|
"interpreter": null,
|
|
"body": [
|
|
{
|
|
"type": "EnumDeclaration",
|
|
"start": 0,
|
|
"end": 28,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 4,
|
|
"column": 1
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 5,
|
|
"end": 6,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 5
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 6
|
|
},
|
|
"identifierName": "E"
|
|
},
|
|
"name": "E"
|
|
},
|
|
"body": {
|
|
"type": "EnumNumberBody",
|
|
"start": 11,
|
|
"end": 26,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 8
|
|
}
|
|
},
|
|
"explicitType": false,
|
|
"members": [
|
|
{
|
|
"type": "EnumNumberMember",
|
|
"start": 11,
|
|
"end": 16,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 7
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 11,
|
|
"end": 12,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 3
|
|
},
|
|
"identifierName": "A"
|
|
},
|
|
"name": "A"
|
|
},
|
|
"init": {
|
|
"type": "NumericLiteral",
|
|
"start": 15,
|
|
"end": 16,
|
|
"loc": {
|
|
"start": {
|
|
"line": 2,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 2,
|
|
"column": 7
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": 1,
|
|
"raw": "1"
|
|
},
|
|
"value": 1
|
|
}
|
|
},
|
|
{
|
|
"type": "EnumNumberMember",
|
|
"start": 20,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 7
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 20,
|
|
"end": 21,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 2
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 3
|
|
},
|
|
"identifierName": "B"
|
|
},
|
|
"name": "B"
|
|
},
|
|
"init": {
|
|
"type": "NumericLiteral",
|
|
"start": 24,
|
|
"end": 25,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 7
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": 2,
|
|
"raw": "2"
|
|
},
|
|
"value": 2
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
} |