GeezerVison is showing github.com — BridgeJS: Register parameter names in scope instead of reserveNames · devxsby/JavaScriptKit@834b59a
File tree
Expand file treeCollapse file tree
Open diff view settings
Plugins/BridgeJS/Sources/BridgeJSLink
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1219,7 +1219,8 @@ public struct BridgeJSLink { |
1219 | 1219 | loweringFragment.parameters.count == 1, |
1220 | 1220 | "Lowering fragment should have exactly one parameter to lower" |
1221 | 1221 | ) |
1222 | | - let loweredValues = try loweringFragment.printCode([param.name], context) |
| 1222 | + let paramName = scope.variable(param.name) |
| 1223 | + let loweredValues = try loweringFragment.printCode([paramName], context) |
1223 | 1224 | parameterForwardings.append(contentsOf: loweredValues) |
1224 | 1225 | } |
1225 | 1226 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift -6Lines changed: 0 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,11 +90,6 @@ final class JSGlueVariableScope { |
90 | 90 | JSGlueVariableScope(intrinsicRegistry: intrinsicRegistry) |
91 | 91 | } |
92 | 92 |
|
93 | | - fileprivate func reserveNames(_ names: [String]) { |
94 | | - for name in names { |
95 | | - variables.insert(name) |
96 | | - } |
97 | | - } |
98 | 93 | } |
99 | 94 |
|
100 | 95 | extension JSGlueVariableScope { |
@@ -738,7 +733,6 @@ struct IntrinsicJSFragment: Sendable { |
738 | 733 | printCode: { arguments, context in |
739 | 734 | let (scope, printer) = (context.scope, context.printer) |
740 | 735 | let value = arguments[0] |
741 | | - scope.reserveNames(arguments) |
742 | 736 | let isSomeVar = scope.variable("isSome") |
743 | 737 | printer.write("const \(isSomeVar) = \(kind.presenceCheck(value: value));") |
744 | 738 |
|
|