Fix TypeScript parsers missing token check (#9571) (#9572)

* Fix TypeScript parsers missing token check (#9571)

* fix unit test
This commit is contained in:
Barthélémy Ledoux
2019-02-24 06:34:38 -06:00
committed by Nicolò Ribaudo
parent 0b01b5217b
commit 9f3457797f
3 changed files with 77 additions and 9 deletions

View File

@@ -86,7 +86,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
!this.match(tt.parenR) &&
!this.match(tt.colon) &&
!this.match(tt.eq) &&
!this.match(tt.question)
!this.match(tt.question) &&
!this.match(tt.bang)
);
}

View File

@@ -3,4 +3,5 @@ class C {
public static(): void;
readonly = 0;
async<T>(): void;
abstract!:void;
}

View File

@@ -1,28 +1,28 @@
{
"type": "File",
"start": 0,
"end": 98,
"end": 118,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"line": 7,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 98,
"end": 118,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"line": 7,
"column": 1
}
},
@@ -32,14 +32,14 @@
{
"type": "ClassDeclaration",
"start": 0,
"end": 98,
"end": 118,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"line": 7,
"column": 1
}
},
@@ -64,14 +64,14 @@
"body": {
"type": "ClassBody",
"start": 8,
"end": 98,
"end": 118,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 6,
"line": 7,
"column": 1
}
},
@@ -370,6 +370,72 @@
}
}
}
},
{
"type": "ClassProperty",
"start": 101,
"end": 116,
"loc": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 6,
"column": 19
}
},
"static": false,
"key": {
"type": "Identifier",
"start": 101,
"end": 109,
"loc": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 6,
"column": 12
},
"identifierName": "abstract"
},
"name": "abstract"
},
"computed": false,
"definite": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 110,
"end": 115,
"loc": {
"start": {
"line": 6,
"column": 13
},
"end": {
"line": 6,
"column": 18
}
},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start": 111,
"end": 115,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 18
}
}
}
},
"value": null
}
]
}