Skip to content

Commit 834b59a

Browse files
committed
BridgeJS: Register parameter names in scope instead of reserveNames
1 parent 1ad419b commit 834b59a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,8 @@ public struct BridgeJSLink {
12191219
loweringFragment.parameters.count == 1,
12201220
"Lowering fragment should have exactly one parameter to lower"
12211221
)
1222-
let loweredValues = try loweringFragment.printCode([param.name], context)
1222+
let paramName = scope.variable(param.name)
1223+
let loweredValues = try loweringFragment.printCode([paramName], context)
12231224
parameterForwardings.append(contentsOf: loweredValues)
12241225
}
12251226

Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ final class JSGlueVariableScope {
9090
JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry)
9191
}
9292

93-
fileprivate func reserveNames(_ names: [String]) {
94-
for name in names {
95-
variables.insert(name)
96-
}
97-
}
9893
}
9994

10095
extension JSGlueVariableScope {
@@ -738,7 +733,6 @@ struct IntrinsicJSFragment: Sendable {
738733
printCode: { arguments, context in
739734
let (scope, printer) = (context.scope, context.printer)
740735
let value = arguments[0]
741-
scope.reserveNames(arguments)
742736
let isSomeVar = scope.variable("isSome")
743737
printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));")
744738

0 commit comments

Comments
 (0)