mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Fixes bugs in JCL implementation
This commit is contained in:
parent
25f4ad4b45
commit
684d1f2be8
|
@ -85,7 +85,7 @@ public class TBufferedReader extends TReader {
|
||||||
|
|
||||||
public TString readLine() throws TIOException {
|
public TString readLine() throws TIOException {
|
||||||
requireOpened();
|
requireOpened();
|
||||||
if (eof && index == count) {
|
if (eof && index >= count) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TStringBuilder line = new TStringBuilder();
|
TStringBuilder line = new TStringBuilder();
|
||||||
|
|
|
@ -28,21 +28,7 @@ import org.teavm.model.MethodReference;
|
||||||
public class MathNativeGenerator implements Generator {
|
public class MathNativeGenerator implements Generator {
|
||||||
@Override
|
@Override
|
||||||
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
|
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
|
||||||
switch (methodRef.getName()) {
|
function(context, writer, "Math." + methodRef.getName(), methodRef.parameterCount());
|
||||||
case "sin":
|
|
||||||
case "cos":
|
|
||||||
case "tan":
|
|
||||||
case "asin":
|
|
||||||
case "acos":
|
|
||||||
case "atan":
|
|
||||||
case "exp":
|
|
||||||
case "log":
|
|
||||||
case "sqrt":
|
|
||||||
case "floor":
|
|
||||||
case "ceil":
|
|
||||||
function(context, writer, "Math." + methodRef.getName(), methodRef.parameterCount());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void function(GeneratorContext context, SourceWriter writer, String name, int paramCount)
|
private void function(GeneratorContext context, SourceWriter writer, String name, int paramCount)
|
||||||
|
|
|
@ -1492,6 +1492,11 @@ public class TArrays extends TObject {
|
||||||
@Override public T get(int index) {
|
@Override public T get(int index) {
|
||||||
return a[index];
|
return a[index];
|
||||||
}
|
}
|
||||||
|
@Override public T set(int index, T element) {
|
||||||
|
T old = a[index];
|
||||||
|
a[index] = element;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
@Override public int size() {
|
@Override public int size() {
|
||||||
return a.length;
|
return a.length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user