rainforestapp / decaf

Coffeescript to ES.next transpiler. Now maintained over at
https://github.com/juliankrispel/decaf
MIT License
106 stars 10 forks source link

Switch without a value #85

Closed bouk closed 8 years ago

bouk commented 8 years ago

Input:

switch
  when true
    1

Error:

TypeError: Cannot read property 'constructor' of null
  at mapExpression (/Users/bouke/repos/decaf/dist/index.js:1034:18)
  at mapSwitchStatement (/Users/bouke/repos/decaf/dist/index.js:919:45)
  at mapStatement (/Users/bouke/repos/decaf/dist/index.js:514:39)
  at /Users/bouke/repos/decaf/dist/index.js:526:12
  at Array.map (native)
  at mapBlockStatements (/Users/bouke/repos/decaf/dist/index.js:525:27)
  at mapBlockStatement (/Users/bouke/repos/decaf/dist/index.js:533:23)
  at transpile (/Users/bouke/repos/decaf/dist/index.js:1197:17)
  at /Users/bouke/repos/decaf/dist/index.js:1214:12
  at /Users/bouke/repos/decaf/node_modules/lodash/internal/createFlow.js:67:31
  at Object.compile (/Users/bouke/repos/decaf/dist/index.js:1217:10)
  at runByFile (/Users/bouke/repos/decaf/bin/decaf:52:20)
  at /Users/bouke/repos/decaf/bin/decaf:44:7
  at Array.forEach (native)
  at run (/Users/bouke/repos/decaf/bin/decaf:28:9)
  at Object.<anonymous> (/Users/bouke/repos/decaf/bin/decaf:25:1)
  at Module._compile (module.js:413:34)
  at Object.Module._extensions..js (module.js:422:10)
  at Module.load (module.js:357:32)
  at Function.Module._load (module.js:314:12)
  at Function.Module.runMain (module.js:447:10)
  at startup (node.js:139:18)
  at node.js:999:3

This is probably best transformed into an if/else statement

juliankrispel commented 8 years ago

thanks looking