Skip to content

Conversation

grivera64
Copy link
Contributor

@grivera64 grivera64 commented Mar 14, 2025

Description

This PR fixes maker.Make() to no longer expect a struct's definition to be defined in all input files.

Changes

  • Return structtype error after searching all files (rather than within a file search) in the first pass
  • Rename maker.validateStructType() -> maker.containsStructType()
  • (WIP) Add tests for the new functionality

Fixes Issue #69

This commit fixes `maker.Make()` to no longer expect a struct's
definition to be defined in all input files.

Fixes Issue vburenin#69
@gaby
Copy link
Collaborator

gaby commented Mar 15, 2025

@grivera64 I think the changes here are the same as the ones in #65 but implemented differently?

@grivera64
Copy link
Contributor Author

@grivera64 I think the changes here are the same as the ones in #65 but implemented differently?

@gaby Ah yes, it looks like they did a more convenient check. Instead of checking each file's declared types, that PR checks all declared types directly outside of the for loop. I think it may be cleaner to do that instead.

I believe that #65 does not include any tests though. I've added some here which should be compatible with both versions. Would you like me to edit this PR to include the maker.Make() changes from that PR instead of the current ones?

Or would we want to merge that other PR and merge this one with the new test case?

@gaby
Copy link
Collaborator

gaby commented Mar 15, 2025

@grivera64 Lets update this one with the changes from #65 that way we can use your unit-tests

@grivera64
Copy link
Contributor Author

@grivera64 Lets update this one with the changes from #65 that way we can use your unit-tests

Sounds good! I will make a new commit moving the check outside of the for loop like in #65.

@grivera64
Copy link
Contributor Author

@gaby Done! I also reverted the name change from containsStructType back to validateStructType since it makes more sense to keep that name when it's done outside of the for loop.

@gaby gaby changed the title 🩹 Fix: Update maker.Make() to work with a struct across files 🩹 fix: Update maker.Make() to work with a struct across files Mar 15, 2025
@gaby
Copy link
Collaborator

gaby commented Mar 15, 2025

@grivera64 Seems like #66 also had similar changes, although it was created by the same person as #65 so it's probably old code from another branch?

@grivera64
Copy link
Contributor Author

@grivera64 Seems like #66 also had similar changes, although it was created by the same person as #65 so it's probably old code from another branch?

It seems that PR #66 was created with the same commit history as #65 (maybe checked out a branch based on #65), but is an unrelated issue.

#66 tries to fix the situation where the output interface's package is different from the input package. In these cases, any non built-in types declared in the package should be prefixed by the appropriate package (and be imported) when generating the interface in the new package.

Copy link
Collaborator

@gaby gaby left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@gaby gaby changed the title 🩹 fix: Update maker.Make() to work with a struct across files fix: Update maker.Make() to work with a struct across files Mar 19, 2025
@gaby gaby merged commit 7b8567d into vburenin:master Mar 24, 2025
9 checks passed
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