Emit native JS Nullish Coalescing operator (??)#136
Emit native JS Nullish Coalescing operator (??)#136theolivenbaum wants to merge 1 commit intomasterfrom
Conversation
Replaced the verbose temporary variable generation for the null coalescing operator (`??`) with the native JavaScript `??` operator. This simplifies the generated code and aligns with modern JavaScript standards. Note: The Optional Chaining operator (`?.`) remains rewritten to explicit null checks due to parser limitations in the current compiler architecture. Co-authored-by: theolivenbaum <8791811+theolivenbaum@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Implemented native emission of the JavaScript Nullish Coalescing operator (
??) inBinaryOperatorBlock. This replaces the previous implementation which generated complex ternary expressions with temporary variables (e.g.,($t1 = val, $t1 != null ? $t1 : default)).This change improves readability and semantic correctness (handling
0,false,""correctly compared to||, though H5 handled this previously with explicit null checks).Verified with new integration tests covering string, nullable types, and side effects. Existing tests passed (with one unrelated known failure).
PR created automatically by Jules for task 13322305318253151803 started by @theolivenbaum