CodeTools: Complete local var with full qualification if type name conflicts. Issue , patch from Anton

git-svn-id: trunk@40992 -
This commit is contained in:
juha 2013-05-02 09:11:10 +00:00
parent c8323bd08e
commit 32b591a40e

View File

@ -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