From 696ae12a21aa52b5a49a3cd897786842009dc32f Mon Sep 17 00:00:00 2001 From: ondrej Date: Wed, 20 Jan 2016 13:50:12 +0000 Subject: [PATCH] codetools: add Default compiler magic git-svn-id: trunk@51353 - --- components/codetools/finddeclarationtool.pas | 6 ++++-- components/codetools/identcompletiontool.pas | 2 ++ components/codetools/keywordfunclists.pas | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 73fa288642..33a46d04ce 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -9470,8 +9470,10 @@ begin exit; ParamList:=CreateParamExprListFromStatement(CurPos.StartPos,Params); if (CompareIdentifiers(IdentPos,'PREC')=0) - or (CompareIdentifiers(IdentPos,'SUCC')=0) then begin - // the PREC and SUCC of a expression has the same type as the expression + or (CompareIdentifiers(IdentPos,'SUCC')=0) + or (CompareIdentifiers(IdentPos,'DEFAULT')=0) + then begin + // the DEFAULT, PREC and SUCC of a expression has the same type as the expression if ParamList.Count<>1 then exit; Result:=ParamList.Items[0]; end diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 12b18c72a9..6d4f093f24 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -1383,6 +1383,7 @@ begin AddCompilerProcedure('Continue',''); AddCompilerFunction('Copy','const S:String;FromPosition,Count:Integer', 'String'); AddCompilerProcedure('Dec','var X:Ordinal;N:Integer=1'); + AddCompilerFunction('Default','T:Type','const'); AddCompilerProcedure('Dispose','var X:Pointer'); AddCompilerProcedure('Exclude','var S:Set;X:Ordinal'); AddCompilerProcedure('Exit',''); @@ -2911,6 +2912,7 @@ var AddCompilerProc('Concat','S1:String;S2:String[...;Sn:String]', 'String'); AddCompilerProc('Copy','const S:String;FromPosition,Count:Integer', 'String'); AddCompilerProc('Dec','var X:Ordinal;N:Integer=1'); + AddCompilerProc('Default','T:Type','const'); AddCompilerProc('Dispose','var X:Pointer'); AddCompilerProc('Exclude','var S:Set;X:Ordinal'); AddCompilerProc('Exit','ResultValue:Ordinal=Result'); diff --git a/components/codetools/keywordfunclists.pas b/components/codetools/keywordfunclists.pas index a27051872e..bd9b7e0841 100644 --- a/components/codetools/keywordfunclists.pas +++ b/components/codetools/keywordfunclists.pas @@ -1245,6 +1245,7 @@ begin Add('SETLENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('INC' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('DEC' ,{$ifdef FPC}@{$endif}AllwaysTrue); + Add('DEFAULT' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('INITIALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('FINALIZE' ,{$ifdef FPC}@{$endif}AllwaysTrue); Add('COPY' ,{$ifdef FPC}@{$endif}AllwaysTrue);