vinivendra / Gryphon

The Swift to Kotlin translator.
https://vinivendra.github.io/Gryphon/
Other
609 stars 46 forks source link

Support protocol inheritance #88

Open vinivendra opened 4 years ago

vinivendra commented 4 years ago

Kotlin, like Swift, supports protocol inheritance. It would be useful to analyze and compare the feature in the two languages and see which cases can be translated correctly.

rlinoz commented 3 years ago

I am needing this feature, so I guess I could help, if you give me an idea from where to start

vinivendra commented 3 years ago

Hi! I took a look at this today and it doesn't look like it's gonna cause many problems. The implementation should be pretty simple. Maybe something like:

  1. Add an inheritances property to the ProtocolDeclaration class (like the one we have in ClassDeclaration).
  2. Put the inherited protocols in the property in both SwiftSyntaxDecoder.swift and SwiftTranslator.swift (again, just like with ClassDeclaration).
  3. Fix any build errors that show up in TranspilationPass.swift.
  4. Add the inheritances to the Kotlin code in KotlinTranslator.swift.

If you want to try an implementation, go ahead! If you have any problems, just let me know. Otherwise, I may be able to do this next weekend. Feel free to ping me if I forget.