Skip to content

Cleanup unused code, fix event handlers crash #4

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

Merged
merged 7 commits into from
Dec 27, 2020
Merged

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Dec 26, 2020

Some weird names and typealiases were cleaned up (I don't think that Int8ArrayOrInt16ArrayOrInt32ArrayOrUint8ArrayOrUint16ArrayOrUint32ArrayOrUint8ClampedArrayOrFloat32ArrayOrFloat64ArrayOrDataView or typealias VoidFunction = (() -> Void) could be useful in any way). GlobalEventHandlers protocol which was only inherited by a single concrete type was removed with its extension becoming the extension of the corresponding class.

I've also cleaned up event handlers to retain and release closures when needed, which makes our single basic test pass in browsers. Basic CI config to verify that is added here.

A few other uses of JSClosure were updated accordingly to fix memory management. Unused ClosureHandler property wrapper is removed, leaving only OptionalClosureHandler.

@MaxDesiatov MaxDesiatov added bug Something isn't working continuous integration Changes related to CI/CD labels Dec 26, 2020
Copy link
Member

@j-f1 j-f1 left a comment

Choose a reason for hiding this comment

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

LGTM for now but in the long term I’m worried about modifying the generated files too much. The specs we depend on will change from time to time and we should keep up to date. Ideally we’d have a way to list the APIs we’ve manually implemented in Swift, then tweak webidl2swift to avoid auto-generating those APIs.

@MaxDesiatov
Copy link
Contributor Author

Great point! I'm going to submit another PR to the generator soon to provide better tokenizer diagnostics, as I'm getting inscrutable errors with some other spec files. I hope I'm more familiar with the codebase by then to find a way to avoid overwriting manually updated files.

Base automatically changed from update-dependencies to main December 27, 2020 11:59
@MaxDesiatov MaxDesiatov marked this pull request as ready for review December 27, 2020 11:59
@MaxDesiatov MaxDesiatov merged commit e4b50a4 into main Dec 27, 2020
@MaxDesiatov MaxDesiatov deleted the fix-handler-crash branch December 27, 2020 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working continuous integration Changes related to CI/CD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants