1 11 package org.eclipse.jdt.internal.compiler.flow; 12 13 import org.eclipse.jdt.core.compiler.CharOperation; 14 import org.eclipse.jdt.internal.compiler.ast.ASTNode; 15 import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; 16 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 17 18 22 public class LabelFlowContext extends SwitchFlowContext { 23 24 public char[] labelName; 25 26 public LabelFlowContext(FlowContext parent, ASTNode associatedNode, char[] labelName, BranchLabel breakLabel, BlockScope scope) { 27 super(parent, associatedNode, breakLabel); 28 this.labelName = labelName; 29 checkLabelValidity(scope); 30 } 31 32 void checkLabelValidity(BlockScope scope) { 33 FlowContext current = parent; 35 while (current != null) { 36 char[] currentLabelName; 37 if (((currentLabelName = current.labelName()) != null) 38 && CharOperation.equals(currentLabelName, labelName)) { 39 scope.problemReporter().alreadyDefinedLabel(labelName, associatedNode); 40 } 41 current = current.parent; 42 } 43 } 44 45 public String individualToString() { 46 return "Label flow context [label:" + String.valueOf(labelName) + "]"; } 48 49 public char[] labelName() { 50 return labelName; 51 } 52 } 53 | Popular Tags |