Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change access level modifiers #120

Open
angelolloqui opened this issue Jun 19, 2020 · 0 comments
Open

Change access level modifiers #120

angelolloqui opened this issue Jun 19, 2020 · 0 comments

Comments

@angelolloqui
Copy link
Owner

In kotlin, the default access level for classes, members and variables is public, while in Swift is internal. As a result, when transpaling code we should also update the access level accordingly.

This code:


class ImplicitInternalClass {
    private let privateVar: Int = 1
    let implicitInternalVar: Int = 1
    internal let explicitInternalVar: Int = 1

    private class PrivateClass {
        private var privateVar: Int = 1
        var implicitPrivateVar: Int = 1

        class InheritedAccess {
            private var privateVar: Int = 1
            var implicitPrivateVar: Int = 1

            func inheritedAccessFunc() {}
        }

        func inheritedAccessFunc() {}
    }

    func implicitInternalFunc() {}
    internal func internalFunc() {}
    private func privateFunc() {}
}

Should produce

internal class ImplicitInternalClass {
    private val privateVar: Int = 1
    internal val implicitInternalVar: Int = 1
    internal val explicitInternalVar: Int = 1

    private class PrivateClass {
        private var privateVar: Int = 1
        var implicitPrivateVar: Int = 1

        class InheritedAccess {
            private var privateVar: Int = 1
            var implicitPrivateVar: Int = 1

            fun inheritedAccessFunc() {}
        }

        fun inheritedAccessFunc() {}
    }

    internal fun implicitInternalFunc() {}

    internal fun internalFunc() {}

    private fun privateFunc() {}
}
angelolloqui added a commit that referenced this issue Jun 19, 2020
#120 Added access level modifiers and other minor related fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant