private void checkChildOfSwitch(Statement node, String desc) { if (node.getParent() == null) return; Block p = node.upToBlock(); Switch gp = p == null ? null : p.upToSwitch(); boolean genError = false; genError = p == null; genError |= gp == null && p.getParent() != null; if (genError) { node.addMessage(error(STATEMENT_ONLY_LEGAL_IN_SWITCH, desc + " statements are only legal directly inside switch statements.")); } }
Statement statement = getParentOfType(node, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator(); while (iterator.hasNext()) { if (iterator.next() == statement) {
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
@Override public boolean visitIf(If node) { Expression condition = node.astCondition(); Statement body = node.astStatement(); Statement elseBody = node.astElseStatement(); if (condition != null) { condition.accept(this); } if (body != null) { boolean wasReachable = mReachable; body.accept(this); mReachable = wasReachable; } if (elseBody != null) { boolean wasReachable = mReachable; elseBody.accept(this); mReachable = wasReachable; } endVisit(node); return false; }
Statement statement = getParentOfType(argument, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator(); while (iterator.hasNext()) { if (iterator.next() == statement) {
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
ifNode.astStatement().accept(visitor); if (!assignments.isEmpty()) { List<String> references = new ArrayList<String>();
private void checkChildOfSwitch(Statement node, String desc) { if (node.getParent() == null) return; Block p = node.upToBlock(); Switch gp = p == null ? null : p.upToSwitch(); boolean genError = false; genError = p == null; genError |= gp == null && p.getParent() != null; if (genError) { node.addMessage(error(STATEMENT_ONLY_LEGAL_IN_SWITCH, desc + " statements are only legal directly inside switch statements.")); } }
Statement statement = getParentOfType(argument, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator(); while (iterator.hasNext()) { if (iterator.next() == statement) {
private void checkForUnreachables(Statement n) { Block b = n.upToBlock(); if (b == null) return; boolean found = false; for (Node s : b.rawContents()) { if (found) { s.addMessage(error(STATEMENT_UNREACHABLE, "Unreachable code")); return; } if (s == n) found = true; } } }
private void checkChildOfSwitch(Statement node, String desc) { if (node.getParent() == null) return; Block p = node.upToBlock(); Switch gp = p == null ? null : p.upToSwitch(); boolean genError = false; genError = p == null; genError |= gp == null && p.getParent() != null; if (genError) { node.addMessage(error(STATEMENT_ONLY_LEGAL_IN_SWITCH, desc + " statements are only legal directly inside switch statements.")); } }
Statement statement = getParentOfType(node, Statement.class, false); if (statement != null) { ListIterator<Node> iterator = statement.getParent().getChildren().listIterator(); while (iterator.hasNext()) { if (iterator.next() == statement) {
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }