Fix: Use parseExprAtom() for TS module id string (#684)

This commit is contained in:
James Henry 2017-08-20 16:38:55 +01:00 committed by Brian Ng
parent d685b3999c
commit d0c7d7a8c7
4 changed files with 72 additions and 1 deletions

View File

@ -911,7 +911,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
node.global = true;
node.id = this.parseIdentifier();
} else if (this.match(tt.string)) {
node.id = this.parseLiteral(this.state.value, "StringLiteral");
node.id = this.parseExprAtom();
} else {
this.unexpected();
}

View File

@ -0,0 +1,4 @@
{
"sourceType": "module",
"plugins": ["typescript", "estree"]
}

View File

@ -0,0 +1 @@
declare module "hot-new-module";

View File

@ -0,0 +1,66 @@
{
"type": "File",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"program": {
"type": "Program",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"sourceType": "module",
"body": [
{
"type": "TSModuleDeclaration",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"id": {
"type": "Literal",
"start": 15,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 31
}
},
"value": "hot-new-module",
"raw": "\"hot-new-module\""
},
"declare": true
}
]
}
}