1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
1615import JavaTypes
1716
1817/// Represents a value of a `java.lang.foreign.Self` that we want to render in generated Java code.
@@ -22,18 +21,16 @@ public struct ForeignValueLayout: CustomStringConvertible, Equatable {
2221 var inlineComment : String ?
2322 var value : String
2423
25- var needsMemoryLayoutCall : Bool = false
26-
2724 public init ( inlineComment: String ? = nil , javaConstant: String ) {
2825 self . inlineComment = inlineComment
2926 self . value = " SwiftValueLayout. \( javaConstant) "
30- self . needsMemoryLayoutCall = false
3127 }
3228
3329 public init ( inlineComment: String ? = nil , customType: String ) {
3430 self . inlineComment = inlineComment
35- self . value = customType
36- self . needsMemoryLayoutCall = true
31+ // When the type is some custom type, e.g. another Swift struct that we imported,
32+ // we need to import its layout. We do this by referring $LAYOUT on it.
33+ self . value = " \( customType) .$LAYOUT "
3734 }
3835
3936 public init ? ( javaType: JavaType ) {
@@ -59,12 +56,6 @@ public struct ForeignValueLayout: CustomStringConvertible, Equatable {
5956
6057 result. append ( value)
6158
62- // When the type is some custom type, e.g. another Swift struct that we imported,
63- // we need to import its layout. We do this by calling $LAYOUT() on it.
64- if needsMemoryLayoutCall {
65- result. append ( " .$LAYOUT() " )
66- }
67-
6859 return result
6960 }
7061}
0 commit comments