Permalink
Commits on Dec 29, 2011
  1. Fixed a problem with if statements (the rewriting is too greedy and i…

    …t removes too much code)
    
    Sample code
    =======
    
        if(isSafari())
            ta = TEXTAREA(name_d, d.name_val);
        else {
            ta = TEXTAREA(name_d);
        }
    
        if(isSafari()) { } else { ta = TEXTAREA(name_d); }
    
        if(isSafari()) { } else { ta = TEXTAREA(name_d); }
    
    How the current compiler compiles it (incorrectly for the first rewrite)
    =========
    
        ta = TEXTAREA(name_d)  unless isSafari()
        ta = TEXTAREA(name_d)  unless isSafari()
        ta = TEXTAREA(name_d)  unless isSafari()
    
    How this fix compiles the above JS code (correctly):
    ========
    
        if isSafari()
          ta = TEXTAREA(name_d, d.name_val)
        else
          ta = TEXTAREA(name_d)
        ta = TEXTAREA(name_d)  unless isSafari()
        ta = TEXTAREA(name_d)  unless isSafari()
    
    This issue has been reported here
    js2coffee#108
    amix committed Dec 29, 2011
Commits on Dec 28, 2011
  1. Added the ability to output more Pythonic code by providing --pythonic

    Made following options configureable via lib/codestyle.coffee:
    
    tabspacing = 2
    parenthesized_calls = false
    explicit_return = false
    use_unless = true
    doublespacing_if = true
    
    Added a command line option --pythonic that when provided will
    configure code style to be more pythonic (tabspace 4, no unless,
    parenthesized calls and explicit returns).
    
    Commandline parsing is a bit dirty now and I would have used something
    like commander (npm commander), but I am unsure what the author prefers.
    
    A showcase of the new features:
    ~/> cat test.'s
    function helloWorld(some_value) {
        if(some_value != 'hello')
            return;
        aFunctionCall('hello');
        return "value";
    }
    
    ~/> ./bin/js2coffee test.js
    helloWorld = (some_value) ->
      return  unless some_value is "hello"
      aFunctionCall "hello"
      "value"
    
    ~/> ./bin/js2coffee --pythonic test.js
    helloWorld = (some_value) ->
        return if some_value isnt "hello"
        aFunctionCall("hello")
        return "value"
    amix committed Dec 28, 2011
Commits on Nov 19, 2011
  1. Merge pull request #109 from tricknotes/fix-cake-text

    Fix cake test
    rstacruz committed Nov 19, 2011
  2. Fix cake test

    tricknotes committed Nov 19, 2011
Commits on Oct 20, 2011
Commits on Oct 15, 2011
  1. Release v0.1.2

    rstacruz committed Oct 15, 2011
  2. Update HISTORY.md.

    rstacruz committed Oct 15, 2011
  3. Retrieve reserved words from coffeescript; removed use of reserved wo…

    …rd 'yes' from a test.
    codelahoma committed with rstacruz Aug 13, 2011
  4. Add a test for function invocations with the first argument being an …

    …object literal. Related to #69.
    rstacruz committed Oct 15, 2011
  5. Compile 'undefined' properly.

    rstacruz committed Oct 15, 2011
  6. Update HISTORY.md.

    rstacruz committed Oct 15, 2011
  7. Update HISTORY.md.

    rstacruz committed Oct 15, 2011
  8. Update HISTORY.md.

    rstacruz committed Oct 15, 2011
  9. Fix fall through switch case

    Surat committed with rstacruz Sep 4, 2011
  10. don't unreserve property accessors

    fixes #95
    Mike Blume committed with rstacruz Oct 4, 2011
  11. also don't inline objects if they're in lists

    Mike Blume committed with rstacruz Oct 7, 2011
  12. make tests pass

    Mike Blume committed with rstacruz Oct 4, 2011
  13. Inline most one-property objects

    Just newline them if they are themselves property values.
    
    This will preserve the desired round-trip behavior with fewer unneeded
    side-effects
    Mike Blume committed with rstacruz Oct 4, 2011
  14. don't special-case one-property objects

    ensure generated coffeescript does not fall afoul of jashkenas/coffeescript#1116
    Mike Blume committed with rstacruz Oct 4, 2011
  15. Use 'npm test' for tests.

    rstacruz committed Oct 15, 2011
  16. Update HISTORY.md.

    rstacruz committed Oct 15, 2011