[Github-comments] [geany] C, C++, C#, D: Improve return type and var type recognition (#889)

Colomban Wendling notifications at xxxxx
Wed Jan 27 12:57:23 UTC 2016


>  	for (i = 0; i < st->tokenIndex; i++)
>  	{
> +		const tokenInfo *const t = st->token[i];
> +
> +		/* stop if we find the token used to generate the tag name, or
> +		 * a name token in the middle yet not preceded by a scope separator */
> +		if ((t == nameToken ||
> +		     (t->type == nameToken->type &&
> +		      t->keyword == nameToken->keyword &&
> +		      t->lineNumber == nameToken->lineNumber &&
> +		      strcmp(vStringValue(t->name), vStringValue(nameToken->name)) == 0)) ||
> +		    (t->type == TOKEN_NAME && seenType &&
> +		     (i > 0 && st->token[i - 1]->type != TOKEN_DOUBLE_COLON)))

No, the point is to not include e.g. the class name in `std::string myclass::do_something();`.
The idea is fairly simple: when I see a name not preceded by a double colon (e.g. not simply qualified), and I already found something looking like a type (either a custom name, or a data type keyword (`void`, `int`, etc.)), I assume it's not part of the type anymore.

Maybe I miss some legitimate cases I don't know about, and yeah, it might lead to also ignoring template types (but it already did before, so it might be unrelated and that might just not show in the statement's tokens).

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/889/files#r50979636
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160127/831d0ebd/attachment.html>


More information about the Github-comments mailing list