mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
classlib: properly determine enum class in SwitchBootstrapSubstitutor
This commit is contained in:
parent
f14fc18afb
commit
58e68db2c4
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.classlib.impl;
|
package org.teavm.classlib.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.teavm.dependency.BootstrapMethodSubstitutor;
|
import org.teavm.dependency.BootstrapMethodSubstitutor;
|
||||||
import org.teavm.dependency.DynamicCallSite;
|
import org.teavm.dependency.DynamicCallSite;
|
||||||
import org.teavm.model.BasicBlock;
|
import org.teavm.model.BasicBlock;
|
||||||
|
@ -24,8 +23,6 @@ import org.teavm.model.ValueType;
|
||||||
import org.teavm.model.emit.PhiEmitter;
|
import org.teavm.model.emit.PhiEmitter;
|
||||||
import org.teavm.model.emit.ProgramEmitter;
|
import org.teavm.model.emit.ProgramEmitter;
|
||||||
import org.teavm.model.emit.ValueEmitter;
|
import org.teavm.model.emit.ValueEmitter;
|
||||||
import org.teavm.model.instructions.SwitchInstruction;
|
|
||||||
import org.teavm.model.instructions.SwitchTableEntry;
|
|
||||||
|
|
||||||
public class SwitchBootstrapSubstitutor implements BootstrapMethodSubstitutor {
|
public class SwitchBootstrapSubstitutor implements BootstrapMethodSubstitutor {
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,9 +44,9 @@ public class SwitchBootstrapSubstitutor implements BootstrapMethodSubstitutor {
|
||||||
|
|
||||||
var block = pe.prepareBlock();
|
var block = pe.prepareBlock();
|
||||||
pe.enter(block);
|
pe.enter(block);
|
||||||
ValueType.Object enumType = enumSwitch ? labels.stream()
|
var enumType = enumSwitch
|
||||||
.filter(l -> l.getKind() == RuntimeConstant.TYPE)
|
? (ValueType.Object) callSite.getCalledMethod().parameterType(0)
|
||||||
.findAny().map(vt -> (ValueType.Object) vt.getValueType()).orElseThrow() : null;
|
: null;
|
||||||
if (enumType != null) {
|
if (enumType != null) {
|
||||||
pe.initClass(enumType.getClassName());
|
pe.initClass(enumType.getClassName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user