How do I identify the lowest required visibility of methods?
As part of a large refactoring project, I need to identify methods that are no longer used, or where the visibility can be reduced.
Consider the following code:
program Project1;
type
TMyClass = class(TObject)
private
function Method1 : integer;
public
function Method2 : integer;
function Method3 : integer;
function Method4 : integer;
end;
var
vMyObject : TMyClass;
function TMyClass.Method1: integer;
begin
Result := Method2;
end;
function TMyClass.Method2: integer;
begin
Result := 2;
end;
function TMyClass.Method3: integer;
begin
Result := 3;
end;
function TMyClass.Method4: integer;
begin
Result := 4;
end;
begin
vMyObject := TMyClass.Create;
try
writeln(vMyObject.Method3);
finally
vMyObject.Free;
end;
end.
The Delphi compiler gives the warning "[DCC Hint] Project1.dpr(6): H2219 Private symbol 'Method1' declared but never used", which is very helpful. But there are other issues with this code that I would like to be warned about:
Are there any tools I can use to identify issues like these?
帕斯卡分析仪可以做到这一点,更多的情况。
来自Peganza和/或CodeHealer的PAL可能可以帮助您。
链接地址: http://www.djcxy.com/p/54380.html上一篇: 请帮我理解Javascript的匿名函数和jQuery.proxy()
下一篇: 我如何确定方法所需的最低可见度?