Fix emit API. Fix several JS wrappers.

This commit is contained in:
Alexey Andreev 2015-10-25 19:22:48 +03:00
parent f25b2d46e8
commit b12404ee7e
6 changed files with 11 additions and 2 deletions

View File

@ -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);
}

View File

@ -42,6 +42,7 @@ public class ChooseEmitter {
pe.enter(entry.getTarget());
pe.emitAndJump(fragment, joinBlock);
pe.enter(joinBlock);
insn.getEntries().add(entry);
return this;
}

View File

@ -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());
}

View File

@ -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();
}
}

View File

@ -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();

View File

@ -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);