Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Oct 24, 2025

This null chaining operator is not only redundant (because it happens only after a typeof check), but simply doesn't work.

One cannot do foo?.bar if foo does not exist. One would need to instead do globalThis?.foo?.bar.

@sbc100 sbc100 requested a review from juj October 24, 2025 17:29
@sbc100
Copy link
Collaborator Author

sbc100 commented Oct 24, 2025

Speaking of which, I assume there is a reason we use typeof here in this file instead of simply using an optional chain starting with globalThis?

@sbc100 sbc100 force-pushed the minimum_runtime_check2 branch from 77892a2 to c2fd910 Compare October 24, 2025 17:33
@juj
Copy link
Collaborator

juj commented Oct 24, 2025

Speaking of which, I assume there is a reason we use typeof here in this file instead of simply using an optional chain starting with globalThis

This was one of the review comments: #25414 (comment) . The idea here was that even if this code is run on a very old browser, it would still work.

Though now I realize that I was using ?. thinking that "it'll get babeled away", but naturally that won't be the case.

So if something, it would probably be good to remove uses of ES6 altogether in this code.

This null chaining operator is not only redundant (because it happens
only after a typeof check), but simply doesn't work.

One cannot do `foo?.bar` if `foo` does not exist.  One would need to
instead do `globalThis?.foo?.bar`.
@sbc100 sbc100 force-pushed the minimum_runtime_check2 branch from c2fd910 to 70ed25c Compare October 24, 2025 19:14
@sbc100 sbc100 merged commit b1072be into emscripten-core:main Oct 24, 2025
34 checks passed
@sbc100 sbc100 deleted the minimum_runtime_check2 branch October 24, 2025 20:46
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