mattbierner / khepri

ECMAScript derived programming language
http://khepri-lang.com/
MIT License
67 stars 3 forks source link

Inefficent Code For Call of curried operator #90

Closed mattbierner closed 10 years ago

mattbierner commented 10 years ago
(+, 3) 4;

Outputs:

var x;
((x = 3), (function(y) {
    return (x + y);
}))(4);

Target:

var x, y;
((x=3), (y = 4), x + y);
mattbierner commented 10 years ago

Fixed in V0.3.4

(+, 2) 4; 
//ouput
"use strict";
6;

var a, b;
(+, a) b; 
//output
"use strict";
var a, b;
a + b;

Forcing no constant folding:

var a, b;
(+, a.x) b.x;

// Output
"use strict";
var x, y, a, b;
((x = a.x), (y = b.x), (x + y));