mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Don't record anonymous functions into the symbol map
Summary: Although we currently forbid anonymous functions, some day we will likely permit them, and our behavior for them is wrong. Handle them correctly rather than throwing an exception because we should be covered by D1846 against accidental use, and we won't be on PHP 5.2 forever. Test Plan: Ran against a test file with anonymous functions. Before, it emitted a declaration of a nameless function; afterward, it did not. Reviewers: btrahan, edward Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T963 Differential Revision: https://secure.phabricator.com/D1847
This commit is contained in:
parent
36709ece41
commit
6a7b1a7bdd
1 changed files with 8 additions and 3 deletions
|
@ -219,9 +219,14 @@ foreach (Futures($futures) as $file => $future) {
|
|||
$functions = $root->selectDescendantsOfType('n_FUNCTION_DECLARATION');
|
||||
foreach ($functions as $function) {
|
||||
$name = $function->getChildByIndex(2);
|
||||
$requirements->addFunctionDeclaration(
|
||||
$name,
|
||||
$name->getConcreteString());
|
||||
if ($name->getTypeName() == 'n_EMPTY') {
|
||||
// This is an anonymous function; don't record it into the symbol
|
||||
// index.
|
||||
} else {
|
||||
$requirements->addFunctionDeclaration(
|
||||
$name,
|
||||
$name->getConcreteString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue