JS backend: fix class object access A.object$() -> A.object
This commit is contained in:
@@ -49,7 +49,7 @@ public final class Namer {
|
|||||||
private static final String RECEIVER_PARAMETER_NAME = "$receiver";
|
private static final String RECEIVER_PARAMETER_NAME = "$receiver";
|
||||||
private static final String CLASSES_OBJECT_NAME = "_c";
|
private static final String CLASSES_OBJECT_NAME = "_c";
|
||||||
private static final String THROW_NPE_FUN_NAME = "throwNPE";
|
private static final String THROW_NPE_FUN_NAME = "throwNPE";
|
||||||
private static final String CLASS_OBJECT_GETTER = "object$";
|
private static final String CLASS_OBJECT_GETTER = "object";
|
||||||
private static final String CLASS_OBJECT_INITIALIZER = "object_initializer$";
|
private static final String CLASS_OBJECT_INITIALIZER = "object_initializer$";
|
||||||
|
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public final class Namer {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JsExpression getClassObjectAccessor(@NotNull JsExpression referenceToClass) {
|
public static JsExpression getClassObjectAccessor(@NotNull JsExpression referenceToClass) {
|
||||||
return new JsInvocation(new JsNameRef(CLASS_OBJECT_GETTER, referenceToClass));
|
return new JsNameRef(CLASS_OBJECT_GETTER, referenceToClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -180,10 +180,9 @@ var Kotlin = {};
|
|||||||
}
|
}
|
||||||
|
|
||||||
function class_object() {
|
function class_object() {
|
||||||
if (typeof this.$object$ === "undefined") {
|
var object = this.object_initializer$();
|
||||||
this.$object$ = this.object_initializer$();
|
Object.defineProperty(this, "object", {value: object});
|
||||||
}
|
return object;
|
||||||
return this.$object$;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kotlin.createClass = function (bases, constructor, properties, staticProperties) {
|
Kotlin.createClass = function (bases, constructor, properties, staticProperties) {
|
||||||
@@ -210,8 +209,7 @@ var Kotlin = {};
|
|||||||
|
|
||||||
constructor.$metadata$ = metadata;
|
constructor.$metadata$ = metadata;
|
||||||
constructor.prototype = prototypeObj;
|
constructor.prototype = prototypeObj;
|
||||||
//Object.defineProperty(constructor, "$object", {get: class_object}); // TODO: check & fix call $object()
|
Object.defineProperty(constructor, "object", {get: class_object, configurable: true});
|
||||||
constructor.object$ = class_object;
|
|
||||||
return constructor;
|
return constructor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user