@@ -57,7 +57,7 @@ describe('Generator Tests', () => {
57
57
chai . expect ( output ) . contains ( 'public func getClaimableBalances() -> [UInt8] {' ) ;
58
58
chai . expect ( output ) . contains ( 'internal func free() {' ) ;
59
59
60
- chai . expect ( output ) . contains ( 'let chainSourceOption = Option_FilterZ(some: chainSource) ' ) ;
60
+ chai . expect ( output ) . contains ( 'let chainSourceOption = Option_FilterZ(some: chainSource, instantiationContext: " ' ) ;
61
61
chai . expect ( output ) . contains ( 'let nativeCallResult = ChainMonitor_free(self.cType!)' ) ;
62
62
} ) ;
63
63
@@ -105,7 +105,7 @@ describe('Generator Tests', () => {
105
105
const generator = new VectorGenerator ( config , new AuxiliaryArtifacts ( ) ) ;
106
106
const vectorVectorOutput = generator . generateFileContents ( routeVectorVector ) ;
107
107
108
- chai . expect ( vectorVectorOutput ) . includes ( 'public init(array: [[RouteHop]]) {' ) ;
108
+ chai . expect ( vectorVectorOutput ) . includes ( 'internal init(array: [[RouteHop]], instantiationContext: String ) {' ) ;
109
109
chai . expect ( vectorVectorOutput )
110
110
. includes ( 'let dataContainer = UnsafeMutablePointer<LDKCVec_RouteHopZ>.allocate(capacity: array.count)' ) ;
111
111
chai . expect ( vectorVectorOutput )
@@ -123,11 +123,11 @@ describe('Generator Tests', () => {
123
123
chai . expect ( vectorVectorOutput )
124
124
. includes ( 'let swiftArray = array.map { (currentCType: [LDKRouteHop]) -> [RouteHop] in' ) ;
125
125
chai . expect ( vectorVectorOutput ) . includes ( 'currentCType.map { (currentCType: LDKRouteHop) -> RouteHop in' ) ;
126
- chai . expect ( vectorVectorOutput ) . includes ( 'RouteHop(cType: currentCType, anchor: self).dangle()' ) ;
126
+ chai . expect ( vectorVectorOutput ) . includes ( 'RouteHop(cType: currentCType, instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)", anchor: self).dangle()' ) ;
127
127
128
128
const routeVector = < RustVector > glossary [ 'LDKCVec_RouteHopZ' ] ;
129
129
const vectorOutput = generator . generateFileContents ( routeVector ) ;
130
- chai . expect ( vectorOutput ) . includes ( 'public init(array: [RouteHop]) {' ) ;
130
+ chai . expect ( vectorOutput ) . includes ( 'internal init(array: [RouteHop], instantiationContext: String ) {' ) ;
131
131
chai . expect ( vectorOutput )
132
132
. includes ( 'let rustArray = array.map { (currentValueDepth1: RouteHop) -> LDKRouteHop in' ) ;
133
133
chai . expect ( vectorOutput ) . includes ( 'return currentValueDepth1.cType!' ) ;
@@ -140,7 +140,7 @@ describe('Generator Tests', () => {
140
140
chai . expect ( vectorOutput ) . includes ( 'var array = [LDKRouteHop]()' ) ;
141
141
chai . expect ( vectorOutput )
142
142
. includes ( 'let swiftArray = array.map { (currentCType: LDKRouteHop) -> RouteHop in' ) ;
143
- chai . expect ( vectorOutput ) . includes ( 'RouteHop(cType: currentCType, anchor: self).dangle()' ) ;
143
+ chai . expect ( vectorOutput ) . includes ( 'RouteHop(cType: currentCType, instantiationContext: "#{swift_class_name}::\\(#function):\\(#line)", anchor: self).dangle()' ) ;
144
144
} ) ;
145
145
146
146
it ( 'should generate Vec<u8>' , ( ) => {
@@ -155,7 +155,7 @@ describe('Generator Tests', () => {
155
155
const generator = new VectorGenerator ( config , new AuxiliaryArtifacts ( ) ) ;
156
156
const output = generator . generateFileContents ( routeVectorVector ) ;
157
157
158
- chai . expect ( output ) . includes ( 'public init(array: [UInt8]) {' ) ;
158
+ chai . expect ( output ) . includes ( 'internal init(array: [UInt8], instantiationContext: String ) {' ) ;
159
159
chai . expect ( output )
160
160
. includes ( 'let dataContainer = UnsafeMutablePointer<UInt8>.allocate(capacity: array.count)' ) ;
161
161
chai . expect ( output ) . includes ( 'dataContainer.initialize(from: array, count: array.count)' ) ;
@@ -260,27 +260,27 @@ describe('Generator Tests', () => {
260
260
const strOutput = generator . generateFileContents ( ldkStr ) ;
261
261
const u5Output = generator . generateFileContents ( ldku5 ) ;
262
262
263
- chai . expect ( transactionOutput ) . includes ( 'public init(value: [UInt8]) {' ) ;
263
+ chai . expect ( transactionOutput ) . includes ( 'internal init(value: [UInt8], instantiationContext: String ) {' ) ;
264
264
chai . expect ( transactionOutput ) . includes ( 'public func getValue() -> [UInt8] {' ) ;
265
265
chai . expect ( transactionOutput )
266
266
. includes ( 'self.cType = LDKTransaction(data: dataContainer, datalen: UInt(value.count), data_is_owned: true)' ) ;
267
267
268
- chai . expect ( thirtyTwoBytesOutput ) . includes ( 'public init(value: [UInt8]) {' ) ;
268
+ chai . expect ( thirtyTwoBytesOutput ) . includes ( 'internal init(value: [UInt8], instantiationContext: String ) {' ) ;
269
269
chai . expect ( thirtyTwoBytesOutput ) . includes ( 'public func getValue() -> [UInt8] {' ) ;
270
270
chai . expect ( thirtyTwoBytesOutput )
271
271
. includes ( 'self.cType = LDKThirtyTwoBytes(data: Bindings.arrayToUInt8Tuple32(array: value))' ) ;
272
272
273
273
chai . expect ( thirtyTwoBytesOutput )
274
274
. includes ( 'return Bindings.UInt8Tuple32ToArray(tuple: self.cType!.data)' ) ;
275
275
276
- chai . expect ( strOutput ) . includes ( 'public init(value: String) {' ) ;
276
+ chai . expect ( strOutput ) . includes ( 'internal init(value: String, instantiationContext : String) {' ) ;
277
277
chai . expect ( strOutput ) . includes ( 'public func getValue() -> String {' ) ;
278
278
chai . expect ( strOutput )
279
279
. includes ( 'self.cType = LDKStr(chars: Bindings.string_to_unsafe_uint8_pointer(string: value), len: UInt(value.count), chars_is_owned: true)' ) ;
280
280
281
281
chai . expect ( strOutput ) . includes ( 'return String(data: data, encoding: .utf8)!' ) ;
282
282
283
- chai . expect ( u5Output ) . includes ( 'public init(value: UInt8) {' ) ;
283
+ chai . expect ( u5Output ) . includes ( 'internal init(value: UInt8, instantiationContext: String ) {' ) ;
284
284
chai . expect ( u5Output ) . includes ( 'public func getValue() -> UInt8 {' ) ;
285
285
chai . expect ( u5Output ) . includes ( 'self.cType = LDKU5(_0: value)' ) ;
286
286
chai . expect ( u5Output ) . includes ( 'return self.cType!._0' ) ;
0 commit comments