Skip to content

Commit

Permalink
internal backend optimizations
Browse files Browse the repository at this point in the history
described in theos/logos#108.

PR'd so this can also be instantly merged when the PR is accepted assuming if everything in that PR is fine.
  • Loading branch information
0xilis authored Nov 17, 2023
1 parent 556ca6f commit f81c0f5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Sources/Orion/InternalBackend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@ extension Backends.Internal {

let imp = IMP(replacement)
let orig: IMP
// first try to add the method (in case the current imp is inherited)
if class_addMethod(cls, sel, imp, types) {
// if added, return the super imp
orig = method_getImplementation(origMethod)
} else {
// otherwise, the current class has its own imp of the method. Replace it.
orig = method_setImplementation(origMethod, imp)
}
// class_replaceMethod adds the method if it's implemented by the superclass so no need to replicate this behavior
orig = class_replaceMethod(cls, sel, imp, types);

Check warning on line 42 in Sources/Orion/InternalBackend.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Semicolon Violation: Lines should not have trailing semicolons (trailing_semicolon)

return .init(orig)
}
Expand Down

0 comments on commit f81c0f5

Please sign in to comment.