Skip to content

Wrong line numbers in stack trace. #4418

@rayzorben

Description

@rayzorben

Read on a few websites that just running 'coffee app.coffee' should generate source maps and print out correct debugging information.

Taken from another website, the simple example:

  1 test = ->
  2     people =
  3         john:
  4             first_name: 'john'
  5             last_name: 'doe'
  6         mary:
  7             first_name: 'mary'
  8             last_name: 'jane'
  9
 10     console.log("Welcome", people[p].first_name, people[p].last_name, "!!!")     for p in ['john', 'mary', 'josh']
 11
 12 process.nextTick test

When run with coffee test.coffee I get the following error

Welcome john doe !!!
Welcome mary jane !!!
/home/pi/onkyo/nodejs-onkyoserial/test.coffee:20
      results.push(console.log("Welcome", people[p].first_name, people[p].last_name, "!!!"));
                                                   ^

TypeError: Cannot read property 'first_name' of undefined
    at test (/home/pi/onkyo/nodejs-onkyoserial/test.coffee:20:52)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

Shows the error on test.coffee line 20, but there are only 12 lines in the file. I tried compiling it with a source map (-m) as well as with an inline map (-M) and running the resulting .js file through node, and still get errors on or around line 20.

Running coffee-script 1.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions