Skip to content

CoffeeScript descending loops broken (e.g. for [10..1]) #97

Open

Description

@differentmatt

Loops using descending shorthand notation [10..1] aren't working in CoffeeScript.

Browser console error:
escodegen couldn't handle Object { type="Program", attr={...}, body=[1]}
gave error:
Error: Invalid mapping: {"generated":{"line":5,"column":25},"source":"foo","original":{"line":0,"column":0},"name":"accum$"}

Ascending [1..10] works. Spelled out arrays work, [3, 2, 1], [1, 2, 3].

total = 0
total += num for num in [10..1]
# total still 0

The equivalent JS generated from http://coffeescript.org/ can be run through Aether.

Failing Aether test: CS test Suite! Basics Should Map

Escodegen reference: https://github.com/Constellation/escodegen/wiki/Source-Map-Usage

Reminder: Enable Should Map test case with the fix.

Activity

  1. nwinter commented on May 22, 2016

    @nwinter
    Contributor

    No longer throwing escodegen error, but total is still 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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