@@ -25,19 +25,28 @@ public struct ImportedProtocol: ImportedDecl {
25
25
public var identifier : String
26
26
}
27
27
28
- public struct ImportedClass : ImportedDecl {
28
+ /// Describes a Swift nominal type (e.g., a class, struct, enum) that has been
29
+ /// imported and is being translated into Java.
30
+ public struct ImportedNominalType : ImportedDecl {
29
31
public var name : ImportedTypeName
30
-
31
- public var implementedInterfaces : Set < ImportedTypeName > = [ ]
32
+ public var kind : NominalTypeKind
32
33
33
34
public var initializers : [ ImportedFunc ] = [ ]
34
35
public var methods : [ ImportedFunc ] = [ ]
35
36
36
- public init ( name: ImportedTypeName ) {
37
+ public init ( name: ImportedTypeName , kind : NominalTypeKind ) {
37
38
self . name = name
39
+ self . kind = kind
38
40
}
39
41
}
40
42
43
+ public enum NominalTypeKind {
44
+ case `actor`
45
+ case `class`
46
+ case `enum`
47
+ case `struct`
48
+ }
49
+
41
50
public struct ImportedParam : Hashable {
42
51
let param : FunctionParameterSyntax
43
52
@@ -99,9 +108,10 @@ public struct ImportedTypeName: Hashable {
99
108
javaType. className
100
109
}
101
110
102
- public init ( swiftTypeName: String , javaType: JavaType ) {
111
+ public init ( swiftTypeName: String , javaType: JavaType , swiftMangledName : String ? = nil ) {
103
112
self . swiftTypeName = swiftTypeName
104
113
self . javaType = javaType
114
+ self . swiftMangledName = swiftMangledName ?? " "
105
115
}
106
116
}
107
117
@@ -126,6 +136,8 @@ public struct ImportedFunc: ImportedDecl, CustomStringConvertible {
126
136
/// This is a full name such as init(cap:name:).
127
137
public var identifier : String
128
138
139
+ /// This is the base identifier for the function, e.g., "init" for an
140
+ /// initializer or "f" for "f(a:b:)".
129
141
public var baseIdentifier : String {
130
142
guard let idx = identifier. firstIndex ( of: " ( " ) else {
131
143
return identifier
@@ -134,7 +146,7 @@ public struct ImportedFunc: ImportedDecl, CustomStringConvertible {
134
146
}
135
147
136
148
/// A display name to use to refer to the Swift declaration with its
137
- /// enclosing type.
149
+ /// enclosing type, if there is one .
138
150
public var displayName : String {
139
151
if let parentName {
140
152
return " \( parentName. swiftTypeName) . \( identifier) "
0 commit comments