@@ -4,51 +4,19 @@ export class Decorator {
44 }
55
66 public static getDecoratorKind ( decoratorKindString : string ) : DecoratorKind | undefined {
7- switch ( decoratorKindString . toLowerCase ( ) ) {
8- case "extension" :
9- return DecoratorKind . Extension ;
10- case "metaextension" :
11- return DecoratorKind . MetaExtension ;
12- case "customconstructor" :
13- return DecoratorKind . CustomConstructor ;
14- case "compilemembersonly" :
15- return DecoratorKind . CompileMembersOnly ;
16- case "noresolution" :
17- return DecoratorKind . NoResolution ;
18- case "pureabstract" :
19- return DecoratorKind . PureAbstract ;
20- case "phantom" :
21- return DecoratorKind . Phantom ;
22- case "tuplereturn" :
23- return DecoratorKind . TupleReturn ;
24- case "luaiterator" :
25- return DecoratorKind . LuaIterator ;
26- case "luatable" :
27- return DecoratorKind . LuaTable ;
28- case "noself" :
29- return DecoratorKind . NoSelf ;
30- case "noselfinfile" :
31- return DecoratorKind . NoSelfInFile ;
32- case "vararg" :
33- return DecoratorKind . Vararg ;
34- case "forrange" :
35- return DecoratorKind . ForRange ;
36- }
37-
38- return undefined ;
7+ return Object . values ( DecoratorKind ) . find (
8+ decoratorKind => decoratorKind . toLowerCase ( ) === decoratorKindString . toLowerCase ( )
9+ ) ;
3910 }
4011
4112 public kind : DecoratorKind ;
42- public args : string [ ] ;
43-
44- constructor ( name : string , args : string [ ] ) {
13+ constructor ( name : string , public args : string [ ] ) {
4514 const kind = Decorator . getDecoratorKind ( name ) ;
4615 if ( kind === undefined ) {
4716 throw new Error ( `Failed to parse decorator '${ name } '` ) ;
4817 }
4918
5019 this . kind = kind ;
51- this . args = args ;
5220 }
5321}
5422
0 commit comments