changeset 8:613a0bb20207

Now works with dmd 1.062
author Jacob Carlborg <doob@me.com>
date Wed, 21 Jul 2010 13:44:08 +0200
parents 32152d5fad4b
children 99c52d46822a
files orange/serialization/Serializer.d
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/orange/serialization/Serializer.d	Fri Jun 25 23:07:49 2010 +0200
+++ b/orange/serialization/Serializer.d	Wed Jul 21 13:44:08 2010 +0200
@@ -426,7 +426,7 @@
 	private void objectStructSerializeHelper (T) (ref T value)
 	{
 		static assert(isStruct!(T) || isObject!(T), format!(`The given value of the type "`, T, `" is not a valid type, the only valid types for this method are objects and structs.`));
-		const nonSerializedFields = collectAnnotations!(nonSerializedField)(value);
+		const nonSerializedFields = collectAnnotations!(nonSerializedField, T);
 		
 		foreach (i, dummy ; typeof(T.tupleof))
 		{
@@ -447,7 +447,7 @@
 	private void objectStructDeserializeHelper (T) (ref T value)
 	{		
 		static assert(isStruct!(T) || isObject!(T), format!(`The given value of the type "`, T, `" is not a valid type, the only valid types for this method are objects and structs.`));
-		const nonSerializedFields = collectAnnotations!(nonSerializedField)(value);
+		const nonSerializedFields = collectAnnotations!(nonSerializedField, T);
 		
 		foreach (i, dummy ; typeof(T.tupleof))
 		{
@@ -590,21 +590,18 @@
 			triggerEvent!(onDeserializedField)(value);
 	}
 	
-	private static string[] collectAnnotations (string name, T) (T value)
+	private static string[] collectAnnotations (string name, T) ()
 	{
 		static assert (isObject!(T) || isStruct!(T), format!(`The given value of the type "`, T, `" is not a valid type, the only valid types for this method are objects and structs.`));
 		
 		string[] annotations;
 		
-		foreach (i, dummy ; typeof(T.tupleof))
+		foreach (i, type ; typeof(T.tupleof))
 		{
 			const field = nameOfFieldAt!(T, i);
 			
 			static if (field == name)
-			{
-				typeof(value.tupleof[i]) f;
-				annotations ~= f.field;
-			}
+				annotations ~= type.field;
 		}
 		
 		return annotations;