JS backend: fix tests after mangling.
This commit is contained in:
@@ -291,6 +291,12 @@ public final class StaticContext {
|
||||
Rule<JsName> predefinedObjectsHasUnobfuscatableNames = new Rule<JsName>() {
|
||||
@Override
|
||||
public JsName apply(@NotNull DeclarationDescriptor descriptor) {
|
||||
// The mixing of override and rename by annotation(e.g. native) is forbidden.
|
||||
if (descriptor instanceof CallableMemberDescriptor &&
|
||||
!((CallableMemberDescriptor) descriptor).getOverriddenDescriptors().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String name = getNameForAnnotatedObject(descriptor);
|
||||
if (name != null) return getEnclosingScope(descriptor).declareName(name);
|
||||
return null;
|
||||
|
||||
+7
-3
@@ -19,6 +19,7 @@ package org.jetbrains.k2js.translate.intrinsic.functions.factories;
|
||||
import com.google.dart.compiler.backend.js.ast.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
@@ -104,7 +105,7 @@ public final class TopLevelFIF extends CompositeFIF {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String operation() {
|
||||
return "put";
|
||||
return "put_5yfy9u$";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -167,8 +168,11 @@ public final class TopLevelFIF extends CompositeFIF {
|
||||
return callTranslator.extensionFunctionCall(false);
|
||||
}
|
||||
else {
|
||||
if (functionReference instanceof JsNameRef && ((JsNameRef) functionReference).getIdent().equals("invoke")) {
|
||||
return callTranslator.explicitInvokeCall();
|
||||
CallableDescriptor descriptor = callTranslator.getResolvedCall().getCandidateDescriptor();
|
||||
if (descriptor.getName().asString().equals("invoke") &&
|
||||
functionReference instanceof JsNameRef &&
|
||||
((JsNameRef) functionReference).getIdent().startsWith("invoke")) {
|
||||
return callTranslator.explicitInvokeCall();
|
||||
}
|
||||
return new JsInvocation(Namer.getFunctionCallRef(functionReference), generateInvocationArguments(thisExpression, arguments));
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
var map = new Kotlin.HashMap();
|
||||
|
||||
map.put(3, 4);
|
||||
map.put(6, 3);
|
||||
map.put_5yfy9u$(3, 4);
|
||||
map.put_5yfy9u$(6, 3);
|
||||
|
||||
function test() {
|
||||
if (map.containsKey(4) || map.containsKey(5)) return false;
|
||||
@@ -28,11 +28,11 @@ function test() {
|
||||
obj = map.get(6);
|
||||
if (obj !== 3) return false;
|
||||
if (map.size() !== 2) return false;
|
||||
map.put(2, 3);
|
||||
map.put_5yfy9u$(2, 3);
|
||||
if (map.size() !== 3) return false;
|
||||
if (!map.containsKey(2) || !map.containsKey(3) || !map.containsKey(6)) return false;
|
||||
if (!map.containsValue(4) || !map.containsValue(3)) return false;
|
||||
map.put(2, 1000);
|
||||
map.put_5yfy9u$(2, 1000);
|
||||
if (map.size() !== 3) return false;
|
||||
if (map.get(2)!== 1000) return false;
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ String.prototype.contains = function (s) {
|
||||
return Kotlin.arrayEquals(obj1, obj2);
|
||||
}
|
||||
|
||||
if (typeof obj1 == "object" && obj1.equals !== undefined) {
|
||||
return obj1.equals(obj2);
|
||||
if (typeof obj1 == "object" && obj1.equals_s9cetl$ !== undefined) {
|
||||
return obj1.equals_s9cetl$(obj2);
|
||||
}
|
||||
|
||||
return obj1 === obj2;
|
||||
@@ -164,7 +164,7 @@ String.prototype.contains = function (s) {
|
||||
}
|
||||
}
|
||||
enumEntryList.values$ = values;
|
||||
enumEntryList.valueOf = valueOf;
|
||||
enumEntryList.valueOf_e51dcq$ = valueOf;
|
||||
enumEntryList.values = getValues;
|
||||
return enumEntryList;
|
||||
};
|
||||
@@ -193,7 +193,7 @@ String.prototype.contains = function (s) {
|
||||
iterator: function () {
|
||||
return new ArrayIterator(this.toArray());
|
||||
},
|
||||
equals: function (o) {
|
||||
equals_s9cetl$: function (o) {
|
||||
if (this.size() !== o.size()) return false;
|
||||
|
||||
var iterator1 = this.iterator();
|
||||
@@ -233,13 +233,13 @@ String.prototype.contains = function (s) {
|
||||
iterator: function () {
|
||||
return new ListIterator(this);
|
||||
},
|
||||
remove: function (o) {
|
||||
remove_s9cetl$: function (o) {
|
||||
var index = this.indexOf(o);
|
||||
if (index !== -1) {
|
||||
this.removeAt(index);
|
||||
this.remove_s9c8w6$(index);
|
||||
}
|
||||
},
|
||||
contains: function (o) {
|
||||
contains_s9cetl$: function (o) {
|
||||
return this.indexOf(o) !== -1;
|
||||
}
|
||||
});
|
||||
@@ -250,11 +250,11 @@ String.prototype.contains = function (s) {
|
||||
this.array = [];
|
||||
this.$size = 0;
|
||||
}, {
|
||||
get: function (index) {
|
||||
get_s9c8w6$: function (index) {
|
||||
this.checkRange(index);
|
||||
return this.array[index];
|
||||
},
|
||||
set: function (index, value) {
|
||||
set_bar457$: function (index, value) {
|
||||
this.checkRange(index);
|
||||
this.array[index] = value;
|
||||
},
|
||||
@@ -264,15 +264,15 @@ String.prototype.contains = function (s) {
|
||||
iterator: function () {
|
||||
return Kotlin.arrayIterator(this.array);
|
||||
},
|
||||
add: function (element) {
|
||||
add_s9cetl$: function (element) {
|
||||
this.array[this.$size++] = element;
|
||||
return true;
|
||||
},
|
||||
addAt: function (index, element) {
|
||||
add_bar457$: function (index, element) {
|
||||
this.array.splice(index, 0, element);
|
||||
this.$size++;
|
||||
},
|
||||
addAll: function (collection) {
|
||||
addAll_5ib00d$: function (collection) {
|
||||
var it = collection.iterator();
|
||||
for (var i = this.$size, n = collection.size(); n-- > 0;) {
|
||||
this.array[i++] = it.next();
|
||||
@@ -280,7 +280,7 @@ String.prototype.contains = function (s) {
|
||||
|
||||
this.$size += collection.size();
|
||||
},
|
||||
removeAt: function (index) {
|
||||
remove_s9c8w6$: function (index) {
|
||||
this.checkRange(index);
|
||||
this.$size--;
|
||||
return this.array.splice(index, 1)[0];
|
||||
@@ -489,7 +489,7 @@ String.prototype.contains = function (s) {
|
||||
array.sort(boundComparator);
|
||||
|
||||
for (var i = 0, n = array.length; i < n; i++) {
|
||||
mutableList.set(i, array[i]);
|
||||
mutableList.set_bar457$(i, array[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@
|
||||
}
|
||||
},
|
||||
|
||||
containsKey: createBucketSearcher(EXISTENCE),
|
||||
containsKey_s9cetl$: createBucketSearcher(EXISTENCE),
|
||||
|
||||
containsValue: function (value) {
|
||||
containsValue_s9cetl$: function (value) {
|
||||
var i = this.entries.length;
|
||||
while (i--) {
|
||||
if (value === this.entries[i][1]) {
|
||||
@@ -205,7 +205,7 @@
|
||||
var hashingFunction = (typeof hashingFunctionParam == FUNCTION) ? hashingFunctionParam : hashObject;
|
||||
var equalityFunction = (typeof equalityFunctionParam == FUNCTION) ? equalityFunctionParam : null;
|
||||
|
||||
this.put = function (key, value) {
|
||||
this.put_5yfy9u$ = function (key, value) {
|
||||
checkKey(key);
|
||||
checkValue(value);
|
||||
var hash = hashingFunction(key), bucket, bucketEntry, oldValue = null;
|
||||
@@ -259,14 +259,14 @@
|
||||
// Check if a bucket exists for the bucket key
|
||||
var bucket = getBucketForHash(bucketsByHash, bucketKey);
|
||||
|
||||
return bucket ? bucket.containsKey(key) : false;
|
||||
return bucket ? bucket.containsKey_s9cetl$(key) : false;
|
||||
};
|
||||
|
||||
this.containsValue = function (value) {
|
||||
checkValue(value);
|
||||
var i = buckets.length;
|
||||
while (i--) {
|
||||
if (buckets[i].containsValue(value)) {
|
||||
if (buckets[i].containsValue_s9cetl$(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@
|
||||
var i = values.length;
|
||||
var result = new Kotlin.ArrayList();
|
||||
while (i--) {
|
||||
result.add(values[i]);
|
||||
result.add_s9cetl$(values[i]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -360,13 +360,13 @@
|
||||
if (hasConflictCallback && (thisValue = that.get(key))) {
|
||||
value = conflictCallback(key, thisValue, value);
|
||||
}
|
||||
that.put(key, value);
|
||||
that.put_5yfy9u$(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
this.clone = function () {
|
||||
var clone = new Hashtable(hashingFunctionParam, equalityFunctionParam);
|
||||
clone.putAll(that);
|
||||
clone.putAll_s9c68p$(that);
|
||||
return clone;
|
||||
};
|
||||
|
||||
@@ -375,7 +375,7 @@
|
||||
var keys = this._keys();
|
||||
var i = keys.length;
|
||||
while (i--) {
|
||||
res.add(keys[i]);
|
||||
res.add_s9cetl$(keys[i]);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
@@ -422,7 +422,7 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
|
||||
return this.map.$size === 0;
|
||||
},
|
||||
contains: function (o) {
|
||||
return this.map.containsValue(o);
|
||||
return this.map.containsValue_s9cetl$(o);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -437,10 +437,10 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
|
||||
isEmpty: function () {
|
||||
return this.$size === 0;
|
||||
},
|
||||
containsKey: function (key) {
|
||||
containsKey_s9cetl$: function (key) {
|
||||
return this.map[key] !== undefined;
|
||||
},
|
||||
containsValue: function (value) {
|
||||
containsValue_s9cetl$: function (value) {
|
||||
var map = this.map;
|
||||
for (var key in map) {
|
||||
if (map.hasOwnProperty(key) && map[key] === value) {
|
||||
@@ -453,7 +453,7 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
|
||||
get: function (key) {
|
||||
return this.map[key];
|
||||
},
|
||||
put: function (key, value) {
|
||||
put_5yfy9u$: function (key, value) {
|
||||
var prevValue = this.map[key];
|
||||
this.map[key] = value === undefined ? null : value;
|
||||
if (prevValue === undefined) {
|
||||
@@ -473,7 +473,7 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
|
||||
this.$size = 0;
|
||||
this.map = {};
|
||||
},
|
||||
putAll: function (fromMap) {
|
||||
putAll_s9c68p$: function (fromMap) {
|
||||
var map = fromMap.map;
|
||||
for (var key in map) {
|
||||
if (map.hasOwnProperty(key)) {
|
||||
@@ -487,7 +487,7 @@ Kotlin.ComplexHashMap = Kotlin.HashMap;
|
||||
var map = this.map;
|
||||
for (var key in map) {
|
||||
if (map.hasOwnProperty(key)) {
|
||||
result.add(key);
|
||||
result.add_s9cetl$(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ Kotlin.PrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
||||
contains: function (key) {
|
||||
return this.map[key] === true;
|
||||
},
|
||||
add: function (element) {
|
||||
add_s9cetl$: function (element) {
|
||||
var prevElement = this.map[element];
|
||||
this.map[element] = true;
|
||||
if (prevElement === true) {
|
||||
@@ -546,14 +546,14 @@ Kotlin.PrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
||||
function HashSet(hashingFunction, equalityFunction) {
|
||||
var hashTable = new Kotlin.HashTable(hashingFunction, equalityFunction);
|
||||
|
||||
this.add = function (o) {
|
||||
hashTable.put(o, true);
|
||||
this.add_s9cetl$ = function (o) {
|
||||
hashTable.put_5yfy9u$(o, true);
|
||||
};
|
||||
|
||||
this.addAll = function (arr) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
hashTable.put(arr[i], true);
|
||||
hashTable.put_5yfy9u$(arr[i], true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -570,7 +570,7 @@ Kotlin.PrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
||||
};
|
||||
|
||||
this.contains = function (o) {
|
||||
return hashTable.containsKey(o);
|
||||
return hashTable.containsKey_s9cetl$(o);
|
||||
};
|
||||
|
||||
this.clear = function () {
|
||||
@@ -632,8 +632,8 @@ Kotlin.PrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
||||
var values = hashSet.values(), i = values.length, val;
|
||||
while (i--) {
|
||||
val = values[i];
|
||||
if (hashTable.containsKey(val)) {
|
||||
intersection.add(val);
|
||||
if (hashTable.containsKey_s9cetl$(val)) {
|
||||
intersection.add_s9cetl$(val);
|
||||
}
|
||||
}
|
||||
return intersection;
|
||||
@@ -644,8 +644,8 @@ Kotlin.PrimitiveHashSet = Kotlin.createClassNow(Kotlin.AbstractCollection,
|
||||
var values = hashSet.values(), i = values.length, val;
|
||||
while (i--) {
|
||||
val = values[i];
|
||||
if (!hashTable.containsKey(val)) {
|
||||
union.add(val);
|
||||
if (!hashTable.containsKey_s9cetl$(val)) {
|
||||
union.add_s9cetl$(val);
|
||||
}
|
||||
}
|
||||
return union;
|
||||
|
||||
Reference in New Issue
Block a user