예제 #1
0
void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) {
  PrintLabels(node->labels());
  Print("switch (");
  Visit(node->tag());
  Print(") { ");
  ZoneList<CaseClause*>* cases = node->cases();
  for (int i = 0; i < cases->length(); i++)
    Visit(cases->at(i));
  Print("}");
}
예제 #2
0
void UsageComputer::VisitSwitchStatement(SwitchStatement* node) {
  Read(node->tag());
  ZoneList<CaseClause*>* cases = node->cases();
  for (int i = cases->length(); i-- > 0;) {
    WeightScaler ws(this, static_cast<float>(1.0 / cases->length()));
    CaseClause* clause = cases->at(i);
    if (!clause->is_default())
      Read(clause->label());
    VisitStatements(clause->statements());
  }
}
예제 #3
0
void UsageComputer::VisitFunctionLiteral(FunctionLiteral* node) {
  ZoneList<Declaration*>* decls = node->scope()->declarations();
  for (int i = 0; i < decls->length(); i++) VisitDeclaration(decls->at(i));
  VisitStatements(node->body());
}