coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

Add error message when defer slot is a function call

Open zapu opened this issue 7 years ago • 3 comments

This turned out to be an evening project to make the tests pass again on latest node and npm.

PR fixes compilation error during await foo defer err result, which because of lack of comma is compiled as await foo(defer(err(result))) and err(result) is not valid slot. It's so not valid that it even crashes compiler.

 » echo "await func defer err foo" | iced -cpbs
TypeError: a.icedToSlot is not a function
  at /usr/local/lib/node_modules/iced-coffee-script/lib/coffee-script/nodes.js:3196:27
  at new Defer (/usr/local/lib/node_modules/iced-coffee-script/lib/coffee-script/nodes.js:3199:9)
  at Object.anonymous (/usr/local/lib/node_modules/iced-coffee-script/lib/coffee-script/parser.js:312:58)
  at Parser.parse (/usr/local/lib/node_modules/iced-coffee-script/lib/coffee-script/parser.js:690:36)

 » echo "await func defer err foo" | ./bin/coffee -cpbs
[stdin]:1:18: error: function call cannot be a slot for defer
await func defer err foo
                 ^^^^^^^

zapu avatar May 05 '18 18:05 zapu

I think you need to hit merge as well. Thanks!

zapu avatar May 11 '18 18:05 zapu

ah, but I didn't touch the version string anywhere. please hold

zapu avatar May 11 '18 18:05 zapu

Done! Bumped version and recompiled browser bundle

zapu avatar May 12 '18 10:05 zapu