refactor(library/tactic): remove unnecessary hack
It is not needed anymore. We had to use this hack when we had tactic_macro_definition_cell.
This commit is contained in:
parent
7c62446023
commit
60132912a4
1 changed files with 1 additions and 13 deletions
|
@ -75,8 +75,6 @@ std::string const & get_tactic_expr_opcode() { return *g_tactic_expr_opcode; }
|
||||||
name const & get_tactic_name() { return *g_tactic_name; }
|
name const & get_tactic_name() { return *g_tactic_name; }
|
||||||
std::string const & get_tactic_opcode() { return *g_tactic_opcode; }
|
std::string const & get_tactic_opcode() { return *g_tactic_opcode; }
|
||||||
|
|
||||||
LEAN_THREAD_VALUE(bool, g_unfold_tactic_macros, true);
|
|
||||||
|
|
||||||
class tactic_expr_macro_definition_cell : public macro_definition_cell {
|
class tactic_expr_macro_definition_cell : public macro_definition_cell {
|
||||||
public:
|
public:
|
||||||
tactic_expr_macro_definition_cell() {}
|
tactic_expr_macro_definition_cell() {}
|
||||||
|
@ -85,16 +83,7 @@ public:
|
||||||
return mk_pair(get_tactic_expr_type(), constraint_seq());
|
return mk_pair(get_tactic_expr_type(), constraint_seq());
|
||||||
}
|
}
|
||||||
virtual optional<expr> expand(expr const &, extension_context &) const {
|
virtual optional<expr> expand(expr const &, extension_context &) const {
|
||||||
// Remark: small hack for conditionally expanding tactic expr macros.
|
return some_expr(get_tactic_expr_builtin());
|
||||||
// When type checking a macro definition, we want to unfold it,
|
|
||||||
// otherwise the kernel will not accept it.
|
|
||||||
// When converting it to a tactic object, we don't want to unfold it.
|
|
||||||
// The procedure expr_to_tactic temporarily sets g_unfold_tactic_macros to false.
|
|
||||||
// This is a thread local storage. So, there is no danger.
|
|
||||||
if (g_unfold_tactic_macros)
|
|
||||||
return some_expr(get_tactic_expr_builtin());
|
|
||||||
else
|
|
||||||
return none_expr();
|
|
||||||
}
|
}
|
||||||
virtual void write(serializer & s) const {
|
virtual void write(serializer & s) const {
|
||||||
s.write_string(get_tactic_expr_opcode());
|
s.write_string(get_tactic_expr_opcode());
|
||||||
|
@ -220,7 +209,6 @@ static name_generator next_name_generator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tactic expr_to_tactic(environment const & env, elaborate_fn const & fn, expr const & e, pos_info_provider const * p) {
|
tactic expr_to_tactic(environment const & env, elaborate_fn const & fn, expr const & e, pos_info_provider const * p) {
|
||||||
flet<bool> let(g_unfold_tactic_macros, false);
|
|
||||||
type_checker tc(env, next_name_generator());
|
type_checker tc(env, next_name_generator());
|
||||||
return expr_to_tactic(tc, fn, e, p);
|
return expr_to_tactic(tc, fn, e, p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue