1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 03:20:59 +01:00

Skip anon functions in symbol generation script

Summary:
Filters closures out of symbol generator script, per @epriestley's
comment in T4334

Test Plan:
Before:
  eric@eric-dev ~/phabricator/scripts/symbols: echo 'closure.php' | ./generate_php_symbols.php
    function php  /closure.php
   d function php 10 /closure.php
    function php  /closure.php
   a class php 3 /closure.php
  a b method php 4 /closure.php

After:
  eric@eric-dev ~/phabricator/scripts/symbols: echo 'closure.php' | ./generate_php_symbols.php
   d function php 10 /closure.php
   a class php 3 /closure.php
  a b method php 4 /closure.php

eric@eric-dev ~/phabricator/scripts/symbols: cat closure.php
  <?php

  class a {
    function b() {
      $c = function() { return 1; };
      $c();
    }
  }

  function d() {
    return 2;
  }
  $e = function() {
    return 3;
  };

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: epriestley, Korvin, aran

Differential Revision: https://secure.phabricator.com/D8054
This commit is contained in:
Eric Stern 2014-01-23 17:01:11 -08:00 committed by epriestley
parent febc494737
commit 14f070a0af

View file

@ -34,6 +34,10 @@ foreach (Futures($futures)->limit(8) as $file => $future) {
$functions = $root->selectDescendantsOfType('n_FUNCTION_DECLARATION'); $functions = $root->selectDescendantsOfType('n_FUNCTION_DECLARATION');
foreach ($functions as $function) { foreach ($functions as $function) {
$name = $function->getChildByIndex(2); $name = $function->getChildByIndex(2);
// Skip anonymous functions
if (!$name->getConcreteString()) {
continue;
}
print_symbol($file, 'function', $name); print_symbol($file, 'function', $name);
} }