@Override public void visit(SwitchStatement statement) { try { output.writeByte(4); writeNullableString(statement.getId()); writeExpr(statement.getValue()); output.writeShort(statement.getClauses().size()); for (SwitchClause clause : statement.getClauses()) { int[] conditions = clause.getConditions(); output.writeShort(conditions.length); for (int condition : conditions) { output.writeInt(condition); } writeSequence(clause.getBody()); } writeSequence(statement.getDefaultClause()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(SwitchStatement statement) { statement.getValue().acceptVisitor(this); statement.setValue(resultExpr); for (SwitchClause clause : statement.getClauses()) { List<Statement> newBody = processSequence(clause.getBody()); clause.getBody().clear(); clause.getBody().addAll(newBody); } List<Statement> newDefault = processSequence(statement.getDefaultClause()); statement.getDefaultClause().clear(); statement.getDefaultClause().addAll(newDefault); if (statement.getClauses().isEmpty()) { SequentialStatement seq = new SequentialStatement(); seq.getSequence().addAll(statement.getDefaultClause()); resultStmt = seq; } else { resultStmt = statement; } }
accept(statement.getValue()); WasmExpression condition = result; WasmBlock initialWrapper = wrapper;
@Override public void visit(SwitchStatement statement) { statement.getValue().acceptVisitor(this); for (SwitchClause clause : statement.getClauses()) { visit(clause.getBody()); } visit(statement.getDefaultClause()); }
try { debugEmitter.emitStatementStart(); if (statement.getValue().getLocation() != null) { pushLocation(statement.getValue().getLocation()); writer.append("switch").ws().append("("); precedence = Precedence.min(); statement.getValue().acceptVisitor(this); if (statement.getValue().getLocation() != null) { popLocation();
@Override public void visit(SwitchStatement statement) { writer.print("switch ("); statement.getValue().acceptVisitor(this); writer.print(") {").println().indent(); for (SwitchClause clause : statement.getClauses()) { for (int condition : clause.getConditions()) { writer.println("case " + condition + ":"); } writer.indent(); visitMany(clause.getBody()); writer.println("break;"); writer.outdent(); } if (!statement.getDefaultClause().isEmpty()) { writer.println("default:").indent(); visitMany(statement.getDefaultClause()); writer.outdent(); } writer.outdent().println("}"); if (statement.getId() != null) { writer.outdent().println("label_" + statement.getId() + ":;").indent(); } }
@Override public void visit(SwitchStatement statement) { statement.getValue().acceptVisitor(this); statement.setValue(resultExpr); for (SwitchClause clause : statement.getClauses()) { List<Statement> newBody = processSequence(clause.getBody()); clause.getBody().clear(); clause.getBody().addAll(newBody); } List<Statement> newDefault = processSequence(statement.getDefaultClause()); statement.getDefaultClause().clear(); statement.getDefaultClause().addAll(newDefault); resultStmt = statement; }
@Override public void visit(SwitchStatement statement) { try { output.writeByte(4); writeNullableString(statement.getId()); writeExpr(statement.getValue()); output.writeShort(statement.getClauses().size()); for (SwitchClause clause : statement.getClauses()) { int[] conditions = clause.getConditions(); output.writeShort(conditions.length); for (int condition : conditions) { output.writeInt(condition); } writeSequence(clause.getBody()); } writeSequence(statement.getDefaultClause()); } catch (IOException e) { throw new IOExceptionWrapper(e); } }
@Override public void visit(SwitchStatement statement) { statement.getValue().acceptVisitor(this); for (SwitchClause clause : statement.getClauses()) { visit(clause.getBody()); } visit(statement.getDefaultClause()); }
accept(statement.getValue()); WasmExpression condition = result; WasmBlock initialWrapper = wrapper;
try { debugEmitter.emitStatementStart(); if (statement.getValue().getLocation() != null) { pushLocation(statement.getValue().getLocation()); writer.append("switch").ws().append("("); precedence = Precedence.min(); statement.getValue().acceptVisitor(this); if (statement.getValue().getLocation() != null) { popLocation();