@@ -444,12 +444,18 @@ public static function generate(int $layer, string $inputSchema, string $outputF
444444
445445 $ locations ['account.uploadTheme ' ][] = new Noop ('A freshly uploaded theme file will obtain a context only once it is created via account.createTheme ' );
446446
447- $ constructorList = $ TL ->tl ->getConstructors ()->by_id ;
448- $ mergedConstructorMethods = [
449- ...$ constructorList ,
450- ...$ TL ->tl ->getMethods ()->by_id ,
451- ];
452- $ recurse = static function (Closure $ onStackEnd , string $ type , array &$ stack , array &$ stackTypes , bool $ incoming ) use ($ TL , &$ recurse , $ mergedConstructorMethods , $ constructorList ): void {
447+ $ incomingList = [];
448+ $ outgoingList = $ TL ->tl ->getMethods ()->by_id ;
449+ foreach ($ TL ->tl ->getConstructors ()->by_id as $ k => $ constructor ) {
450+ if (str_starts_with ($ constructor ['predicate ' ], 'input ' )
451+ && ctype_upper (substr ($ constructor ['predicate ' ], strlen ('input ' ), 1 ))
452+ ) {
453+ $ outgoingList [$ k ] = $ constructor ;
454+ } else {
455+ $ incomingList [$ k ] = $ constructor ;
456+ }
457+ }
458+ $ recurse = static function (Closure $ onStackEnd , string $ type , array &$ stack , array &$ stackTypes , bool $ incoming ) use ($ TL , &$ recurse , $ outgoingList , $ incomingList ): void {
453459 if ($ incoming ) {
454460 if ($ type === 'Update ' || $ type === 'Updates ' ) {
455461 $ onStackEnd ($ stack );
@@ -461,7 +467,7 @@ public static function generate(int $layer, string $inputSchema, string $outputF
461467 }
462468
463469 $ pos = \count ($ stack );
464- foreach ($ incoming ? $ constructorList : $ mergedConstructorMethods as $ constructor ) {
470+ foreach ($ incoming ? $ incomingList : $ outgoingList as $ constructor ) {
465471 $ predicate = $ constructor ['predicate ' ] ?? $ constructor ['method ' ];
466472 if ($ predicate === 'updateShortMessage ' || $ predicate === 'updateShortChatMessage ' || $ predicate === 'updateShortSentMessage ' ) {
467473 // Assume these are converted to message constructors by the client.
0 commit comments