Skip to content

Kaffeine chokes on some return statements #22

Open
felixge opened this Issue Apr 16, 2011 · 6 comments

2 participants

@felixge
felixge commented Apr 16, 2011

Kaffeine chockes on return statements like this:

return typeof step === 'string';

The output I get is:

/var/git/transloader.transload.it/api2/node_modules/transloadit/assembly.js (compiled):254
      return typeof return step === 'string';
                    ^^^^^^

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
SyntaxError: Unexpected token return
    at Module._compile (module.js:399:25)
    at /usr/local/lib/node_modules/kaffeine/lib/index.js:94:12
    at Object..js (/var/git/transloader.transload.it/api2/node_modules/transloadit/transloadit.js:9:12)
    at Module.load (module.js:336:31)
    at Function._load (module.js:297:12)
    at require (module.js:348:19)
    at Object.<anonymous> (/var/git/transloader.transload.it/api2/node_modules/transloadit/assembly_manager.js (compiled):4:16)
    at Module._compile (module.js:404:26)
    at /usr/local/lib/node_modules/kaffeine/lib/index.js:94:12
    at Object..js (/var/git/transloader.transload.it/api2/node_modules/transloadit/transloadit.js:9:12)

The problem goes way when changing my line to:

return (typeof step === 'string');

But since my code was valid JS to begin with, I think this is probably a bug.

@weepy
Owner
weepy commented Apr 16, 2011
@weepy
Owner
weepy commented Apr 16, 2011

please let me know with any other return statements that don't work as expected ...

@weepy
Owner
weepy commented Apr 17, 2011

I think what I need to do here is create the concept of operators such as

unary

  • var
  • return
  • throw
  • typeof

binary

  • instanceof
@weepy
Owner
weepy commented Apr 17, 2011

for the moment I've pushed an easy fix for this - you suggested there was some other cases where it choked?

@felixge
felixge commented Apr 17, 2011

I have the same problem with instanceof. For example:

return file instanceof StreamFile

Produces the same issues.

@weepy
Owner
weepy commented Apr 18, 2011

I've pushed a fix for this - also fixes the problem with the regexs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.