theos / logos

Preprocessor that simplifies Objective-C hooking.
https://theos.dev/docs/logos
Other
206 stars 34 forks source link

%c should cast the result to the input class type #56

Closed NSExceptional closed 4 years ago

NSExceptional commented 4 years ago

For example, %c(Foo) should evaluate to

((Foo *) _logos_static_class_lookup$Foo())

instead of just

_logos_static_class_lookup$Foo()

so that type information is not lost, allowing for things like %c(Foo).classProperty

kirb commented 4 years ago

I’m really certain we’ve had this discussion before. The problem is Foo * is the instance type of Foo, when %c(Foo) is giving you the class type. I don’t know of any way to return a Class correctly typed for the compiler.

NSExceptional commented 4 years ago

Ah, yes we have. I'm dumb. It's not possible AFAICT either

I wonder if new logos could just eagerly transform %c(Foo).classProperty to [%c(Foo) classProperty] then? That would personally go a long way for me