我在Delphi Tokyo第 2版下,我有这个声明:
type
FIRMessagingConnectCompletion = procedure of object;
Run Code Online (Sandbox Code Playgroud)
我会将其标记为已弃用.我试着这样:
type
FIRMessagingConnectCompletion = procedure of object deprecated 'Please listen for the FIRMessagingConnectionStateChangedNotification NSNotification instead.';
Run Code Online (Sandbox Code Playgroud)
但没有错误的工作"E1030 Invalid compiler directive: 'DEPRECATED'"
.我错过了什么?
似乎编译器不允许这样做.但有一个解决方法:
type
TProc = procedure of object;
TProc1 = TProc deprecated 'test';
Run Code Online (Sandbox Code Playgroud)
更新:
正如指出的那样,这个变种会更好
type
__InternalFakeProcType__ = procedure of object;
TProc = __InternalFakeProcType__ deprecated 'test';
Run Code Online (Sandbox Code Playgroud)