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

157 lines
3.5 KiB
JSON

{
"type": "File",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"program": {
"type": "Program",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"sourceType": "module",
"body": [
{
"type": "DeclareModule",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
},
"id": {
"type": "StringLiteral",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
}
},
"extra": {
"rawValue": "M",
"raw": "\"M\""
},
"value": "M"
},
"body": {
"type": "BlockStatement",
"start": 19,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 47
}
},
"body": [
{
"type": "ImportDeclaration",
"start": 21,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 45
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 34
}
},
"local": {
"type": "Identifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 34
},
"identifierName": "T"
},
"name": "T"
}
}
],
"importKind": "type",
"source": {
"type": "StringLiteral",
"start": 40,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 44
}
},
"extra": {
"rawValue": "TM",
"raw": "\"TM\""
},
"value": "TM"
}
}
]
},
"kind": "CommonJS"
}
],
"directives": []
}
}