Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logos errors out on calling %orig with an inline block with multiple lines. #6

Open
orikad opened this issue Jan 11, 2014 · 4 comments
Labels
bug Something isn't working

Comments

@orikad
Copy link

orikad commented Jan 11, 2014

When hooking a method which accepts a block as a paramter, Logos dislikes this form of calling the original implementation:

%hook AwesomeClass

- (void)AwesomeMethod:(void (^)(void))awesomeBlock
{
    %orig(^{
        NSLog(@"Hello");
    }); 
}

%end

However, this works:

%hook AwesomeClass

- (void)AwesomeMethod:(void (^)(void))awesomeBlock
{
    %orig(^{ NSLog(@"Hello"); }); 
}

%end

and putting the block in a variable, works too, obviously.

Logos errors out with this error: "error: missing closing parenthesis"

@theiostream
Copy link
Contributor

Attempt to declare the block separately and then pass the block to %orig. I think that should work with Logos as-is and this is quite an interesting issue!

@orikad
Copy link
Author

orikad commented Jan 15, 2014

Yes, that works, as I originally mentioned "and putting the block in a variable, works too, obviously".

@DHowett
Copy link
Contributor

DHowett commented Jan 15, 2014

Unfortunately, this is a known (and difficult to fix properly) issue. Logos is a somewhat degenerate parser - regex-based, non-tokenizing, and without a lexical understanding.

@JesseVelden
Copy link

I think this is related: by having a comment with //*
it gives a %hook does not make sense inside a block later in the code.

@uroboro uroboro transferred this issue from theos/theos Nov 2, 2018
@uroboro uroboro added the bug Something isn't working label Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants