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

Dynamically looking-up classes beside bracketed math causes compiling error #24

Closed
candoizo opened this issue Jul 31, 2017 · 3 comments
Closed

Comments

@candoizo
Copy link

example : self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y + 1 - (1 * 2), [%c(UIScreen) mainScreen].bounds.size.width, self.frame.size.height);

What are the steps to reproduce this issue?

  1. Try to use brackets in calculations next to dynamically looked-up classes
  2. Receive error when compiling

What happens?

Compiler returns expression error

What were you expecting to happen?

Compiles with no problems

Any logs, error output, etc?

==> Compiling Tweak.xm (armv7)…

Tweak.xm:11:85: error: expected expression self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y + 1 - (1 * 2), [%c(UIScreen) mainScreen].b...
^
Tweak.xm:11:88: error: unexpected interface name 'UIScreen': expected expression self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y + 1 - (1 * 2), [%c(UIScreen) mainScreen].b...

Any other comments?

Compiles fine without the brackets around (1 * 2), but obviously will not return the value needed.

Changing the positioning of the bracketed math does not overcome the error

Does not work with objc_getClass either

Adding an interface for the class will avoid the issue.

Compiling using linux toolchain, 9.2 sdk, most recent theos pull

@kirb
Copy link
Member

kirb commented Jun 6, 2018

Can’t repro with the latest Logos, can you check if this still happens for you? Try to create a minimal test case — a Logos file with as little as you need to trigger the bug. Run $THEOS/bin/logos.pl mytest.x and make sure you see _logos_static_class_lookup$UIScreen() being defined and used in the appropriate place with no syntax errors.

@candoizo
Copy link
Author

candoizo commented Jun 6, 2018 via email

@kirb
Copy link
Member

kirb commented Jun 6, 2018

Perfect! There are also fixes from #246 that I’ve been meaning to merge that would probably help reduce these errors.

@kirb kirb closed this as completed Jun 6, 2018
@uroboro uroboro transferred this issue from theos/theos Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants