codetools: code completion: add proc for procvar: fixed reference-to

git-svn-id: trunk@54692 -
This commit is contained in:
mattias 2017-04-22 18:10:28 +00:00
parent 3ca49ceb2b
commit e96ede4637
4 changed files with 13 additions and 2 deletions

View File

@ -1550,6 +1550,8 @@ begin
MethodDefinition:=TrimCodeSpace(
ProcContext.Tool.ExtractProcHead(ProcContext.Node,
MethodAttr+[phpWithoutClassName,phpWithoutName]));
if MethodDefinition='' then
RaiseException(20170422200434,'unknown proctype '+ProcContext.Node.DescAsString);
MethodDefinition:=Beauty.AddClassAndNameToProc(MethodDefinition, '', NewProcName);
debugln(['TCodeCompletionCodeTool.AddProcedureCompatibleToProcType MethodDefinition="',MethodDefinition,'"']);
@ -2210,7 +2212,8 @@ begin
Params);
if not Result then exit;
if ProcContext.Tool.ProcNodeHasOfObject(ProcContext.Node) then begin
if ((AClassNode<>nil) and (ProcContext.Node.Desc=ctnReferenceTo))
or ProcContext.Tool.ProcNodeHasOfObject(ProcContext.Node) then begin
if AClassNode<>nil then begin
{$IFDEF VerboseCompleteEventAssign}
DebugLn(' CompleteEventAssignment: CreateEventFullName... UserEventAtom.StartPos=',dbgs(UserEventAtom.StartPos));

View File

@ -4657,7 +4657,8 @@ end;
function TPascalParserTool.KeyWordFuncTypeReferenceTo: boolean;
begin
if cmsBlocks in Scanner.CompilerModeSwitches then begin
if (cmsBlocks in Scanner.CompilerModeSwitches)
or (Scanner.PascalCompiler=pcPas2js) then begin
CreateChildNode;
CurNode.Desc:=ctnReferenceTo;
if not ReadNextUpAtomIs('TO') then

View File

@ -613,6 +613,10 @@ begin
ProcNode:=ProcNode.Parent;
if ProcNode=nil then exit;
end;
if ProcNode.Desc=ctnReferenceTo then begin
ProcNode:=ProcNode.FirstChild;
if ProcNode=nil then exit;
end;
if ProcNode.Desc=ctnProcedure then
IsProcType:=false
else if ProcNode.Desc=ctnProcedureType then

View File

@ -1896,6 +1896,9 @@ var
Level: Integer;
begin
Result:='';
{$IFDEF VerboseAddClassAndNameToProc}
debugln(['TBeautifyCodeOptions.AddClassAndNameToProc AProcCode="',AProcCode,'" AClassName="',AClassName,'" AMethodName="',AMethodName,'"']);
{$ENDIF}
p:=1;
ProcLen:=length(AProcCode);
// read proc keyword 'procedure', 'function', ...