Handle declarations of deprecated Objective-C "Enumeration Case" values

Description

  1. In https://swiftify.atlassian.net/browse/SWC-716, you have removed many declarations like `NSControlCharacterZeroAdvancementAction`.

In Apple Help, we see the following:

https://take.ms/hQkdw

Optimally, this should make `NSControlCharacterZeroAdvancementAction` map to the same value as `NSControlCharacterActionZeroAdvancement`.

That is, in addition to this existing line in EnumMappings.def:

generate the following:

2. Another similar case (but this declaration is not mapped as deprecated).

NSLayoutFormatAlignAllBaselineshould be optimally mapped to the same value as NSLayoutFormatAlignAllLastBaselineand produce the following:

3. NSPropertyListImmutableis mapped to kCFPropertyListImmutable.

kCFPropertyListImmutable is mapped to 0, and listed as “Enumeration Case“.

Thus, we should produce the following lines:

kCFPropertyListImmutable=[] -> PropertyListSerialization.MutabilityOptions

NSPropertyListImmutable=[] -> PropertyListSerialization.MutabilityOptions

Note that the type name in the r-value should be translated from NSPropertyListMutabilityOptionsto PropertyListSerialization.MutabilityOptions.

Environment

None

Activity

Show:
Vadim Vorotilin
July 25, 2020, 5:53 AM

I’ve created experimental code as a result of the investigation and committed it here:
But honestly, I don’t think this is the way to go as it took me about an hour to generate the mappings, as opposed to a few minutes that it took previously.

Alex Petuschak
August 5, 2020, 1:11 PM
Edited

Just looked at the resulting EnumMappings.def:

NSControlCharacterZeroAdvancementAction, NSLayoutFormatAlignAllBaseline, NSPropertyListImmutableare missing.

The translation of kCFPropertyListImmutable is incorrect:

… but should be:

kCFPropertyListImmutable=[] -> PropertyListSerialization.MutabilityOptions.

 

Looking at newly added entries,

kBluetoothL2CAPSupervisoryFuctionTypeSelectiveReject=[] -> BluetoothL2CAPSupervisoryFuctionType

looks just wrong, since the value is 0x3 according to Apple Help:

https://take.ms/Slqmy

Alex Petuschak
August 5, 2020, 1:14 PM

P.S. For records, I’m copying the code you’ve added (to EnumBuilder.cs) in the PR since we won’t likely merge it:

https://take.ms/Ninwm

Assignee

Vadim Vorotilin

Reporter

Alex Petuschak

Labels

None

GitHub Issue

None

Components

Fix versions

Priority

Low
Configure