Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Left precedence of pipeline #12

@jridgewell

Description

@jridgewell

Spinning this out of #11:

On the left, |> is as tight as assignment operators. This allows parsing x = y |> z as x = (y |> z), and x ? y : z |> w as (x ? y : z) |> w.

That ternary example is super confusing, and it's different than how arrows are parsed:

// arrow:
x ? y : z => w;

// parsed as
x ? y : (z => w);

The spec seems to say arrows and pipelines would bind at the same level, so I'd think the ternary example would be x ? y : (z |> w)

When I load this into AST explorer, I actually get the same results for pipeline and arrow, but maybe that's just because babel hasn't fixed the right-associativity of the operator yet.

/cc @nicolo-ribaudo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions