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

Exclude types before generating them #76

Merged
merged 3 commits into from
May 18, 2022
Merged

Exclude types before generating them #76

merged 3 commits into from
May 18, 2022

Conversation

ferranbt
Copy link
Owner

@ferranbt ferranbt commented May 18, 2022

Unlike the include-objs flag which forces sszgen to only generate objects that are included, the exclude-objs flag performs that filter after the generation is done. Thus, if an invalid object is present on the file, it cannot be excluded and the generation fails like in #75. An example of an invalid type would be:

type Bytes []byte

Since we cannot add tags to this alias struct. This type could never be rendered.
I am still not sure if we should be smart and skip right away these objects from the generation. Then, for now, this is a good enough workaround to remove this limitation.

It also fixes the core issue on #75 in which the tags used to declare one alias would be used in another one.

{
elemIndx := hh.Index()
byteLen := uint64(len(c.Bar))
if byteLen > 2048 {

Choose a reason for hiding this comment

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

This should be 32, correct?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, you are right. This is not correct.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Now it works.

@ferranbt ferranbt merged commit fadd032 into master May 18, 2022
@ferranbt ferranbt deleted the fix-exclude-types branch July 11, 2022 20:03
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

Successfully merging this pull request may close these issues.

2 participants