format list changes for JSLint

and rename var ‘me’ to ‘myself’ to make it conform to the rest of
Snap’s codebase
pull/3/merge
jmoenig 2014-07-17 09:12:20 +02:00
rodzic fe8f15b8c7
commit ff854784c0
1 zmienionych plików z 15 dodań i 15 usunięć

Wyświetl plik

@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph,
StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph, StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph,
MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/ MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/
modules.lists = '2014-Jun-04'; modules.lists = '2014-July-14';
var List; var List;
var ListWatcherMorph; var ListWatcherMorph;
@ -281,8 +281,8 @@ List.prototype.becomeArray = function () {
this.contents.push(next.at(i)); this.contents.push(next.at(i));
} }
this.isLinked = false; this.isLinked = false;
this.first = null; this.first = null;
this.rest = null; this.rest = null;
} }
}; };
@ -304,43 +304,43 @@ List.prototype.becomeLinked = function () {
// List testing // List testing
List.prototype.equalTo = function (other) { List.prototype.equalTo = function (other) {
var me = this, it = other, i, j, loopcount; var myself = this, it = other, i, j, loopcount;
if (!(other instanceof List)) { if (!(other instanceof List)) {
return false; return false;
} }
while (me.isLinked && it.isLinked) { while (myself.isLinked && it.isLinked) {
if (!snapEquals(me.first, it.first)) { if (!snapEquals(myself.first, it.first)) {
return false; return false;
} }
me = me.rest; myself = myself.rest;
it = it.rest; it = it.rest;
} }
if (it.isLinked) { if (it.isLinked) {
i = it; i = it;
it = me; it = myself;
me = i; myself = i;
} }
j = 0; j = 0;
while (me.isLinked) { while (myself.isLinked) {
if (!snapEquals(me.first, it.contents[j])) { if (!snapEquals(myself.first, it.contents[j])) {
return false; return false;
} }
me = me.rest; myself = myself.rest;
j += 1; j += 1;
} }
i = 0; i = 0;
if (me.contents.length !== (it.contents.length - j)) { if (myself.contents.length !== (it.contents.length - j)) {
return false; return false;
} }
loopcount = me.contents.length; loopcount = myself.contents.length;
while (loopcount > 0) { while (loopcount > 0) {
loopcount -= 1; loopcount -= 1;
if (!snapEquals(me.contents[i], it.contents[j])) { if (!snapEquals(myself.contents[i], it.contents[j])) {
return false; return false;
} }
i += 1; i += 1;