📄 testlocaltypes.out
字号:
unit TestLocalTypes;
{ AFS 9 March 2K test local types
This code compiles, but is not semantically meaningfull.
It is test cases for the code-formating utility
procedure-local types are an obscure piece of legacy syntax
that I would not reccomend to anyone
}
interface
implementation
uses Dialogs;
procedure Fred;
type
TFred = integer;
const
FRED = 'hello wold';
var
li: TFred;
begin
ShowMessage('Fred was here');
end;
procedure Jim;
type
TGoon = (NedSeagoon, Eccles, Bluebottle, HenryCrun, Bloodnok);
TGoons = set of TGoon;
pTGoon = ^TGoon;
pGoonProc = function: TGoon of object;
const
Protagonist: TGoon = NedSeagoon;
begin
ShowMessage('Allo Jiim');
end;
procedure ClasslessSociety;
type
//TThing = class;
{ this does not compile - it gives
"error 62. Local class or object types not allowed
The solution is to move out the declaration of the class or object type to the global scope."
Thanks for *some* sanity. One could apply that comment to all procedure-local types
}
Tbub = boolean;
TFredsNumbers = 42..122;
var
liWhatFredHas: TFredsNumbers;
begin
end;
procedure HasRecords;
type
TFoo = record
liBar: integer;
liBaz: string;
end;
TFoo2 = record
Bar: integer;
case Spon: boolean of
True: (Baz: PChar);
False: (Fred: integer);
end;
begin
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -