Added some debug code
This commit is contained in:
parent
21a123e525
commit
20f4ccde96
5 changed files with 36 additions and 0 deletions
24
src/op.cc
24
src/op.cc
|
|
@ -150,6 +150,15 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
|
|||
|
||||
value_t result;
|
||||
|
||||
#if defined(DEBUG_ON)
|
||||
if (! skip_debug && SHOW_DEBUG("expr.calc")) {
|
||||
for (int i = 0; i < depth; i++)
|
||||
ledger::_log_buffer << '.';
|
||||
ledger::_log_buffer << op_context(this) << " => ...";
|
||||
DEBUG("expr.calc", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (kind) {
|
||||
case VALUE:
|
||||
result = as_value();
|
||||
|
|
@ -252,6 +261,21 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
|
|||
if (! func)
|
||||
throw_(calc_error, _("Calling unknown function '%1'") << name);
|
||||
|
||||
#if defined(DEBUG_ON)
|
||||
if (! skip_debug && SHOW_DEBUG("expr.calc")) {
|
||||
for (int i = 0; i < depth; i++)
|
||||
ledger::_log_buffer << '.';
|
||||
ledger::_log_buffer << " args: ";
|
||||
if (call_args.args.is_sequence()) {
|
||||
foreach (value_t& arg, call_args)
|
||||
ledger::_log_buffer << arg << " ";
|
||||
} else {
|
||||
ledger::_log_buffer << call_args.args[0] << " ";
|
||||
}
|
||||
DEBUG("expr.calc", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (func->is_function())
|
||||
result = func->as_function()(call_args);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ public:
|
|||
if (xdata_)
|
||||
if (account_t * acct = xdata_->account)
|
||||
return acct;
|
||||
assert(account);
|
||||
return account;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -347,7 +347,13 @@ protected:
|
|||
|
||||
class call_scope_t : public context_scope_t
|
||||
{
|
||||
#if defined(DEBUG_ON)
|
||||
public:
|
||||
#endif
|
||||
value_t args;
|
||||
#if defined(DEBUG_ON)
|
||||
private:
|
||||
#endif
|
||||
mutable void * ptr;
|
||||
|
||||
value_t& resolve(const std::size_t index,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public:
|
|||
const char * p = input.c_str();
|
||||
std::size_t len = input.length();
|
||||
|
||||
assert(len < 1024);
|
||||
VERIFY(utf8::is_valid(p, p + len));
|
||||
utf8::unchecked::utf8to32(p, p + len, std::back_inserter(utf32chars));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -901,16 +901,20 @@ public:
|
|||
}
|
||||
|
||||
sequence_t::iterator begin() {
|
||||
VERIFY(is_sequence());
|
||||
return as_sequence_lval().begin();
|
||||
}
|
||||
sequence_t::iterator end() {
|
||||
VERIFY(is_sequence());
|
||||
return as_sequence_lval().end();
|
||||
}
|
||||
|
||||
sequence_t::const_iterator begin() const {
|
||||
VERIFY(is_sequence());
|
||||
return as_sequence().begin();
|
||||
}
|
||||
sequence_t::const_iterator end() const {
|
||||
VERIFY(is_sequence());
|
||||
return as_sequence().end();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue