summaryrefslogtreecommitdiff
path: root/src/expr/node_value.cpp
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2011-10-28 20:30:24 +0000
committerMorgan Deters <mdeters@gmail.com>2011-10-28 20:30:24 +0000
commit890bacd7cb11c6e991722e8a7b7cd0ef9147ea3b (patch)
tree0c2f05f224fe79310130dc054c7606144e248de0 /src/expr/node_value.cpp
parentb084a7efa9d65ec2f7475caa8486f8fd4cbafbd5 (diff)
* ability to output NodeBuilders without first converting them to Nodes---useful for debugging.
* language-dependent Node::toString() * some minor proof-related cleanup
Diffstat (limited to 'src/expr/node_value.cpp')
-rw-r--r--src/expr/node_value.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/expr/node_value.cpp b/src/expr/node_value.cpp
index 5fe48b01d..f1fade69d 100644
--- a/src/expr/node_value.cpp
+++ b/src/expr/node_value.cpp
@@ -39,16 +39,23 @@ NodeValue NodeValue::s_null(0);
string NodeValue::toString() const {
stringstream ss;
- toStream(ss);
+ toStream(ss, -1, false, Options::current()->outputLanguage);
return ss.str();
}
void NodeValue::toStream(std::ostream& out, int toDepth, bool types,
OutputLanguage language) const {
+ // Ensure that this node value is live for the length of this call.
+ // It really breaks things badly if we don't have a nonzero ref
+ // count, even just for printing.
+ RefCountGuard guard(this);
+
Printer::getPrinter(language)->toStream(out, TNode(this), toDepth, types);
}
void NodeValue::printAst(std::ostream& out, int ind) const {
+ RefCountGuard guard(this);
+
indent(out, ind);
out << '(';
out << getKind();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback