[svn] r6024: nemerle/trunk: macros/xml.n ncc/testsuite/positive/serialize.n

nazgul svnadmin at nemerle.org
Mon Dec 19 20:21:23 CET 2005


Log:
Fix XmlSerialize macro

Author: nazgul
Date: Mon Dec 19 20:21:18 2005
New Revision: 6024

Modified:
   nemerle/trunk/macros/xml.n
   nemerle/trunk/ncc/testsuite/positive/serialize.n

Modified: nemerle/trunk/macros/xml.n
==============================================================================
--- nemerle/trunk/macros/xml.n	(original)
+++ nemerle/trunk/macros/xml.n	Mon Dec 19 20:21:18 2005
@@ -157,15 +157,14 @@
                        Inherited = false, AllowMultiple = false)]
   macro XmlSerializable (par : TypeBuilder)
   {
-    par.Define (<[ decl: private _N_dummy : int; ]>);
+    par.Define (<[ decl: private _N_dummy : int = 0; ]>);
     match (par.GetTydecl ()) {
       | TypeDeclaration.Variant (lst) =>
         def mods = par.GetModifiers ();
-        foreach (ti : TypeInfo in lst) {
-          (ti :> TypeBuilder).Define (<[ decl: public this () { } ]>);
+        foreach (ti :> TypeBuilder in lst) {
+          ti.Define (<[ decl: public this () { } ]>);
           // prevent _N_constant_object
-          def name = <[ $(ti.FullName : usesite) ]>;
-          def expr = <[ XmlInclude (typeof ($name)) ]>;
+          def expr = <[ XmlInclude (typeof ($(ti.ParsedName : name))) ]>;
           mods.AddCustomAttribute (expr);
         }
       | _ =>

Modified: nemerle/trunk/ncc/testsuite/positive/serialize.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/serialize.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/serialize.n	Mon Dec 19 20:21:18 2005
@@ -89,6 +89,13 @@
   | B
 }
 
+[Nemerle.Xml.Serialization.XmlSerializable]
+public variant Form {
+      | Cstr { name : string; label : string }
+      | Atom { basis : string }
+      | Empt
+}
+
 /*
 BEGIN-OUTPUT
 Before serialization the object contains:



More information about the svn mailing list