-
Notifications
You must be signed in to change notification settings - Fork 19
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
generated code not compiling due to missing cast to an enum #155
Comments
Hey @joelmartinez, This looking similar to #150. The code that would need to change is here: https://github.com/bottlenoselabs/c2cs/blob/main/src/cs/production/C2CS.Tool/Features/WriteCodeCSharp/Domain/CodeGenerator/Handlers/MacroCodeGenerator.cs#L41. |
@lithiumtoast ahh yes indeed, that does look like a) the same issue, and b) probably where that needs to change. Would this be a simple enough change? code = $@"
{attributesString}
public static {node.Type} {name} = ({node.Type}){node.Value};
"; If so ... do you want me to open a PR with this? Do you think it's easy enough to onboard by cloning the repo and making the change? would you recommend adding some test for this somewhere? |
@lithiumtoast ok, so I created a pull request with this change. I ran the unit tests and they all passed. There were a few updates I didn't include, for example some changes to the generated metadata of the generated files, e.g.
Let me know if you want me to include those in the PR as well |
Hey @joelmartinez, I see you figured it out with your PR #157.
When I split If you are feeling up to it, you could add a test for a macro object using a theory attribute for macro objects similar to enums. |
I merged it in thanks, @joelmartinez |
@joelmartinez It's up on NuGet as version |
Amazing, thank you @lithiumtoast! Sorry, I meant to post/respond that I had started to take a look at adding the unit test, but unfortunately I was quite busy and didn't get a chance to really dig in. Appreciate your help in this 🙏🏼 |
@joelmartinez I did it as part of #158. There was a couple things that needed fixing to make adding more unit tests easier anyways. |
Hi ... I'm working on generating bindings with c2cs, and am getting the following error during the generate command:
That points to this line:
So the
128
is just missing an explicit cast to_lv_buttonmatrix_ctrl_t
And if it helps, here's the corresponding enum definition in the ast file:
Any hints or ideas as to what might be going on and how to mitigate would be greatly appreciated!
The text was updated successfully, but these errors were encountered: