Fixes bugs in JCL implementation

This commit is contained in:
konsoletyper 2014-04-05 11:14:43 +04:00
parent 25f4ad4b45
commit 684d1f2be8
3 changed files with 7 additions and 16 deletions

View File

@ -85,7 +85,7 @@ public class TBufferedReader extends TReader {
public TString readLine() throws TIOException {
requireOpened();
if (eof && index == count) {
if (eof && index >= count) {
return null;
}
TStringBuilder line = new TStringBuilder();

View File

@ -28,21 +28,7 @@ import org.teavm.model.MethodReference;
public class MathNativeGenerator implements Generator {
@Override
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
switch (methodRef.getName()) {
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;
}
function(context, writer, "Math." + methodRef.getName(), methodRef.parameterCount());
}
private void function(GeneratorContext context, SourceWriter writer, String name, int paramCount)

View File

@ -1492,6 +1492,11 @@ public class TArrays extends TObject {
@Override public T get(int 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() {
return a.length;
}