return returnStatement;
}
protected SwitchStatement processSwitchStatement(StatementContext context) {
SwitchStatement switchStatement = createNode(context, SwitchStatement.class);
ParExpressionContext parExpressionContext = getChild(context, ParExpressionContext.class);
switchStatement.setExpression(processParExpression(parExpressionContext));
List<SwitchBlock> switchBlocks = transform(context, SwitchBlockStatementGroupContext.class,
new Function<SwitchBlockStatementGroupContext, SwitchBlock>() {
@Override
public SwitchBlock apply(SwitchBlockStatementGroupContext context) {
SwitchBlock switchBlock = createNode(context, SwitchBlock.class);
switchBlock.setLabels(getSwitchLabels(context));
switchBlock.setStatements(transform(context, BlockStatementContext.class,
new Function<BlockStatementContext, BlockStatement>() {
@Override
public BlockStatement apply(BlockStatementContext context) {
return getAdapter(BlockStatementAdapter.class).adapt(context);
}
}));
return switchBlock;
}
});
List<SwitchLabel> extraSwitchLabels = getSwitchLabels(context);
if (!extraSwitchLabels.isEmpty()) {
List<SwitchLabelContext> switchLabelContexts = getChildren(context, SwitchLabelContext.class);
SwitchBlock extraSwitchBlock =
createNode(switchLabelContexts.get(0),
switchLabelContexts.get(switchLabelContexts.size() - 1), SwitchBlock.class);
extraSwitchBlock.setLabels(extraSwitchLabels);
switchBlocks.add(extraSwitchBlock);
}
switchStatement.setSwitchBlocks(switchBlocks);
return switchStatement;
}