Flatten TokenType class hierarchy (#8537)

`KeywordTokenType` and `BinopTokenType` were just meant to be factory
helpers, there's no reason for a class hierarchy.
This commit is contained in:
Justin Ridgewell 2018-08-25 20:02:32 -04:00 committed by GitHub
parent 5899940156
commit 524d847763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,18 +66,12 @@ export class TokenType {
}
}
class KeywordTokenType extends TokenType {
constructor(name: string, options: TokenOptions = {}) {
options.keyword = name;
super(name, options);
}
function KeywordTokenType(keyword: string, options: TokenOptions = {}) {
return new TokenType(keyword, { ...options, keyword });
}
export class BinopTokenType extends TokenType {
constructor(name: string, prec: number) {
super(name, { beforeExpr, binop: prec });
}
function BinopTokenType(name: string, binop: number) {
return new TokenType(name, { beforeExpr, binop });
}
export const types: { [name: string]: TokenType } = {