Commit a1bd28b0 authored by Mathias Hasselmann's avatar Mathias Hasselmann Committed by Mathias Hasselmann
Browse files

include type-name in to_string result implement to_string method, fixes

2007-08-27  Mathias Hasselmann  <mathias.hasselmann@gmx.de>

	* vala/valacodenode.vala: include type-name in to_string result
	* vala/valaunaryexpression.vala: implement to_string method,
       fixes bug 470778

svn path=/trunk/; revision=511
parent d3e24868
2007-08-27 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* vala/valacodenode.vala: include type-name in to_string result
* vala/valaunaryexpression.vala: implement to_string method,
fixes bug 470778
2007-08-27 Jürg Billeter <j@bitron.ch> 2007-08-27 Jürg Billeter <j@bitron.ch>
* vapi/Makefile.am, vapi/clutter-0.3.deps, vapi/clutter-0.3.vala, * vapi/Makefile.am, vapi/clutter-0.3.deps, vapi/clutter-0.3.vala,
......
...@@ -117,9 +117,14 @@ public abstract class Vala.CodeNode { ...@@ -117,9 +117,14 @@ public abstract class Vala.CodeNode {
* @return a string representation * @return a string representation
*/ */
public virtual string! to_string () { public virtual string! to_string () {
var str = new String ();
str.append ("/* ").append (get_type ().name ());
if (source_reference != null) { if (source_reference != null) {
return source_reference.to_string (); str.append ("@").append (source_reference.to_string ());
} }
return "(unknown)";
return str.append (" */").str;
} }
} }
...@@ -73,6 +73,27 @@ public class Vala.UnaryExpression : Expression { ...@@ -73,6 +73,27 @@ public class Vala.UnaryExpression : Expression {
inner = (Expression) new_node; inner = (Expression) new_node;
} }
} }
public string! operator_string {
get {
switch (_operator) {
case UnaryOperator.PLUS: return "+";
case UnaryOperator.MINUS: return "-";
case UnaryOperator.LOGICAL_NEGATION: return "!";
case UnaryOperator.BITWISE_COMPLEMENT: return "~";
case UnaryOperator.INCREMENT: return "++";
case UnaryOperator.DECREMENT: return "--";
case UnaryOperator.REF: return "ref ";
case UnaryOperator.OUT: return "out ";
}
assert_not_reached ();
}
}
public override string! to_string () {
return operator_string + _inner.to_string ();
}
} }
public enum Vala.UnaryOperator { public enum Vala.UnaryOperator {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment