codetools: fixed parsing paremeter type array of const, bug #14247

git-svn-id: trunk@21072 -
This commit is contained in:
mattias 2009-08-02 16:16:15 +00:00
parent 1402a46c56
commit 6a4ad23422
2 changed files with 18 additions and 21 deletions

View File

@ -2048,7 +2048,7 @@ var
VarNameAtom, ProcNameAtom, ParameterIndex)
then begin
if VarNameAtom.StartPos=0 then ;
DebugLn(['TIdentCompletionTool.FindCodeContext.CheckContextIsParameter not in a parameter list']);
//DebugLn(['TIdentCompletionTool.FindCodeContext.CheckContextIsParameter not in a parameter list']);
exit;
end;
//DebugLn('CheckContextIsParameter Variable=',GetAtom(VarNameAtom),' Proc=',GetAtom(ProcNameAtom),' ParameterIndex=',dbgs(ParameterIndex));
@ -2115,7 +2115,7 @@ begin
if CursorNode<>nil then begin
if not CheckContextIsParameter(Result) then begin
DebugLn(['TIdentCompletionTool.FindCodeContext cursor not at parameter']);
//DebugLn(['TIdentCompletionTool.FindCodeContext cursor not at parameter']);
exit;
end;
end;

View File

@ -1183,7 +1183,7 @@ var CloseBracket: char;
procedure ReadPrefixModifier;
begin
// read parameter prefix modifier
if (UpAtomIs('VAR')) or (UpAtomIs('CONST'))
if UpAtomIs('VAR') or UpAtomIs('CONST')
or (UpAtomIs('OUT') and (Scanner.CompilerMode in [cmOBJFPC,cmDELPHI,cmFPC]))
then begin
Desc:=ctnVarDefinition;
@ -1288,7 +1288,9 @@ begin
// read default value
ReadDefaultValue;
end;
end else begin
end else if (CurPos.Flag in [cafSemicolon,cafRoundBracketClose,
cafEdgedBracketClose])
then begin
// no type -> variant
if (phpCreateNodes in Attr) then begin
CreateChildNode;
@ -1296,7 +1298,8 @@ begin
CurNode.EndPos:=CurNode.StartPos;
EndChildNode;
end;
end;
end else
break;
if (phpCreateNodes in Attr) then begin
CurNode.EndPos:=CurPos.EndPos;
EndChildNode;
@ -1340,6 +1343,7 @@ end;
function TPascalParserTool.ReadParamType(ExceptionOnError, Extract: boolean;
const Attr: TProcHeadAttributes): boolean;
// after reading, CurPos is the atom after the type
var
copying: boolean;
IsArrayType: Boolean;
@ -1368,13 +1372,15 @@ begin
if (phpCreateNodes in Attr) then begin
CreateChildNode;
CurNode.Desc:=ctnOfConstType;
end;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if (phpCreateNodes in Attr) then begin
CurNode.EndPos:=CurPos.EndPos;
EndChildNode;
// close ctnOpenArrayType
CurNode.EndPos:=CurPos.EndPos;
EndChildNode;
end;
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
Result:=true;
exit;
end;
@ -1399,21 +1405,12 @@ begin
CurNode.Desc:=ctnIdentifier;
CurNode.EndPos:=CurPos.EndPos;
end;
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if CurPos.Flag=cafPoint then begin
// first identifier was unitname -> read '.' + identifier
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if not AtomIsIdentifier(ExceptionOnError) then exit;
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
end;
if (phpCreateNodes in Attr) then
EndChildNode;