Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-04

how to check if the same identifier appear in more than 1 unit of the project?

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

I have been restructuring my projects units and move some variables/functions from one unit to another.
I am worried that I have have the same identifier in more than 1 unit and the compiler is choosing the wrong one as that identifier exists in more than 1 units of my uses clause.

Is there any tool to find out ?

Thanks in advance,

Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160420/d81d46ab/attachment.html>

Reply by email

Graeme Geldenhuys
to Dennis
Dennis wrote
Is there any tool to find out ?

Multiple options:

* Do a "Find in Files" search.

* In Lazarus, place the edit cursor inside the identifier. Right Click and select "Find declaration of <xyz>". Do that in a few units where the identifier is used, and see if the same declaration is shown.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 10 lines
On 2016-04-20 08:32, Dennis wrote: > Is there any tool to find out ? Multiple options: * Do a "Find in Files" search. * In Lazarus, place the edit cursor inside the identifier. Right Click and select "Find declaration of <xyz>". Do that in a few units where the identifier is used, and see if the same declaration is shown.

IMHO you can better use the code browser for this.

Set scope to Project, 'with required packages' scans recursively.

after Show Identifiers type the identifier.

It just misses 'whole words only'...

I find it easier than the find in files:
Till project groups finally work and find in files is extended to use 'project group' scope, the code browser seems the best tool.

Michael.

Reply by email

Dennis
to Michael Van Canneyt
Michael Van Canneyt wrote 30 lines
On Wed, 20 Apr 2016, Graeme Geldenhuys wrote: > On 2016-04-20 08:32, Dennis wrote: >> Is there any tool to find out ? > > Multiple options: > > * Do a "Find in Files" search. > > * In Lazarus, place the edit cursor inside the identifier. Right Click > and select "Find declaration of <xyz>". Do that in a few units where > the identifier is used, and see if the same declaration is shown. IMHO you can better use the code browser for this. Set scope to Project, 'with required packages' scans recursively. after Show Identifiers type the identifier. It just misses 'whole words only'... I find it easier than the find in files: Till project groups finally work and find in files is extended to use 'project group' scope, the code browser seems the best tool. Michael.

Thanks for all of your advice but I have many identifiers in a dozen of units.
I am hoping for a tool that do the checking automatically and show me a list of conflicts.

Dennis

Reply by email