mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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:
|
case NEGATE:
|
||||||
if (outerPrecedence.ordinal() > Precedence.UNARY.ordinal()) {
|
if (outerPrecedence.ordinal() > Precedence.UNARY.ordinal()) {
|
||||||
writer.append('(');
|
writer.append('(');
|
||||||
|
} else if (outerPrecedence.ordinal() >= Precedence.ADDITION.ordinal()) {
|
||||||
|
writer.append(' ');
|
||||||
}
|
}
|
||||||
writer.append("-");
|
writer.append("-");
|
||||||
precedence = Precedence.UNARY;
|
precedence = Precedence.UNARY;
|
||||||
|
@ -1661,11 +1663,15 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
pushLocation(expr.getLocation());
|
pushLocation(expr.getLocation());
|
||||||
}
|
}
|
||||||
String str = constantToString(expr.getValue());
|
String str = constantToString(expr.getValue());
|
||||||
if (str.startsWith("-") && precedence.ordinal() > Precedence.MULTIPLICATION.ordinal()) {
|
if (str.startsWith("-")) {
|
||||||
writer.append('(');
|
if (precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||||
|
writer.append('(');
|
||||||
|
} else {
|
||||||
|
writer.append(' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
writer.append(str);
|
writer.append(str);
|
||||||
if (str.startsWith("-") && precedence.ordinal() > Precedence.MULTIPLICATION.ordinal()) {
|
if (str.startsWith("-") && precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||||
writer.append(')');
|
writer.append(')');
|
||||||
}
|
}
|
||||||
if (expr.getLocation() != null) {
|
if (expr.getLocation() != null) {
|
||||||
|
|
|
@ -50,13 +50,13 @@ public abstract class Window implements JSObject, EventTarget, StorageProvider {
|
||||||
@JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
|
@JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
|
||||||
public static native void clearTimeout(int 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);
|
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);
|
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);
|
public static native void clearInterval(int timeoutId);
|
||||||
|
|
||||||
@JSBody(params = {}, script = "return window;")
|
@JSBody(params = {}, script = "return window;")
|
||||||
|
|
|
@ -23,6 +23,9 @@ import org.teavm.jso.JSProperty;
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public abstract class ArrayBufferView implements JSObject {
|
public abstract class ArrayBufferView implements JSObject {
|
||||||
|
private ArrayBufferView() {
|
||||||
|
}
|
||||||
|
|
||||||
@JSProperty
|
@JSProperty
|
||||||
public abstract int getLength();
|
public abstract int getLength();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user