diff --git a/includes/libs/JavaScriptMinifier.php b/includes/libs/JavaScriptMinifier.php index d87a3fdcdf..f778983c9f 100644 --- a/includes/libs/JavaScriptMinifier.php +++ b/includes/libs/JavaScriptMinifier.php @@ -713,12 +713,17 @@ class JavaScriptMinifier { $newlineFound = false; // Now that we have output our token, transition into the new state. + echo "\n| stack | " . implode('>', array_map( 'self::getConstName', $stack ) ); + echo "\n| token: `$token`"; if ( isset( $push[$state][$type] ) && count( $stack ) < self::STACK_LIMIT ) { + echo " | action = stack_push " . self::getConstName( $push[$state][$type] ); $stack[] = $push[$state][$type]; } if ( $stack && isset( $pop[$state][$type] ) ) { + echo " | action = stack_pop"; $state = array_pop( $stack ); } elseif ( isset( $goto[$state][$type] ) ) { + echo " | action = goto " . self::getConstName( $goto[$state][$type] ); $state = $goto[$state][$type]; } } @@ -729,4 +734,13 @@ class JavaScriptMinifier { // TODO: Handle the error: trigger_error, throw exception, return false... return false; } + + private static function getConstName( $constVal ) { + $theClass = new ReflectionClass( self::class ); + foreach ( $theClass->getConstants() as $name => $value ) { + if ( $value === $constVal ) { + return $name; + } + } + } }