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

272 lines
7.3 KiB
JSON

{
"type": "File",
"start": 0,
"end": 74,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 74
}
},
"program": {
"type": "Program",
"start": 0,
"end": 74,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 74
}
},
"sourceType": "module",
"body": [
{
"type": "DeclareClass",
"start": 0,
"end": 74,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 74
}
},
"id": {
"type": "Identifier",
"start": 14,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "IViewFactory"
},
"name": "IViewFactory"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 27,
"end": 74,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 74
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 29,
"end": 71,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 71
}
},
"key": {
"type": "Identifier",
"start": 29,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 39
},
"identifierName": "didAnimate"
},
"name": "didAnimate"
},
"static": false,
"kind": "init",
"value": {
"type": "FunctionTypeAnnotation",
"start": 29,
"end": 71,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 71
}
},
"params": [
{
"type": "FunctionTypeParam",
"start": 40,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 51
}
},
"name": {
"type": "Identifier",
"start": 40,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 44
},
"identifierName": "view"
},
"name": "view"
},
"optional": false,
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 51
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 45,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 1,
"column": 51
},
"identifierName": "Object"
},
"name": "Object"
}
}
},
{
"type": "FunctionTypeParam",
"start": 53,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 64
}
},
"name": {
"type": "Identifier",
"start": 53,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 57
},
"identifierName": "prop"
},
"name": "prop"
},
"optional": false,
"typeAnnotation": {
"type": "StringTypeAnnotation",
"start": 58,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 58
},
"end": {
"line": 1,
"column": 64
}
}
}
}
],
"rest": null,
"typeParameters": null,
"returnType": {
"type": "VoidTypeAnnotation",
"start": 67,
"end": 71,
"loc": {
"start": {
"line": 1,
"column": 67
},
"end": {
"line": 1,
"column": 71
}
}
}
},
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}