Variant FunctionStatement::evalBody(VariableEnvironment &env) const { Variant &ret = env.getRet(); if (m_maybeIntercepted) { Variant handler = get_intercept_handler(fullName(), &m_maybeIntercepted); if (!handler.isNull() && handle_intercept(handler, fullName(), env.getParams(), ret)) { if (m_ref) { ret.setContagious(); } return ret; } } if (m_body) { m_body->eval(env); if (env.isReturning()) { if (m_ref) { ret.setContagious(); } return ret; } else if (env.isBreaking()) { throw FatalErrorException("Cannot break/continue out of function"); } } return Variant(); }
Variant FunctionStatement::evalBody(VariableEnvironment &env) const { if (m_body) { m_body->eval(env); if (env.isReturning()) { if (m_ref) { env.getRet().setContagious(); } return env.getRet(); } else if (env.isBreaking()) { throw FatalErrorException("Cannot break/continue out of function"); } } return Variant(); }