[vala/wip/attributes: 112/119] Drop all attribute-specific code from the codewriter



commit c9cd43e51239e61564953d7dd2bfd2670fa3481d
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 3 19:25:32 2011 +0200

    Drop all attribute-specific code from the codewriter

 vala/valacodewriter.vala |  188 +++++-----------------------------------------
 1 files changed, 18 insertions(+), 170 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 047187b..031b947 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -182,38 +182,6 @@ public class Vala.CodeWriter : CodeVisitor {
 		return cheaders;
 	}
 
-	private void emit_deprecated_attribute (Symbol symbol) {
-		if (symbol.deprecated) {
-			write_indent ();
-			write_string ("[Deprecated");
-			var since = symbol.deprecated_since;
-			var replacement = symbol.replacement;
-
-			if (since != null || replacement != null) {
-				write_string (" (");
-				if (since != null) {
-					write_string ("since = \"%s\"".printf (since));
-				}
-				if (since != null && replacement != null) {
-					write_string (", ");
-				}
-				if (replacement != null) {
-					write_string ("replacement = \"%s\"".printf (replacement));
-				}
-				write_string (")");
-			}
-			write_string ("]");
-		}
-	}
-
-	private void emit_experimental_attribute (Symbol symbol) {
-		if (symbol.experimental) {
-			write_indent ();
-			write_string ("[Experimental]");
-			write_newline ();
-		}
-	}
-
 	public override void visit_class (Class cl) {
 		if (cl.external_package) {
 			return;
@@ -223,21 +191,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		if (cl.is_compact) {
-			write_indent ();
-			write_string ("[Compact]");
-			write_newline ();
-		}
-
-		if (cl.is_immutable) {
-			write_indent ();
-			write_string ("[Immutable]");
-			write_newline ();
-		}
-
-		emit_deprecated_attribute (cl);
-		emit_experimental_attribute (cl);
-
 		write_attributes (cl);
 		
 		write_indent ();
@@ -344,35 +297,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 		
-		if (st.is_immutable) {
-			write_indent ();
-			write_string ("[Immutable]");
-			write_newline ();
-		}
-
-		emit_deprecated_attribute (st);
-		emit_experimental_attribute (st);
-
-		write_indent ();
-
-		if (st.is_simple_type ()) {
-			write_indent ();
-			write_string ("[SimpleType]");
-			write_newline ();
-		}
-
-		if (st.is_integer_type ()) {
-			write_indent ();
-			write_string ("[IntegerType (rank = %d)]".printf (st.get_rank ()));
-			write_newline ();
-		}
-
-		if (st.is_floating_type ()) {
-			write_indent ();
-			write_string ("[FloatingType (rank = %d)]".printf (st.get_rank ()));
-			write_newline ();
-		}
-
 		write_attributes (st);
 
 		write_indent ();
@@ -411,9 +335,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (iface);
-		emit_experimental_attribute (iface);
-
 		write_attributes (iface);
 
 		write_indent ();
@@ -479,9 +400,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (en);
-		emit_experimental_attribute (en);
-
 		write_attributes (en);
 
 		write_indent ();
@@ -539,9 +457,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (edomain);
-		emit_experimental_attribute (edomain);
-
 		write_attributes (edomain);
 
 		write_indent ();
@@ -591,9 +506,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (c);
-		emit_experimental_attribute (c);
-
 		write_attributes (c);
 
 		write_indent ();
@@ -621,9 +533,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (f);
-		emit_experimental_attribute (f);
-
 		write_attributes (f);
 
 		write_indent ();
@@ -724,9 +633,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (cb);
-		emit_experimental_attribute (cb);
-
 		write_attributes (cb);
 
 		write_indent ();
@@ -788,42 +694,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			}
 		}
 
-		if (m.get_attribute ("NoWrapper") != null) {
-			write_indent ();
-			write_string ("[NoWrapper]");
-		}
-		if (m.get_attribute ("NoThrow") != null) {
-			write_indent ();
-			write_string ("[NoThrow]");
-		}
-		if (m.get_attribute ("DestroysInstance") != null) {
-			write_indent ();
-			write_string ("[DestroysInstance]");
-		}
-		if (m.printf_format) {
-			write_indent ();
-			write_string ("[PrintfFormat]");
-		}
-		if (m.scanf_format) {
-			write_indent ();
-			write_string ("[ScanfFormat]");
-		}
-		if (m.get_attribute ("Print") != null) {
-			write_indent ();
-			write_string ("[Print]");
-		}
-		if (m.get_attribute ("NoReturn") != null) {
-			write_indent ();
-			write_string ("[NoReturn]");
-		}
-		if (m.get_attribute ("Diagnostics") != null) {
-			write_indent ();
-			write_string ("[Diagnostics]");
-		}
-
-		emit_deprecated_attribute (m);
-		emit_experimental_attribute (m);
-
 		write_attributes (m);
 		
 		write_indent ();
@@ -905,14 +775,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 
-		emit_deprecated_attribute (prop);
-		emit_experimental_attribute (prop);
-
-		if (prop.get_attribute ("NoAccessorMethod") != null) {
-			write_indent ();
-			write_string ("[NoAccessorMethod]");
-		}
-
 		write_attributes (prop);
 
 		write_indent ();
@@ -971,9 +833,6 @@ public class Vala.CodeWriter : CodeVisitor {
 			return;
 		}
 		
-		emit_deprecated_attribute (sig);
-		emit_experimental_attribute (sig);
-
 		write_attributes (sig);
 		
 		write_indent ();
@@ -1681,39 +1540,28 @@ public class Vala.CodeWriter : CodeVisitor {
 
 	private void write_attributes (CodeNode node) {
 		foreach (Attribute attr in node.attributes) {
-			if (!filter_attribute (attr)) {
-				write_indent ();
-				stream.printf ("[%s", attr.name);
-
-				var keys = attr.args.get_keys ();
-				if (keys.size != 0) {
-					stream.printf (" (");
-
-					string separator = "";
-					foreach (string arg_name in keys) {
-						if (arg_name == "cheader_filename") {
-							stream.printf ("%scheader_filename = \"%s\"", separator, get_cheaders ((Symbol) node));
-						} else {
-							stream.printf ("%s%s = %s", separator, arg_name, attr.args.get (arg_name));
-						}
-						separator = ", ";
-					}
+			write_indent ();
+			stream.printf ("[%s", attr.name);
 
-					stream.printf (")");
+			var keys = attr.args.get_keys ();
+			if (keys.size != 0) {
+				stream.printf (" (");
+
+				string separator = "";
+				foreach (string arg_name in keys) {
+					if (arg_name == "cheader_filename") {
+						stream.printf ("%scheader_filename = \"%s\"", separator, get_cheaders ((Symbol) node));
+					} else {
+						stream.printf ("%s%s = %s", separator, arg_name, attr.args.get (arg_name));
+					}
+					separator = ", ";
 				}
-				stream.printf ("]");
-				write_newline ();
-			}
-		}
-	}
 
-	private bool filter_attribute (Attribute attr) {
-		if (attr.name == "Compact" || attr.name == "Immutable"
-		    || attr.name == "SimpleType" || attr.name == "IntegerType" || attr.name == "FloatingType"
-		    || attr.name == "Flags") {
-			return true;
+				stream.printf (")");
+			}
+			stream.printf ("]");
+			write_newline ();
 		}
-		return false;
 	}
 
 	private void write_accessibility (Symbol sym) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]