Dropped get_hasNext (hasNext property) from js library files.

This commit is contained in:
develar
2013-06-21 16:21:28 +04:00
committed by Zalim Bashorov
parent 9d1e319f0f
commit 7f1f2aa641
3 changed files with 10 additions and 19 deletions
+3 -9
View File
@@ -116,9 +116,6 @@ var kotlin = {set:function (receiver, key, value) {
next: function () { next: function () {
return this.array[this.index++]; return this.array[this.index++];
}, },
get_hasNext: function () {
return this.index < this.size;
},
hasNext: function () { hasNext: function () {
return this.index < this.size; return this.index < this.size;
} }
@@ -132,9 +129,6 @@ var kotlin = {set:function (receiver, key, value) {
}, },
next: function () { next: function () {
return this.list.get(this.index++); return this.list.get(this.index++);
},
get_hasNext: function () {
return this.index < this.size;
} }
}); });
@@ -379,8 +373,8 @@ var kotlin = {set:function (receiver, key, value) {
this.set_i(this.$i + this.$increment); this.set_i(this.$i + this.$increment);
return value; return value;
}, },
get_hasNext: function () { hasNext: function () {
return this.$increment > 0 ? this.$next <= this.$end : this.$next >= this.$end; return this.get_count() > 0;
} }
}); });
@@ -449,7 +443,7 @@ var kotlin = {set:function (receiver, key, value) {
throw Kotlin.Exception(); throw Kotlin.Exception();
} }
var max = it.next(); var max = it.next();
while (it.get_hasNext()) { while (it.hasNext()) {
var el = it.next(); var el = it.next();
if (comp.compare(max, el) < 0) { if (comp.compare(max, el) < 0) {
max = el; max = el;
@@ -175,12 +175,9 @@ var Kotlin = Object.create(null);
initializer = value; initializer = value;
} }
else if (name.indexOf("get_") === 0) { else if (name.indexOf("get_") === 0) {
// our std lib contains collision: hasNext property vs hasNext as function, we prefer function (actually, it does work) descriptors[name.substring(4)] = {get: value};
var getterName = name.substring(4); // std lib code can refers to
if (!descriptors.hasOwnProperty(getterName)) { descriptors[name] = {value: value};
descriptors[getterName] = {get: value};
descriptors[name] = {value: value};
}
} }
else if (name.indexOf("set_") === 0) { else if (name.indexOf("set_") === 0) {
descriptors[name.substring(4)] = {set: value}; descriptors[name.substring(4)] = {set: value};
+4 -4
View File
@@ -404,7 +404,7 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
next: function () { next: function () {
return this.map[this.keys[this.index++]]; return this.map[this.keys[this.index++]];
}, },
get_hasNext: function () { hasNext: function () {
return this.index < this.size; return this.index < this.size;
} }
}); });
@@ -595,8 +595,8 @@ Kotlin.PrimitiveHashSet = Kotlin.$createClass(Kotlin.AbstractCollection, {
var iter1 = this.iterator(); var iter1 = this.iterator();
var iter2 = o.iterator(); var iter2 = o.iterator();
while (true) { while (true) {
var hn1 = iter1.get_hasNext(); var hn1 = iter1.hasNext();
var hn2 = iter2.get_hasNext(); var hn2 = iter2.hasNext();
if (hn1 != hn2) return false; if (hn1 != hn2) return false;
if (!hn2) if (!hn2)
return true; return true;
@@ -614,7 +614,7 @@ Kotlin.PrimitiveHashSet = Kotlin.$createClass(Kotlin.AbstractCollection, {
var builder = "["; var builder = "[";
var iter = this.iterator(); var iter = this.iterator();
var first = true; var first = true;
while (iter.get_hasNext()) { while (iter.hasNext()) {
if (first) if (first)
first = false; first = false;
else else