Fixes small bugs that were found by html4j TCK

This commit is contained in:
konsoletyper 2014-09-02 18:25:43 +04:00
parent 8dada3b28c
commit 0ff2b2a1dc
2 changed files with 6 additions and 2 deletions

View File

@ -21,7 +21,7 @@ $rt_compare = function(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
}
$rt_isInstance = function(obj, cls) {
return obj != null && obj.constructor.$meta && $rt_isAssignable(obj.constructor, cls);
return obj !== null && !!obj.constructor.$meta && $rt_isAssignable(obj.constructor, cls);
}
$rt_isAssignable = function(from, to) {
if (from === to) {

View File

@ -116,8 +116,12 @@ public class JavaScriptConvGenerator implements Generator {
writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Double")
.append(") {").indent().softNewLine();
writer.append("return ").appendMethodBody(valueOfDoubleMethod).append("(" + obj + ");").softNewLine();
writer.outdent().append("} else if (" + type + " === $rt_intcls()) {").indent().softNewLine();
writer.outdent().append("} else if (" + type + " === $rt_intcls() || " + type + " === $rt_bytecls() || " +
type + " === $rt_shortcls()) {").indent().softNewLine();
writer.append("return " + obj + "|0;").softNewLine();
writer.outdent().append("} else if (" + type + " === $rt_doublecls() || " + type + " == $rt_floatcls()) {")
.indent().softNewLine();
writer.append("return " + obj + ";").softNewLine();
writer.outdent().append("} else if (" + type + " === ").appendClass("java.lang.Boolean")
.append(") {").indent().softNewLine();
writer.append("return ").appendMethodBody(valueOfBooleanMethod).append("(" + obj + "?1:0);").softNewLine();