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

Source analysis needs to catch missing commas in API calls #1161

Open
hostilefork opened this issue Sep 16, 2024 · 0 comments
Open

Source analysis needs to catch missing commas in API calls #1161

hostilefork opened this issue Sep 16, 2024 · 0 comments

Comments

@hostilefork
Copy link
Member

If you write:

rebElide("catch ["
    "print {asdf}"
    "print {jkl;}"
"]");

C will merge those strings without spaces, so you get print {asdf}print{jkl;}. If you use commas in the variadic API the way you're supposed to, it will work correctly.

It's an easy mistake to make, especially because it works sometimes. e.g. the catch [print is legal to not have a space.

Source analysis could catch these cases. It also might be nice if __FILE__ and __LINE__ information could be injected by some preprocessing step so the scanner could have that data:

rebElide(rebWhereFile(__FILE__), rebWhereLine(__LINE__), "catch [",
    rebWhereLine(__LINE__), "print {asdf}",
    rebWhereLine(__LINE__), "print {jkl;}"
rebWhereLine(__LINE__), "]");

This would be optional, but very useful.

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

1 participant