mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 14:39:11 +02: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
|
||||
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
|
||||
Params.Free;
|
||||
DeactivateGlobalWriteLock;
|
||||
@ -1668,6 +1678,15 @@ var
|
||||
// check for semicolon at end of statement
|
||||
MoveCursorToCleanPos(UserEventAtom.EndPos);
|
||||
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
|
||||
SemicolonPos:=CurPos.StartPos
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user