Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

prefix op on index expr doesn't return value #267

Open
@jmesserly

Description

@jmesserly

This test uses async, but I don't think that's the issue. We desugar ++v[0] without a return value, so the expect 42 fails.

    test("suffix operator + pre-increment", () {
      f() async {
        var v = [41];
        return await ++v[0];
      }
      return expect42(f());
    });

the bug seems to be here:

            let v = [41];
            return yield (() => {
              let i = 0;
              return v[dartx.set](i, dart.dsend(v[dartx.get](i), '+', 1));
            })();

Note the return v[dartx.set] line ... how can that possibly work? []= methods and setters don't need to return values...

edit: and we get undefined back out from calling the function. Array looks fine, v is [42]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions