Minor in JS lib: avoid to use undefined literal which may be over overlapped.

This commit is contained in:
Zalim Bashorov
2014-12-24 16:26:43 +03:00
parent 51724e4b0d
commit 6c6ced2442
3 changed files with 15 additions and 15 deletions
+9 -9
View File
@@ -41,7 +41,7 @@
return Kotlin.arrayEquals(obj1, obj2);
}
if (typeof obj1 == "object" && obj1.equals_za3rmp$ !== undefined) {
if (typeof obj1 == "object" && typeof obj1.equals_za3rmp$ === "function") {
return obj1.equals_za3rmp$(obj2);
}
@@ -170,7 +170,7 @@
return Kotlin.createClassNow(base,
/** @constructs */
function (message) {
this.message = (message !== undefined) ? message : null;
this.message = (message !== void 0) ? message : null;
}
);
}
@@ -191,7 +191,7 @@
function throwAbstractFunctionInvocationError(funName) {
return function () {
var message;
if (funName !== undefined) {
if (funName !== void 0) {
message = "Function " + funName + " is abstract";
}
else {
@@ -283,8 +283,8 @@
Kotlin.Enum = Kotlin.createClassNow(null,
function () {
this.name$ = undefined;
this.ordinal$ = undefined;
this.name$ = void 0;
this.ordinal$ = void 0;
}, {
name: function () {
return this.name$;
@@ -848,8 +848,8 @@
};
Kotlin.collectionsSort = function (mutableList, comparator) {
var boundComparator = undefined;
if (comparator !== undefined) {
var boundComparator = void 0;
if (comparator !== void 0) {
boundComparator = comparator.compare.bind(comparator);
}
@@ -887,9 +887,9 @@
this.string = "";
}, {
append: function (obj, from, to) {
if (from == undefined && to == undefined) {
if (from == void 0 && to == void 0) {
this.string = this.string + obj.toString();
} else if (to == undefined) {
} else if (to == void 0) {
this.string = this.string + obj.toString().substring(from);
} else {
this.string = this.string + obj.toString().substring(from, to);
@@ -383,7 +383,7 @@ var Kotlin = {};
var obj = {};
obj.name = name;
obj.get_za3rmp$ = getFun;
if (setFun !== undefined) {
if (typeof setFun === "function") {
obj.set_wn2jw4$ = setFun;
}
return obj;
+5 -5
View File
@@ -47,7 +47,7 @@
}
function hashSetEquals(o) {
if (o === null || o === undefined || this.size() !== o.size()) return false;
if (o == null || this.size() !== o.size()) return false;
return this.containsAll_4fm7v2$(o);
}
@@ -511,7 +511,7 @@
},
containsKey_za3rmp$: function (key) {
// TODO: should process "__proto__" separately?
return this.map[key] !== undefined;
return this.map[key] !== void 0;
},
containsValue_za3rmp$: function (value) {
var map = this.map;
@@ -529,15 +529,15 @@
},
put_wn2jw4$: function (key, value) {
var prevValue = this.map[key];
this.map[key] = value === undefined ? null : value;
if (prevValue === undefined) {
this.map[key] = value === void 0 ? null : value;
if (prevValue === void 0) {
this.$size++;
}
return prevValue;
},
remove_za3rmp$: function (key) {
var prevValue = this.map[key];
if (prevValue !== undefined) {
if (prevValue !== void 0) {
delete this.map[key];
this.$size--;
}