Daniel Tschinder d1a5220b89 Add support for declare export + fixes (#224)
* Add support for declare export

* Do not allow declare module inside declare module

* Reallow module exports outside module

* Add handling of `declare export default`

Add check for multiple module.export declarations

* Disallow export let/const/type

Refactor parsing object properties to share more code and add support
for getters and setters

* Rename tests

* Update test fixtures

* Optimize for performance

* disallow declare export interface outside of module

* Refactor code to be more readable and less lookahead

* Add comments

* Add test for export star as

* Test for number literal getter/setter

* Add more tests

* Fix tests

* Allow union types and correctly eat semi after type

* Use non computed keys

* Fix tests
2017-04-21 14:41:59 +02:00

242 lines
5.6 KiB
JSON

{
"type": "File",
"start": 0,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "DeclareClass",
"start": 0,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "X"
},
"name": "X"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 16,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 5,
"column": 1
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 19,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 10
}
},
"key": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 2
},
"identifierName": "a"
},
"name": "a"
},
"static": false,
"kind": "init",
"value": {
"type": "NumberTypeAnnotation",
"start": 22,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 10
}
}
},
"variance": null,
"optional": false
},
{
"type": "ObjectTypeProperty",
"start": 31,
"end": 47,
"loc": {
"start": {
"line": 3,
"column": 1
},
"end": {
"line": 3,
"column": 17
}
},
"key": {
"type": "Identifier",
"start": 38,
"end": 39,
"loc": {
"start": {
"line": 3,
"column": 8
},
"end": {
"line": 3,
"column": 9
},
"identifierName": "b"
},
"name": "b"
},
"static": true,
"kind": "init",
"value": {
"type": "NumberTypeAnnotation",
"start": 41,
"end": 47,
"loc": {
"start": {
"line": 3,
"column": 11
},
"end": {
"line": 3,
"column": 17
}
}
},
"variance": null,
"optional": false
},
{
"type": "ObjectTypeProperty",
"start": 50,
"end": 59,
"loc": {
"start": {
"line": 4,
"column": 1
},
"end": {
"line": 4,
"column": 10
}
},
"key": {
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 4,
"column": 1
},
"end": {
"line": 4,
"column": 2
},
"identifierName": "c"
},
"name": "c"
},
"static": false,
"kind": "init",
"value": {
"type": "NumberTypeAnnotation",
"start": 53,
"end": 59,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 10
}
}
},
"variance": null,
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}