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