mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:29:25 +02:00
+ add and document a way to hide the generic methods from Lazarus' CodeTools as they don't support them yet
git-svn-id: trunk@37082 -
This commit is contained in:
parent
92caf587f5
commit
ce958cacc4
@ -17,6 +17,22 @@ unit Rtti experimental;
|
||||
{$mode objfpc}{$H+}
|
||||
{$modeswitch advancedrecords}
|
||||
|
||||
{ Note: since the Lazarus IDE is not yet capable of correctly handling generic
|
||||
functions it is best to define a InLazIDE define inside the IDE that disables
|
||||
the generic code for CodeTools. To do this do this:
|
||||
|
||||
- go to Tools -> Codetools Defines Editor
|
||||
- go to Edit -> Insert Node Below -> Define Recurse
|
||||
- enter the following values:
|
||||
Name: InLazIDE
|
||||
Description: Define InLazIDE everywhere
|
||||
Variable: InLazIDE
|
||||
Value from text: 1
|
||||
}
|
||||
{$ifdef InLazIDE}
|
||||
{$define NoGenericMethods}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -73,7 +89,9 @@ type
|
||||
public
|
||||
class function Empty: TValue; static;
|
||||
class procedure Make(ABuffer: pointer; ATypeInfo: PTypeInfo; out result: TValue); static;
|
||||
{$ifndef NoGenericMethods}
|
||||
generic class function From<T>(constref aValue: T): TValue; static; inline;
|
||||
{$endif}
|
||||
function IsArray: boolean; inline;
|
||||
function AsString: string;
|
||||
function AsExtended: Extended;
|
||||
@ -699,10 +717,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ifndef NoGenericMethods}
|
||||
generic class function TValue.From<T>(constref aValue: T): TValue;
|
||||
begin
|
||||
TValue.Make(@aValue, System.TypeInfo(T), Result);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function TValue.GetTypeDataProp: PTypeData;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user