@Override public boolean shouldBreak(Statement statement, Statement previousStatement) { if (statement.getPosition() == null) { return false; } if (!this.regexp.matcher(statement.getPosition().getFileName()).matches()) { return false; } boolean result = false; if (this.line >= 0) { if (this.line <= statement.getPosition().getLine()) { if (previousStatement == null) { result = true; } else { result = (this.line > (previousStatement.getPosition().getLine() - 1)); } } else { result = false; } } return result; }
public static void injectLineNumber(CodeBlock block, Statement statement) { Position position = statement.getPosition(); if (position != null) { LabelNode lineLabel = new LabelNode(); block.line(position.getLine(), lineLabel); block.label(lineLabel); } }