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

#120 Added access level modifiers and other minor related fixes #121

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftKotlinFramework"
BuildableName = "SwiftKotlinFramework"
BlueprintName = "SwiftKotlinFramework"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftKotlinFrameworkTests"
BuildableName = "SwiftKotlinFrameworkTests"
BlueprintName = "SwiftKotlinFrameworkTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftKotlinFrameworkTests"
BuildableName = "SwiftKotlinFrameworkTests"
BlueprintName = "SwiftKotlinFrameworkTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SwiftKotlinFramework"
BuildableName = "SwiftKotlinFramework"
BlueprintName = "SwiftKotlinFramework"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
80 changes: 80 additions & 0 deletions Assets/Tests/KotlinTokenizer/access_control.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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() {}
}

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

internal class InheritedAccess {}

internal fun implicitInternalFunc() {}

internal fun internalFunc() {}

private fun privateFunc() {}

fun publicFunc() {}
}

private class PrivateClass {

class InheritedAccess {}
}

data class publicStruct(
var publicVar: String,
internal var internalVar: String,
private var privateVar: String) {}

internal data class internalStruct(
internal var internalVar: String,
private var privateVar: String) {}

interface publicProtocol {}
enum class publicEnum {
a
}
internal enum class internalEnum {
a
}

internal fun implicitInternalFunc() {
val internalVariable = 1
}

internal fun internalFunc() {
val internalVariable = 1
}

private fun privateFunc() {
val internalVariable = 1
}

fun publicFunc() {
val internalVariable = 1
}
80 changes: 80 additions & 0 deletions Assets/Tests/KotlinTokenizer/access_control.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

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() {}
}

public class PublicClass {
private let privateVar: Int = 1
let implicitInternalVar: Int = 1
internal let explicitInternalVar: Int = 1
public let publicVar: Int = 1

class InheritedAccess {

}

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

private class PrivateClass {
class InheritedAccess {

}
}

public struct publicStruct {
public var publicVar: String
var internalVar: String
private var privateVar: String
}

struct internalStruct {
var internalVar: String
private var privateVar: String
}

public protocol publicProtocol {
}

public enum publicEnum {
case a
}
enum internalEnum {
case a
}

func implicitInternalFunc() {
let internalVariable = 1
}
internal func internalFunc() {
let internalVariable = 1
}
private func privateFunc() {
let internalVariable = 1
}
public func publicFunc() {
let internalVariable = 1
}
10 changes: 5 additions & 5 deletions Assets/Tests/KotlinTokenizer/annotations.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
var completionHandlers: List<() -> Unit> = listOf()
internal var completionHandlers: List<() -> Unit> = listOf()

fun someFunctionWithEscapingClosure(completionHandler: () -> Unit) {
internal fun someFunctionWithEscapingClosure(completionHandler: () -> Unit) {
completionHandlers.append(completionHandler)
}

fun serve(customerProvider: () -> String) {
internal fun serve(customerProvider: () -> String) {
print("Now serving ${customerProvider()}!")
}

fun collectCustomerProviders(customerProvider: () -> String) {
internal fun collectCustomerProviders(customerProvider: () -> String) {
customerProviders.append(customerProvider)
}

fun foo(code: (() -> String)) : String =
internal fun foo(code: (() -> String)) : String =
"foo ${bar(code)}"
35 changes: 21 additions & 14 deletions Assets/Tests/KotlinTokenizer/constructors.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@

open class ClassA {
public constructor() {}

constructor() {}
}

open class ClassB: ClassA {
val message: String
val cause: String
public constructor(message: String, cause: String) : super() {
private val cause: String

constructor(message: String, cause: String) : super() {
this.message = message
this.cause = cause
}

public constructor(cause: String) : this(message = "", cuase = cause) {}

constructor(cause: String) : this(message = "", cuase = cause) {}

private fun privateMethod() {}

internal fun internalMethod() {}

fun implicitInternalMethod()

fun publicMethod() {}
}

open class ClassC: ClassB {
public constructor() : super(message = "message", cause = "cause") {}

constructor() : super(message = "message", cause = "cause") {}
}
val obj1 = ClassA()
val obj2 = ClassB(message = "message", cause = "a cause")
val obj3 = ClassB("a cause")
val obj4 = ClassC()
internal val obj1 = ClassA()
internal val obj2 = ClassB(message = "message", cause = "a cause")
internal val obj3 = ClassB("a cause")
internal val obj4 = ClassC()
9 changes: 7 additions & 2 deletions Assets/Tests/KotlinTokenizer/constructors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ open class ClassA {
}

open class ClassB: ClassA {
let message: String
let cause: String
public let message: String
private let cause: String

public init(message: String, cause: String) {
self.message = message
Expand All @@ -16,6 +16,11 @@ open class ClassB: ClassA {
public convenience init(_ cause: String) {
self.init(message: "", cuase: cause)
}

private func privateMethod() {}
internal func internalMethod() {}
func implicitInternalMethod()
public func publicMethod() {}
}

open class ClassC: ClassB {
Expand Down
Loading