Как пометить как устаревшее единственное значение перечисления в Delphi - PullRequest
18 голосов
/ 24 февраля 2012

Я хочу получить следующее:

TEnumType = (
  etValue1 = 1,
  etValue2 = 2 deprecated,
  etValue3 = 3);

Возвращает:

[DCC Error] unt_CollectionImportType.pas(19): E2029 ',' or ')' expected 
but identifier 'deprecated' found.

Есть ли способ указать компилятору, что это значение устарело.

1 Ответ

36 голосов
/ 24 февраля 2012
type
  TEnumType = (
    etValue1 = 1,
    etDeprecated2 = 2, // was: etValue2; Renamed so we can deprecate it by name
    etValue3 = 3);

const
   etValue2 = etDeprecated2 deprecated; // Declares a constant mapped to the renamed enum value.
...