Giter Site home page Giter Site logo

harmonizer's People

Contributors

kamicane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

harmonizer's Issues

Using let renames wrong variables

let y = x => x * 2;
var z = x => ++x;

Compiles to

var yA = function (xA) {
  return xA * 2;
};
var z = function (x) {
  return ++xA;
};

The local variable x in function z shouldn't be renamed.

Unknown expression type: SpreadElement

given a source like

var ArrayLike = class extends Array {
  constructor(...args){
    if (args.length === 1 && typeof args[0] === 'Number') {
        this.length = args[0]
    }else{
        this.push.apply(this, args)
    }
  }
}

var HaskellArray = class extends ArrayLike {
  constructor(...args){
    if(args.length === 1) {
      super(0)
      this.push(args[0])
    }else{
      super(...args)
    }
  }
  head(){
    return new HaskellArray(this[0])
  }
  tail(){
    return new HaskellArray(...this.slice(1))
  }
}

I get an error while transpiling, trying the same code on http://kamicane.github.io/harmonizer-demo/
on the es5 output (escodegen) I can read the error Unknown expression type: SpreadElement on the tail method

Missing Type: ImportDeclaration

Guessing it's not supported as of yet, but for funzies here's the stack trace (Node v0.10.28):

node_modules/harmonizer/node_modules/nodes/lib/factory.js:475
  if (!NodeClass) throw new Error('missing type: ' + type);
                        ^
Error: missing type: ImportDeclaration
    at build (node_modules/nodes/lib/factory.js:475:25)
    at Array.map (native)
    at build (node_modules/harmonizer/node_modules/nodes/lib/factory.js:491:37)
    at transform (node_modules/harmonizer/index.js:56:17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.