|
@@ -4637,6 +4637,7 @@ var
|
|
Proc: TPasProcedure;
|
|
Proc: TPasProcedure;
|
|
Store, SameScope: Boolean;
|
|
Store, SameScope: Boolean;
|
|
ProcScope: TPasProcedureScope;
|
|
ProcScope: TPasProcedureScope;
|
|
|
|
+ CurResolver: TPasResolver;
|
|
|
|
|
|
procedure CountProcInSameModule;
|
|
procedure CountProcInSameModule;
|
|
begin
|
|
begin
|
|
@@ -4667,28 +4668,35 @@ begin
|
|
exit; // no hint
|
|
exit; // no hint
|
|
end;
|
|
end;
|
|
case Data^.Kind of
|
|
case Data^.Kind of
|
|
- fpkProc:
|
|
|
|
- // proc hides a non proc
|
|
|
|
- if (Data^.Proc.GetModule=El.GetModule) then
|
|
|
|
- // forbidden within same module
|
|
|
|
- RaiseMsg(20170216151649,nDuplicateIdentifier,sDuplicateIdentifier,
|
|
|
|
- [El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType)
|
|
|
|
- else
|
|
|
|
|
|
+ fpkProc:
|
|
|
|
+ // proc hides a non proc
|
|
|
|
+ if (Data^.Proc.GetModule=El.GetModule) then
|
|
|
|
+ // forbidden within same module
|
|
|
|
+ RaiseMsg(20170216151649,nDuplicateIdentifier,sDuplicateIdentifier,
|
|
|
|
+ [El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType)
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ // give a hint
|
|
|
|
+ if Data^.Proc.Parent is TPasMembersType then
|
|
begin
|
|
begin
|
|
- // give a hint
|
|
|
|
- if Data^.Proc.Parent is TPasMembersType then
|
|
|
|
- begin
|
|
|
|
- if El.Visibility=visStrictPrivate then
|
|
|
|
- else if (El.Visibility=visPrivate) and (El.GetModule<>Data^.Proc.GetModule) then
|
|
|
|
- else
|
|
|
|
- LogMsg(20171118205344,mtHint,nFunctionHidesIdentifier_NonProc,sFunctionHidesIdentifier,
|
|
|
|
- [GetElementSourcePosStr(El)],Data^.Proc.ProcType);
|
|
|
|
- end;
|
|
|
|
|
|
+ if El.Visibility=visStrictPrivate then
|
|
|
|
+ else if (El.Visibility=visPrivate) and (El.GetModule<>Data^.Proc.GetModule) then
|
|
|
|
+ else
|
|
|
|
+ LogMsg(20171118205344,mtHint,nFunctionHidesIdentifier_NonProc,sFunctionHidesIdentifier,
|
|
|
|
+ [GetElementSourcePosStr(El)],Data^.Proc.ProcType);
|
|
end;
|
|
end;
|
|
- fpkMethod:
|
|
|
|
- // method hides a non proc
|
|
|
|
|
|
+ end;
|
|
|
|
+ fpkMethod:
|
|
|
|
+ // method hides a non proc
|
|
|
|
+ begin
|
|
|
|
+ ProcScope:=TPasProcedureScope(Data^.Proc.CustomData);
|
|
|
|
+ CurResolver:=ProcScope.Owner as TPasResolver;
|
|
|
|
+ if msDelphi in CurResolver.CurrentParser.CurrentModeswitches then
|
|
|
|
+ // ok in delphi
|
|
|
|
+ else
|
|
RaiseMsg(20171118232543,nDuplicateIdentifier,sDuplicateIdentifier,
|
|
RaiseMsg(20171118232543,nDuplicateIdentifier,sDuplicateIdentifier,
|
|
[El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType);
|
|
[El.Name,GetElementSourcePosStr(El)],Data^.Proc.ProcType);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
@@ -4911,8 +4919,12 @@ var
|
|
C: TClass;
|
|
C: TClass;
|
|
i: Integer;
|
|
i: Integer;
|
|
OtherScope: TPasIdentifierScope;
|
|
OtherScope: TPasIdentifierScope;
|
|
|
|
+ IsDelphi: Boolean;
|
|
begin
|
|
begin
|
|
if aName='' then exit(nil);
|
|
if aName='' then exit(nil);
|
|
|
|
+
|
|
|
|
+ IsDelphi:=msDelphi in CurrentParser.CurrentModeswitches;
|
|
|
|
+
|
|
if Scope is TPasGroupScope then
|
|
if Scope is TPasGroupScope then
|
|
begin
|
|
begin
|
|
Group:=TPasGroupScope(Scope);
|
|
Group:=TPasGroupScope(Scope);
|
|
@@ -4932,7 +4944,8 @@ begin
|
|
RaiseMsg(20170403223024,nSymbolCannotBePublished,sSymbolCannotBePublished,[],El);
|
|
RaiseMsg(20170403223024,nSymbolCannotBePublished,sSymbolCannotBePublished,[],El);
|
|
end;
|
|
end;
|
|
|
|
|
|
- if (Kind=pikSimple) and (Group<>nil) and (El.ClassType<>TPasProperty) then
|
|
|
|
|
|
+ if (Kind=pikSimple) and (Group<>nil) and (El.ClassType<>TPasProperty)
|
|
|
|
+ and not IsDelphi then
|
|
begin
|
|
begin
|
|
// check duplicate in ancestors and helpers
|
|
// check duplicate in ancestors and helpers
|
|
for i:=1 to Group.Count-1 do
|
|
for i:=1 to Group.Count-1 do
|