summaryrefslogtreecommitdiff
path: root/src/op.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-09 00:02:59 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-09 00:02:59 -0400
commit4a463aca3bece8f2beb68b0fc4d347a713ff07a6 (patch)
tree4c506ae2010f886fc35e7d2f5b43cbd20b7d4eee /src/op.cc
parent76ab8cc083108c1407d7ce326821d3fbe9fbd2b9 (diff)
downloadfork-ledger-4a463aca3bece8f2beb68b0fc4d347a713ff07a6.tar.gz
fork-ledger-4a463aca3bece8f2beb68b0fc4d347a713ff07a6.tar.bz2
fork-ledger-4a463aca3bece8f2beb68b0fc4d347a713ff07a6.zip
If a valexpr identifier is unknown at calc time, re-compile at that point.
Diffstat (limited to 'src/op.cc')
-rw-r--r--src/op.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/op.cc b/src/op.cc
index 902ed647..6a48d528 100644
--- a/src/op.cc
+++ b/src/op.cc
@@ -105,14 +105,17 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus)
break;
case IDENT: {
- if (! left())
+ ptr_op_t def = left();
+ if (! def)
+ def = compile(scope);
+ if (! def)
throw_(calc_error, "Unknown identifier '" << as_ident() << "'");
// Evaluating an identifier is the same as calling its definition
// directly, so we create an empty call_scope_t to reflect the scope for
// this implicit call.
call_scope_t call_args(scope);
- result = left()->calc(call_args, locus);
+ result = def->calc(call_args, locus);
break;
}