1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

expressions nested in expressions made for some indentation issues -- statements are now responsible for their own leading indentation

This commit is contained in:
Jeremy Ashkenas 2009-12-31 16:50:46 -05:00
parent bfd7455db4
commit f299972713
8 changed files with 102 additions and 78 deletions

View file

@ -1,20 +1,24 @@
(function(){
var __a, __b, __c, __d, __e, __f, __g, __h, food, i, lunch, row;
var __a, __b, __c, __d, __e, __f, __g, food, i, lunch, row;
// Eat lunch.
__a = ['toast', 'cheese', 'wine'];
__d = [];
for (__b=0, __c=__a.length; __b<__c; __b++) {
food = __a[__b];
__d[__b] = food.eat();
__c = [];
for (__b in __a) {
if (__a.hasOwnProperty(__b)) {
food = __a[__b];
__d = food.eat();
__c.push(__d);
}
}
lunch = __d;
lunch = __c;
// Zebra-stripe a table.
__e = table;
__h = [];
for (__f=0, __g=__e.length; __f<__g; __f++) {
row = __e[__f];
i = __f;
__h[__f] = i % 2 === 0 ? highlight(row) : null;
__f = [];
for (i in __e) {
if (__e.hasOwnProperty(i)) {
row = __e[i];
i % 2 === 0 ? highlight(row) : null;
}
}
__h;
__f;
})();

View file

@ -23,10 +23,13 @@
};
// Array comprehensions:
__a = list;
__d = [];
for (__b=0, __c=__a.length; __b<__c; __b++) {
num = __a[__b];
__d[__b] = math.cube(num);
__c = [];
for (__b in __a) {
if (__a.hasOwnProperty(__b)) {
num = __a[__b];
__d = math.cube(num);
__c.push(__d);
}
}
cubed_list = __d;
cubed_list = __c;
})();

View file

@ -4,7 +4,7 @@
change_numbers = function change_numbers() {
var new_num;
num = 2;
return (new_num = 3);
return (new_num = 3);
};
new_num = change_numbers();
})();

View file

@ -6,7 +6,7 @@
return alert(this.name + " moved " + meters + "m.");
};
Snake = function Snake(name) {
return (this.name = name);
return (this.name = name);
};
Snake.__superClass__ = Animal.prototype;
Snake.prototype = new Animal();
@ -16,7 +16,7 @@
return Snake.__superClass__.move.call(this, 5);
};
Horse = function Horse(name) {
return (this.name = name);
return (this.name = name);
};
Horse.__superClass__ = Animal.prototype;
Horse.prototype = new Animal();