Пример #1
0
void TryStatement::eval(VariableEnvironment &env) const {
  //if (env.isGotoing()) return;
  ENTER_STMT;
  try {
    m_body->eval(env);
  } catch (Object e) {
    for (vector<CatchBlockPtr>::const_iterator it = m_catches.begin();
         it != m_catches.end(); ++it) {
      if ((*it)->match(e)) {
        if ((*it)->body()) {
          String s = (*it)->vname();
          SuperGlobal sg = (*it)->sg();
          env.getVar(s, sg) = e;
          EVAL_STMT((*it)->body(), env);
        }
        return;
      }
    }
    throw e;
  }
  if (env.isGotoing()) {
    for (vector<CatchBlockPtr>::const_iterator it = m_catches.begin();
         it != m_catches.end(); ++it) {
      if ((*it)->body()) {
        EVAL_STMT((*it)->body(), env);
        if (!env.isGotoing()) return;
      }
    }
  }
}
Пример #2
0
void TryStatement::eval(VariableEnvironment &env) const {
  ENTER_STMT;
  try {
    m_body->eval(env);
  } catch (Object e) {
    for (vector<CatchBlockPtr>::const_iterator it = m_catches.begin();
         it != m_catches.end(); ++it) {
      if ((*it)->match(e)) {
        if ((*it)->body()) {
          env.get((*it)->vname()) = e;
          EVAL_STMT((*it)->body(), env);
        }
        return;
      }
    }
    throw e;
  }
}
Пример #3
0
void TryStatement::eval(VariableEnvironment &env) const {
  if (env.isGotoing()) return;
  ENTER_STMT;
  try {
    EVAL_STMT_HANDLE_GOTO_BEGIN(restart1);
    m_body->eval(env);
    EVAL_STMT_HANDLE_GOTO_END(restart1);
  } catch (Object e) {
    for (vector<CatchBlockPtr>::const_iterator it = m_catches.begin();
         it != m_catches.end(); ++it) {
      if ((*it)->match(e)) {
        if ((*it)->body()) {
          env.get(String((*it)->vname())) = e;
          EVAL_STMT_HANDLE_GOTO_BEGIN(restart2);
          EVAL_STMT((*it)->body(), env);
          EVAL_STMT_HANDLE_GOTO_END(restart2);
        }
        return;
      }
    }
    throw e;
  }
}