Skip to content

Allow null-aware invocations. #404

Open
@lrhn

Description

@lrhn

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?.<Types>(args) as null-aware invocations.

The current workaround is to use o?.call(args) and o?.call<Types>(args), which works, but is inconsistent with that we allow o(args) and o<Types>(args) directly. The ?.call(...) workaround is already in common use.

This change modifies the grammar to allow <argumentPart> as a <cascadeSelector> (allowing o..(args) and o?..(args)) and allowing an <argumentPart> after a ?. as well, in whichever way we already modify the grammar to allow ?.[e].
An <argumentPart> is still not an assignable selector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions