JS backend: minor -- dropped temporary hack after KT-4517 fixed.

This commit is contained in:
Zalim Bashorov
2014-03-07 21:16:18 +04:00
parent 344ce6c095
commit 209f7e8d51
2 changed files with 8 additions and 15 deletions
@@ -44,8 +44,6 @@ import static org.jetbrains.k2js.translate.utils.JsAstUtils.createDataDescriptor
public final class TranslationUtils {
public static final Comparator<FunctionDescriptor> OVERLOADED_FUNCTION_COMPARATOR = new OverloadedFunctionComparator();
// TODO drop after KT-4517 will be fixed.
public static final Set<String> ANY_METHODS = ContainerUtil.set("equals", "hashCode", "toString");
private TranslationUtils() {
}
@@ -178,11 +176,6 @@ public final class TranslationUtils {
else if (containingDeclaration instanceof ClassDescriptor) {
ClassDescriptor classDescriptor = (ClassDescriptor) containingDeclaration;
// TODO drop this temporary workaround and uncomment test cases in manglingAnyMethods.kt after KT-4517 will be fixed.
if (ANY_METHODS.contains(descriptor.getName().asString())) {
return true;
}
// Use stable mangling when it inside a overridable declaration for avoid clashing names when inheritance.
if (classDescriptor.getModality().isOverridable()) {
return true;
@@ -67,8 +67,8 @@ fun test(expected: String, f: () -> Unit) {
}
val SIMPLE_EQUALS = "equals"
val SIMPLE_HASH_CODE = "hashCode"
val SIMPLE_TO_STRING = "toString"
val SIMPLE_HASH_CODE_1 = "hashCode_1"
val SIMPLE_TO_STRING_1 = "toString_1"
val STABLE_EQUALS = { equals(0) }.extractNames()[1]
val STABLE_HASH_CODE = { hashCode() }.extractNames()[1]
val STABLE_TO_STRING = { toString() }.extractNames()[1]
@@ -83,17 +83,17 @@ fun box(): String {
test(STABLE_EQUALS) { InternalClass().equals(0) }
test(STABLE_HASH_CODE) { InternalClass().hashCode() }
test(STABLE_TO_STRING) { InternalClass().toString() }
//test(SIMPLE_EQUALS) { InternalClassWithPublics().equals(0, 1) }
//test(SIMPLE_HASH_CODE) { InternalClassWithPublics().hashCode(2) }
//test(SIMPLE_TO_STRING) { InternalClassWithPublics().toString("3") }
test(SIMPLE_EQUALS) { InternalClass().equals(0, 1) }
test(SIMPLE_HASH_CODE_1) { InternalClass().hashCode(2) }
test(SIMPLE_TO_STRING_1) { InternalClass().toString("3") }
testGroup = "Private Class"
test(STABLE_EQUALS) { PrivateClass().equals(0) }
test(STABLE_HASH_CODE) { PrivateClass().hashCode() }
test(STABLE_TO_STRING) { PrivateClass().toString() }
//test(SIMPLE_EQUALS) { PrivateClassWithPublics().equals(0, 1) }
//test(SIMPLE_HASH_CODE) { PrivateClassWithPublics().hashCode(2) }
//test(SIMPLE_TO_STRING) { PrivateClassWithPublics().toString("3") }
test(SIMPLE_EQUALS) { PrivateClass().equals(0, 1) }
test(SIMPLE_HASH_CODE_1) { PrivateClass().hashCode(2) }
test(SIMPLE_TO_STRING_1) { PrivateClass().toString("3") }
return "OK"
}