@@ -6,14 +6,18 @@ export class Enumeration extends Declaration implements IEnumeration, Searchable
66 * @brief Enum entries
77 * @readonly
88 */
9- readonly entries : Record < string , IEntry > ;
9+ readonly entries : Record < string , Entry > ;
1010
1111 readonly identifier : Identifier = Identifier . Enumeration ;
1212
1313 public constructor ( enumeration : IEnumeration ) {
1414 super ( enumeration ) ;
1515
16- this . entries = enumeration . entries ;
16+ this . entries = Object . keys ( enumeration . entries ) . reduce ( ( acc , key ) => {
17+ acc [ key ] = new Entry ( enumeration . entries [ key ] ) ;
18+
19+ return acc ;
20+ } , { } as Record < string , Entry > ) ;
1721 }
1822
1923 public async search ( needle : string , options : Readonly < SearchOptions > ) : Promise < SearchResult [ ] > {
@@ -24,7 +28,7 @@ export class Enumeration extends Declaration implements IEnumeration, Searchable
2428 ] ;
2529
2630 ret [ 0 ] . score += 0.01 ;
27-
31+
2832 localOptions . parents . push ( `${ this . identifier } .${ this . name } ` ) ;
2933
3034 if ( localOptions . l1Only !== true ) {
@@ -50,3 +54,18 @@ export class Enumeration extends Declaration implements IEnumeration, Searchable
5054 return ret ;
5155 }
5256}
57+
58+ export class Entry extends Declaration implements IEntry {
59+ /**
60+ * @brief Value that are explicitly set in code expressions
61+ */
62+ value ?: string ;
63+
64+ readonly identifier : Identifier = Identifier . EnumerationEntry ;
65+
66+ constructor ( entry : IEntry ) {
67+ super ( entry ) ;
68+
69+ this . value = entry . value ;
70+ }
71+ }
0 commit comments