Minor fixes

This commit is contained in:
konsoletyper 2015-02-26 23:47:57 +03:00
parent a9ff14b599
commit 302c1c2237
2 changed files with 18 additions and 3 deletions

View File

@ -1094,6 +1094,14 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
@Override @Override
public void visit(InitClassStatement statement) { public void visit(InitClassStatement statement) {
ClassReader cls = classSource.get(statement.getClassName());
if (cls == null) {
return;
}
MethodReader method = cls.getMethod(new MethodDescriptor("<clinit>", void.class));
if (method == null) {
return;
}
try { try {
debugEmitter.emitStatementStart(); debugEmitter.emitStatementStart();
if (statement.getLocation() != null) { if (statement.getLocation() != null) {
@ -1310,7 +1318,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
exitPriority(); exitPriority();
break; break;
case NEGATE: case NEGATE:
enterPriority(Priority.UNARY, Associativity.RIGHT, true); enterPriority(Priority.MULTIPLICATION, Associativity.RIGHT, true);
writer.append("-"); writer.append("-");
expr.getOperand().acceptVisitor(this); expr.getOperand().acceptVisitor(this);
exitPriority(); exitPriority();
@ -1425,7 +1433,14 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
if (expr.getLocation() != null) { if (expr.getLocation() != null) {
pushLocation(expr.getLocation()); pushLocation(expr.getLocation());
} }
writer.append(constantToString(expr.getValue())); String str = constantToString(expr.getValue());
if (str.startsWith("-")) {
enterPriority(Priority.MULTIPLICATION, Associativity.RIGHT, true);
}
writer.append(str);
if (str.startsWith("-")) {
exitPriority();
}
if (expr.getLocation() != null) { if (expr.getLocation() != null) {
popLocation(); popLocation();
} }

View File

@ -184,7 +184,7 @@ class JavascriptNativeProcessor {
} }
replacement.clear(); replacement.clear();
MethodReader method = getMethod(invoke.getMethod()); MethodReader method = getMethod(invoke.getMethod());
if (method.hasModifier(ElementModifier.STATIC)) { if (method == null || method.hasModifier(ElementModifier.STATIC)) {
continue; continue;
} }
if (method.hasModifier(ElementModifier.FINAL)) { if (method.hasModifier(ElementModifier.FINAL)) {