Ejemplo n.º 1
0
bool CatchBlock::proc(CObjRef exn, VariableEnvironment &env) const {
  if (exn.instanceof(m_ename.c_str())) {
    if (m_body) {
      env.get(m_vname) = exn;
      m_body->eval(env);
    }
    return true;
  }
  return false;
}
Ejemplo n.º 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;
  }
}
Ejemplo n.º 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;
  }
}
 void initGlobals(VariableEnvironment &env) const {
   env.get(s_names[s_num-1]) = get_global_array_wrapper();
 }