Commit 19cf7c9f authored by Skylot's avatar Skylot

refactor: improve multi line warning print

parent 363cd85b
......@@ -84,7 +84,7 @@ public final class ResourcesLoader {
LOG.error("Decode error", e);
CodeWriter cw = new CodeWriter();
cw.add("Error decode ").add(rf.getType().toString().toLowerCase());
cw.startLine(Utils.getStackTrace(e.getCause()));
Utils.appendStackTrace(cw, e.getCause());
return ResContainer.textResource(rf.getName(), cw);
}
}
......
......@@ -263,7 +263,7 @@ public class ClassGen {
} catch (Exception e) {
code.newLine().add("/*");
code.newLine().addMultiLine(ErrorsCounter.methodError(mth, "Method generation error", e));
code.newLine().addMultiLine(Utils.getStackTrace(e));
Utils.appendStackTrace(code, e);
code.newLine().add("*/");
code.setIndent(savedIndent);
mth.addError("Method generation error: " + e.getMessage(), e);
......
......@@ -97,10 +97,12 @@ public class CodeWriter {
}
public CodeWriter addMultiLine(String str) {
buf.append(str);
if (str.contains(NL)) {
buf.append(str.replace(NL, NL + indentStr));
line += StringUtils.countMatches(str, NL);
offset = 0;
} else {
buf.append(str);
}
return this;
}
......
......@@ -84,8 +84,8 @@ public class CheckRegions extends AbstractVisitor {
private static String getBlockInsnStr(MethodNode mth, IBlock block) {
CodeWriter code = new CodeWriter();
code.incIndent();
code.newLine();
code.setIndent(3);
MethodGen mg = MethodGen.getFallbackMethodGen(mth);
InsnGen ig = new InsnGen(mg, true);
for (InsnNode insn : block.getInstructions()) {
......@@ -95,7 +95,7 @@ public class CheckRegions extends AbstractVisitor {
// ignore
}
}
code.newLine().addIndent();
code.newLine();
code.finish();
return code.toString();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment