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

sanitise result #18

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

sanitise result #18

wants to merge 10 commits into from

Conversation

eugenebokhan
Copy link
Contributor

No description provided.

@eugenebokhan eugenebokhan requested a review from s1ddok March 13, 2021 13:52
@eugenebokhan eugenebokhan self-assigned this Mar 13, 2021

public func sanitizeResult() {
self.result = self.result
.replacingOccurrences(of: "simd_float2,", with: "SIMD2<Float>,")
Copy link
Owner

Choose a reason for hiding this comment

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

why include commas and brackets into replacement?

Copy link
Contributor Author

@eugenebokhan eugenebokhan Mar 14, 2021

Choose a reason for hiding this comment

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

to ignore float2x2, float3x3 etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the pr looks hacky, but does the job

.trimmingCharacters(in: .whitespacesAndNewlines)
if #available(OSX 10.12, *),
let checkedType = TypeSanitizer.sanitizeType(swiftTypeName) {
Copy link
Owner

@s1ddok s1ddok Mar 22, 2021

Choose a reason for hiding this comment

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

I think we can have it, at least as an experimental feature, but we defintely need to introduce a command line argument parameter for this

also, you have to keep in mind that users can use aliases/typenames of their private codebase and that is totally fine (we do not limit swift type usage to simd) hence your approach won't work for such types. I see that we check for nil here but still. I think what we can do instead is introduce a simple dictionary here and try map swiftTypeName to something else

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