codetools: identifier completion: compiler function objselector, find predefined identifier

git-svn-id: trunk@21686 -
This commit is contained in:
mattias 2009-09-13 14:06:03 +00:00
parent 60784ed8aa
commit c286c1ba10
3 changed files with 50 additions and 29 deletions

View File

@ -5036,6 +5036,7 @@ function TFindDeclarationTool.FindExpressionResultType(
uniquestring?
procedure include(set type,enum identifier);
procedure exclude(set type,enum identifier);
function objcselector(string): sel;
}
type
TOperandAndOperator = record
@ -6916,8 +6917,9 @@ var
IdentPos: PChar;
ParamList: TExprTypeList;
ParamNode: TCodeTreeNode;
SubParams: TFindDeclarationParams;
NewTool: TFindDeclarationTool;
begin
Result:=CleanExpressionType;
IdentPos:=@Src[StartPos];
Result.Desc:=PredefinedIdentToExprTypeDesc(IdentPos);
@ -6997,6 +6999,23 @@ begin
if (ParamList.Count<>3) or (Scanner.Values.IsDefined('VER1_0')) then
exit;
Result.Desc:=xtString;
end
else if (CompareIdentifiers(IdentPos,'OBJCSELECTOR')=0) then
begin
// return type is System.SEL
NewTool:=FindCodeToolForUsedUnit('system','',true);
if NewTool=nil then exit;
SubParams:=TFindDeclarationParams.Create;
try
SubParams.Identifier:='SEL'#0;
if (not NewTool.FindIdentifierInInterface(Self,SubParams))
or (SubParams.NewNode=nil) then exit;
Result.Desc:=xtContext;
Result.Context.Node:=SubParams.NewNode;
Result.Context.Tool:=SubParams.NewCodeTool;
finally
SubParams.Free;
end;
end;
end;

View File

@ -1170,6 +1170,7 @@ begin
AddCompilerFunction('Length','A:Array','Ordinal');
AddCompilerFunction('Low','Arg:TypeOrVariable','Ordinal');
AddCompilerProcedure('New','var X:Pointer');
AddCompilerFunction('ObjCSelector','String','SEL');
AddCompilerFunction('Ofs','var X','LongInt');
AddCompilerFunction('Ord','X:Ordinal', 'Integer');
AddCompilerProcedure('Pack','A:Array;N:Integer;var A:Array');

View File

@ -1041,34 +1041,35 @@ begin
IsWordBuiltInFunc:=TKeyWordFunctionList.Create;
KeyWordLists.Add(IsWordBuiltInFunc);
with IsWordBuiltInFunc do begin
Add('LOW' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('HIGH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LO' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('HI' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ORD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PRED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SUCC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SETLENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DEC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INITIALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FINALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('COPY' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SIZEOF' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WRITE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WRITELN' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('READ' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('READLN' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('TYPEOF' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ASSIGNED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INCLUDE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXCLUDE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXIT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('BREAK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CONTINUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('NEW' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DISPOSE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LOW' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('HIGH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LO' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('HI' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ORD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PRED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SUCC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SETLENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DEC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INITIALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FINALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('COPY' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SIZEOF' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WRITE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WRITELN' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('READ' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('READLN' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('TYPEOF' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ASSIGNED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INCLUDE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXCLUDE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXIT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('BREAK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CONTINUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('NEW' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DISPOSE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('OBJCSELECTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsTermOperator:=TKeyWordFunctionList.Create;