Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe call operators ?. #2142

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Expand example
  • Loading branch information
Gregoirevda committed Aug 14, 2018
commit e4f80af418a99da021590e22cb2a38565a08ce81
11 changes: 11 additions & 0 deletions src/reason-parser/reason_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -2984,6 +2984,17 @@ parenthesized_expr:
* | Some(a) => Some(a.b)
* | None => None
* };
*
* let res = c?.+d;
*
* -generates->
*
* let res = switch c {
* | Some(c) => c.d <-- assuming d is optional
* | None => None
* };
*
* Same goes for ?# and ?#+ for JS objects
*)
| E OPTIONALACCESS simple_expr_no_call
{
Expand Down