Fix closure warnings in JS library code#21670
Open
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
Open
Fix closure warnings in JS library code#21670sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
sbc100 wants to merge 1 commit intoemscripten-core:mainfrom
Conversation
935bbdf to
ca0367c
Compare
For some reason closure doesn't report these real issues in the current configuration but they show up in the `MODULARIZE_INSTANCE` configuration that I'm working on. Most of these issues consist of adding default parameters to functions declared on objects such as `FS`. In addition there are a couple of other changes that are all real fixes: - ErrnoError unified between old FS and wasm FS. This should have been done as part of emscripten-core#21149 - Default initializer for `canvasResizedCallbackTargetThread` removed since `JSEvents.getTargetThreadForEventCallback()` will always return undefined when called with no arguments - Extra arguments to copyIndexedColorData removed in library_sdl.js since it only ever called with one arg. - Sorting callback for JSEvents.deferredCalls.sort updated to correctly return number rather than a boolean. This change is basically code size neutral with a few tests coming in a byte or two heavier and others a byte or two lighter.
ca0367c to
f4502a5
Compare
kripken
reviewed
Apr 2, 2024
| }, | ||
|
|
||
| setCanvasSize(width, height, noUpdates) { | ||
| setCanvasSize(width, height, noUpdates = false) { |
Member
There was a problem hiding this comment.
Is it better perhaps to use a closure annotation here instead, which would not add code size? (As this is safe - it is just that closure flags it as a possible bug, but here it isn't.)
Member
|
If you want a third set of eyes on this, then @brendandahl is probably a better set. |
juj
reviewed
Apr 3, 2024
| for (var i = 0; i < JSEvents.eventHandlers.length; ++i) { | ||
| if (JSEvents.eventHandlers[i].target == target && | ||
| (!eventTypeString || eventTypeString == JSEvents.eventHandlers[i].eventTypeString)) { | ||
| if (JSEvents.eventHandlers[i].target) { |
Collaborator
There was a problem hiding this comment.
Shouldn't this be JSEvents.eventHandlers[i].target == target?
juj
reviewed
Apr 3, 2024
| return FS.mknod(path, mode, 0); | ||
| }, | ||
| mkdir(path, mode) { | ||
| mkdir(path, mode = undefined) { |
Collaborator
There was a problem hiding this comment.
Does Closure optimize these = undefined away?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For some reason closure doesn't report these real issues in the current configuration but they show up in the
MODULARIZE_INSTANCEconfiguration that I'm working on.Most of these issues consist of adding default parameters to functions declared on objects such as
FS.In addition there are a couple of other changes that are all real fixes:
canvasResizedCallbackTargetThreadremoved sinceJSEvents.getTargetThreadForEventCallback()will always return undefined when called with no argumentsreturn number rather than a boolean.
This change is basically code size neutral with a few tests coming in a byte or two heavier and others a byte or two lighter.