Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kaffeine chokes on some return statements #22

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

Kaffeine chokes on some return statements #22

felixge opened this issue Apr 16, 2011 · 6 comments

Comments

@felixge
Copy link

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
Copy link
Owner

weepy commented Apr 16, 2011

Yep that's a bug. Easy to fix luckily

Tapped on my fone

On 16 Apr 2011, at 18:09, felixge
[email protected]
wrote:

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. (/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.

Reply to this email directly or view it on GitHub:
#22

@weepy
Copy link
Owner

weepy commented Apr 16, 2011

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

@weepy
Copy link
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
Copy link
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
Copy link
Author

felixge commented Apr 17, 2011

I have the same problem with instanceof. For example:

return file instanceof StreamFile

Produces the same issues.

@weepy
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants