dillon1000/react
Commit
Browse files [hir] implement nullish coalescing operator
This currently basically lowers the code into the equivalent of ``` const vLeft = <left>; const vNull = null; const vCond = vLeft != vNull; vCond ? vLeft : <right> ``` I created a temporary `Place` to hold the `null` constant value because the binary operator in HIR accepts only `Place`s. Not sure if this is the preferred approach. Alternatives I could think of: - Allow constants as an alternative to Place? - A `NotNull` operator for `<x> != null` - Some other extension to the HIR?
Changed paths4 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/HIR/InferReferenceEffects.ts ModifiedA compiler/forget/src/__tests__/fixtures/hir/logical-expression.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/logical-expression.js AddedPatch
Files changed
Rendering syntax-highlighted changes…