CoffeeScriptRedux icon indicating copy to clipboard operation
CoffeeScriptRedux copied to clipboard

Compiler errors do not include line/column information

Open xonev opened this issue 11 years ago • 2 comments

Errors thrown in compiler.coffee do not include line or column information.

For example, if you try to compile a file that contains this:

fn = ->
  return i for i in [1..3]

You will get this output, which contains no information about where the error was generated:

$ node_modules/.bin/coffee --compile < test-compile-error.coffee

/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:154
    throw new Error('expr: Cannot use a ' + s.type + ' as a value');
          ^
Error: expr: Cannot use a ReturnStatement as a value
    at expr (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:154:11)
    at expr (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:136:52)
    at makeReturn (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:183:35)
    at class$.exports.Compiler.expression (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:1141:20)
    at class$.<anonymous> (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:2377:86)
    at class$.exports.Compiler.Compiler.compile.walk (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:2289:19)
    at class$.exports.Compiler.Compiler.compile.walk (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:2280:68)
    at class$.exports.Compiler.Compiler.compile.walk (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:2280:68)
    at Compiler.i [as compile] (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:2376:20)
    at Function.exports.Compiler.cache$2 [as compile] (/Users/xonev/workspace/project/node_modules/coffee-script-redux/lib/compiler.js:655:44)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

xonev avatar Mar 21 '14 19:03 xonev

https://github.com/michaelficarra/CoffeeScriptRedux/issues/248

hmaurer avatar Apr 08 '14 11:04 hmaurer

Since this example is better isolated, I'm going to close the earlier issue as a duplicate of this one.

michaelficarra avatar Apr 09 '14 04:04 michaelficarra