+ private CompositeLocation checkLocationFromSwitchStatementNode(MethodDescriptor md,
+ SymbolTable nametable, SwitchStatementNode ssn) {
+
+ ClassDescriptor cd = md.getClassDesc();
+ CompositeLocation condLoc =
+ checkLocationFromExpressionNode(md, nametable, ssn.getCondition(), new CompositeLocation());
+ BlockNode sbn = ssn.getSwitchBody();
+
+ Set<CompositeLocation> blockLocSet = new HashSet<CompositeLocation>();
+ for (int i = 0; i < sbn.size(); i++) {
+ CompositeLocation blockLoc =
+ checkLocationFromSwitchBlockNode(md, nametable, (SwitchBlockNode) sbn.get(i));
+ if (!CompositeLattice.isGreaterThan(condLoc, blockLoc)) {
+ throw new Error(
+ "The location of the switch-condition statement is lower than the conditional body at "
+ + cd.getSourceFileName() + ":" + ssn.getCondition().getNumLine());
+ }
+
+ blockLocSet.add(blockLoc);
+ }
+ return CompositeLattice.calculateGLB(blockLocSet);
+ }
+
+ private CompositeLocation checkLocationFromSwitchBlockNode(MethodDescriptor md,
+ SymbolTable nametable, SwitchBlockNode sbn) {
+
+ CompositeLocation blockLoc =
+ checkLocationFromBlockNode(md, nametable, sbn.getSwitchBlockStatement());
+
+ return blockLoc;
+
+ }
+