Fixed parsing of "deferred notes" in auto xacts
This commit is contained in:
parent
7eb1eddcf6
commit
3ae4a38e4d
2 changed files with 9 additions and 12 deletions
|
|
@ -559,11 +559,6 @@ void instance_t::automated_xact_directive(char * line)
|
||||||
item->add_flags(ITEM_NOTE_ON_NEXT_LINE);
|
item->add_flags(ITEM_NOTE_ON_NEXT_LINE);
|
||||||
item->pos->end_pos = context.curr_pos;
|
item->pos->end_pos = context.curr_pos;
|
||||||
item->pos->end_line++;
|
item->pos->end_line++;
|
||||||
|
|
||||||
// If there was no last_post yet, then deferred notes get applied to
|
|
||||||
// the matched posting. Other notes get applied to the auto-generated
|
|
||||||
// posting.
|
|
||||||
ae->deferred_notes->back().apply_to_post = last_post;
|
|
||||||
}
|
}
|
||||||
else if ((remlen > 7 && *p == 'a' &&
|
else if ((remlen > 7 && *p == 'a' &&
|
||||||
std::strncmp(p, "assert", 6) == 0 && std::isspace(p[6])) ||
|
std::strncmp(p, "assert", 6) == 0 && std::isspace(p[6])) ||
|
||||||
|
|
@ -591,7 +586,7 @@ void instance_t::automated_xact_directive(char * line)
|
||||||
parse_post(p, len - (p - line), top_account(), NULL, true)) {
|
parse_post(p, len - (p - line), top_account(), NULL, true)) {
|
||||||
reveal_context = true;
|
reveal_context = true;
|
||||||
ae->add_post(post);
|
ae->add_post(post);
|
||||||
last_post = post;
|
ae->active_post = last_post = post;
|
||||||
}
|
}
|
||||||
reveal_context = true;
|
reveal_context = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/xact.h
12
src/xact.h
|
|
@ -173,17 +173,19 @@ public:
|
||||||
typedef std::list<deferred_tag_data_t> deferred_notes_list;
|
typedef std::list<deferred_tag_data_t> deferred_notes_list;
|
||||||
|
|
||||||
optional<deferred_notes_list> deferred_notes;
|
optional<deferred_notes_list> deferred_notes;
|
||||||
|
post_t * active_post;
|
||||||
|
|
||||||
auto_xact_t() : try_quick_match(true) {
|
auto_xact_t() : try_quick_match(true), active_post(NULL) {
|
||||||
TRACE_CTOR(auto_xact_t, "");
|
TRACE_CTOR(auto_xact_t, "");
|
||||||
}
|
}
|
||||||
auto_xact_t(const auto_xact_t& other)
|
auto_xact_t(const auto_xact_t& other)
|
||||||
: xact_base_t(), predicate(other.predicate),
|
: xact_base_t(), predicate(other.predicate),
|
||||||
try_quick_match(other.try_quick_match) {
|
try_quick_match(other.try_quick_match),
|
||||||
|
active_post(other.active_post) {
|
||||||
TRACE_CTOR(auto_xact_t, "copy");
|
TRACE_CTOR(auto_xact_t, "copy");
|
||||||
}
|
}
|
||||||
auto_xact_t(const predicate_t& _predicate)
|
auto_xact_t(const predicate_t& _predicate)
|
||||||
: predicate(_predicate), try_quick_match(true)
|
: predicate(_predicate), try_quick_match(true), active_post(NULL)
|
||||||
{
|
{
|
||||||
TRACE_CTOR(auto_xact_t, "const predicate_t&");
|
TRACE_CTOR(auto_xact_t, "const predicate_t&");
|
||||||
}
|
}
|
||||||
|
|
@ -202,12 +204,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void parse_tags(const char * p,
|
virtual void parse_tags(const char * p, scope_t&,
|
||||||
scope_t&,
|
|
||||||
bool overwrite_existing = true) {
|
bool overwrite_existing = true) {
|
||||||
if (! deferred_notes)
|
if (! deferred_notes)
|
||||||
deferred_notes = deferred_notes_list();
|
deferred_notes = deferred_notes_list();
|
||||||
deferred_notes->push_back(deferred_tag_data_t(p, overwrite_existing));
|
deferred_notes->push_back(deferred_tag_data_t(p, overwrite_existing));
|
||||||
|
deferred_notes->back().apply_to_post = active_post;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void extend_xact(xact_base_t& xact, parse_context_t& context);
|
virtual void extend_xact(xact_base_t& xact, parse_context_t& context);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue