Example #1
0
environment environment::add(certified_declaration const & d) const {
    if (!m_id.is_descendant(d.get_id()))
        throw_incompatible_environment(*this);
    name const & n = d.get_declaration().get_name();
    if (find(n))
        throw_already_declared(*this, n);
    return environment(m_header, m_id, insert(m_declarations, n, d.get_declaration()), m_global_levels, m_extensions);
}
Example #2
0
environment environment::add(declaration const & d) const {
    if (trust_lvl() == 0)
        throw_kernel_exception(*this, "environment trust level does not allow users to add declarations that were not type checked");
    name const & n = d.get_name();
    if (find(n))
        throw_already_declared(*this, n);
    return environment(m_header, m_id, insert(m_declarations, n, d), m_global_levels, m_extensions);
}