diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java b/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java index 528a51da5..845585440 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java @@ -67,7 +67,7 @@ public class TDate implements TComparable { @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); } diff --git a/core/src/main/java/org/teavm/model/emit/ChooseEmitter.java b/core/src/main/java/org/teavm/model/emit/ChooseEmitter.java index 68b02da8c..72fc51e69 100644 --- a/core/src/main/java/org/teavm/model/emit/ChooseEmitter.java +++ b/core/src/main/java/org/teavm/model/emit/ChooseEmitter.java @@ -42,6 +42,7 @@ public class ChooseEmitter { pe.enter(entry.getTarget()); pe.emitAndJump(fragment, joinBlock); pe.enter(joinBlock); + insn.getEntries().add(entry); return this; } diff --git a/core/src/main/java/org/teavm/model/emit/ProgramEmitter.java b/core/src/main/java/org/teavm/model/emit/ProgramEmitter.java index 2ffe29a18..7bcf5c902 100644 --- a/core/src/main/java/org/teavm/model/emit/ProgramEmitter.java +++ b/core/src/main/java/org/teavm/model/emit/ProgramEmitter.java @@ -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()); } diff --git a/jso/apis/src/main/java/org/teavm/jso/browser/History.java b/jso/apis/src/main/java/org/teavm/jso/browser/History.java index db3c80994..3a7b7fac0 100644 --- a/jso/apis/src/main/java/org/teavm/jso/browser/History.java +++ b/jso/apis/src/main/java/org/teavm/jso/browser/History.java @@ -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(); + } } diff --git a/jso/apis/src/main/java/org/teavm/jso/browser/Window.java b/jso/apis/src/main/java/org/teavm/jso/browser/Window.java index 8c1f4b872..c5ef1d36c 100644 --- a/jso/apis/src/main/java/org/teavm/jso/browser/Window.java +++ b/jso/apis/src/main/java/org/teavm/jso/browser/Window.java @@ -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(); diff --git a/jso/apis/src/main/java/org/teavm/jso/core/JSDate.java b/jso/apis/src/main/java/org/teavm/jso/core/JSDate.java index db4b656d9..039f495ec 100644 --- a/jso/apis/src/main/java/org/teavm/jso/core/JSDate.java +++ b/jso/apis/src/main/java/org/teavm/jso/core/JSDate.java @@ -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);