mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 21:55:56 +02:00
MG: fixed SearchFileInPath
git-svn-id: trunk@1583 -
This commit is contained in:
parent
73ee86def0
commit
074a94475e
@ -32,6 +32,7 @@
|
|||||||
- 'inherited'
|
- 'inherited'
|
||||||
- variants
|
- variants
|
||||||
- array of const
|
- array of const
|
||||||
|
- open arrays
|
||||||
- interfaces
|
- interfaces
|
||||||
- Get and Set property access parameter lists
|
- Get and Set property access parameter lists
|
||||||
- ignore error after cursor position
|
- ignore error after cursor position
|
||||||
@ -593,6 +594,25 @@ begin
|
|||||||
if CursorNode.Desc=ctnProcedure then begin
|
if CursorNode.Desc=ctnProcedure then begin
|
||||||
BuildSubTreeForProcHead(CursorNode);
|
BuildSubTreeForProcHead(CursorNode);
|
||||||
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||||
|
// check if cursor on proc name
|
||||||
|
if (CursorNode.Desc=ctnProcedureHead)
|
||||||
|
and (CleanCursorPos>CursorNode.StartPos) then begin
|
||||||
|
MoveCursorToNodeStart(CursorNode);
|
||||||
|
ReadNextAtom;
|
||||||
|
if AtomIsIdentifier(false) then begin
|
||||||
|
ReadNextAtom;
|
||||||
|
if AtomIsChar('.') then begin
|
||||||
|
ReadNextAtom;
|
||||||
|
ReadNextAtom;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if CurPos.StartPos>CleanCursorPos then
|
||||||
|
// cursor on proc name
|
||||||
|
// -> ignore proc name and search overloaded identifier
|
||||||
|
SearchAlsoInCurContext:=false;
|
||||||
|
end;
|
||||||
|
if CursorNode.Desc=ctnProcedureHead then
|
||||||
|
CursorNode:=CursorNode.Parent;
|
||||||
end;
|
end;
|
||||||
MoveCursorToCleanPos(CleanCursorPos);
|
MoveCursorToCleanPos(CleanCursorPos);
|
||||||
while (CurPos.StartPos>1) and (IsIdentChar[Src[CurPos.StartPos-1]]) do
|
while (CurPos.StartPos>1) and (IsIdentChar[Src[CurPos.StartPos-1]]) do
|
||||||
@ -3945,6 +3965,8 @@ end;
|
|||||||
function TFindDeclarationTool.IsCompatible(TargetType,
|
function TFindDeclarationTool.IsCompatible(TargetType,
|
||||||
ExpressionType: TExpressionType; Params: TFindDeclarationParams
|
ExpressionType: TExpressionType; Params: TFindDeclarationParams
|
||||||
): TTypeCompatibility;
|
): TTypeCompatibility;
|
||||||
|
// can ExpressionType be assigned to TargetType
|
||||||
|
var TargetNode, ExprNode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
{$IFDEF ShowExprEval}
|
{$IFDEF ShowExprEval}
|
||||||
writeln('[TFindDeclarationTool.IsCompatible] B ',
|
writeln('[TFindDeclarationTool.IsCompatible] B ',
|
||||||
@ -3952,9 +3974,39 @@ begin
|
|||||||
' ExpressionType=',ExpressionTypeDescNames[ExpressionType.Desc]);
|
' ExpressionType=',ExpressionTypeDescNames[ExpressionType.Desc]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=tcIncompatible;
|
Result:=tcIncompatible;
|
||||||
if (TargetType.Desc=ExpressionType.Desc)
|
if (TargetType.Desc=ExpressionType.Desc) then begin
|
||||||
and (not (TargetType.Desc in [xtNone,xtContext])) then begin
|
case TargetType.Desc of
|
||||||
Result:=tcExact;
|
xtNone: ;
|
||||||
|
xtContext:
|
||||||
|
begin
|
||||||
|
TargetNode:=TargetType.Context.Node;
|
||||||
|
ExprNode:=ExpressionType.Context.Node;
|
||||||
|
if ExprNode.Desc=TargetNode.Desc then begin
|
||||||
|
// same context type
|
||||||
|
case ExprNode.Desc of
|
||||||
|
|
||||||
|
ctnClass:
|
||||||
|
// check, if ExpressionType.Context is descend of TargetContext
|
||||||
|
if ContextIsDescendOf(ExpressionType.Context,
|
||||||
|
TargetType.Context,Params)
|
||||||
|
then
|
||||||
|
Result:=tcCompatible;
|
||||||
|
|
||||||
|
ctnArrayType:
|
||||||
|
// check if
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// different context type
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
Result:=tcExact;
|
||||||
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
// check, if ExpressionType can be auto converted into TargetType
|
// check, if ExpressionType can be auto converted into TargetType
|
||||||
if ((TargetType.Desc in xtAllRealTypes)
|
if ((TargetType.Desc in xtAllRealTypes)
|
||||||
@ -3967,18 +4019,14 @@ begin
|
|||||||
and (ExpressionType.Desc in xtAllBooleanConvertibles))
|
and (ExpressionType.Desc in xtAllBooleanConvertibles))
|
||||||
or ((TargetType.Desc in xtAllPointerTypes)
|
or ((TargetType.Desc in xtAllPointerTypes)
|
||||||
and (ExpressionType.Desc in xtAllPointerConvertibles))
|
and (ExpressionType.Desc in xtAllPointerConvertibles))
|
||||||
or ((TargetType.Desc=xtContext)
|
|
||||||
and (TargetType.Context.Node.Desc in [ctnClass,ctnProcedure])
|
|
||||||
and (ExpressionType.Desc=xtNil))
|
|
||||||
then
|
then
|
||||||
Result:=tcCompatible
|
Result:=tcCompatible
|
||||||
else if (ExpressionType.Desc=xtContext) then begin
|
else if (TargetType.Desc=xtContext) then begin
|
||||||
if ExpressionType.Context.Node.Desc=ctnClass then begin
|
if (TargetType.Context.Node.Desc in [ctnClass,ctnProcedure])
|
||||||
// check, if ExpressionType.Context is descend of FindContext
|
and (ExpressionType.Desc=xtNil)
|
||||||
if ContextIsDescendOf(ExpressionType.Context,TargetType.Context,Params)
|
//or (TargetType.Context.Node.Desc=ctnA)
|
||||||
then
|
then
|
||||||
Result:=tcCompatible;
|
Result:=tcCompatible
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
* *
|
* *
|
||||||
* This unit is an altered heaptrc.pp from the fpc sources *
|
* This unit is an altered heaptrc.pp from the fpc sources *
|
||||||
* *
|
* *
|
||||||
|
* The only change are the 2 procs CheckHeap *
|
||||||
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
}
|
}
|
||||||
unit MemCheck;
|
unit MemCheck;
|
||||||
|
@ -293,7 +293,7 @@ begin
|
|||||||
// check if filename absolute
|
// check if filename absolute
|
||||||
if FilenameIsAbsolute(Filename) then begin
|
if FilenameIsAbsolute(Filename) then begin
|
||||||
if FileExists(Filename) then begin
|
if FileExists(Filename) then begin
|
||||||
Result:=Filename;
|
Result:=ExpandFilename(Filename);
|
||||||
exit;
|
exit;
|
||||||
end else begin
|
end else begin
|
||||||
Result:='';
|
Result:='';
|
||||||
|
Loading…
Reference in New Issue
Block a user