JS lib: made error message more understandable when module already defined.

(cherry picked from commit 28c8404)
This commit is contained in:
develar
2013-09-20 17:10:53 +04:00
committed by Zalim Bashorov
parent d4924b58b1
commit 0182ec280a
@@ -310,12 +310,12 @@ var Kotlin = {};
return definition; return definition;
}; };
Kotlin.defineModule = function (id, module) { Kotlin.defineModule = function (id, declaration) {
if (id in Kotlin.modules) { if (id in Kotlin.modules) {
throw new Kotlin.IllegalArgumentException(); throw new Error("Module " + id + " is already defined");
} }
module.$initializer$.call(module); // TODO: temporary hack declaration.$initializer$.call(declaration); // TODO: temporary hack
Object.defineProperty(Kotlin.modules, id, {value: module}); Object.defineProperty(Kotlin.modules, id, {value: declaration});
}; };
})(); })();