Skip to content

Commit

Permalink
Removed reudndant token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgsowa authored and nikic committed Nov 24, 2024
1 parent 25828ea commit 74d3f7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/fuzzing/target.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function leaveNode(PhpParser\Node $node) {
$stmts = $parser->parse($input);
$printed = $prettyPrinter->prettyPrintFile($stmts);

$visitor->setTokens($lexer->tokenize($input));
$visitor->setTokens($parser->getTokens());
$stmts = $traverser->traverse($stmts);
if ($visitor->hasProblematicConstruct) {
return;
Expand All @@ -116,7 +116,7 @@ public function leaveNode(PhpParser\Node $node) {
throw new Error("Failed to parse pretty printer output");
}

$visitor->setTokens($lexer->tokenize($printed));
$visitor->setTokens($parser->getTokens());
$printedStmts = $traverser->traverse($printedStmts);
$same = $nodeDumper->dump($stmts) == $nodeDumper->dump($printedStmts);
if (!$same && !preg_match('/<\?php<\?php/i', $input)) {
Expand Down

0 comments on commit 74d3f7f

Please sign in to comment.