mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-08 21:39:31 +01:00
CodeTools: Complete local var with full qualification if type name conflicts. Issue #17777, patch from Anton
git-svn-id: trunk@40992 -
This commit is contained in:
parent
c8323bd08e
commit
32b591a40e
@ -1600,6 +1600,16 @@ begin
|
|||||||
if NewType='' then
|
if NewType='' then
|
||||||
RaiseException('CompleteLocalVariableAssignment Internal error: NewType=""');
|
RaiseException('CompleteLocalVariableAssignment Internal error: NewType=""');
|
||||||
|
|
||||||
|
// check if there is another NewType in context of CursorNode
|
||||||
|
if (ExprType.Desc = xtContext) and (ExprType.Context.Tool <> nil) then
|
||||||
|
begin
|
||||||
|
Params.SetIdentifier(Self, PChar(NewType), nil);
|
||||||
|
Params.ContextNode := CursorNode;
|
||||||
|
Params.Flags := [fdfSearchInAncestors..fdfIgnoreCurContextNode];
|
||||||
|
if FindIdentifierInContext(Params)
|
||||||
|
and (Params.NewNode <> ExprType.Context.Node.Parent) then
|
||||||
|
NewType := ExprType.Context.Tool.ExtractSourceName + '.' + NewType;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
Params.Free;
|
Params.Free;
|
||||||
DeactivateGlobalWriteLock;
|
DeactivateGlobalWriteLock;
|
||||||
@ -1668,6 +1678,15 @@ var
|
|||||||
// check for semicolon at end of statement
|
// check for semicolon at end of statement
|
||||||
MoveCursorToCleanPos(UserEventAtom.EndPos);
|
MoveCursorToCleanPos(UserEventAtom.EndPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
if CurPos.Flag = cafRoundBracketOpen then
|
||||||
|
if Scanner.CompilerMode <> cmDELPHI then
|
||||||
|
Exit // indeed it is assignment to function, e.g. x:=sin(y);
|
||||||
|
else begin
|
||||||
|
ReadNextAtom;
|
||||||
|
if CurPos.Flag <> cafRoundBracketClose then
|
||||||
|
Exit; // in Delhi mode empty brackets are allowed after method: OnClick:=FormCreate();
|
||||||
|
ReadNextAtom;
|
||||||
|
end;
|
||||||
if AtomIsChar(';') then
|
if AtomIsChar(';') then
|
||||||
SemicolonPos:=CurPos.StartPos
|
SemicolonPos:=CurPos.StartPos
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user