-
Notifications
You must be signed in to change notification settings - Fork 15
translate-c: add detect possible member functions #22
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
Conversation
If the function where the first argument is a container or a pointer to a container, then add a const variable that store the function, and the variable name is the function name without the prefix.
src/Scope.zig
Outdated
const last_index = std.mem.lastIndexOf(u8, func_name, "_"); | ||
const last_name = if (last_index) |index| func_name[index + 1 ..] else continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all potential member functions should be added untrimmed and only then should we try to add aliases with prefixes removed. That way you also shouldn't need to mangle the names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand how to implement this suggestion. How to avoid to mangle the names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it more you'd need to add a const __root = @This()
to the global scope to be able to reference the function without an ambiguous reference issue but the idea would be to check if member_names.get(func_name) == null
and then add an alias for func_name
.
I can do this as a follow up.
@Vexu It is also failed by use your suggest command, the detail command and error messages is in below:
|
I got it mixed because I was still working on #18, it should work now. |
Use comparison types instead of comparison variable names
Thanks! |
Fixes #14
If the function where the first argument is a container or a pointer to a container, then add a const variable that store the function, and the variable name is the function name without the prefix.