summaryrefslogtreecommitdiff
path: root/src/op.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-17 04:55:01 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-17 04:55:01 -0400
commit06bbe56701568ac5c6dc9b80489d2e0c0b623d77 (patch)
tree4bfdb2105155c674510a8dd46230dea7c503a6e7 /src/op.h
parent08488d4cd733ff37a0a096f4b5bcbece0c181cc9 (diff)
downloadfork-ledger-06bbe56701568ac5c6dc9b80489d2e0c0b623d77.tar.gz
fork-ledger-06bbe56701568ac5c6dc9b80489d2e0c0b623d77.tar.bz2
fork-ledger-06bbe56701568ac5c6dc9b80489d2e0c0b623d77.zip
Fixed an assertion.
Diffstat (limited to 'src/op.h')
-rw-r--r--src/op.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/op.h b/src/op.h
index b155063d..6f81c155 100644
--- a/src/op.h
+++ b/src/op.h
@@ -214,16 +214,16 @@ public:
return left_;
}
const ptr_op_t& left() const {
- assert(kind > TERMINALS);
+ assert(kind > TERMINALS || kind == IDENT);
return left_;
}
void set_left(const ptr_op_t& expr) {
- assert(kind > TERMINALS);
+ assert(kind > TERMINALS || kind == IDENT);
left_ = expr;
}
ptr_op_t& as_op_lval() {
- assert(kind > TERMINALS);
+ assert(kind > TERMINALS || kind == IDENT);
return boost::get<ptr_op_t>(data);
}
const ptr_op_t& as_op() const {
@@ -305,8 +305,8 @@ inline expr_t::ptr_op_t
expr_t::op_t::new_node(kind_t _kind, ptr_op_t _left, ptr_op_t _right)
{
ptr_op_t node(new op_t(_kind));
- node->set_left(_left);
- node->set_right(_right);
+ if (_left) node->set_left(_left);
+ if (_right) node->set_right(_right);
return node;
}