mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-21 01:00:54 +08:00
wasm gc: fix conversion of multidimensional arrays from JS
This commit is contained in:
parent
0bd7bc6ca9
commit
2aabddc32d
@ -34,6 +34,7 @@ import org.teavm.model.ReferenceCache;
|
||||
import org.teavm.model.TextLocation;
|
||||
import org.teavm.model.ValueType;
|
||||
import org.teavm.model.Variable;
|
||||
import org.teavm.model.instructions.CastInstruction;
|
||||
import org.teavm.model.instructions.ClassConstantInstruction;
|
||||
import org.teavm.model.instructions.InvocationType;
|
||||
import org.teavm.model.instructions.InvokeInstruction;
|
||||
@ -472,11 +473,19 @@ class JSValueMarshaller {
|
||||
insn = new InvokeInstruction();
|
||||
insn.setMethod(JSMethods.UNMAP_ARRAY);
|
||||
insn.setArguments(cls, var, function);
|
||||
insn.setReceiver(var);
|
||||
insn.setReceiver(program.createVariable());
|
||||
insn.setType(InvocationType.SPECIAL);
|
||||
insn.setLocation(location.getSourceLocation());
|
||||
replacement.add(insn);
|
||||
|
||||
var cast = new CastInstruction();
|
||||
cast.setTargetType(ValueType.arrayOf(ValueType.arrayOf(type)));
|
||||
cast.setWeak(true);
|
||||
cast.setValue(insn.getReceiver());
|
||||
cast.setReceiver(var);
|
||||
cast.setLocation(location.getSourceLocation());
|
||||
replacement.add(cast);
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,6 @@ public class ConversionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
||||
public void convertsPrimitiveArraysToJava() {
|
||||
PrimitiveArrays arrays = getPrimitiveArrays();
|
||||
|
||||
@ -90,7 +89,6 @@ public class ConversionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
||||
public void convertsPrimitiveArrays2ToJava() {
|
||||
PrimitiveArrays2 arrays = getPrimitiveArrays2();
|
||||
|
||||
@ -117,7 +115,6 @@ public class ConversionTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
||||
public void convertsPrimitiveArrays4ToJava() {
|
||||
PrimitiveArrays4 arrays = getPrimitiveArrays4();
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.teavm.jso.JSProperty;
|
||||
import org.teavm.junit.EachTestCompiledSeparately;
|
||||
import org.teavm.junit.OnlyPlatform;
|
||||
import org.teavm.junit.SkipJVM;
|
||||
import org.teavm.junit.SkipPlatform;
|
||||
import org.teavm.junit.TeaVMTestRunner;
|
||||
import org.teavm.junit.TestPlatform;
|
||||
|
||||
@ -90,7 +89,6 @@ public class FunctorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipPlatform(TestPlatform.WEBASSEMBLY_GC)
|
||||
public void castToFunctor() {
|
||||
JSBiFunction f = getBiFunctionAsObject().cast();
|
||||
assertEquals(23042, f.foo(23, 42));
|
||||
|
Loading…
Reference in New Issue
Block a user