mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
More JS API fixes
This commit is contained in:
parent
94368935ab
commit
5592862c70
|
@ -1525,6 +1525,8 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
case NEGATE:
|
||||
if (outerPrecedence.ordinal() > Precedence.UNARY.ordinal()) {
|
||||
writer.append('(');
|
||||
} else if (outerPrecedence.ordinal() >= Precedence.ADDITION.ordinal()) {
|
||||
writer.append(' ');
|
||||
}
|
||||
writer.append("-");
|
||||
precedence = Precedence.UNARY;
|
||||
|
@ -1661,11 +1663,15 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
pushLocation(expr.getLocation());
|
||||
}
|
||||
String str = constantToString(expr.getValue());
|
||||
if (str.startsWith("-") && precedence.ordinal() > Precedence.MULTIPLICATION.ordinal()) {
|
||||
writer.append('(');
|
||||
if (str.startsWith("-")) {
|
||||
if (precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||
writer.append('(');
|
||||
} else {
|
||||
writer.append(' ');
|
||||
}
|
||||
}
|
||||
writer.append(str);
|
||||
if (str.startsWith("-") && precedence.ordinal() > Precedence.MULTIPLICATION.ordinal()) {
|
||||
if (str.startsWith("-") && precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||
writer.append(')');
|
||||
}
|
||||
if (expr.getLocation() != null) {
|
||||
|
|
|
@ -50,13 +50,13 @@ public abstract class Window implements JSObject, EventTarget, StorageProvider {
|
|||
@JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
|
||||
public static native void clearTimeout(int timeoutId);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInterval(handler, delay);")
|
||||
public static native int setInterval(TimerHandler handler, int delay);
|
||||
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
|
||||
@JSBody(params = { "handler", "delay" }, script = "return setInterval(handler, delay);")
|
||||
public static native int setInterval(TimerHandler handler, double delay);
|
||||
|
||||
@JSBody(params = { "timeoutId" }, script = "clearInverval(timeoutId);")
|
||||
@JSBody(params = { "timeoutId" }, script = "clearInterval(timeoutId);")
|
||||
public static native void clearInterval(int timeoutId);
|
||||
|
||||
@JSBody(params = {}, script = "return window;")
|
||||
|
|
|
@ -23,6 +23,9 @@ import org.teavm.jso.JSProperty;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public abstract class ArrayBufferView implements JSObject {
|
||||
private ArrayBufferView() {
|
||||
}
|
||||
|
||||
@JSProperty
|
||||
public abstract int getLength();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user