summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/expr.cc10
-rw-r--r--src/expr.h5
2 files changed, 11 insertions, 4 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 89214d51..4f12a648 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -78,6 +78,16 @@ expr_t::ptr_op_t expr_t::get_op() throw()
return ptr;
}
+string expr_t::text()
+{
+ if (str.empty()) {
+ std::ostringstream out;
+ ptr->print(out);
+ set_text(out.str());
+ }
+ return str;
+}
+
expr_t& expr_t::operator=(const expr_t& _expr)
{
if (this != &_expr) {
diff --git a/src/expr.h b/src/expr.h
index 24276cd1..b880fd79 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -116,10 +116,7 @@ public:
}
ptr_op_t get_op() throw();
-
- string text() const throw() {
- return str;
- }
+ string text();
// This has special use in the textual parser
void set_text(const string& txt) {