# HG changeset patch # User Jacob Carlborg # Date 1279712648 -7200 # Node ID 613a0bb20207a1d5a77f58f841e8aff933f67eb3 # Parent 32152d5fad4ba56526141d6caeca0a6f3849299d Now works with dmd 1.062 diff -r 32152d5fad4b -r 613a0bb20207 orange/serialization/Serializer.d --- 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;