Skip to content

Commit

Permalink
PHP: fix generating variable tags for rvalues
Browse files Browse the repository at this point in the history
Only generate tags for variable declarations without assignments inside
classes and interfaces not to get fooled by rvalues.

This prevents generation of a "$bar" tag for something like:

	$foo = $bar;

while still generating "$bar" tag for:

	class Foo {
		var $bar;
	}
  • Loading branch information
b4n committed Apr 15, 2013
1 parent af47ccf commit 1c3fd55
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tagmanager/ctags/php.c
Expand Up @@ -909,7 +909,15 @@ static boolean parseVariable (tokenInfo *const token)
}
}
else if (token->type == TOKEN_SEMICOLON)
makeSimplePhpTag (name, K_VARIABLE, access);
{
/* generate tags for variable declarations in classes
* class Foo {
* protected $foo;
* }
* but don't get fooled by stuff like $foo = $bar; */
if (token->parentKind == K_CLASS || token->parentKind == K_INTERFACE)
makeSimplePhpTag (name, K_VARIABLE, access);
}
else
readNext = FALSE;

Expand Down

0 comments on commit 1c3fd55

Please sign in to comment.