[vala] dova: Do not use infix for creation methods of basic types



commit e4284d3bad686502882e681d2bfa88d6a196fa9d
Author: Jürg Billeter <j bitron ch>
Date:   Sat Jun 5 09:58:56 2010 +0200

    dova: Do not use infix for creation methods of basic types

 vala/valacreationmethod.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 8bcaecf..09c3733 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -97,7 +97,18 @@ public class Vala.CreationMethod : Method {
 		var parent = parent_symbol as TypeSymbol;
 
 		string infix = "new";
-		if (parent is Struct) {
+		var st = parent as Struct;
+		if (st != null) {
+			if (CodeContext.get ().profile == Profile.DOVA) {
+				if (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ()) {
+					// don't use any infix for basic types
+					if (name == ".new") {
+						return parent.get_lower_case_cname ();
+					} else {
+						return "%s%s".printf (parent.get_lower_case_cprefix (), name);
+					}
+				}
+			}
 			infix = "init";
 		}
 
@@ -122,6 +133,10 @@ public class Vala.CreationMethod : Method {
 
 		string infix = "construct";
 
+		if (CodeContext.get ().profile == Profile.DOVA) {
+			infix = "init";
+		}
+
 		if (name == ".new") {
 			return "%s%s".printf (parent.get_lower_case_cprefix (), infix);
 		} else {



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