mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix emit API. Fix several JS wrappers.
This commit is contained in:
parent
f25b2d46e8
commit
b12404ee7e
|
@ -67,7 +67,7 @@ public class TDate implements TComparable<TDate> {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static long parse(String s) {
|
public static long parse(String s) {
|
||||||
double value = JSDate.parse(s).getTime();
|
double value = JSDate.parse(s);
|
||||||
if (Double.isNaN(value)) {
|
if (Double.isNaN(value)) {
|
||||||
throw new IllegalArgumentException("Can't parse date: " + s);
|
throw new IllegalArgumentException("Can't parse date: " + s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class ChooseEmitter {
|
||||||
pe.enter(entry.getTarget());
|
pe.enter(entry.getTarget());
|
||||||
pe.emitAndJump(fragment, joinBlock);
|
pe.emitAndJump(fragment, joinBlock);
|
||||||
pe.enter(joinBlock);
|
pe.enter(joinBlock);
|
||||||
|
insn.getEntries().add(entry);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,6 +453,7 @@ public final class ProgramEmitter {
|
||||||
public ChooseEmitter choice(ValueEmitter value) {
|
public ChooseEmitter choice(ValueEmitter value) {
|
||||||
SwitchInstruction insn = new SwitchInstruction();
|
SwitchInstruction insn = new SwitchInstruction();
|
||||||
insn.setCondition(value.getVariable());
|
insn.setCondition(value.getVariable());
|
||||||
|
addInstruction(insn);
|
||||||
return new ChooseEmitter(this, insn, prepareBlock());
|
return new ChooseEmitter(this, insn, prepareBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,4 +42,8 @@ public interface History extends JSObject {
|
||||||
void replaceState(JSObject data, String title);
|
void replaceState(JSObject data, String title);
|
||||||
|
|
||||||
void replaceState(JSObject data, String title, String url);
|
void replaceState(JSObject data, String title, String url);
|
||||||
|
|
||||||
|
static History current() {
|
||||||
|
return Window.current().getHistory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,9 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv
|
||||||
@JSProperty
|
@JSProperty
|
||||||
public abstract Location getLocation();
|
public abstract Location getLocation();
|
||||||
|
|
||||||
|
@JSProperty
|
||||||
|
public abstract History getHistory();
|
||||||
|
|
||||||
@JSProperty
|
@JSProperty
|
||||||
public abstract HTMLElement getFrameElement();
|
public abstract HTMLElement getFrameElement();
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public abstract class JSDate implements JSObject {
|
||||||
public static native double now();
|
public static native double now();
|
||||||
|
|
||||||
@JSBody(params = "stringValue", script = "return Date.parse(stringValue);")
|
@JSBody(params = "stringValue", script = "return Date.parse(stringValue);")
|
||||||
public static native JSDate parse(String stringValue);
|
public static native double parse(String stringValue);
|
||||||
|
|
||||||
@JSBody(params = { "year", "month" }, script = "return Date.UTC(year, month);")
|
@JSBody(params = { "year", "month" }, script = "return Date.UTC(year, month);")
|
||||||
public static native double UTC(int year, int month);
|
public static native double UTC(int year, int month);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user