mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -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
|
||||
public static long parse(String s) {
|
||||
double value = JSDate.parse(s).getTime();
|
||||
double value = JSDate.parse(s);
|
||||
if (Double.isNaN(value)) {
|
||||
throw new IllegalArgumentException("Can't parse date: " + s);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public class ChooseEmitter {
|
|||
pe.enter(entry.getTarget());
|
||||
pe.emitAndJump(fragment, joinBlock);
|
||||
pe.enter(joinBlock);
|
||||
insn.getEntries().add(entry);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,6 +453,7 @@ public final class ProgramEmitter {
|
|||
public ChooseEmitter choice(ValueEmitter value) {
|
||||
SwitchInstruction insn = new SwitchInstruction();
|
||||
insn.setCondition(value.getVariable());
|
||||
addInstruction(insn);
|
||||
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, String url);
|
||||
|
||||
static History current() {
|
||||
return Window.current().getHistory();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@ public abstract class Window implements JSObject, WindowEventTarget, StorageProv
|
|||
@JSProperty
|
||||
public abstract Location getLocation();
|
||||
|
||||
@JSProperty
|
||||
public abstract History getHistory();
|
||||
|
||||
@JSProperty
|
||||
public abstract HTMLElement getFrameElement();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public abstract class JSDate implements JSObject {
|
|||
public static native double now();
|
||||
|
||||
@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);")
|
||||
public static native double UTC(int year, int month);
|
||||
|
|
Loading…
Reference in New Issue
Block a user