Skip to content

Commit eeb3c6d

Browse files
build fix
1 parent ca36e11 commit eeb3c6d

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,14 @@ function renderParameters(params) {
543543
* @returns {string}
544544
*/
545545
function renderBridgeType(type) {
546-
if (type.int) return "Int";
547-
if (type.float) return "Float";
548-
if (type.double) return "Double";
549-
if (type.string) return "String";
550-
if (type.bool) return "Bool";
551-
if (type.void) return "Void";
552-
if (type.jsObject) {
553-
const name = type.jsObject._0;
546+
if ("int" in type) return "Int";
547+
if ("float" in type) return "Float";
548+
if ("double" in type) return "Double";
549+
if ("string" in type) return "String";
550+
if ("bool" in type) return "Bool";
551+
if ("void" in type) return "Void";
552+
if ("jsObject" in type) {
553+
const name = "_0" in type.jsObject ? type.jsObject._0 : undefined;
554554
return name ? renderTypeName(name) : "JSObject";
555555
}
556556
return "JSObject";

Sources/JavaScriptKit/Macros.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,3 @@ public macro JSFunction(from: String? = nil, jsName: String? = nil) = #externalM
116116

117117
@attached(member)
118118
public macro JSClass(from: String? = nil, jsName: String? = nil) = #externalMacro(module: "JavaScriptKitMacros", type: "JSImportClassMacro")
119-
120-
enum JSGlobalThis {}
121-
122-
extension JSGlobalThis {
123-
@JSVariable public static var console: JSObject
124-
@JSVariable public static var document: JSObject
125-
@JSFunction public static func alert(message: String) throws -> Void
126-
@JSFunction public static func fetch(url: String) async throws -> JSResponse
127-
}
128-
129-
@JSClass(from: "globalThis", jsName: "Response")
130-
public class JSResponse {
131-
@JSVariable public var status: Int
132-
@JSFunction public func json() async throws -> JSObject
133-
}

Sources/JavaScriptKitMacros/JSImportMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ extension JSImportVariableMacro: AccessorMacro {
183183
if isInstanceMember {
184184
getterArgs.append("self.jsObject")
185185
}
186-
let getterCall = "return try \(getterName)(\(getterArgs.joined(separator: ", ")))"
186+
let getterCall: CodeBlockItemSyntax = "return try \(raw: getterName)(\(raw: getterArgs.joined(separator: ", ")))"
187187

188188
let throwsClause = ThrowsClauseSyntax(
189189
throwsSpecifier: .keyword(.throws),
@@ -212,7 +212,7 @@ extension JSImportVariableMacro: AccessorMacro {
212212
setterArgs.append("self.jsObject")
213213
}
214214
setterArgs.append("newValue")
215-
let setterCall = "try \(setterName)(\(setterArgs.joined(separator: ", ")))"
215+
let setterCall: CodeBlockItemSyntax = "try \(raw: setterName)(\(raw: setterArgs.joined(separator: ", ")))"
216216
accessors.append(
217217
AccessorDeclSyntax(
218218
accessorSpecifier: .keyword(.set),

0 commit comments

Comments
 (0)