Fixed the scoping of auto xact predicates

This commit is contained in:
John Wiegley 2012-02-27 04:08:39 -06:00
parent 3d8cad77c4
commit ee530f9433

View file

@ -619,6 +619,8 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
if (initial_post->has_flags(ITEM_GENERATED)) if (initial_post->has_flags(ITEM_GENERATED))
continue; continue;
bind_scope_t bound_scope(*scope_t::default_scope, *initial_post);
bool matches_predicate = false; bool matches_predicate = false;
if (try_quick_match) { if (try_quick_match) {
try { try {
@ -646,14 +648,13 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
DEBUG("xact.extend.fail", DEBUG("xact.extend.fail",
"The quick matcher failed, going back to regular eval"); "The quick matcher failed, going back to regular eval");
try_quick_match = false; try_quick_match = false;
matches_predicate = predicate(*initial_post); matches_predicate = predicate(bound_scope);
} }
} else { } else {
matches_predicate = predicate(*initial_post); matches_predicate = predicate(bound_scope);
} }
if (matches_predicate) {
bind_scope_t bound_scope(*scope_t::default_scope, *initial_post);
if (matches_predicate) {
if (deferred_notes) { if (deferred_notes) {
foreach (deferred_tag_data_t& data, *deferred_notes) { foreach (deferred_tag_data_t& data, *deferred_notes) {
if (data.apply_to_post == NULL) if (data.apply_to_post == NULL)
@ -661,6 +662,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
data.overwrite_existing); data.overwrite_existing);
} }
} }
if (check_exprs) { if (check_exprs) {
foreach (check_expr_pair& pair, *check_exprs) { foreach (check_expr_pair& pair, *check_exprs) {
if (pair.second == auto_xact_t::EXPR_GENERAL) { if (pair.second == auto_xact_t::EXPR_GENERAL) {