File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,27 +12,26 @@ export class MetadataScanner {
1212 prototype ,
1313 callback : ( name : string ) => R ,
1414 ) : R [ ] {
15- return iterate ( this . getAllFilteredMethodNames_ ( prototype ) )
15+ return iterate ( [ ... this . getAllFilteredMethodNames ( prototype ) ] )
1616 . map ( callback )
1717 . filter ( metadata => ! isNil ( metadata ) )
1818 . toArray ( ) ;
1919 }
2020
21- private getAllFilteredMethodNames_ ( prototype ) : string [ ] {
22- let methods : string [ ] = [ ] ;
21+ * getAllFilteredMethodNames ( prototype ) : IterableIterator < string > {
2322 do {
24- iterate ( Object . getOwnPropertyNames ( prototype ) )
25- . filter ( prop => {
26- const descriptor = Object . getOwnPropertyDescriptor ( prototype , prop ) ;
27- if ( descriptor . set || descriptor . get ) {
28- return false ;
29- }
30- return ! isConstructor ( prop ) && isFunction ( prototype [ prop ] ) ;
31- } )
32- . forEach ( method => {
33- methods . push ( method ) ;
34- } ) ;
35- } while ( ( prototype = Reflect . getPrototypeOf ( prototype ) ) && prototype != Object . prototype )
36- return methods ;
23+ yield * iterate ( Object . getOwnPropertyNames ( prototype ) )
24+ . filter ( prop => {
25+ const descriptor = Object . getOwnPropertyDescriptor ( prototype , prop ) ;
26+ if ( descriptor . set || descriptor . get ) {
27+ return false ;
28+ }
29+ return ! isConstructor ( prop ) && isFunction ( prototype [ prop ] ) ;
30+ } )
31+ . toArray ( )
32+ } while (
33+ ( prototype = Reflect . getPrototypeOf ( prototype ) ) &&
34+ prototype != Object . prototype
35+ ) ;
3736 }
3837}
You can’t perform that action at this time.
0 commit comments