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 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 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.")); } }
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.")); } }
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.")); } }
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; } }