Skip to content

Commit ca86d92

Browse files
committed
BridgeJS: Align naming for stack based types from "raise" to "lift"
1 parent f297fd7 commit ca86d92

File tree

17 files changed

+214
-214
lines changed

17 files changed

+214
-214
lines changed

Benchmarks/Sources/Generated/BridgeJS.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ extension SimpleStruct: _BridgedSwiftStruct {
279279
func toJSObject() -> JSObject {
280280
let __bjs_self = self
281281
__bjs_self.bridgeJSLowerReturn()
282-
return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_SimpleStruct()))
282+
return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_SimpleStruct()))
283283
}
284284
}
285285

@@ -293,10 +293,10 @@ fileprivate func _bjs_struct_lower_SimpleStruct(_ objectId: Int32) -> Int32 {
293293
#endif
294294

295295
#if arch(wasm32)
296-
@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_SimpleStruct")
297-
fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32
296+
@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_SimpleStruct")
297+
fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32
298298
#else
299-
fileprivate func _bjs_struct_raise_SimpleStruct() -> Int32 {
299+
fileprivate func _bjs_struct_lift_SimpleStruct() -> Int32 {
300300
fatalError("Only available on WebAssembly")
301301
}
302302
#endif
@@ -332,7 +332,7 @@ extension Address: _BridgedSwiftStruct {
332332
func toJSObject() -> JSObject {
333333
let __bjs_self = self
334334
__bjs_self.bridgeJSLowerReturn()
335-
return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Address()))
335+
return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Address()))
336336
}
337337
}
338338

@@ -346,10 +346,10 @@ fileprivate func _bjs_struct_lower_Address(_ objectId: Int32) -> Int32 {
346346
#endif
347347

348348
#if arch(wasm32)
349-
@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Address")
350-
fileprivate func _bjs_struct_raise_Address() -> Int32
349+
@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Address")
350+
fileprivate func _bjs_struct_lift_Address() -> Int32
351351
#else
352-
fileprivate func _bjs_struct_raise_Address() -> Int32 {
352+
fileprivate func _bjs_struct_lift_Address() -> Int32 {
353353
fatalError("Only available on WebAssembly")
354354
}
355355
#endif
@@ -391,7 +391,7 @@ extension Person: _BridgedSwiftStruct {
391391
func toJSObject() -> JSObject {
392392
let __bjs_self = self
393393
__bjs_self.bridgeJSLowerReturn()
394-
return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_Person()))
394+
return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_Person()))
395395
}
396396
}
397397

@@ -405,10 +405,10 @@ fileprivate func _bjs_struct_lower_Person(_ objectId: Int32) -> Int32 {
405405
#endif
406406

407407
#if arch(wasm32)
408-
@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_Person")
409-
fileprivate func _bjs_struct_raise_Person() -> Int32
408+
@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_Person")
409+
fileprivate func _bjs_struct_lift_Person() -> Int32
410410
#else
411-
fileprivate func _bjs_struct_raise_Person() -> Int32 {
411+
fileprivate func _bjs_struct_lift_Person() -> Int32 {
412412
fatalError("Only available on WebAssembly")
413413
}
414414
#endif
@@ -453,7 +453,7 @@ extension ComplexStruct: _BridgedSwiftStruct {
453453
func toJSObject() -> JSObject {
454454
let __bjs_self = self
455455
__bjs_self.bridgeJSLowerReturn()
456-
return JSObject(id: UInt32(bitPattern: _bjs_struct_raise_ComplexStruct()))
456+
return JSObject(id: UInt32(bitPattern: _bjs_struct_lift_ComplexStruct()))
457457
}
458458
}
459459

@@ -467,10 +467,10 @@ fileprivate func _bjs_struct_lower_ComplexStruct(_ objectId: Int32) -> Int32 {
467467
#endif
468468

469469
#if arch(wasm32)
470-
@_extern(wasm, module: "bjs", name: "swift_js_struct_raise_ComplexStruct")
471-
fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32
470+
@_extern(wasm, module: "bjs", name: "swift_js_struct_lift_ComplexStruct")
471+
fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32
472472
#else
473-
fileprivate func _bjs_struct_raise_ComplexStruct() -> Int32 {
473+
fileprivate func _bjs_struct_lift_ComplexStruct() -> Int32 {
474474
fatalError("Only available on WebAssembly")
475475
}
476476
#endif

Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,9 +1184,9 @@ struct StructCodegen {
11841184
let accessControl = structDef.explicitAccessControl.map { "\($0) " } ?? ""
11851185

11861186
let lowerExternName = "swift_js_struct_lower_\(structDef.name)"
1187-
let raiseExternName = "swift_js_struct_raise_\(structDef.name)"
1187+
let liftExternName = "swift_js_struct_lift_\(structDef.name)"
11881188
let lowerFunctionName = "_bjs_struct_lower_\(structDef.name)"
1189-
let raiseFunctionName = "_bjs_struct_raise_\(structDef.name)"
1189+
let liftFunctionName = "_bjs_struct_lift_\(structDef.name)"
11901190

11911191
let bridgedStructExtension: DeclSyntax = """
11921192
extension \(raw: typeName): _BridgedSwiftStruct {
@@ -1207,7 +1207,7 @@ struct StructCodegen {
12071207
\(raw: accessControl)func toJSObject() -> JSObject {
12081208
let __bjs_self = self
12091209
__bjs_self.bridgeJSLowerReturn()
1210-
return JSObject(id: UInt32(bitPattern: \(raw: raiseFunctionName)()))
1210+
return JSObject(id: UInt32(bitPattern: \(raw: liftFunctionName)()))
12111211
}
12121212
}
12131213
"""
@@ -1220,16 +1220,16 @@ struct StructCodegen {
12201220
returnType: .i32
12211221
)
12221222
)
1223-
let raiseExternDecl = Self.renderStructExtern(
1224-
externName: raiseExternName,
1225-
functionName: raiseFunctionName,
1223+
let liftExternDecl = Self.renderStructExtern(
1224+
externName: liftExternName,
1225+
functionName: liftFunctionName,
12261226
signature: SwiftSignatureBuilder.buildABIFunctionSignature(
12271227
abiParameters: [],
12281228
returnType: .i32
12291229
)
12301230
)
12311231

1232-
return [bridgedStructExtension, lowerExternDecl, raiseExternDecl]
1232+
return [bridgedStructExtension, lowerExternDecl, liftExternDecl]
12331233
}
12341234

12351235
private static func renderStructExtern(

Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,10 @@ public struct BridgeJSLink {
475475
}
476476
printer.write("}")
477477

478-
printer.write("bjs[\"swift_js_struct_raise_\(structDef.name)\"] = function() {")
478+
printer.write("bjs[\"swift_js_struct_lift_\(structDef.name)\"] = function() {")
479479
printer.indent {
480480
printer.write(
481-
"const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).raise(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));"
481+
"const value = \(JSGlueVariableScope.reservedStructHelpers).\(structDef.name).lift(\(JSGlueVariableScope.reservedTmpRetStrings), \(JSGlueVariableScope.reservedTmpRetInts), \(JSGlueVariableScope.reservedTmpRetF32s), \(JSGlueVariableScope.reservedTmpRetF64s), \(JSGlueVariableScope.reservedTmpRetPointers));"
482482
)
483483
printer.write("return \(JSGlueVariableScope.reservedSwift).memory.retain(value);")
484484
}

0 commit comments

Comments
 (0)