chore(frontends/lean): use update_if_undef

This commit is contained in:
Leonardo de Moura 2015-01-13 13:02:14 -08:00
parent 533438b011
commit 41935906a8
3 changed files with 8 additions and 8 deletions

View file

@ -127,7 +127,7 @@ static bool print_parse_table(parser & p, parse_table const & t, bool nud, buffe
bool found = false;
io_state ios = p.ios();
options os = ios.get_options();
os = os.update(get_pp_full_names_option_name(), true);
os = os.update_if_undef(get_pp_full_names_option_name(), true);
os = os.update(get_pp_notation_option_name(), false);
ios.set_options(os);
optional<token_table> tt(get_token_table(p.env()));
@ -307,7 +307,7 @@ environment check_cmd(parser & p) {
auto reg = p.regular_stream();
formatter fmt = reg.get_formatter();
options opts = p.ios().get_options();
opts = opts.update(get_pp_metavar_args_name(), true);
opts = opts.update_if_undef(get_pp_metavar_args_name(), true);
fmt = fmt.update_options(opts);
unsigned indent = get_pp_indent(opts);
format r = group(fmt(e) + space() + colon() + nest(indent, line() + fmt(type)));

View file

@ -176,7 +176,7 @@ public:
virtual void display(io_state_stream const & ios, unsigned line) const {
ios << "-- OVERLOAD|" << line << "|" << get_column() << "\n";
options os = ios.get_options();
os = os.update(get_pp_full_names_option_name(), true);
os = os.update_if_undef(get_pp_full_names_option_name(), true);
auto new_ios = ios.update_options(os);
for (unsigned i = 0; i < get_num_choices(m_choices); i++) {
if (i > 0)
@ -197,8 +197,8 @@ public:
virtual void display(io_state_stream const & ios, unsigned line) const {
ios << "-- OVERLOAD|" << line << "|" << get_column() << "\n";
options os = ios.get_options();
os = os.update(get_pp_full_names_option_name(), true);
os = os.update(get_pp_notation_option_name(), false);
os = os.update_if_undef(get_pp_full_names_option_name(), true);
os = os.update_if_undef(get_pp_notation_option_name(), false);
auto new_ios = ios.update_options(os);
bool first = true;
for (expr const & e : m_alts) {
@ -221,7 +221,7 @@ public:
virtual void display(io_state_stream const & ios, unsigned line) const {
ios << "-- COERCION|" << line << "|" << get_column() << "\n";
options os = ios.get_options();
os = os.update(get_pp_coercions_option_name(), true);
os = os.update_if_undef(get_pp_coercions_option_name(), true);
ios.update_options(os) << m_expr << endl << "--" << endl << m_type << endl;
ios << "-- ACK" << endl;
}

View file

@ -101,8 +101,8 @@ struct class_instance_context {
m_trace_instances = get_class_trace_instances(ios.get_options());
m_max_depth = get_class_instance_max_depth(ios.get_options());
options opts = m_ios.get_options();
opts = opts.update(get_pp_purify_metavars_name(), false);
opts = opts.update(get_pp_implicit_name(), true);
opts = opts.update_if_undef(get_pp_purify_metavars_name(), false);
opts = opts.update_if_undef(get_pp_implicit_name(), true);
m_ios.set_options(opts);
}