aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-08-27 10:59:33 +0300
committerMihai Bazon <mihai@bazon.net>2012-08-27 10:59:33 +0300
commita8e49f15361cce98fdecb20535df4b4f0de553ca (patch)
treeb4c766fed066670cb77093e9b225ac1086d7fecb /lib/output.js
parent8d233c38d485020bdb9d86865cf50a8199fbfc27 (diff)
downloadtracifyjs-a8e49f15361cce98fdecb20535df4b4f0de553ca.tar.gz
tracifyjs-a8e49f15361cce98fdecb20535df4b4f0de553ca.zip
added print_to_string helper method
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/output.js b/lib/output.js
index f83a5c89..307e7cb7 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -296,6 +296,12 @@ function OutputStream(options) {
});
};
+ AST_Node.DEFMETHOD("print_to_string", function(options){
+ var s = OutputStream(options);
+ this.print(s);
+ return s.get();
+ });
+
function PARENS(nodetype, func) {
nodetype.DEFMETHOD("needs_parens", func);
};