dart-lang / dart-lang/language
Allow null-aware invocations.
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
We already plan to allow `o?.[v]` as a null-aware index operator access (#376).
To complete the selectors, we will also allow `o?.(args)` and `o?.(args)` as null-aware invocations.
The current workaround is to use `o?.call(args)` and `o?.call(args)`, which works, but is inconsistent with that we allow `o(args)` and `o(args)` directly. The `?.call(...)` workaround is already in common use.
This change modifies the grammar to allow `` as a `` (allowing `o..(args)` and `o?..(args)`) and allowing an `` after a `?.` as well, in whichever way we already modify the grammar to allow `?.[e]`.
An `` is still not an assignable selector.
Contributor guide
Assessment
This issue has not been assessed yet.