* @param name the name of the label.
* @return the {@link LabelReference} found, can not be null.
* @throws OutOfScopeException if label with the given name can not be found.
*/
public LabelReference getLabel(String name) {
Label found = null;
Context ctx = this;
do {
if (ctx.labels != null) {
found = ctx.labels.get(name);
}
}
while (found == null && (ctx = ctx.parent) != null);
if (found == null)
throw new OutOfScopeException("Label not found: " + name);
return found.getReference();
}