Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

[SoM] Binding importer needs a mapping step #93

Open
stephen-hawley opened this issue Dec 18, 2018 · 0 comments
Open

[SoM] Binding importer needs a mapping step #93

stephen-hawley opened this issue Dec 18, 2018 · 0 comments
Milestone

Comments

@stephen-hawley
Copy link
Contributor

Right now there are a number of protocols that are being remapped by hand.
I fully expect that there will be a number that we are incorrectly mapping because apple decided to change the name in swift.

To address this, I think that there needs to be a subsystem that takes an input file with the form:

<remap>
    <entityNameRule platform="" entityType="" csFullName="" swiftModuleName="" swiftName=""/>
    <methodNameRule platform="" entityType="" csFullName="" csMethodName="" swiftName=""/>
    <methodParameterRule platform="" entityType="" csFullName="" csMethodName="">
        <parameter csName="" swiftName="" swiftTypeSpec="" isInOut=""/>
    </methodParameterRule>
</remap>

entityType would be one of Class, Struct, Protocol, Enum
platform would be one of iOS, macOS, tvOS, watchOS, * (or empty)
Each rule would match on an entity type for the given platform and match of the full C# name present.
Each matching rule would project the changes onto those entities.

When rules are read in, they can be put into separate containers based on entity type. This will likely speed up mapping since there are likely to be fewer class rules than protocol rules.

The mapping function should be something like:
T RemapDeclaration<T> (T declaration) where T : BaseDeclaration
It would return the original if it doesn't change. If supplied null, it would return null. If remapped it would return a new instance with the changes.

@stephen-hawley stephen-hawley transferred this issue from another repository Oct 29, 2019
@chamons chamons added this to the Future milestone Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants