Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cfile/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ def _write_function_declaration(self, elem: core.Function) -> None:
self._write("static ")
if isinstance(elem.return_type, core.Type):
self._write_type_declaration(elem.return_type)
if isinstance(elem.return_type, core.TypeDef):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is supposed to be here without having a unit test that proves it. Nevertheless it should say elif here and not if.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can chage it to elif. But should work similary.
Well i need it here otherwise i cannot generate my code :D

@Hadatko Hadatko Oct 22, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doing something like this. Maybe it is not optional. Byt i would like to have function which will return STRING from declaration instead of this hack for cfile.Writer(cfile.StyleOptions()).write_str:

"sizeof({cfile.Writer(cfile.StyleOptions()).write_str(self.cF.sequence().append(self.paramsTypes[param["data"].type]["C"]))})"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this change is not necessary as i should use self.cF.func_call("sizeof", [self.paramsTypes[param["data"].type]["C"]]) instead of what i mentioned. I am developing under pressure a bit and lack of documentation is not helping :D

self._write_typedef_usage(elem.return_type)
elif isinstance(elem.return_type, core.Enum):
self._write_enum_usage(elem.return_type)
elif isinstance(elem.return_type, core.Struct):
Expand Down