dillon1000/react
Commit
Browse files BuildHIR for OptionalCallExpression
Implements lowering for a subset of optional calls - specifically, we don't (yet) support when the callee is a member expression or an optional member expression. So `foo?.()` works but we bailout on `object?.foo()` and `object.foo?.()`. For `<calleee>?.(<args>)` we lower as roughly: ``` bb0: t0 = <callee> OptionalCall test=bb1 fallthrough= bb1 (value): Branch t0 consequent=bb2 alternate=bb3 bb2 (value): ...lower <args> here... t1 = Call t0, args StoreLocal res, t1 Goto bb4 bb3 (value): t2 = undefined StoreLocal res, t2 Goto bb4 bb4: // result in `res` here ```
Changed paths3 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/visitors.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…