diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SwiftKotlinFramework.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftKotlinFramework.xcscheme
new file mode 100644
index 0000000..61ae3be
--- /dev/null
+++ b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftKotlinFramework.xcscheme
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Assets/Tests/KotlinTokenizer/access_control.kt b/Assets/Tests/KotlinTokenizer/access_control.kt
new file mode 100644
index 0000000..b1e01c3
--- /dev/null
+++ b/Assets/Tests/KotlinTokenizer/access_control.kt
@@ -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
+}
diff --git a/Assets/Tests/KotlinTokenizer/access_control.swift b/Assets/Tests/KotlinTokenizer/access_control.swift
new file mode 100644
index 0000000..6423fcf
--- /dev/null
+++ b/Assets/Tests/KotlinTokenizer/access_control.swift
@@ -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
+}
diff --git a/Assets/Tests/KotlinTokenizer/annotations.kt b/Assets/Tests/KotlinTokenizer/annotations.kt
index 25096fe..33f47dc 100644
--- a/Assets/Tests/KotlinTokenizer/annotations.kt
+++ b/Assets/Tests/KotlinTokenizer/annotations.kt
@@ -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)}"
diff --git a/Assets/Tests/KotlinTokenizer/constructors.kt b/Assets/Tests/KotlinTokenizer/constructors.kt
index 7dd1b87..7e8b0e0 100644
--- a/Assets/Tests/KotlinTokenizer/constructors.kt
+++ b/Assets/Tests/KotlinTokenizer/constructors.kt
@@ -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()
diff --git a/Assets/Tests/KotlinTokenizer/constructors.swift b/Assets/Tests/KotlinTokenizer/constructors.swift
index 8a62684..a43b3d5 100644
--- a/Assets/Tests/KotlinTokenizer/constructors.swift
+++ b/Assets/Tests/KotlinTokenizer/constructors.swift
@@ -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
@@ -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 {
diff --git a/Assets/Tests/KotlinTokenizer/enums.kt b/Assets/Tests/KotlinTokenizer/enums.kt
index b52966b..8e21543 100644
--- a/Assets/Tests/KotlinTokenizer/enums.kt
+++ b/Assets/Tests/KotlinTokenizer/enums.kt
@@ -1,4 +1,4 @@
-enum class CompassPoint {
+internal enum class CompassPoint {
north,
south,
east,
@@ -14,28 +14,28 @@ private enum class Planet {
uranus,
neptune
}
-sealed class Barcode {
+internal sealed class Barcode {
data class upc(val v1: Int, val v2: Int, val v3: Int, val v4: Int) : Barcode()
data class qrCode(val named: String) : Barcode()
object empty : Barcode()
}
-public sealed class SDKException : Error {
+sealed class SDKException : Error {
object notFound : SDKException()
object unauthorized : SDKException()
data class network(val v1: HttpResponse, val v2: Error?) : SDKException()
}
-public enum class PaymentMethodType (val rawValue: String) : Equatable {
+enum class PaymentMethodType (val rawValue: String) : Equatable {
direct("DIRECT"), creditCard("CREDIT_CARD");
companion object {
operator fun invoke(rawValue: String) = PaymentMethodType.values().firstOrNull { it.rawValue == rawValue }
}
}
-enum class AnimationLength {
+internal enum class AnimationLength {
short,
long
- val duration: Double
+ internal val duration: Double
get() {
when (this) {
AnimationLength.short -> return 2
@@ -43,15 +43,15 @@ enum class AnimationLength {
}
}
- fun getDuration() : Double =
+ internal fun getDuration() : Double =
this.duration
}
-sealed class AnimationLengthAdvanced {
+internal sealed class AnimationLengthAdvanced {
object short : AnimationLengthAdvanced()
object long : AnimationLengthAdvanced()
data class custom(val v1: Double) : AnimationLengthAdvanced()
- val duration: Double
+ internal val duration: Double
get() {
when (this) {
short -> return 2
@@ -60,7 +60,7 @@ sealed class AnimationLengthAdvanced {
}
}
- fun getDuration() : Double =
+ internal fun getDuration() : Double =
this.duration
}
when (enumValue) {
@@ -82,7 +82,7 @@ when (planets) {
mars, earth, venus -> habitable = true
else -> habitable = false
}
-val nb = 42
+internal val nb = 42
when (nb) {
0 -> print("zero")
1, 2, 3 -> print("low numbers")
diff --git a/Assets/Tests/KotlinTokenizer/exceptions.kt b/Assets/Tests/KotlinTokenizer/exceptions.kt
index 178faf1..ba46731 100644
--- a/Assets/Tests/KotlinTokenizer/exceptions.kt
+++ b/Assets/Tests/KotlinTokenizer/exceptions.kt
@@ -1,7 +1,7 @@
-val optA = try { obj.methodThrows() } catch (e: Throwable) { null }
-val forceA = obj.methodThrows()
+internal val optA = try { obj.methodThrows() } catch (e: Throwable) { null }
+internal val forceA = obj.methodThrows()
-fun method() {
+internal fun method() {
obj.methodThrows()
}
diff --git a/Assets/Tests/KotlinTokenizer/expressions.kt b/Assets/Tests/KotlinTokenizer/expressions.kt
index f3bee3b..96cbe34 100644
--- a/Assets/Tests/KotlinTokenizer/expressions.kt
+++ b/Assets/Tests/KotlinTokenizer/expressions.kt
@@ -1,8 +1,8 @@
-val value = if (isTrue) "yes" else "no"
-val label = if (x > 0) "Positive" else "negative"
+internal val value = if (isTrue) "yes" else "no"
+internal val label = if (x > 0) "Positive" else "negative"
button.color = if (item.deleted) red else green
-val text = label ?: "default"
+internal val text = label ?: "default"
service.deleteObject()
this.service.fetchData()?.user?.name?.size
this.data.filter { it.item?.value == 1 }.map { it.key }.firstOrNull()?.name?.size
diff --git a/Assets/Tests/KotlinTokenizer/extensions.kt b/Assets/Tests/KotlinTokenizer/extensions.kt
index e21c5ac..3db98ea 100644
--- a/Assets/Tests/KotlinTokenizer/extensions.kt
+++ b/Assets/Tests/KotlinTokenizer/extensions.kt
@@ -1,15 +1,15 @@
-val Double.km: Double
+internal val Double.km: Double
get() = this * 1000.0
-val Double.m: Double
+internal val Double.m: Double
get() = this
-open fun Double.toKm() : Double =
+private fun Double.toKm() : Double =
this * 1000.0
-fun Double.toMeter() : Double =
+internal fun Double.toMeter() : Double =
this
-public fun Double.Companion.toKm() : Double =
+fun Double.Companion.toKm() : Double =
this * 1000.0
-public val Double.Companion.m: Double
+val Double.Companion.m: Double
get() = this
diff --git a/Assets/Tests/KotlinTokenizer/extensions.swift b/Assets/Tests/KotlinTokenizer/extensions.swift
index 9baca1d..8fe853c 100644
--- a/Assets/Tests/KotlinTokenizer/extensions.swift
+++ b/Assets/Tests/KotlinTokenizer/extensions.swift
@@ -3,7 +3,7 @@ extension Double {
var m: Double { return self }
}
extension Double {
- open func toKm() -> Double { return self * 1000.0 }
+ private func toKm() -> Double { return self * 1000.0 }
func toMeter() -> Double { return self }
}
public extension Double {
diff --git a/Assets/Tests/KotlinTokenizer/foundation_types.kt b/Assets/Tests/KotlinTokenizer/foundation_types.kt
index c249deb..98697ba 100644
--- a/Assets/Tests/KotlinTokenizer/foundation_types.kt
+++ b/Assets/Tests/KotlinTokenizer/foundation_types.kt
@@ -1,15 +1,15 @@
-var boolean: Boolean
-var anyObject: Any? = null
-var any: Any? = null
-var array: List? = null
-var array: Promise>? = null
-var array: List>>
-var strings1 = listOf()
-var strings2 = listOf("value1", "value2")
-var strings3: List = listOf("value3", "value4")
-var map: Map? = null
-var map: Promise