dart-lang / dart-lang/language

Allow null-aware invocations.

Open
#404 2 comments 12 reactions 0 assignees View on GitHub
nnbd state-backlog
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.