|
@@ -1443,7 +1443,7 @@ type
|
|
FindProcData: Pointer; var Abort: boolean); virtual;
|
|
FindProcData: Pointer; var Abort: boolean); virtual;
|
|
function IsSameProcContext(ProcParentA, ProcParentB: TPasElement): boolean;
|
|
function IsSameProcContext(ProcParentA, ProcParentB: TPasElement): boolean;
|
|
function FindProcSameSignature(const ProcName: string; Proc: TPasProcedure;
|
|
function FindProcSameSignature(const ProcName: string; Proc: TPasProcedure;
|
|
- Scope: TPasScope): TPasProcedure;
|
|
|
|
|
|
+ Scope: TPasIdentifierScope; OnlyLocal: boolean): TPasProcedure;
|
|
protected
|
|
protected
|
|
procedure SetCurrentParser(AValue: TPasParser); override;
|
|
procedure SetCurrentParser(AValue: TPasParser); override;
|
|
procedure ScannerWarnDirective(Sender: TObject; Identifier: string;
|
|
procedure ScannerWarnDirective(Sender: TObject; Identifier: string;
|
|
@@ -4871,7 +4871,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TPasResolver.FindProcSameSignature(const ProcName: string;
|
|
function TPasResolver.FindProcSameSignature(const ProcName: string;
|
|
- Proc: TPasProcedure; Scope: TPasScope): TPasProcedure;
|
|
|
|
|
|
+ Proc: TPasProcedure; Scope: TPasIdentifierScope; OnlyLocal: boolean
|
|
|
|
+ ): TPasProcedure;
|
|
var
|
|
var
|
|
FindData: TFindProcData;
|
|
FindData: TFindProcData;
|
|
Abort: boolean;
|
|
Abort: boolean;
|
|
@@ -4881,7 +4882,10 @@ begin
|
|
FindData.Args:=Proc.ProcType.Args;
|
|
FindData.Args:=Proc.ProcType.Args;
|
|
FindData.Kind:=fpkSameSignature;
|
|
FindData.Kind:=fpkSameSignature;
|
|
Abort:=false;
|
|
Abort:=false;
|
|
- Scope.IterateElements(ProcName,Scope,@OnFindProc,@FindData,Abort);
|
|
|
|
|
|
+ if OnlyLocal then
|
|
|
|
+ Scope.IterateLocalElements(ProcName,Scope,@OnFindProc,@FindData,Abort)
|
|
|
|
+ else
|
|
|
|
+ Scope.IterateElements(ProcName,Scope,@OnFindProc,@FindData,Abort);
|
|
Result:=FindData.Found;
|
|
Result:=FindData.Found;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -5860,7 +5864,7 @@ var
|
|
DeclProc, Proc, ParentProc: TPasProcedure;
|
|
DeclProc, Proc, ParentProc: TPasProcedure;
|
|
Abort, HasDots, IsClassConDestructor: boolean;
|
|
Abort, HasDots, IsClassConDestructor: boolean;
|
|
DeclProcScope, ProcScope: TPasProcedureScope;
|
|
DeclProcScope, ProcScope: TPasProcedureScope;
|
|
- ParentScope: TPasScope;
|
|
|
|
|
|
+ ParentScope: TPasIdentifierScope;
|
|
pm: TProcedureModifier;
|
|
pm: TProcedureModifier;
|
|
ptm: TProcTypeModifier;
|
|
ptm: TProcTypeModifier;
|
|
ObjKind: TPasObjKind;
|
|
ObjKind: TPasObjKind;
|
|
@@ -6100,13 +6104,15 @@ begin
|
|
if (ProcName<>'') and ProcNeedsBody(Proc) then
|
|
if (ProcName<>'') and ProcNeedsBody(Proc) then
|
|
begin
|
|
begin
|
|
// check if there is a forward declaration
|
|
// check if there is a forward declaration
|
|
- ParentScope:=GetParentLocalScope;
|
|
|
|
|
|
+ //writeln('TPasResolver.FinishProcedureType ',GetObjName(TopScope),' ',GetObjName(Scopes[ScopeCount-2]));
|
|
|
|
+ ParentScope:=GetParentLocalScope as TPasIdentifierScope;
|
|
//writeln('TPasResolver.FinishProcedureType FindForward2 ParentScope=',GetObjName(ParentScope),'=',GetObjName(ParentScope.Element),' Proc=',GetObjName(Proc),' at ',GetElementSourcePosStr(Proc));
|
|
//writeln('TPasResolver.FinishProcedureType FindForward2 ParentScope=',GetObjName(ParentScope),'=',GetObjName(ParentScope.Element),' Proc=',GetObjName(Proc),' at ',GetElementSourcePosStr(Proc));
|
|
- DeclProc:=FindProcSameSignature(ProcName,Proc,ParentScope);
|
|
|
|
|
|
+ DeclProc:=FindProcSameSignature(ProcName,Proc,ParentScope,true);
|
|
//writeln('TPasResolver.FinishProcedureType FindForward3 DeclProc=',GetObjName(DeclProc),' Proc.Parent=',GetObjName(Proc.Parent));
|
|
//writeln('TPasResolver.FinishProcedureType FindForward3 DeclProc=',GetObjName(DeclProc),' Proc.Parent=',GetObjName(Proc.Parent));
|
|
|
|
+ //if DeclProc<>nil then writeln('TPasResolver.FinishProcedureType DeclProc at ',GetElementSourcePosStr(DeclProc));
|
|
if (DeclProc=nil) and (Proc.Parent.ClassType=TImplementationSection) then
|
|
if (DeclProc=nil) and (Proc.Parent.ClassType=TImplementationSection) then
|
|
DeclProc:=FindProcSameSignature(ProcName,Proc,
|
|
DeclProc:=FindProcSameSignature(ProcName,Proc,
|
|
- (Proc.GetModule.InterfaceSection.CustomData) as TPasScope);
|
|
|
|
|
|
+ (Proc.GetModule.InterfaceSection.CustomData) as TPasIdentifierScope,true);
|
|
//writeln('TPasResolver.FinishProcedureType FindForward4 ',GetObjName(DeclProc),' at ',GetElementSourcePosStr(DeclProc));
|
|
//writeln('TPasResolver.FinishProcedureType FindForward4 ',GetObjName(DeclProc),' at ',GetElementSourcePosStr(DeclProc));
|
|
if (DeclProc<>nil) then
|
|
if (DeclProc<>nil) then
|
|
begin
|
|
begin
|
|
@@ -6333,7 +6339,7 @@ begin
|
|
else if ImplProc.ClassType=TPasClassDestructor then
|
|
else if ImplProc.ClassType=TPasClassDestructor then
|
|
DeclProc:=ClassOrRecScope.ClassDestructor
|
|
DeclProc:=ClassOrRecScope.ClassDestructor
|
|
else
|
|
else
|
|
- DeclProc:=FindProcSameSignature(ProcName,ImplProc,ClassOrRecScope);
|
|
|
|
|
|
+ DeclProc:=FindProcSameSignature(ProcName,ImplProc,ClassOrRecScope,false);
|
|
if DeclProc=nil then
|
|
if DeclProc=nil then
|
|
RaiseIdentifierNotFound(20170216151720,ImplProc.Name,ImplProc.ProcType);
|
|
RaiseIdentifierNotFound(20170216151720,ImplProc.Name,ImplProc.ProcType);
|
|
DeclProcScope:=DeclProc.CustomData as TPasProcedureScope;
|
|
DeclProcScope:=DeclProc.CustomData as TPasProcedureScope;
|
|
@@ -9004,7 +9010,7 @@ begin
|
|
exit;
|
|
exit;
|
|
InhScope:=PushInheritedScope(TPasMembersType(AncestorScope.Element),true,nil);
|
|
InhScope:=PushInheritedScope(TPasMembersType(AncestorScope.Element),true,nil);
|
|
end;
|
|
end;
|
|
- AncestorProc:=FindProcSameSignature(DeclProc.Name,DeclProc,InhScope);
|
|
|
|
|
|
+ AncestorProc:=FindProcSameSignature(DeclProc.Name,DeclProc,InhScope,false);
|
|
PopScope;
|
|
PopScope;
|
|
if AncestorProc=nil then
|
|
if AncestorProc=nil then
|
|
// 'inherited;' without ancestor DeclProc is silently ignored
|
|
// 'inherited;' without ancestor DeclProc is silently ignored
|