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 { function KeywordTokenType(keyword: string, options: TokenOptions = {}) {
constructor(name: string, options: TokenOptions = {}) { return new TokenType(keyword, { ...options, keyword });
options.keyword = name;
super(name, options);
}
} }
export class BinopTokenType extends TokenType { function BinopTokenType(name: string, binop: number) {
constructor(name: string, prec: number) { return new TokenType(name, { beforeExpr, binop });
super(name, { beforeExpr, binop: prec });
}
} }
export const types: { [name: string]: TokenType } = { export const types: { [name: string]: TokenType } = {