Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ struct IntrinsicJSFragment: Sendable {
return IntrinsicJSFragment(
parameters: ["value"],
printCode: { arguments, context in
let (scope, printer, cleanup) = (context.scope, context.printer, context.cleanupCode)
let (scope, printer) = (context.scope, context.printer)
let value = arguments[0]
let idVar = scope.variable("id")
printer.write("let \(idVar);")
Expand All @@ -3040,16 +3040,6 @@ struct IntrinsicJSFragment: Sendable {
}
printer.write("}")
scope.emitPushI32Parameter("\(idVar) !== undefined ? \(idVar) : 0", printer: printer)
cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {")
cleanup.indent {
cleanup.write("try {")
cleanup.indent {
cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));")
cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));")
}
cleanup.write("} catch(e) {}")
}
cleanup.write("}")
return [idVar]
}
)
Expand Down Expand Up @@ -3208,16 +3198,6 @@ struct IntrinsicJSFragment: Sendable {
}
printer.write("}")
scope.emitPushI32Parameter("\(isSomeVar) ? 1 : 0", printer: printer)
cleanup.write("if(\(idVar) !== undefined && \(idVar) !== 0) {")
cleanup.indent {
cleanup.write("try {")
cleanup.indent {
cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.getObject(\(idVar));")
cleanup.write("\(JSGlueVariableScope.reservedSwift).memory.release(\(idVar));")
}
cleanup.write("} catch(e) {}")
}
cleanup.write("}")
return [idVar]
} else {
switch wrappedType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,7 @@ export async function createInstantiator(options, swift) {
i32Stack.push(0);
}
i32Stack.push(isSome ? 1 : 0);
const cleanup = () => {
if(id !== undefined && id !== 0) {
try {
swift.memory.getObject(id);
swift.memory.release(id);
} catch(e) {}
}
if(id1 !== undefined && id1 !== 0) {
try {
swift.memory.getObject(id1);
swift.memory.release(id1);
} catch(e) {}
}
};
return { cleanup };
return { cleanup: undefined };
},
lift: () => {
const isSome = i32Stack.pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,7 @@ export async function createInstantiator(options, swift) {
i32Stack.push(0);
}
i32Stack.push(isSome ? 1 : 0);
const cleanup = () => {
if(id !== undefined && id !== 0) {
try {
swift.memory.getObject(id);
swift.memory.release(id);
} catch(e) {}
}
if(id1 !== undefined && id1 !== 0) {
try {
swift.memory.getObject(id1);
swift.memory.release(id1);
} catch(e) {}
}
};
return { cleanup };
return { cleanup: undefined };
},
lift: () => {
const isSome = i32Stack.pop();
Expand Down